So, Joe really needs no introduction, but how many people are here for the first time? Yeah, okay, so a little bit of history. Back at DEF CON 14, there was kind of a big shift. First, DEF CON moved to a real casino and a real big hotel, but then also somebody came up with an idea to do an electronic badge. You can blame this guy for all of the blinking and the smashing and the crashing that's all on your chests. So, let's give Joe Grand a big round of applause. Thank you. Cool, thank you. So, yeah, I officially retired making badges at DEF CON 18, and we didn't know what to expect, so it's come quite a ways. So, all right, I like to move around a lot, so I'm going to switch between these two mics because I can't sit still, and this is so exciting to me that it's hard to stay in one spot. Yeah, so I'm Joe Grand. We're going to talk today about a project called OpticSpy, and OpticSpy is a device that lets you reset. It lets you receive data transmitted over light waves, and I'll go into the history of why this is so exciting to me because it's not, you know, a typical kind of security thing, but it actually is. So, quick little background. I've been involved in electronics since I was 7 years old, 1982. Figured out how to make my first free phone call when I was 10. Just loved making mischievous devices of different kinds, and that's when I realized, like, oh, you can build whatever you want. If you think of something, you can build it. And a lot of what I end up building nowadays are open source projects for other people to use, as building blocks to create their own projects. And that's, you know, that's more exciting to sort of see what other people do with your stuff. So that's been really fun on the engineering side of things. But, yeah, I worked on a bunch of different stuff along the way. Got in trouble when I was younger, and that sort of redirected my passion towards, like, oh, I can share stuff and maybe not break into buildings and computers and stuff and do things in a legitimate way. So that's really what got me involved in DEF CON, even though I'd sort of, you know, known about that world. I'd been in that world before then. I'm going to switch to this one. Hold on. All right. Anyone who knows me knows this is really hard to do. So I'll move this one out of the way. And no wireless mics at DEF CON, which is probably a good idea. So anyway, this project, OpticSpy, again, I'll go into the history, but it's a device that I just thought would be really cool to let people explore a different sort of thing about electronics. And about hardware. Ooh, is this a longer one? Awesome. Yeah, good. Hello, check. Is this one on? Okay, not as loud. Ooh, wow, look at that. So I have three microphones now. This is even better. Now I should have someone following me with, like, a boom mic or something. All right. So there's a bunch of wires up here. So, yeah, OpticSpy is a project that will convert light into voltage. Open source project. I'll go into all the details of it. But the whole research into this... This really started with something called covert channels. And covert channels are methods of communicating in ways that are secret. And that might be a one-way transmission from a computer system to the outside world. Say, if you're trying to exfiltrate data. You know, we see that a lot on the network side where, you know, someone breaks into a computer and then just exfiltrates 50 gigs of data and nobody in the IT department or security department notices. But that's sort of an old way of doing it, like using the network. So I'm more interested in, like, what can you do? If you compromise a system somewhere along the way, how can that then be used to exfiltrate data in a non-standard way? So using other sorts of environmental conditions. And to implement a covert channel, there's a lot of different ways, right? If you have network access to a device or you have physical access to a device somewhere along the supply chain, you can load malicious code in. You can change the design. A lot of times products, especially since we're dealing with visible LEDs on products, almost every product has visible LEDs anyway. So if you can compromise a device and you're just changing the twiddling of the I.O. pins to now send data instead of appearing, instead of just being on. And the data, the light's still going to appear to be solid. So, you know, there's lots of stuff you can do along the way, whether it's, you know, changing the specifications or modifying the physical device, maybe intercepting a device as it's going from the factory to the end customer. I know our government's been really good at doing stuff like that. And then they complain when they, discover other nation states doing the same thing. But this is not a, you know, this is not a theoretical sort of thing, like implanting malicious code, malicious functionality, covert channels is real. And that's what got me really excited about it. So different types of ways to exfiltrate data. There's been a lot of work in this area, whether it's changing kind of optical or changing RF characteristics or electromagnetic interference patterns from a computer. There's been a lot of work in the computer system, so Tempest monitoring from back in the day, where the CRT was emanating a whole bunch of different high voltage noise and spikes, like as the raster went across the screen, you could pick that up from far away. Even before then, like SparkGap transmitters, I don't remember when, I think maybe World War I, you know, Morse code communication over SparkGap transmitters, were generating huge amounts of noise and everybody else could listen in. So maybe not exactly a covert channel, but it's an unintentional sort of thing. You could do things through thermal, through the sound. Mordecai Goury gave a great presentation at Black Hat this year, and he's been doing research on kind of air gap data exfiltration techniques for a long time. And he shows how you can have two machines separate and use ultrasound to communicate, which actually is what advertisers do a lot of times on television sets. They'll send ultrasound that we can't hear, but your, you know, mobile phone with an app can hear, and then they can track what you're watching. So there's been a lot of, you know, covert data communication stuff going on. But the stuff that really excited me are blinking lights, because everybody likes blinking lights, and they're on most products, and I always make this joke that nobody laughs, so hopefully you will, since this is being recorded, is I always say that the more LEDs there are on a product, the more secure people think it is. Cool. That's almost like the canned, you know, you press the button and it's like the audience laughing. But it's true, you know, people take hardware for granted, they don't really understand what's going on behind the scenes, and if you have a device that has lights, you can't really tell what's going on. So this project, you know, that's what inspired me. The original paper actually is information leakage from optical emanations from 2002. I read that when it came out, and I was like, this is so cool. Because I'd been interested in kind of optical communications like that for a while, you know, like I said, I built mischievous stuff as a kid, and one of the things I built was this laser listener system. Or I guess an attempt at a laser listener system, where I had a laser beam shining onto a window, and then receiving that reflection back from the window, so as the window vibrated when people were talking inside, I could spy on them. Which, apparently the government also does that. I was using a visible red laser, but probably most governments are using an infrared laser or something you can't see. So it was neat when I read this paper, I'm like, wow, this is cool. And maybe at the time it was shocking, but maybe not. What they had discovered is a lot of off-the-shelf information, a lot of off-devices without even being modified or compromised, were leaking information through LEDs. As an unintentional side effect or artifact of the way that the designers designed the product. So I'll show you a demonstration of that later. One of them is this Hays Smart Modem from back in the day that's actually leaking information on the transmit and receive pins. So you don't have to have direct connection in line with the data, you can just see it from the LEDs. So I bought one of those on eBay to demonstrate it because I thought that was really cool. And of course I have a bunch of other demos to show how easy it is to kind of create your own. But the point is that besides, you know, adding your own type of interface, there might be products out there even today that are leaking information through LEDs. We have wireless, you know, light networking systems now. And as IoT gets bigger and network connected things get bigger, and as the RF space gets more kind of crowded, we're going to see more information being transmitted over light, from light bulbs, from other things, mesh networks, networking through light bulbs, communicating with light. And that's something that's been going on for the past few years, so it is happening. And all of this stuff we can now, you know, with a piece of hardware, kind of listen in and sniff around and see what's going on. With a lot of this work though, what I found is there was never like a defined, here's how to build a receiver that you can actually experiment with this stuff. And I was like, well, I want to build a receiver because that's what I do. I want to actually try it. Like reading the paper is great, but doing it is better. And that's really where OpticsPy came from. So, yeah, a little history. There's been a lot of work with transmitting information over light waves. Definitely not going to claim I'm the first. And I always say that we're standing on the shoulders of giants and we're building, we're taking little steps, right? And you're seeing what somebody else has done and improving it or modifying it to do something different. And this is the same thing. So, you know, Graham Bell had the photo phone back in 1880. I'm not going to do the math in my head, but it was what, like 130 something years ago. And he was using the sun, the reflection of the sun, and it went off of a mirror to modulate light. And then somewhere down the way, that modulated light would be captured and replicated back into voice. The problem, it was very weather specific. So it didn't work on cloudy days. And people thought that was sort of lame. So they decided to use the telephone instead. But he actually says that the photo phone is more important to him than anything else that he had done. Fiber optics have been around for a long time. You know, we're basically doing the same thing. We have a light and we're modulating and we're sending data on it. But it's been around for a long time. Laser tag. Everyone like laser tag? Yeah? A few people. I think it's pretty cool. Did anyone have the Star Trek laser tag from 1979? You know, you guys are all too young. This was a system that actually, the way the laser tag works, it's actually sending data, infrared data, so it can receive data and know, you know, who's shooting and who's being hit. So it's not just a light, but there's actually data in it. And then, like I mentioned, optical networking systems started in 2011, but they're becoming more popular now. And it really is something where it's just another kind of medium where data is being transmitted, right? So, you know, we know it's network and wireless and now it's optical and perhaps the other things. Lots of other projects also as well. I have more resources at the end of the slides. Craig Hefner gave a talk a few years ago at DEF CON. That was an infrared receiver specifically for, it was a high gain infrared receiver for looking at things, you know, output from mobile phones, proximity sensors and things like that. And I'll show you, there's many differences with OpticSpy, mainly that it will work with visible light and also tunable. But there's been, you know, people working on this for a while in different ways. So the goal, like with most of my projects, is open source. Have something that's easy to understand, like an easy to understand theory. So the sort of optical receive chain is very kind of simplistic. And you'll see what I mean as we go through it. So it's something that's, you know, not this super complicated voodoo that, you know, kind of black magic sort of thing. It's like a very simple thing you can mess around with. Hand solderable, using off the shelf components. You know, some of them are small. But you can't really avoid that because sometimes they don't make them in big sizes. But everything's hand solderable. And again, this whole project comes down to raising awareness of their communication methods, getting more people involved in hardware. And for me, it was a great experience of working with analog electronics. Because the receivers have no microcontroller on them. No, you know, intelligence. It's doing everything analog. And I typically stay on the digital design side of things because that's where I'm most comfortable. So this is a good example of sort of experimenting with amplifiers and comparators and things like that. So just some early versions. I like showing pictures of this stuff. If you're getting into hardware development, this is a typical process where you start with some sort of breadboard system in the upper left and the upper right where you can plug components in and out. And sort of fine-tune things before you go design a circuit board. Even though nowadays with places like OSH Park where you pay $5 a square inch, it's almost, you know, some people just go straight to a circuit board because you can just revise it and iterate so quickly. But I love having that chance to, you know, plug things in. There's a few other variations of the board I made. All this stuff is available on the website, these different variations. The first one in the lower left is a digital receiver. And that's just using a TOSLINK type of optical receiver module. That's for like SPDIF audio on receivers. And, you know, stereo equipment. And that's designed to just receive red light. And it has to be a certain brightness. And it has to be NRZ encoded, which I'll talk about, which actually OpticSpy is similar. So a very simple receiver. But there's like a little, in the little receiver module, that black thing, there's a little door. And you have to shove the light into the door, otherwise you're not going to be able to see it. So it's a little more intrusive to whatever you're doing. But that was the first one I built to kind of prove the concept. And then I went to an analog version, which is ultimately what this one turned into. And that has some potentiometers to let you adjust the gain and thresholds and really fine-tune for a particular type of target. And another thing, too, that's sort of funny is I originally ended the project on the lower right, the final version of the lower right. So that's a prototype of what ultimately was like a kit version that had potentiometers and a square. And you needed a little FTDI USB to serial adapter to power it. And I've been using that in some projects. I've been using it in classes and workshops and stuff. And that was sort of the end of it. But then I ended up meeting with my friend Josh, who runs Crowd Supply, who specializes in kind of open-source hardware, providing open-source hardware to the masses. And he saw it a little bit ahead. And he was like, you should make an easy-to-connect-up module so then people can just use this to experiment with and we can hide secret messages and things at our conference and stuff. He was putting on a conference. So he sort of had this vision a little bit ahead. Where I was already done, I was like, all right, whatever. But he was right. So it turned into like this streamlined version that did make it a lot more easy to kind of look around for stuff, which was sort of fun. And again, all of that stuff is online. You can build your own. So some development process. You know, there's always going to be problems. So the first version I came back with, I was using an FT231X for the USB to serial adapter instead of the typical FT232, which is what most people use. So it was like the lower-cost version of the FTDI part, but newer. And some of the pins were a little bit different. So I ended up, and you see in the upper right corner, in the upper left, there's some blue wires, really small blue wires. I had to reroute some stuff before I went to the production version. But, you know, typical sort of testing before you go to production is highly recommended. This one I decided, so I had hand-built the first one to make sure it worked. And then you see in the lower left, I was actually screening solder paste onto the board because hand-soldering surface mount parts tends to not look as good as like, you know, if you put it through a reflow oven and you have maybe professional or semi-professional, assembly. So I wanted to have one that would, that I'd be able to take nice pictures of. And that's what I used the silk screen for with the solder paste. And that screen you can actually get, so the boards, they're purple, they were made by OSH Park. And then there's a company called OSH Stencils that will make the stencil for you that matches your paste layer for your circuit board. And then you can just get solder paste and kind of squeegee it on yourself and make your own. So it's sort of like do-it-yourself production manufacturing, which sometimes is easier than hand-soldering depending on how small your parts are. So here's the block diagram. We have our photodiode, which is the receiver that's going to convert the light waves into current. And then we have some amplifiers that are going to amplify two stages of that. I'll talk about all of these stages in more detail. And the threshold detector that turns the received data into actual ones and zeros and then passes that to a USB to serial adapter that is going to then connect to your computer and make it easy to decode stuff. But, you know, not too complicated, which is what I like about it. Here's a visual view of the board. Points of interest. And the way the board works, if you start at the left of the photodiode, that's sort of the received chain. It just, you know, the light comes in the photodiode and it gets processed and goes out the USB port on the other side. And I just like that process. And there's different test points along the way. So you can check at different stages, like how is your receive going. Especially in the case of if you're dealing with signals that are not NRZ encoded, non-returned signals, which again I'll talk about in a second. If there's somebody that is intentionally creating an optical covert channel and doesn't want to be detected, they'll probably create some custom modulation scheme or maybe they'll put in some error checking or other sorts of things. So if it's not NRZ, the USB to serial adapter isn't going to be able to process it and show you on the terminal program. So you can tap on at a test point right before it goes to the USB to serial adapter and then connect that up to your logic analyzer, your oscilloscope, your Arduino, whatever it is, whatever modulation scheme it is. You might need to do some reverse engineering. But generally there's ways to break it out if you have some custom thing you're working on. I'm not going to explain the whole schematic here because you probably can't even see it. But it is, again, very sort of simple, clean design. So here's the photodiode. Most systems that I saw that were for receiving light, and especially photodiodes, are designed to receive infrared light only. So we have infrared remote controls and a lot of other things that are running infrared. This particular photodiode mimics the sensitivity of the human eye, which makes it a lot different than other ones. Which is probably why they charge so much for it. I think it's like $11 a piece or something. But totally worth it because now you can capture visible light. And that's how most status indicators on products are. They're visible light. So it's really pretty cool. And we're running it in a photoconductive mode, reverse bias, and current flows through when we receive light waves. That's going to be proportional current flow. And then we have a load resistor there that's acting as our gain. And we can adjust that with a potentiometer which ends up being our first stage gain, which is very small compared to what comes next. And we have our amplification stage. So that's the light comes in. We have two basically the same amplifiers in a row. And the reason to have two amplifiers instead of one is if you're amplifying a small signal a lot, you're going to end up amplifying a lot more noise with it at the beginning. So if you do smaller amplification, you can amplify it a little bit and then you get more signal and less noise and then you do it again, more signal, less noise. So it's a little trick to give you less overall noise. And there's potentiometers on both stages of those gains so you can have a pretty giant range of gains if you need to. Generally, the way the system is set up, are going to be pretty good for just about any general purpose kind of investigations you're doing. And there are some capacitors and some other things in between the stages to help with sort of, we have capacitive coupling in there to get rid of the DC offset on the first stage and that brings it down, but then you run into problems with relaxation that you then need to deal with. So I'll show you the screenshot of what that looks like and what these things do. So the point is we're trying to get the data, we're trying to get the light in and then get it to a point that it ends up being a 0 to 3.3 volt signal so you have to do some extra analog stuff to bring it down. So once we have this amplified stage it should hopefully look pretty close to digital data by then but then we have this comparator which is our threshold that we set that with a potentiometer and that's going to set the state of whatever is above that threshold becomes a logic level 1, whatever is below that threshold and now we have digital data. And it's hard to see on the slides but TP5 on the crowd supply version is the output stage before it goes to the USB to serial adapter, so that's where you could tap on if it's an unknown modulation scheme. And then the USB interface this is going to power the device and also give us that virtual com port on our computer so it's just a much simpler thing than having extra wires and everything so it's like just this light goes in one side, data goes out the other power goes in the same thing this FT231X is a great part I know a lot of people don't like FTDI anymore because of the FTDI gate that happened when they bricked all counterfeit devices which ended up being many more than they anticipated because the chip was, the FT232 was so popular that it ended up being counterfeited and the counterfeits ended up being in legitimate supply chains so even if people thought they were buying legitimate ones they were buying counterfeits and when they updated the driver, it was a big deal so a lot of people protested and don't use them, but I still like their devices and assuming I don't get bricked if I get bricked, I'm going to come up here again and yell and rant so yeah, so that's sort of the different stages of the electronics design here's what the circuit board looks like I made it a kind of pen shape for a few reasons, one of them is I thought it would be easier to hold than like the earlier rectangle ones, sort of like a pencil the other thing is I had originally tried to fit it inside of a standard web whiteboard marker, because that would have been pretty cool and then you have the diode sticking out the end the width of the whiteboard marker, the internal well the internal diameter of the whiteboard marker was just slightly too small compared to the width of this, and I could have made everything smaller, but then that would reduce the likelihood of people being able to hand solder it so you have that trade off, so it barely fits you might be able to sort of mill out or use a lathe or whatever to carve out some space inside a whiteboard marker to fit it in, the other thing too is that as you'll see, the range is pretty limited, so you have to be maybe a few inches away with infrared but much closer, a lot of times with visible light, you could adjust the gain and adjust that a little bit, but you're pretty close so this is a nice size that you could maybe put inside of a rifle scope, or use some other optics and fit it inside of some other optical thing, to amplify the light further away and get a better capture plus it looks cool on the back side there's test points, and those are the ones that you can see each stage, but they're labeled with real words so you can actually look at it quickly I do this all the time too, I'm like what, I want to look at the second stage, it's like which one is that oh yeah, TP3, so it's just an easier thing instead of having to look at your computer schematic or something so bill of materials, there's a handful of parts they end up being about $40 for 100 pieces, and the photodiode's the most expensive actually yeah, $12 single quantity the op amps are $4, so you could probably cost reduce this if you want to, but really that diode I think is the key, and those amplifiers are really nice low noise and I figured, you know, keep with those I should mention too, this design is actually based off of a reference design that Maxim Semiconductor made a really long time ago and been modified since then, and there should be a link to it somewhere in the slides so yeah, those are sort of the big ones, everything else they're what are called like popcorn components, so you know, the discrets and other LEDs and stuff are pretty cheap but the ones in red are the costly ones but still, if you're making one, it's not a big deal right, it's not like I'm mass producing these or anything so that's the receiver side, that's the optic spy side for transmitting, there's lots of different ways to control LEDs and different drivers and I'll show you some variations of things but generally, a system's gonna have something like this, an IO pin is gonna drive an LED, it's either gonna go low to turn on the LED, or maybe it's gonna be driving from the high side, but just a standard LED driver circuit and for the demos I was sort of mimicking like the original paper that I had read these modems were using NRZ data, because that's how Async or serial data is encoded for modems it's non-return to zero, so I was just emulating that and saying, okay, if I'm gonna build demos I'm just gonna use the UART functionality that exists on various microcontrollers and just send the data the same way and then we'll be able to capture it so that's all my demos, it's not limited to that because we can capture any sort of light wave we want of any modulation as long as the signal's being sent within our 100Hz to 1.5MHz speed, we'll be able to capture it, it just happens that NRZ this UART encoded data is very common asynchronous data, we see it on products all over the place so that's what I'm using to transmit information here's just what a data stream looks like, so ultimately you want to get to the stage when you're capturing to have a nice looking square wave there and it literally is as easy as doing a printf function if you want to transmit data through an LED and you have a standard LED driver circuit instead of printf to a debug console or output terminal, you just do printf and point it to an IOPIN and now you're modulating and you're sending data over the IOPIN and then over to the LED and if your speed is fast enough, then you're not going to see it blink, and I think that's the coolest part of the whole thing because you're going to look at it, you're not going to see it the human eye just doesn't respond that fast to motion like that so it's going to look like the LED's on and it's going to be sending data so different ways, there's a PIC example at the beginning and Arduino down at the bottom but yeah, you know, print here's the receiver side and I'll show you some demos so first stage is still very noisy, the signal's in there somewhere but it's really low down in some of that noise and that's going to be the first stage that's going to be before it goes to the amplifier so that's the photodiode connected to the resistor that generates the voltage first stage output of the first amplifier is the signal, you can actually see some data on there, but it's up high and it still has a little bit of noise on the peaks so then the second stage is how we have the capacitor in there and some other discrete components to bring the signal down and we see some relaxation at the top and bottom that's an effect of the distance we are away from the transmitter, but also because some of the relaxation effects from the capacitor is in there as things are discharging if the signal's too slow that happens, so we have to account for all of that and generally what we have is our threshold voltage by default is set to 2.5 volts which looks like it's a pretty good level where that red line is, anything above that's going to become a 1, anything below that's going to become a 0 which seems to make sense, but depending on what system you're looking at, you might end up seeing your data in a different way, your voltage might be something different, so you can tweak that and adjust your threshold voltage how you need to it all depends on what you're encountering that's transmitting light and here's the ultimate sort of output of nice NRZ encoded data, and you can see down at the bottom the scope is decoding that data it says insert secret message here so that's what we want to get to and then yeah, so calibration besides adjusting that target voltage you might want to increase the receive distance by increasing the gain, maybe you want to reduce ambient noise, so you'll see up here it's pretty bright, there's some lights up here so we're going to be receiving more noise than a typical environment, so I'll probably have to cover things with my hand to reduce the noise so if I really wanted to I could have my screwdriver and reduce the noise by reducing the gain but I'm not going to do that live on stage and yeah, all of this depends on the brightness of the signal and the wavelength of the signal so the type of light if it's closer to the center of that band of the sensitivity of the module, you're going to get much better signal to noise than if it's like right on the edge but all visible colors, I've worked with red red, blue, green, yellow like those all work, white all work fine and the potentiometers again are for three stages of the gain adjustment two of the op amps and one at the photodiode stage and then the threshold adjustment alright, let's do some demos so for the demos, I'm going to switch back and forth between my slides and my terminal program the first one I'm going to show is just using this Parallax hackable badge so this was inspired, they had helped build, I think it was the Defcon 20 and onward for a few years, the badges for Defcon, so they created sort of a general purpose badge that you can hack on, and this is using a Parallax propeller processor for those who know some previous projects that I've worked on I like this part so this I'm just going to turn on and again, a very simple proof of concept this is just a simple microcontroller and there's a little LCD on here that says what message it's sending so I'm not going to show you that because it won't be very fun when you see it and there's an infrared LED on here so we can't visibly see what's going on anyway but I'll hold up the receiver and you can see so I'm going to share the screen yeah, so you can see like super noisy already just because there's like light everywhere so I'm not going to bother trying to fine tune it let's see if I can do this while holding the microphone yeah hello Defcon 26 and everybody watching at home alright, so let's switch back and also the baud rate so I have this set, you know the baud rate usually with asynchronous serial data you need to pre-agree, the transmitter and the receiver need to agree on the baud rate beforehand where you can measure the baud rate by looking at the waveform and figure it out but I have some different baud rates set up because different LEDs and different systems respond differently or they take more time to start up and slow down so you can't always use the fastest but you can go way faster than 9600 baud which is what I am showing here so the next one is another LED example I wanted to show this because it's just a cool little device and it's something called Tomu and this is a tiny little USB sized like literally the USB connector sized little microcontroller that has 12 components total and it's EFM 32 it's an ARM Cortex M0 25 megahertz it has 8K of RAM 64K of flash, USB functionality built in and two color LEDs and two capacitive touch buttons and actually you can see that picture on the right side it's shoved into the side of the computer so this could actually be great for like you know, turn this into a USB rubber ducky or some sort of offensive red team tool or something like that where you just plug into someone's machine and maybe they're not going to know or if it's like a desktop computer you plug it in on the back of the computer but in this case I'm just using it as a way to, again, send information so we wrote a little program that has an interactive mode a little menuing system that we could just turn on and clear a message and then the red LED on Tomu's going to turn on so this one's a little more interactive but this is a great example of if you have a computer and you want to optically isolate it from other things or create your own air gap this might still be a way that you can send data you know, from a computer so this one, I am connected to Tomu on a different terminal program so my optic spy is here and then Tomu's here so I'm going to type a message in alright, hold on, I have to put this down so I typed a message and now the red LED is on I have it plugged into the right side of my computer here so I'm just going to I'm essentially connecting one serial port to another serial port through light let's switch over to the terminal program side and I think I'll put this down again I'm at 19200 so I have to change the bot right here thanks, so this one actually this LED is much brighter so I'm probably like two inches away or something like that, which is pretty cool I didn't mention also that there's a switch on here to switch between polarities there's a data inversion switch and because sometimes NRZ encoded data or UART data is sent idle high sometimes it's set idle low and it sort of depends on the driver that's controlling it and how the system is designed so if it doesn't work in one way but you see repeatable patterns you might say, oh that looks like data you flip the slide switch that inverts the signal and now it will work alright, so that's Tomu everyone likes lasers so this is another example of just using a standard type of optical interface where we know we can do it with LEDs and I have another LED example but this one is fun because I have a little laser diode driver module that I made and this laser diode is an off the shelf diode that has the internal APC and other control stuff so you just apply voltage to it and it's going to turn on really small I used these in a laser range finder project from a few years ago so created a little module everything's on my website and the circuit boards are linked on the OSH Park link and the little schematic is there there's a little tiny voltage regulator and then the system powers goes through the voltage regulator and connects to the laser diode and then the enable pin of the voltage regulator is what we're using to modulate on and off this one, I had to slow it down I'm at 4800 baud because any faster was too fast for this particular diode to turn on and actually start transmitting you can see it flicker a little bit so this was a pretty good mid-range and the cool thing about diodes is they go really far so this one in theory I don't even remember what I have on this demo so I'm going to run it and see I hope it's nothing incriminating I'm going to try to set it I'll set it at the end of the table and see how far it goes and the trick is to align it actually no, let's have a volunteer, Zaz, come here Zaz is going to be my laser control module everyone, Zaz Brooks don't you love you just get roped into a demo because you're right there okay, so he'll put it here and I'll try to align the system the trick is that if the laser hits the diode exactly right it's too strong it's going to overpower it so we're going to try to do I have to try to get it at the edge and again, it's going to be hard to see what actually happens because I might have to cover it a little bit but we'll try this out so we're at 4800 baud let's go back to my terminal program what's cool is you can just change the baud rate on the fly, which is really nice so 4800 and I don't even remember what polarity this is so we might have to fiddle around a little bit but let's see cool, that's awesome it actually worked thanks what did it say? I'm Arduino speaking through light waves yeah, cool alright yeah, so that one's sort of fun so sort of related to the laser thing I was at TorCamp and Will said he was there and he's big into lasers and high voltage crazy stuff he's like, hey, we should connect an optic spy with my 1 watt blue laser so to give you an example this laser diode is 3 milliwatts typically your red lasers are 3 or 5 milliwatts, like your brighter ones are maybe 5 or 10 milliwatts and you could see how far this was and this will still hurt your eyes if you look into it so 1 watt interface 1 watt blue laser I didn't know how bright this was but he gave us goggles to wear and everything and so I set up a little system it was hard because he had a battery this battery power supply that connected to this laser so we had to make this little transistor circuit and we were at TorCamp in the middle of Washington on an island and we're trying to cobble something together so I made a little interface that would take serial data and then hit the transistor that would turn on and off the laser we got part of it working but what ended up happening is you can see the laser in the up part so my kids decided to show up right as I was about to test this laser and I'm like guys you gotta stand behind me and I was wearing the goggles but I wasn't thinking about that they didn't have goggles on and my wife didn't have goggles on either so I'm like you have to stand behind me we're gonna test this thing, I don't know what it's gonna do so I turn on the laser and it's doing something and we see the laser but I don't see it much because I have the goggles on that are filtering the wavelength and apparently what was happening is the laser was hitting imagine like a tent you know one of the outdoor tents it was hitting the metal, one of the metal poles like it just happened, it was a huge tent and there was one metal pole and it was hitting the metal pole so reflecting off the pole and then my kids decide to sort of walk in front and then my wife goes after them and looks and the reflection gets her right in the eye and she's like what the hell are you guys doing because I didn't even tell her that there was a blue laser or anything so we were really scared about that her eye was a little bit red for the night but no damage and we thought it would be a pretty funny story if she actually burned her eye out with testing optic spy stuff but luckily that didn't happen and I'm still married so good I'm gonna aim for that and yeah we ultimately weren't able to test it because Will forgot his charger back at home in Boston so the battery ran out and it was like flickering so it probably would have worked he was here and he offered to do it and I'm like nah I don't want to take the risk so we ultimately put a box over it to do our testing and it worked much better okay so then the smart modem is the last demo then I'll show you a video and then we'll be done this is the original smart modem discovered by the guys that wrote this paper and data is leaking through SD on the input line and then it's also the receive data that is getting through the telephone line is showing on the other LED and it's hard to see on the slides but there's a direct path a direct electrical connection from the DB25 connector to the modem receiver chip but also directly to the LED and then same thing from the receive side from the modem chip through the LED to the DB25 so it's a great way to save IO pins the engineer doesn't have to worry about adding extra status LEDs because it's just showing the data and it appears to be solid because the data is going so fast anyway and even if it blinks it doesn't matter it's a status indicator it just happens that it's passing the exact data so this one I made a little micro SD card to serial interface which is a little board I have it plugged into the modem and you can use it as a standalone demo board also that has an LED on it for demonstrations and then the three pin for the laser diode module we can power it with a 9 volt battery or with the AC charger from the modem and it's going to read data off of the micro SD card and then transmit it over the lights I've been waiting for this one a long time so it's great for demonstrations and trolling alright so this is at 9600 baud if this works how I expect I'll be very happy alright so there's 9600 and now let's see if I can do this and the terminal program crashed perfect could you guys see what that was no did someone say no I think someone said no so just for that just for that you get it again yeah never going to give you up guys and so that's reading an entire you know that's reading a text file so it shows that you can do more than just send a you know silly one line message and then this is a video but this is showing like okay what if you modify an off the shelf consumer device to do something useful this is a TLWWR841N that I loaded DDWRT onto so I could actually control the GPIO pins which directly connected to the LEDs so I already had administrator access so it's a little bit contrived but the example is if somebody remotely compromises a device and then turns it into an optical covert channel they can do that this one is going to read the shadow file and then print the password hashes that you could then you know optically receive and then decode and do whatever but it just sort of shows what you could do unmodified hardware other than you know loading DDWRT but physically unmodified and for this one I'm using a prototype but you can see that I had to basically touch the device because the light wasn't very bright and there's a light pipe there that makes the LED not as bright so what you're seeing on the left is the shell from the DDWRT and I'm using the orange LED the WAN light to transmit the message and because this is Linux there's a whole bunch of overhead that happens even if you're controlling a GPIO pin you have to go through all these libraries and stuff to actually get to the bare metal which was super frustrating because I normally deal with bare metal not with Linux and I'm basically sending characters at 2400 baud every second so you can see that's what I'm transmitting and then on the right is going to be what I'm receiving and I'll speed it up and it's just going to send the entire password over and over again I think I actually have it set up to just send the first line because that's the only one we care about in this case so yeah you know it shows you can do it on real consumer stuff as well what about other sorts of devices MacBook Pro I thought it would be cool if I could if I could modulate the keyboard backlight I tried to do it on the screen backlight but that was way too slow so the keyboard backlight though they modulate their LEDs at 100 hertz which means and at 75% duty cycle so you can't really transmit stuff turn stuff on and off too fast because it's going to blink so this is the fastest I could get data to transmit it looks like Morse code but it's not Morse code the signal on the right is what was picked up with Opticspy the 100 hertz modulation and the width that I have there is the actual time per bit so if you want to look at these slides later and recreate that transmission it's going to be another secret message that you guys will hate me for so this is an example of it's not standard modulation you can't use NRZ encoding so you have to tap onto TP5 hook it into some other way to decode it here's one of the remote control this is the one I happen to have in my house most infrared remotes and things that are transmitting infrared on a carrier wave so this is 38 kilohertz the cool thing with Opticspy is you can adjust the gains and the higher gain you go the slower the response time is going to be on the system so you can adjust the gain and actually end up demodulating the data so here we have the carrier all those solid white is the carrier that normally you'd have to filter out Opticspy will do it for you which is pretty cool and then you're just left with the ones and zeros that you can go to work on and here's an iPhone sensor so you know proximity sensors on computers and bathroom stalls and whatever else so I thought it would be fun to just see what would happen if I held Opticspy up to that device and you can see it's something I didn't figure out what it was but it's these pulses at 30 hertz and then you have a little bit of data sent in there so yeah ideas for this sort of stuff it's like you can create your own interfaces you can sniff other people's interfaces I just feel like you never know what you're going to find and that's sort of the fun of hacking in general it's like building something like this really no other purpose except to just learn something new and do something fun and of course limitations if it's not NRZ encoded like we talked about you have to tap earlier the receive range is short so maybe you can amplify that in some way and the one thing that really gets me is that potentiometers are multi-turn so you can't tell what your gain settings are because it's not like this, it's like this so you can't really tell where they are which makes it a little bit trickier you could take the potentiometer measurements and check the resistances of each one and make notes of that and then you can set settings for this particular target depends what you want to do so future work, I have a question mark here because I'm probably not going to do it but maybe somebody will get inspired and do it maybe have some additional intelligence but I like the simplicity of this so probably not maybe having automatic gain control would be cool so if the signal is very weak it's going to amplify more otherwise maybe if it's too strong like the laser it would reduce the amplification which would be kind of cool and then there's actually some work that I thought would be awesome instead of transmitting data through an LED you can actually transmit data into a device through an LED depending on how the system is set up so I thought that would be fun to maybe investigate maybe that's a future talk not related to OpticSpy, I don't know but that's another one of like simple device that could possibly be a problem so then some other resources of other things that have been done and of course final slide with the link and all the information link to OSH Park for stuff if you want to get assembled units, Crowd Supply I think has a few left maybe we'll do another run, it depends but everything you need to build, test example code, all of that stuff even the MacBook Pro keyboard thing stuff that didn't quite work it's all on my website so feel free to contact me if you're building something and you find something cool or if you have questions or anything so that is it, thank you for coming and do we have any questions? no questions right, so for the receiver right, so for the receiver did I try to put a soda straw on it or something like that to limit the kind of area it's seeing I haven't and that would be a great idea to maybe use a paper one or something or maybe some heat shrink or something to narrow down that range and that would reduce the amount of ambient light also so I haven't tried it but, yeah great idea I love that it's all analog right so once you have the data coming in before it goes to the usb to serial adapter how hard would it be to detect the baud rate assuming it's an asynchronous serial nrz super easy because to do that you just have to measure the narrowest bit time within the signal and that's going to determine what your baud rate is because your baud rate is one divided by the bit time of the narrowest bit so yeah you could do auto baud rate detection which would also be good luckily like most people are just using you know like at least for these demos all standard baud rates and if a vendor is trying to be sneaky and they do a non-standard baud rate you could measure it but it's just going to look like noise and you might say oh maybe that's not anything so yeah some auto baud rate would definitely be possible to do for sure stick that from tp5 into a you know arduino or something good okay that is it thanks again and enjoy the rest of the show