A little bit of introduction, I've had the privilege of spending my entire career in free and open source software. And I'm a manager these days. So I do this so that my brain doesn't rot completely. And because I used to be an embedded engineer, and I find this fun. Also, I'm the co-founder of a small R&D shop in Boston, and we do stuff relating to sound and computers. So that got me into this strange topic. Now, usually I talk about hardware hacking. This is actually part of our HHV track. And usually there is a humorous obligatory disclaimer to all my talks that will most likely break some hardware while we're playing with it, and it will come out of your pocket. In this case, we're not breaking anything. The no liability disclaimer is that there is a lot of stuff here that is adjacent to classified material. None of what we will be discussing is classified. It's all coming from open sources. So that's good, I suppose. I literally don't know the part that's classified, so I cannot accidentally tell you. We have quite a bit to go through. So let's go. Now, this talk is all about abusing our beloved keyboards. Keyboards have access to the plain text of what we're so carefully encrypting. They have access to our passwords before hashing. It follows we obviously want some exploit action here. And there is some pretty wild stuff out there, mostly in research more than in active use that we can see. Of course, we don't know what countries are doing to each other, but we kind of have a sense of what's going on in the industry. So we cannot tell what the big boys in the Intel community are doing, but it seems like there is plenty of fun going on in academia. Let's start with something light. So there is this book, Eric Hasselton, interesting career, trained in neurology, then became a Disney Imagineering executive. Then he was recruited by General Hayden to run the NSA's R&D department. This was about 20 years ago. I can't remember if Clinton or Bush was president. An original career trajectory, if I ever saw one. So the first movie connection here is Disney, but the second one is coming from Hasselton's book. Great book, by the way, absolutely enjoyable to read if you are into tech and espionage. Details of the discovery of IBM's electric implants and typewriters in the U.S. Embassy in the Eastern Bloc, among other stories, very nicely written. At this point here, he's talking about Charles Gandy, the legendary NSA researcher, and how he got started in the business. Spoiler, it's the movies. So now I need to read for you. In the movie, FBI agents monitoring Nazi spies in America remotely beamed energy from a dish antenna at a room where the spies were planning their next attack. The intrepid FBI agents were able to decode voice signals in the room from reflections of a vibrating speaker in a telephone headset and to work to the attack. Eleven-year-old Gandy was in awe of FBI's advanced technology and vowed to use it to defend the United States. And then he became an NSA agent. Well, later, because this is 1940s, the NSA is not there anymore and is not there yet. Now, usually this is represented with a Tempest code word. The Tempest code word brings us the first attack vector, which colloquially we call Van Eck freaking. Somewhat of a misnomer, but that's a cool name. Dutch researcher Wim Van Eck opened Pandora's box on EM signal emissions with his 1985 paper, publishing what SIGINT professionals had known since the 40s, but kept classified. It was in the open that signal leakage existed, but it was generally assumed to require expensive equipment and expertise. In Van Eck's attack, he exploits the emanation of unshielded CRT screens containing frequency components in the UHF band, which is old over the air television for the young ones among you. Monitoring synchronization pulses are missing and have to be recreated by the attacker, and he creates some circuitry and costs him about $15 to make. And voila, he can display the resulting feed on a television from hundreds of meters away, up to one kilometer. People freak out about this once about every 20 years. I find that they forget and then the next generation does the same. And from unclassified NSA histories, we know that the Intel community did the same. The labs discovered it in 1943. The CIA rediscovered it in 1951. So looks like this keeps happening. So this is the BBC showing the exploit, mid 80s. So here's the BBC video. We don't have time for the whole thing, but it's on YouTube. Decent introduction explains what's going on and how a CRT monitor works. And then they drive around in a van with some kind of antenna down the street. And as one does, they read a letter from some unknown gentleman eight floors up on the building. Let's see if the media will work for us here. And that's a rather unwelcome birthday greeting. Well, that same hacker has now linked this terminal to the computer at Dairsbury, which is used for nuclear research. You can read all this data because it's obviously low level security. But if I try and go deeper into the computer, the data will be encoded. So all I'll get back is this sort of information, what's known as shash. To be able to read that, I'd need to have access to a decoding system. So you will get to it in a second. He drives in his van down the street and they literally read the TV on a monitor eight floors up. And this is interesting. I guess in the 1980s, it was not necessarily legal in England where they set up to read the TV of somebody who was connected with them. The phenomenon is quite simply that all electrical equipment gives off signals. If you take even a pocket calculator and you put it near to a radio which has long wave on it, you can hear the interference as I press the keys here. Well, even if a calculator radiates a signal like that, you might still be surprised to learn that a computer terminal radiates a signal that can be picked up over two miles. We're going to skip the rest because in the interest of time, since we skipped so much of it. But you can find it on YouTube. It's BBC Tempest. And you will have the slides at the end so you can pick it out a bit. So CRT monitors look like this for those of you that are less than 25. But Tempest as a code word refers for a classified protection standard for unintended signal emissions leaked through EM or other means. Most common sources were CRT monitors. Here's an exemplary from my retrocomputing research. But EM is not the only one. That much we know because the code word definition itself has been declassified in 2008. Much of it is blanked out, but a few interesting things were disclosed. Discovered in 1943 at Bell Labs, a reading and encrypting machine from across the street and rediscovered in 1951 by the CIA. Strategies for mitigation include shielding, so putting the Faraday cage around the device. Filtering, so trying to control the frequencies that get out, and masking, so creating so much noise that you don't know which noise you want to look at. Eventual resolution for the military in the 1950s after trying a bunch of filtering and shielding was that they just told anybody that had a teletype transmitting classified information to control an area 200 feet in all directions around the device so that nobody could get close enough with equipment to collect a signal. This was out of practicality because they didn't think that it was possible to control more than 200 feet in all of these stations, not out of measurement. They kind of thought 200 made sense, but the measurement numbers are still classified. We don't know what the NSA believes are the actual safe numbers. The other instruction was to operate 10 teletypes at once so masking would confuse everyone. That, we understand now, doesn't really work very well, but great for teletype vendors back then, I suppose. Another bit of the classified memo is this Peter Wright. He worked for MI5. Now, there is this bit of a story in his memoir. In the 60s, the UK government was trying to get into the EU, funny given recent news, and French President de Gaulle had a chip on his shoulder about the British, so he was stopping them. So, the foreign office, as one does, instructed MI5 to wiretap the French embassy. As they wiretapped the French embassy to discover what the French negotiating position would be, the technician discovered that aside from the encrypted signal, which they expected to see on the line, there was another much weaker signal. And once they amplified that, they discovered it was the plain text of the transmission. And the reason for this was not that the French machine was bad. The French machine was excellent. The British could not break the ciphertext. The problem was that there was a machine with encrypted data and a machine with decrypted data in two rooms that were adjacent. And the plain text that was leaking across the room, crosstalk literally, and the Brits could pick it out on the line. It didn't do them any good because de Gaulle blocked the admission into the EU until he died and the Brits could only get into the EU in the 1970s. But in a signal intelligence scenario, it was interesting. Now, of course, we know what happened in the last 10 years. So the world is strange. This, however, gave us the other bit of security directive that the NSA gives that we know about, which is red-black separation. Keep the ciphertext machines and the plain text machines separate according to certain rules. We don't know what the rules are. We just, well, we know something about the wiring that's being declassified, but we don't know. We do know that they want them strictly separated. Additionally, the declassified code word describes signal emanations in other domains. Seismic, presumably referring to vibration, but only the headliner is in the declassified thing. The rest is all blanked out, so my guess. And then acoustic is listed there. We understand that one. So the noise made by the machine, quaintly termed phenomenon number five by the NSA. I have no idea why. So here is another target of the age, electric typewriters. This one is from my IBM office in Massachusetts. Obviously, we have the EM emanation problem here, but the interesting bit is the sound emanation. These machines make a serious racket. Turns out you can figure out what is being typed by listening to a typewriter or teletype sound. And the temp test memo itself indicates this can be done from 100 feet away with a shotgun parabolic microphone. Another interesting nugget that, contrary to expectations, soundproofing a room helps the attacker as it dampens background noise better than it does the main signal. And this was something confirmed by others over 40 years of research in academia. So it's public. It's public in the open literature. And the range limits for these interceptions look, seem to be dictated by the ratio between signal and noise. That would make sense. And if you have soundproofed room, the noise is very low. So actually, it goes out farther. And reducing the noise is the wrong strategy. There is a lot out there about Tempest. Some of it is even true. But there is more. And those of you in the room who cannot tell us know what it is. So there is no point dredging gossip. You can Google yourselves what is out there. The other word beside Tempest you can search for is PEMEN, which unlike Tempest has an officially disclosed acronym. Okay, my Cyrillic needs exercise. Which translates to something like unwanted electromagnetic radiation and interference. So the Russian literature uses that instead of Tempest. And briefly around the turn of the millennium, the Russians declassified a whole bunch of documents. If you can translate them, and if you can find them, there is something interesting there about the physics of EM emissions . However, they've reclassified them since so you have to find them in places like archive.org or the like. Now let's change a little bit to go into more fun things. LEDs. I will take revenge of the caps lock for 500 Regis. I must admit, I was disappointed to find no reports of signal leakage from the keyboard LEDs. That would have been cool. But it's actually cool that at least something works the way we expect. There is unintentional leakage. There are multiple exfiltration research papers showing reasonable bandwidth in defeating air-gapped systems by blinking lights to export data from an air-gapped system. I recall one reaching 56 kilobytes. I don't know if somebody has reached higher speeds. Actually, a character in Neil Stephenson's Cryptonomicon exfiltrates data using caps lock just this way. And this is also a novel that makes massive use of Van Eck freaking. So pretty cool. And then there is this. We have an entire industry of pen testers, and the gold standard for them is a keystroke injection tool disguised as a USB drive, which I expect every single person here knows about. Unless you've been living under a rock on one of the outer planets, you know what a rubber ducky is. So I'll reclaim the time from this. But the short version is it's a USB stick. You plug it in. It is recognized by the system as a keyboard, not as a storage device. And then it fires off commands at superhuman speed as a keyboard . Now, when you have that, it has storage, but the ducky is a USB keyboard to the OS, which enables the attack, but then hampers data exfil. You cannot copy data to a keyboard until 2002, that is. And 2022, that is. To reduce the price of PC keyboards, IBM delegated the management of the cap state and lights to the host, giving us a side channel keyboards, or rather the ducky, can now use to exfiltrate data to its internal storage. Side channel, four decades in the making. Keystroke reflection relies only on caps lock, num lock and scroll lock to establish a data transfer path. This is something a rubber ducky can now do out of the box. No more need to connect to IRC servers in strange parts of the internet to export data. Unless you want to, that is. But wait, there is more. For one, this comes from Lagre and Ampers paper. What is this? The lower line is an RS-232 signal, a serial line, straight from the port itself. So it's the upper one is slightly more jagged. Is the brightness variation of a modem's TX LED. This was published in 2002. They could read the data transmission of the modem by looking at the flickering of the TX light on it. This was termed optical tempest at the time. It was quite spectacular for 2002. Modems are obviously a thing of the past, but you could read the transmission from across the room and likely across the street with some help. One bright spot of their study, because they tested other hardware, is that modems and data transmission hardware had this in a lot of cases, but at least hard disk drives did not. The hard disk lights were not leaking IO that way. But wait, there is even more. So continuing the thread of what can you do with the LEDs. The previous gentleman who's from Lockheed Martin was topped in the LED category by a team at Ben Gurion University of the Neve Gev. This was two years ago. They figured out a way to read the sound in a room by looking at the flickering on the speaker lights. So the speaker that's playing your Zoom conference has an LED light or the USB hub that's powering the speaker has a USB light. And from that flicker, they could read the voice payload of the Zoom connection. And you can see there is, I don't know if it's bright enough, but you can see this looks like a 10 inch telescope. They were doing this from 25 meters away. This is not itself a keyboard attack, but it leads us to one more. It used to be don't drink and drive, math jokes, but now it's don't Skype and type. A team led by a researcher at the University of Rome, La Sapienza, and this was also quite recent, like 2017, 2018, demonstrated that you could do the kind of keyboard acoustic attack that I described earlier over a Zoom connection. So if I'm connected in a video conference with you and I'm typing, but from a recording of that or from the other side, you could decode what is that I'm typing. This was postulated by Marcus Kuhn, who became the new avatar of this thing in the open 20 years after Van Eck, when he published a huge research tome around 2003, I think. He's at Cambridge University and his tome is entirely about CRT emissions, but people would kind of use him as a clearinghouse for information. Kuhn postulated that this would be possible. A researcher at IBM a year later proved that it would be possible with phone frequencies, because he analyzed the frequency spectrum and showed that the frequencies that were being used to identify the keys would be carried by the telephone. And now 15 years later, somebody actually has done it. This is Kuhn's report. Probably it's going to be the last most important document in this area because the next one is going to be whenever the NSA declassifies something, I suppose. Plus CRTs are no longer relevant. Now, here's where it gets really interesting. Asunor and Argawal, which are the two IBM researchers, wrote a meticulously detailed paper, I think it was 2004. In their attack, a microphone is placed near a keyboard from half a meter to 15 meters away. And sound is sampled with a standard sound card of the age, so 44.1 kilohertz, probably a sound blaster, although they don't say so. A neural network is trained on a sample of these, not gigantic neural network of the kind that we have today, something with a couple of hundred nodes, and something designed to classify, distinguish the voices of people as Federico or somebody else. And they very methodically do experiments to determine what matters. So, for example, first they want to prove, can you distinguish two letters on the keyboard? So they have a neural net trained with just two letters. And this is the result, 100% success. For 20 tries, the neural net never failed to tell which key it was. Then they ran a longer sample, and it was correct 95% of the time. But we don't know what is the neural network doing, so using their setup, they started researching core questions. Will the distance matter? They tried up to 15 meters away with no decrease in recognition quality. They placed the microphone behind the typist. In another test with 30 keys and 300 tests, the model guessed the correct key 79% of the time, and the correct key was one of the top three choices 88% of the time. So they pretty much demonstrated that you could recover the plain text. Then they tried something that didn't work. They tried the model trained on one keyboard on another model of keyboard, and that didn't work very well at all. It wasn't enough to recover the plain text, but it was enough to compromise the entropy of a password if that was desired. There was some signal there that's not good enough to get back the text. In another test, the typist applied variable force in striking the keys instead of being consistent, and the fixed force neural net couldn't decode that, but training a network with the variable force, this new network could figure out both fixed force and variable force samples equally fine, and pretty much the same result as in the fixed force test. So really good. In yet another test, they subjected the variable force model to inputs from multiple typists to see if the user would matter. They were free to type whichever way they wanted, hard, soft, little bit like a piano player, whatever they wanted. The quality of classification was adversely affected by only slightly by the variance in the typist, showing the applicability of a model trained by an attacker to a potential victim. Studying the average sound of individual keys, which is here, you can see one is the average of one letter and the other is the average of the other letter, there is a distinct difference. So they proved that there was actually a signal there that the neural net was working off of. And then they tried a few things. So they looked at keyboard units, they looked at keyboard models, typist style, the keys themselves, they moved keys around the keyboard to see is it the key cap, and it wasn't. And they determined that what mattered was the place in the keyboard where the key switch was. And then the model that they have is that essentially it's like playing drums, that it makes a different sound depending where you hit the plate of your cymbals or your drum. That seems to be the most relevant thing. Now, in 2005, a UC Berkeley team led by Li Zhuang put the final piece in place. The IBM models were supervised training, the Berkeley model was self-supervised training. The model could discover itself without training data. It couldn't discover the whole ciphertext, but it could compromise passwords successfully. It could break five character random passwords in fewer than 20 attempts, and 80% of 10 character passwords were broken in fewer than 75 attempts. So it wasn't perfect, but it was close enough that it was a successful password attack. Now, from there, sound evolved slightly in a different direction. First with sound. In 2023, a team, I think these were British researchers, demonstrated 95% accuracy without use of language model constraints whatsoever. Usually you use some knowledge of the language. You go and say, this is English, so these combination of letters have certain probabilities. They didn't use any of that. They just did pure matching of the sound of the key, and they got 95%, which is the highest result yet. Using the microphone of... you put down your phone before typing, that's the scenario. The phone can read what you're typing entirely without doing any strange tricks. And they achieved 93% while doing this over Zoom. So again, I'm going to spare you the jokes about all your keyboards, but... Now, if I haven't completely crushed your soul yet, I have one more. And this is the spy phone attack. This one is a Georgia Tech team. They did the same thing, but instead of using the microphone of the phone, they used the accelerometer. So they could get the vibration of the table. And the thing that's cool here is that to get the microphone on the other phone, you needed permission. You needed to hack the phone or somehow convince the user, give me permission to the microphone. Here, you just need a Trojan horse app, because the accelerometer is not privileged. So you can do this without compromising the phone, which is obviously easier. Now, don't forget our friend VanEck. This one actually surprised even me. I put him in the abstract because he's a cool fellow and I needed him to explain all of these data exfil things, but I didn't think we could do EM out of a keyboard. I thought the voltages will be too low and I was wrong. First of all, I should have known because keyboards were PS2, so serial. That's not super low voltage. I should have seen that coming. But so, in 2008, a team in Switzerland extracted the entire signal of both PS2 and USB keyboards. This is done over GNU Radio, an old version of GNU Radio at that. They couldn't afford the classified equipment, so they did it on the cheap. And this is at five meters, but they demonstrated it at up to 20 meters. And the thing that was interesting of their result besides this is that they demonstrated that they could fingerprint different keyboards in the same room. So, if you had the 10 teletype scenario or 10 keyboards in the same room, it didn't matter. They could distinguish the 10 keyboards and follow the signals independently. So, this is also an interesting paper if you want to learn something about GNU Radio without first getting a degree in EE, which most of us just can't. Now that I've convinced you that the world is full of uber-smart adversaries and there is really no hope, let's bring us down a little bit. Let's look at good old-fashioned screw-up. There was wireless keyboards with no encryption whatsoever about 20 years ago. That's just plain stupid, so let's not go there. But then there was this one, which was right on my desk while I was researching this for a year. And a couple of days ago, while I'm looking at the Bastille security mouse jack exploit, I read the list and I thought that they were all Logitech mice. And then I see this thing right in front of me. I'm like, oh, yes. Okay. Pwned. So, I believe that the advisory affected only Logitech. I was wrong. The chips are affected. And for brevity, what mouse jack does is that connection here, it's a Bluetooth connection. It secured one dongle, mouse, and keyboard to reduce the proliferation of dongles. Logitech or some VAR-made chip for Logitech has this thing where you can connect things. The keyboard connection is encrypted. Mouse connection, probably for speed, this was developed 10 years ago, is not encrypted. So, if somebody wanted to move my cursor, but who cares, I guess, was the logic. Researchers discovered that they could create a fake mouse, connect it in, and then once they were connected, this mouse could call the keyboard API in plain text. So, they could inject commands in plain text and bypass the whole thing. It was a big issue for Logitech because they were singled out and I thought they were the only ones. But as you can see, that's not a Logitech mouse. There were plenty of others. No, I had funny images of hotel staff being weirded out by things they see at DEF CON over the years. And I was picturing this happening in my hotel room and they wondering, first, what kind of boring hacker has 20 keyboards in there? And secondly, what kind of sociopath has all clacky keyboards? His colleagues must absolutely hate him. We don't have the time to do this live. I was going to demonstrate this. They've been challenging because of the noise, but I wanted to see if we could do it. But this is how it works. Gennady Gerganov has posted this Hoping project, which is essentially trying to do this in a very low-tech fashion. He doesn't use the neural network, which would be an advantage in figuring out what part of the signal is interesting. But his WebAssembly code is very lightweight. He does some things like the multiple symbol matching. So, your input text must be valid English and so on. But it's very, very lightweight. And you essentially train it by typing a few sentences. I think he wants between 100 and 300 characters of valid English. You cannot make typos, you cannot use backspace, all sorts of constraints. And then it trains a little pattern matching model, not a neural net. And then it makes predictions. And when the prediction, the thing that's cool about this code is that it's visualized this way. And here, I don't know if you can see at this scale, but it's what you would have seen if I managed to demonstrate. These are the top three guesses. So, this was an Annie Pro keyboard, which is very clacky if you don't know what it is. It's a white keyboard with red bezels. And after training, I kept addressing the letter H, I believe. And you can see third guess, H, H, second guess, H, third guess, H, first guess, H. There are a lot of Hs in this sample. It's not perfect, but it's in the top three more than 50% of the time. This is a rookie's code. He's doing it as a hobby. So, it certainly demonstrates the thing. And it's fun to play with if you want to have a shot. Now, if we had managed to do this here, it would have looked like this, because I wanted to stack the deck in our favor with a good microphone. But, oh, well. In closing, so the threat, it's realistically possible for a sophisticated, semi-sophisticated adversary with some resources to read whatever is going on on your keyboard if they can get within, let's say, 30 to 40 feet. Now, the tools to do this are not in the public domain. So, you probably have to expect the government to be able to do this, but not a random hacker unless they have some serious time on their hand to finish up the tools. As I like to point out, until successful security becomes commonplace at the network layer, why would I hack you locally if I can hack you remotely? So, this is probably not the highest priority, but it's there. Plus, if you're a pen tester, you can show off big time doing something like this. I'm going to skip this and just stop there. You have my contact info. The slides will be posted. If you have ideas, feedback, commentary, remember that speakers are Pavlovian devices, let us know what we liked, what we didn't like. If you are a three-letter agency sponsor or know of one that may be interested in funding a small business looking into this further, I would like to have the conversation. And, well, you will see from the slides the little bits that I skipped.