Without further ado, because we stay on schedule, Felipe is here from Portland by way of France, from what I understand. And he is going to talk to us about breaking into embedded devices, including phones. Phones that you might have on your desk at work. Phones that might be, I'm not even gonna get into that. Phones that might be around. Let's learn about embedded device hacking. Let's give Felipe a big round of applause. Have a good time, man. Thank you. Thank you, everyone. I'm really excited to be here. It's like a big honor. And yeah, so today we're going to talk about hardware hacking and I'm going to share this introduction to it and I hope I can share some love about hardware hacking. So who am I? I'm Felipe Lollouet. I'm a senior security researcher at McAfee Advanced Light Research. So I do software and hardware value research and you can find me on Twitter at phloll. Before joining McAfee, I spent two years doing embedded security and before that I was a C++ dev. So I'm more coming from a software background, actually. So you could wonder, like, why should you care about hardware hacking in the first place, right? I can see, like, two main reasons. First, it's actually really fun and empowering to be able to, you know, break open, like, a device that you, like, have in your home, at work, whatever. And instead of considering that it's a black box, you can instead, you know, like, start poking at it and understanding how it works. And then, in a more, like, pragmatic way, if we consider, like, security in the past couple of years, software is becoming much and much harder to, like, break. Like, if you try to, I don't know, like, pawn, like, whatever, like, an embedded device, like a web server, like, finding a vuln in a web server by itself is kind of hard. But if instead you can just, like, open the device, solder a couple of wires, and get, like, a shell from that, that's much easier. So hardware hacking is great because it's also, like, a lot of low-hanging fruits, basically. So today, we're going to talk about Avaya phones, and especially, like, the phone picture on the right side of the slide is a 9611G model. So Avaya is, like, one of the biggest VUIP solution provider. You can find them, like, all over the place. It covers, like, 90% of the Fortune 100 company, and I think that specific model of phones started in 2006 and is going to be out of life, like, at the end of the year or something. And the funny, on the bottom right of my slide, there is this funny, like, screenshot from, like, a few months ago, download page from, like, a really old firmware for these phones, where actually, like, you can see that you can only download that specific firmware if you're, like, a DoD customer. So basically, you can see that these phones are, like, going to a lot of different places. So regarding prior art, in hardware hacking, there's, like, a lot of information nowadays on the Internet. Like, you can find a lot of blog posts, tutorials. There is, like, the hardware hacking village that you all go and check out. CTF, as well, where you can, like, practice, like, kind of, like, the software side of stuff. And on my slides, there are, like, a bunch of links at the end, so you can, like, download the slides at later time. And also, those slides, I've, like, the one I've uploaded, I have, like, more text on them, so it's, like, more, like, standalone. So you can read more. And, yeah, Red Balloon Security found, like, two RCEs in the same phone, something, like, five years ago or something. And they had, like, a talk at RSA called Stepping Ponds that I would also recommend to check out online. So for the next 40 minutes, so I'm going to talk about hardware hacking and use that phone as a base to, like, support that conversation. And basically, the idea of, like, the whole situation is, like, a couple of, like, 12 years ago, maybe, Avaya forked some open source code, and they never applied security patches to that. And it turns out that, like, me, by poking at the device, I found that. And it was, like, women, like, unnoticed for, like, 10 years that there were, like, actually, like, a CVE that got released, like, yeah, 10 years ago for DEF CON. So I'm going to talk about how I found that, like, that there was, like, some stupid, like, vulnerable code inside the firmware. But more interesting, I think, is talking about the whole process, you know, like, how I did it and why I did what I did it. Oops, sorry. Why I did stuff I did when I did it. You know, like, basically, like, sharing the process so that... And, you know, also, like, sharing, you know, what if the stuff I tried didn't work or also, like, stuff that didn't work because, you know, what works for one device might not work for another. And having just, like, that mental model of what you can do and what you cannot helps you a lot approaching, like, any kind of device. And that's, I really think, why I want people to take away from that talk is more, like, learning the process so that you can check out, like, whatever device you have. And, yeah, I would want to, like, insist that if I can do it, I think everyone in this room can do it as well. As I said, I'm more from, like, software background and hardware hacking is still, like, you know, like, a little scary, little foreign to me. But it's... In the end, it's really not that hard if you have, like, a good process and, you know, work with patience. So, how did the whole project start? To be honest, I was, like, you know, working at work and there were, like, all these cubicles. And on every desk, I see this, like, phone, like, standing on the desk. I'm, like, wait a minute. These phones run Linux. They have, you know, network access. They have, like, mics and stuff. It's, like, how secure is that, you know? Like, you know, you wonder, like, what's up with it? Did people consider the security of those? So, the first step, before, you know, even, like, I start, like, stealing my co-worker's phone and breaking it apart, you can, like, and that's a general step, is you can check out the FCC website. Usually, like, any device that has Wi-Fi or Bluetooth has to be on the FCC website for, like, compliance reasons. So, that's what I found. That's not my phone. That's, like, an other model of, like, same brand, basically, and, like, really close. So, you see all these cool pictures. But more interesting is the inside of the phone. So, we can enhance it. And on the left side, in red, I've highlighted, like, this, like, random debug connector. I don't know what it is, but that's interesting to see that's there. And on the right side, there is, like, that, like, in purple, there is that flash memory. So, that's usually where the file system of the phone is going to be stored. And the whole point of that is just to get an idea of what to expect, you know, before even approaching a real target, like, buying hardware and stuff, so that you know, like, if it's going to be a easy target or a hard target. You know? But in black epoxy, that would be harder. So, another important step is, like, getting, like, online material, like, you know, a marketing brochure. So, you have an idea of what the phone, what are the phone capabilities and the ecosystem surrounding it. So that you have an idea of, you know, like, the attack surface. And you can also find, like, user manuals and stuff. And, for instance, I found that one that was pretty cool. It's, like, a user, like, or advanced user manual that says, oh, if you want a serial connection to the phone, you need that funky box. Yeah. Which is interesting. It tells us that, yeah, you can find a serial connection. And you may have some special hardware for that. But are we going to see that in a bit? And after that, you also want to check, like, forums and so that you can find, like, what poor users are doing. Like, for instance, I found, like, the default password for the phone debug interface. Because system admin are talking about that online. And if you're lucky, you can also download a firmware of an ID of WhatsApp there. And I will cover that in a minute. Okay. So what do we do now? We have an idea of, like, what it might look inside. This is a hardware hacking talk. So we're going to avoid warranties. And so the point is, like, you open the phone first. And the trick is, like, usually you always expect to find the same stuff inside. And if you look at the labels of the components, you will see, and you Google that, you will find out, like, what it is. So, for instance, that's my phone. And you can see in the center the CPU. Above it, like, the RAM. In, like, a lavender-ish color. Like, some underneath. And populated, like, header that I marked with a question mark. I think the same header as the one we were, like, seeing in the picture before. And it might be JTAG. I did not have to use it. So I don't know, actually. In purple, we have, like, the EEPROM. So that would hold, like, some settings and stuff. In dark blue in the bottom of the slide is, like, a key, the RG45. So I was kind of confused when I was looking at that. And I didn't know even the term for it. And the idea is just a regular RG45, like, Ethernet plug, but with a weird connector so that you cannot plug the wrong stuff into it. And the idea is just a regular RG45, like, Ethernet plug, but with a weird connector so that you cannot plug the wrong stuff into it. And more interesting in yellow, the UART. So UART is kind of like the serial console. And we have, like, this exposed, like, pads. And so usually, like, in manufacturing or something, you would have, like, pogo pins that would, like, directly connect to the pads. And that one is actually really interesting because you would find, like, you would expect to find a serial console on that. And on the back, we can see the same NAND flash that we've seen in the previous picture. And, yeah, from that is, like, where the file system would be, like, stored on the device. So, okay, you have, um, we looked at the stuff inside. And, like, other things that are interesting to look at is, like, test points and debug headers. So, and, like, basically all this kind of stuff that are not components. And you can ask, why would you expect to find them inside? And a couple of reasons. Like, one is, like, just usually, like, the dev board that the guys are going to use is the same as the production board. And maybe they're just not going to solder the debug components. It's the same as if you had, like, software and it was built with, like, debug symbols, for instance. And, um, also, like, part of the manufacturing process, um, you, these test points and stuff might be used for, like, flashing the device or making sure it's flashed properly. And sometimes, you know, like, something died on, um, in, in the, in the real world. And they want to, like, do a post-mortem to understand what happened. And that's useful as well. So, what kind of stuff you want to look for in that situation? You want to look at UART that we, like, were looking at before, JTAG that I'm going to cover, like, in a minute. And then, like, you can also have, like, random test points that are chilling there, like, all over the, all over the table. Uh, all over the table. All over the board. And there might be, like, long test points that say, like, label, like, TP1, TP2, whatever. And sometimes that, that might be, like, not interesting to you. But sometimes you can find interesting stuff, like, um, you might find that, like, oh, if you short, like, TP64, uh, with ground, it's going to reset the device, which might be actually useful in some extent. So, uh, looking at UART, uh, so as I said, it's for, like, serial connection. Uh, and it comes in, like, three or four pins. The three pins will be, um, ground, uh, transmit and receive. And the fourth pin would be, like, VCC, so three volt, five volt, whatever. And usually you don't care about that one. You don't even want to plug it. You don't have to. And might, uh, yeah. And, um, the, the trick to know is, um, the serial console, uh, send data at different speed. And there are only, like, a couple of, it's called, like, baud rate. And there's only, like, a few, uh, common baud rate values. So if you try to plug your, your system in, uh, into the UART and you just see gibberish on screen, the, probably the reason is you just have the baud rate wrong. And you could just, like, try to plug it in. You have to cycle through, like, all the possible, possible one and you would find something eventually, I think. Um, JTAG is another one that's, um, interesting. Um, so that's for, like, hardware debugging. And with that you could, like, you know, uh, debug the CPU usually and execute, like, instruction by instruction and whatnot. And they come in many different, uh, shapes, number of pins and whatnot. So some example, like, on the bottom of the slide. Uh, but actually only a couple of wires are interesting. And, uh, at the end of the slides. I was, like, clinging to, like, a Sanrio article about, like, understanding JTAG better. But basically, like, if you look on the top right side, uh, of my slides, there is, like, a dev board. And there's, like, a nice, uh, JTAG connector, like, plugged there. And on the other hand, like, on the bottom right, it's, like, some, uh, random device I was looking at. Which you can see there should be a JTAG, but it's never been soldered on. And so I had to solder directly onto that stuff. And the trick to remember here if you, kind of, like, solder your own connector is, uh, you actually may have to co- add, like, extra resistors. Called, like, pull-up and pull-down resistors that connects, like, one pin to ground or one pin to, like, VCC. And the point of that is, actually I don't know the point of that. But, uh, the reason is, like, if you don't have them, it might not work well. Or it's more, like, most of the time it's going to be glitchy. So, um, and if you follow the, uh, instructions from, like, for instance, like, ARM as specification for, like, what resistor you need. So, you might skip them, but then you might waste time, like, understanding why it's, uh, weirdly, like, fucked up sometimes. So I would recommend, like, remember the pull-up and pull-down resistors. So that's just a random board that my co-worker was looking at, uh, just to show you that what I said is actually fairly generic. Uh, on the left side we have, like, UART. On the right side there's, like, some JTAG connectors. Uh, up, there is the, um, up right there is, like, the main CPU, whatever, that's under, like, a shield. And usually you do that for, um, preventing, um, interferences. So it's like a Wi-Fi module, so that's why. And the cool thing to know is usually the shield is grounded. So, like, if you're looking for the ground on your thing, like, either the shield on that kind of stuff or, like, the casing around the ethernet. Port or whatever is also, uh, actually, like, fairly useful. So, uh, now that we learned how to, uh, look into stuff, we need to know what hardware you need for, um, interfacing with what's inside. So I'm going to present, like, a bunch of, uh, cool hacking tool set that's important. So the first one, uh, you may want this pin or, like, the stickers. I don't know if you're familiar with that, but, um, the, actually, like, what's really important is, like, safety. Um, so, you know, don't work with stuff that's plugged in the wall. Uh, remember to unplug stuff. Work in, like, well-ventilated room. It's important. And, uh, yeah, just don't be stupid when you're, like, uh, messing with hardware. Uh, but, yeah. So next, uh, picture from the lab. Uh, I'm holding, um, soldering irons. You can usually switch tip for, like, if you have, like, large tip for, like, big soldering and tiny ones for small soldering. I have a microscope, so that's really useful for doing, uh, tiny soldering. And the trick is I tend to drink a lot of coffee and I shake. So I'm, I would, I was thinking, like, I couldn't do that. But, actually, if you, um, if you're careful and the trick is, like, really, like, try to, um, you know, when you're soldering, like, try to hold your arm, like, straight and well-grounded. And under the microscope, you can actually do a lot of stuff that's, you shouldn't think you, you wouldn't be able to use, you would think you shouldn't be able to do it, but you actually, actually can. Sorry. Um, top right side, um, it's what I actually use for doing tiny soldering. And, um, it's, like, top right is, like, flux. So it's kind of, um, magic glue, magic, uh, gooey substance that you put on, um, pins to, uh, when you're soldering surface mount or pad. So that it works really well. So don't, never forget flux. Uh, bottom is, um, so, like, in the same, uh, size, like, uh, copper wires. Like, um, enameled wire that you use usually for making coils, you know, for, like, radio, whatever. Um, and the trick is, like, the, the wire is actually, um, coated in, uh, varnish. So it doesn't, uh, short. And you can use that to do, like, really tiny point-to-point, like, soldering. And that's actually really useful. And just next to it, you have, like, some desoldering wick. So, like, the idea is if you put too much solder and you fuck it up, uh, you can put the, uh, wick on top of the solder blob that you messed up with. And you, um, put the soldering iron on top of that. It's going to get really hot. So you want to hold it through, like, the plastic casing. And it's going to, uh, absorb all the, like, extra solder. And you can clean up your stuff. And then I put, like, a picture of, like, some random, like, uh, jumper wires that, uh, are usually, always useful to have. And on the bottom right, I have, like, that crazy, uh, heat gun. Uh, which is, like, 60 bucks at Home Depot. It's meant to, like, help paint dry or something. I'm not sure. But it's actually really useful for, uh, if you're not. It's cheap if you want to remove components by just, like, heating them and pulling them off. So, uh, more cool hardware. Um, that's a multimeter. Um, if you're not familiar with that, it's, you use it for, um, finding voltage of chip. You don't know, like, what's the actual voltage. So the black goes to ground. And the, with the red, you, uh, with the white probe, you select poking around to, uh, measure the voltage. And the other really cool stuff is you can set it in continuity mode. And when you have, like, connection between the two probes, it beeps. So if you do, like, a crappy soldering job. As I was describing. Just before. You can make sure that you actually did a proper job where, like, everything is connected the way you think. By, you know, making sure that both, like, when you probe, like, both sides, it actually beeps. And that's actually fairly useful, uh, tool. The other one is, this is a logic analyzer. Uh, the name is, like, Sally. Um, that's a brand. And the idea is, the same as in software, you have, like, ways of communicating between process. Like, in hardware, you have, like, ways of communicating between chips or the CPU and the chip. And it's, uh, it's, like, a lot of different standards. Different ways of doing stuff. But the logic analyzer. Like, know a lot of them. And it's going to convert, like, a bunch of signals that's going on to wires into actual data. And that's actually really useful. That would be your eyes. Like, when you're doing, uh, debugging, you know. And that's, like, a snapshot of, like, some spy communication. Uh, which spy is just some random protocol. Uh, that's, like, an FTDI cable. Also come in many, uh, or serial cable. It comes in many different shapes and stuff. And the idea is just, like, when you want to do, like, UART, you, you plug that into your laptop. And you connect the, the other side to, like, the UART port. And you get, like, a console. It shows up at, uh, serial port. And, uh, as an example, I have, uh, on the bottom right, um, like a Raspberry Pi. That's, you can actually get a serial console. And you don't need, like, HDMI cable or anything to interface with that. Whew. Um, the BuzzPirate. Uh, also, like, cool device. Um, it does, um, it, it's kind of dependent of the hardware hacking. Uh, the, uh, sorry, the, um, the SALI, the logic analyzer. So, instead of absorbing data, it's, like, send data. So, it speaks a bunch of different protocol. And you can use Python to, uh. Uh, program it. So, it's extremely useful if you want to, like, read Flash, program, um, microcontrollers and that kind of stuff. Uh, more cool stuff, like, how about, I was talking about JTAG. That's the JTAG debuggers that you, that's why you would plug, actually, like, the, the JTAG port on. They come in many, many different, like, uh, price range and whatnot. So, on the bottom right is a fly swatter. It's, like, probably, like, 30 bucks, I think. And it works okay. And, uh, above it's, like, a J-Link, which is, uh, more fancy. And the idea is, like, the more expensive the stuff is, the more, the, probably, the more reliable it is. And it comes with, like, better software and whatnot. And on the bottom, right, the pink board is a JTAGulator that, uh, Joe Grant, the same guy who made, like, those badges, uh, made. And it's really awesome. So, if you have, like, that board, you don't know what it is, and there's, like, a bunch of test points. And you're, like, I bet there is some JTAG somewhere in it, but you don't know where. You can just wire, like, all the test points to the JTAGulator and it's going to brute force, like, and try to find everything. So, it's really cool. Um, another interesting, important tool is, uh, Flash readers. So, um. Usually, Flash contains, uh, the Flash has the file system and stuff. And, uh, so you want to, like, interface with that. And, uh, it comes in two flavors, I guess. You can do, like, in-circuit stuff. So, you have, like, either, like, a little, like, clamp that you put on the chip or, like, the little rectangular one, um, that you clip on. Um, so, like, the Raspberry Pi is a good one for that. And on the top right is, like, a flash cat, uh, just, like, useful for the rectangular one. Um, but you can also, like, choose to, like, actually de-solder the chip and in that case you would have, like, some, like, flash cards. Like, little, like, socket adapters so you can clip the chip on and then you plug it into your flash cat or whatever and it's going to read it. And I will cover, like, why, what's, what's, why it's important, like, both in a minute. And finally, it's kind of the, um, last, uh, hope. So let's say, uh, you know, your flash is encrypted, there is no UR, there is no firmware. So you can try to do, like, the more crazy stuff, like, fault injection and side channel attack. So that's the chip whisperer. So, like, more, like, uh, kind of hard, more badass device. And the idea with that is, um. It, it, you can do stuff, like, um, you, you, uh, wire it, um, to the CPU and you're going to drop the power on the CPU for, like, a split second and it's going to, like, mess up some instruction and you can bypass checks and stuff. That's what people use for, like, gaming console hacking and, um, that kind of stuff. So, uh, what do we do now? Um, that we have an idea of what's inside the phone and, um, you know, um, the tools we can use. So, like, I think there's three post, potential track. One is messing with the UR. So the serial console. Another one is, uh, messing with the flash and trying to recover the firmware or something. And then maybe you can just download the firmware online. And the three are, like, valid approach and sometimes it's good to just go from one to another to another. And, you know, whatever you find, like, some hurdle you can, like, go from one to another. Uh, so I went for the UR first and that's what I'm greeted at by when I connect my FTDI cable to the UR port that, uh, I was showing before. So, um, we can see, like, on the left side, the, um, the console thing. It's, like, dot, dot, dot. Usually when you see that you can press space. Or escape. And it's going to interrupt the booting process of the phone. And in that situation, uh, but somehow here it didn't work and, uh, I will cover that why in a minute. And on the top right side of the slide, um, we can see, like, it read something from the EEPROM and it decided to set the console to dev null. So you don't want console to be dev null because that goes nowhere. But that's interesting to know that, uh, there is some potential there. And finally it says, like, booting Linux. So it confirm us that it's a Linux board. But then, uh, there is nothing more, uh, after that. So that's some good thing, bad things. So the problems are, like, nothing shows up after, like, the Linux is as booted. Probably because of the dev null situation. And when I press key it's not working and, uh, I'm going to, like, come up with, like, why that happened. So at that point I was stuck. I was, like, okay, I cannot go anywhere. So I'm going to try to recover the firmware to try to understand what's up with that. Uh, multiple ways of recovering firmwares, uh, it's, like, an easy way, like, you can download it online. And actually that worked. Um, there is, like, some cool snapshot of that. Uh, sometimes it's encrypted. On our case it wasn't. Um, but yeah. So you can also try to sniff a firmware update, uh, that's really useful for IoT devices in general. And you can use a network tab, which is, like, the thing pictured on the top right of the slide. Um, or you can mirror your port on your switch or whatever. Uh, the problem with all of that is oftentimes the firmware update is going to do over, like, HTTPS or it might be. And in this case you're, like, stuck. And then you want to go for, like, a more, like, uh, hardware hacking stuff or, like, you're going to dump a flash, for instance. And there are, like, even more advanced techniques that I will briefly, like, uh, talk about. So, uh, how do you dump a flash? There is two ways, as I was mentioning just before. You can do in-circuit programming and, um, out-of-circuit. So in-circuit is cool because you don't have to, you know, like, remove stuff, break stuff. But there are a couple of issues with that. Um, the main idea is to read the flash you need to power the flash. And if you, if it's, like, still plugged into the whole system, uh, it, when you're, like, Raspberry Pi, for instance, going to try to read the flash, it's going to try to power, like, everything else that's connected to the flash. It's going to be the same, like, you know, bus line, uh, power line. And either, you know, your Raspberry Pi is not strong enough to power, like, a VOIP phone, which you would expect. And in that case, uh, it's just not going to work. Or maybe your Raspberry Pi is really strong and it's going to do it. But then the problem is the CPU starts booting and it's going to talk with the flash. And that's going also to mess up your stuff. So in that situation, you have, like, two choices. Usually, either you can try to, like, lift up the pin, the power pin, so that it doesn't happen. Or you can kind of go a little more like YOLO approach. Where, um. You want to keep the CPU in reset. So I've been successful with that many times where I just, like, start, like, trying to ground, like, random test points of stuff on the board, praying that it's not going to fry anything. And usually, at some points, like, I'm going to notice that, okay, when I do that, the phone, like, light up but doesn't boot. That's good. And maybe better ways, you can dis-order the chip with, like, the big, like, heat gun and whatnot. You have to be careful, though, because if you, like, pull it too hard, you might, like, bend pins and it's going to be, like, useless. Um. But a good trick to know is, like, you can make a little, like. Um. Tin foil hat or whatever, like, around the chip. So that, like, when you're heating up the chip, like, the stuff around it doesn't, like, get too hot. Um. So you don't accidentally, like, knock off, like, some, like, tiny, like, components that would be, like, a pain in the butt to, um, put back. And, uh. Bottom right is, like, I was. I was. I thought I would have to do that on the phone. So I wanted to practice first. And I just took, like, some random, uh, USB thumb drive and I tried. And actually that worked really nice. But the trick is to remember, like, also put some plugs because it helps. And, uh. Yeah. Just don't be careful with. When you pull it off. A few other tricks that actually didn't work on this one but are good to know. Uh. U-Boot is the most common bootloader. Uh. Not used here. But it's. You would find that on pretty much every other device. And the idea is you can also interrupt the boot process of that. And ask nicely U-Boot. Hey. Can you load the flash in memory? And then, uh. U-Boot is also able to dump in hex, like, in the screen, um. The memory. So this way you can just, like, write a little script to do that and recover everything on the flash. Which is really cool. But usually, like, dev don't like letting you do that. So they set, they lock that approach so you cannot, like, press space to interrupt the boot process. But there is a trick that I also call, like, the YOLO approach where, um, instead, when the idea is, like, U-Boot is going to load from the flash, like, the Linux kernel or something. But if while it's happening you start, like, poking with, you know, like, a, a wire that's connecting to ground. You start, like, poking the NAND flash, like, some of the pins. It's going to mess up, like, what's, uh, U-Boot is reading. And after a couple of tries, uh, U-Boot is going to be, like, damn. Uh. The kernel is fucked up. I don't know what to do. And it's going to give you, like, a shell. So that's really cool. But, yeah, as I said, that one wouldn't work on our phone, unfortunately. But, uh, just some cool example that I found online where, like, some guy actually did that. And, uh, I underline in, uh, in, like, purple on the bottom, like, the command you need to use to, like, load the, the, the flash in memory. And on the right side, this, like, little block of text is, um, sorry, is how, uh, U-Boot is panicking and be like, eh, I don't know how to do with your kernel. And give you the, the shell. So, um, how, um, so a few more, like, tricks for, um, dump, dumping a flash. So you can use JTAG. So usually you have, uh, if JTAG works, you're going to be able to, um, dump the RAM. So in this case, it wouldn't be really, like, dumping the flash. It would be more dumping the firmware. But in a lot of devices, it's going to load the whole stuff in memory. So if you can dump the memory, you are, you, you're the same. You're pretty good there. And kind of the last hope, but that's, that's one of my favorite about hardware hacking is you can do crazy, uh, stuff. Uh, an, an example is, uh, ScanLime, um, that person on the internet who, um, she had, um, a Wacom tablet that she wanted to dump the, um, the firmware off. And there was, like, no attack surface at all. But she realized that, like, when you, it was, like, USB stuff. So when you plug your USB, um, onto the laptop, there is some USB exchange that I don't know anything of. But it sends, like, USB descriptor. And if you, if you glitch the CPU just at that time, um, it's going to, like, you know, miss, like, a boundary check. And it's going to send way more data. And with that, uh, she was able to recover, like, the full RAM. Full flash. Uh, full memory or something. So it's really impressive. But, and that's what's kind of awesome about hardware hacking. Okay. So, uh, we recover the firmware, uh, in my case, just by downloading online. But what do we do now? We want to analyze it. Um, the best tool for that is called Binwalk. And it's just basically a magic dictionary that's going to, like, look at your binary blob of stuff and be like, hmm, halfway through it looks like there is a zip file. I'm going to try to extract it. It tries. Maybe it works. Maybe it doesn't. Depending if it was actually a zip file or not. And it does that for everything. And, uh, it might also work. You can also find, like, compressed file system, uh, such as, like, SquashFS, GFFS2, et cetera. And sometimes, like, your, um, your firmware file might just start with, like, health faders or just, like, random, like, ARM code that you could, like, look at. So I run Binwalk on the, so that's the firmware file I've downloaded from the website. And once again, it's easy mode. It's just a tor file. And they already, like, split it up into boot one, boot two, and GFFS2. So, like, Binwalk has nothing to do here, really. And I can just extract the whole file system. And that's cool. Because from there, I can look at what's on the phone just like that. Uh, but the more interesting use case for Binwalk is I took, like, a different, uh, firmware file for, like, uh, another Avaya phone. And this one is way more interesting because Binwalk find, like, a way more, a lot of stuff. And, uh, I've highlighted, like, you find the file system and is able to extract it. And there's also that random, like, MySQL stuff, which I think is a false positive. And you need to be aware that there will be a lot of false positives. So don't blindly trust what Binwalk says. And, uh, really, really funny stuff that I was looking at. Uh, if you run strings on that specific image, um, it will find, like, U-boot strings. So that phone is using U-boot. And the cool stuff I was describing before would actually work on that one. Look. So now that you have extracted the firmware file, what do you want to look for? One of the most, uh, interesting stuff is, uh, finding the U- update mechanism. So assuming you have, uh, encrypted firmware, like, if you reverse engineer that, you might find the keys and how to ex- to extract, like, subsequent, uh, firmware updates without having to do, like, any hardware stuff. And then you want to look for, like, secrets, like, uh, passwords, certificates, and so on and so forth. Uh, originally, my goal was to look at the main binaries. So that's the thing that deal with, like, the VIP stack, uh, that would make sense to look at that. And, um, also you want to look at the bootloader because it may have, like, hidden commands, explain why our console is not working, that kind of stuff. So remember, the point of all of that was I wanted to get a shell on the device. And, um, what's the process to do that? So the one I want to go for is, uh... I want to fix the serial console, you know, like, the dev null was not cool. Um, but also our approach would be, like, messing with U-boot arguments, um, not working here, obviously. Uh, but, you know, you can specify the console you want, and, uh, the init script can be marked as, like, oh, I want binbash as my init script, and then you have a console. Uh, and, like, kind of last resort stuff that I was considering as well is you could patch the firmware. Uh, in our case, the firmware is signed, so, uh, that won't work unless you try to glitch it, which is really hard. But you can also try to patch the file system. So the way binwalk extracts the gffs2 stuff, you could modify it and then, like, repack it and, uh, flash it directly onto the flash. And that's usually, like, a foolproof method, like, that would work in most cases. So instead, I'm going to, uh, reverse, uh, the bootloader, and, um, for that, um, because I wanted to understand, like, why dev null, uh, the console was set to dev null and stuff. I'm not going to cover ARM in much detail, and I would recommend you to check out Azaria Labs' tutorials that cover everything. But just useful here, um, there is this notion in ARM of literal pool, which is, um, inside the code section, you would find some little chunk of data, and that's usually, like, used to, like, load in registries, um, absolute addresses, immediate values, magic offset, that kind of stuff. And, uh, FYI, like, in case of function calls, um, the arguments are going to R0 to R3. The return value is R0, and when you, like, want to return from your call, it's, the return address is saved in, like, the LR register. That stands for, like, link register. Um, and the big trick, the big problem here is, um, we, like, trying to load the bootloader, so it's, uh, it's not really ELF. So if you try to import in IDA, IDA doesn't know what to do with it, and so you need to find the loading address for that stuff so it match what, where the phone is loading it. Couple of tricks, um, sometimes you're lucky and it's going to be printed on screen. That's our case. Sweet. Um, but otherwise, you want to look at, like, header file, headers in the, in the bootloader file, or maybe reset vectors. So that's stuff where, like. Specifically for ARM, like, the CPU needs to know, uh, specific addresses, where, like, there's, like, a reset, like, an interrupt happening, and it's, like, fairly, like, um, square, like, the, how it, that's being set up. So if you find that, and you find, like, what looks like an interrupt vector handle or something, you can find, like, oh, that must be the address. And, uh, finally, the literal pull I was mentioning, uh, really useful, because it's going to contain, like, absolute addresses or point to strings and stuff, so, uh, if, if, like, you have strings and they look, like, all fucked up, you probably got the wrong address. And, uh, Quark's lab wrote a blog post about it, so I would recommend you checking it out. So as I said, in our case, it was easy. Um, when it boots, it prints, uh, the jump, whatever, and that's actually why you should load it. And, um, on the bottom right side, it's, like, a bunch of, uh, strings, um, so it's a bunch of addresses that point to strings, uh, that's a snapshot from IDA. And, um, we can see that, um, it's, like, all the strings, like, print well, so that means that it's loaded properly, it's not, like, all messed up. Okay. So now that we have the boot loader and we can, like, work it with IDA, uh, we want to search for strings. Uh, we were looking at, you know, like, that sentence, like, EEPROM read successful, whatever. So we can use, like, cross-reference in IDA to find where the string is coming from and look at the function that handles that. And, uh, yeah, just as a FYI about, like, EEPROM and SPI, so the EEPROM that's on the board is called a SPI EEPROM, and SPI is just one of those protocol I was mentioning before. EEPROM is just, uh, like, a small memory, uh, whatever. And the SPI, uh, protocol is just, like, four wires, um, and the ID, the CPU is sending command, and the EEPROM, like, reply. And, uh, that's a dump from, like, using the logic analyzer to have a look at what it would look like in real life. Uh, that's the datasheet of the EEPROM, uh, that you can find online if you Google the, the label on it. Um, the cool thing is in, uh, bottom left, uh, of the slide, it tells you, like, the pin out, so you know how to connect stuff to it, and on the right side of the slide, um, it tells you which, uh, which opcodes are for, like, the co- uh, SPI com- SPI command you would send. Like, for instance, if you send, uh, three, it's going to be a re- a read, if you send two, it's going to be a write, so that's, uh, that's something useful to know, right? Oops, sorry. Back to the, um, back to the IDA and, uh, the bootloader, we can see, uh, the strings we were, like, looking for, and something extremely promising is we can see the, uh, console set to dev null, but above that is, like, a b- two other options, and it's actually saying, like, oh, setting console to, like, UART zero or UART one. I want these ones to be printed. Um, that's a, that's a function that actually does print that string, and, uh, what it does is roughly, uh, clean up, clear some bytes on the stack, and then read for me from, from a magic address, and it's going to compare, like, bytes, uh, that has just been read, and if we have the good value, it's going to actually print on the console, setting the console for, uh, the FTTY, uh, AM zero, so we want that to happen, uh, and something you can ask me is, like, well, how did you find that read EEPROM function, you know? And there are, like, multiple ways of doing that. Uh, the easy way that I've highlighted in green in that screenshot is, uh, on the bottom right, you can see some, like, logging that says, oh, EEPROM read fails, so I know that function is responsible for reading EEPROM. Uh, but maybe, maybe the firmware I'm going to look at is not, uh, as, uh, verbose, in which case, um, as I said before, like, to read from an EEPROM, you know, you have to send three over SPI, so if you see, like, SPI function and you see, like, sending three, you know what it is, and that's what I've highlighted in, um, yellow. Uh, but then, like, how do you find the SPI function? You know, it's kind of a problem. Uh, two ways for that, um, in my case, once again, it was logged, so it was easy, but usually, like, the main trick is, um, you have this, um, something called, uh, mapped, uh, I.O., a memory mapped I.O. It's this kind of, like, magic address values in the CPU that, like, if you write to them, it's actually going to send data over, like, UART or SPI or whatever. If you look here, uh, you can see, uh, you can see, uh, the key, you're going to have a data sheet for the CPU, and it specifies exactly what are those addresses. If you're unlucky, um, you have to guess, and that's really hard, and at that time, maybe you should, like, look for something else or just, you know, you're going to spend a lot of time on that. So we want to, uh, patch the EEPROM now so we can enable the console. The whole plan of action is we know the read-write commands, uh, we want to interface with the flash, so to do that, um, uh, sorry, the EEPROM, we, we, um, we need, like, a SPI, uh, device, and we've seen before the bus pirates is a perfect, uh, uh, uh, uh, uh, uh, uh, uh, uh, uh, candidate for that, and we need to connect to the chip. Uh, unfortunately, like, it's a really tiny one, and so, like, the clip I was showing are, like, too big for that. You can buy online some rigs that people make, um, it's, like, expensive, and it takes, like, five weeks to get them. So instead, I went kind of crazy, and I tried to solder, like, um, little wires onto the thing, and I was like, honestly, that's never going to work. But it happened to actually work, and that was, like, sweet, and it's all, like, looked, like, gross because it's, like, all the flux that remains on that. Um, and that's the code for the bus pirates. It's super, like, boilerplate. Uh, thing, and when you just write, um, this magic values that, uh, so, yeah, I was asked to, like, uh, replace them with, like, emojis, but, uh, the idea is, like, just after that you're greeted with, console is set to, uh, like, QR zero, and now we have a lot of more stuff, uh, printed on console, which is great. But, unfortunately, I get, like, this hurdle, like, the input are still, like, not working. I was, like, trying to press space or type, like, it's, like, asking for, oh, you want to look at root? What's, I type, nothing happens, like, ugh, what happens? Did I just cut the trace so you cannot send data? We have the boards, we can look at it. Um, so, uh, let's just, like, like, uh, zoom up on the thing, and at that time I was, like, you know, looking at the UART pad and start, like, with my multimeter, like, trying to beep out, like, where it goes. You know, it's following the continuity testing. And eventually it reached some wires, like, on the right side, and the wires are that little hole that connect one side of the board to the other. So, the trick is the actual, like, trace that connects the UART to whatever, uh, goes to the other side of the board and goes over, uh, to the other side of the board, um, back and forth, and it's, like, really, like, tedious. And eventually I kind of lost where it was going, but it was kind of under that, uh, mod port, uh, that's, like, the keyed, uh, LG45. Um, and so, um, remember, like, the recon side, uh, recon part? Um, we have that box, and it's, like, oh, damn, that's the thing. So, I kind of went for, like, my YOLO approach again, where, um, I was holding, like, I had a plug, like, a jumper cable in my, um, the transmitter of my FTDI cable. And, um, I, uh, I, uh, I, uh, I, uh, I, uh, I, uh, and, uh, so I had, like, this, like, wire that I could poke around. And on the other side, I was, like, pressing keys on the console, trying to see if something happened. And meanwhile, I was poking, like, to the pins one by one, and I think at the second one, it actually worked. And I got greeted by, uh, like, a wood shell on the device. So, that was cool. Um, but the trick was, um, the, on the right side, like, a proper setup, where I plugged my Ethernet cable into the plug. So, at that time, I didn't know what the keyed LG45 was, so I just, like, sanded the plastic of the Ethernet cable, so I could, like, shove it in. And, yeah, it just worked. So, that was nice. Uh, now that we have a wood shell, this is, like, uh, a lot of debug strings pre-printed on screen, and that's annoying. So, um, the trick, I was, like, I want to kill the process that's, like, that's, like, flooding my console. Uh, there's a watchdog that's going to reboot the device if that happens. So, I, uh, highlight in the corner, like, the magic commands that you can run to kill that. It's just, like, random Linux stuff. Uh, so now we can finally do some value research. Um, and really what you're doing to do is, like, look at process running, poke around, look at open ports. Uh, that's just, like, the, uh, the, the, uh, the bunch of processes. Uh, you see cool stuff, but, uh, that's when it started getting interesting. I think at some point I was tired of looking in IDA, and I was, like, I'm going to poke more. And I looked at DHClient, and, like, huh. And the really funny part is, like, I run DHClient, and I see this, like, 2007 copyright. I was, like, whoa, that's not a good thing. And if you just run DHClient by itself, it segfaults. I was, like, that's weird. And if you, like, run it the right way, they print a debug message that say, oh, we modified it to work it better on our device. And I was, like, huh, that's interesting. So, if we look back, uh, and we look for the specific version, it turns out that 10 years ago, actually, for DEF CON, uh, John Oberheit, um, released, like, an exploit for that specific version of DHClient. So, I was, like, whoa, that's, that's easy. Um, but we want to make sure that's actually still vulnerable. So, the, um, the one was, like, a dumb, like, um, stack overflow, like, while handling DHCP options. So, we can compare the original source code with the patch source code, because DHClient is open source. And just to keep in mind, there might be, like, mitigation, like, stack cookies, ASLR, whatnot. So, if we look at the vulnerable code on the left side, we can see a memcpy, like, highlighted in red, that's using, like, data.lane as a field, while on the patch version, they replaced that by 4. So, the idea is, like, this bug is, uh, subnet, it's a bug in the subnet mask handling, and the subnet mask should be, like, 4 bytes. But the way the DHCP option works is that it can send up to, like, 255 bytes, I think, and it used to just dump it, trust, whatever you were sending, which is bad. And if we look in IDA, and, like, there are actually, like, a bunch of, like, function, uh, we can see there is no stack canary, and the vulnerable, the, the, on the left, on the right side, it's, it's not using that magic 4, so it's, it's obviously, like, still vulnerable. So, it's time to exploit stuff. Um, working on the phone was tedious. I was, like, ah, I'm going to try to set up QEMU. Um, if you're not familiar with QEMU, it's going to do, like, emulation of ARM stuff, or, like, many other system, and can do either, like, user land, or, uh, full system. User land wouldn't work here, because, uh, DHCP is, uh, we're going to try to modify an IP and stuff, and that's not cool. Um, but, instead, we're going to try to, like, we can do a full system emulation, and, uh, those tutorials tell you how to, like, set up a cool image for that, and we just want to set up the network properly, uh, because we want to interfere with DHCP, and, naturally, um, the, um, QEMU stack would give you a DHCP for yourself, so you have to be, say, like, don't do that, and, yeah. So, I run it in DH, in QEMU, and, after, like, all this effort, and it's still stack fault. I was, like, huh. So, it turns out that, like, have I modified stuff that's actually causing the stack fault? And, um, I'm not going to cover that too fast, because I'm running, like, a little out of time, but, uh, basically, it's creating that weird socket. Uh, it's, like, a named socket, and, uh, so that, like, the main application that the VoIP stack can talk with the edge client and share options. Um, and, uh, yeah, it is, like, that's, like, the main application, and we can see what it does. That's not super interesting, but, basically, on the left side, it's, like, sending data to configure the edge client at startup, and on the right side, I re-implemented that in Python, and, uh, you can run that with, like, SoCat, um, and, uh, and, uh, you can, uh, so SoCat is just a kind of, like, netcat in, um, in more, like, uh, more tools, so you can create that named socket. And the idea, you run the Python script on the host, you run SoCat on the, um, the QMU, like, binary image, and that would just work. So now we can start debugging, uh, the edge client. Um, you can run GDB, we can try to, like, actually run the POC. Uh, the- I couldn't compile the original proof of concept, it was, like, using really old tools, and it's just- after, like, hal- like, a couple of hours, like, ah, fuck that, I'm tired. So, instead, uh, I use a SCAPI-based, uh, exploit. SCAPI is a Python library that lets you, like, you know, mess with, uh, network packets, like, at a fairly low level. And, um, so now we want to, like, reach the, um, vulnerable- vulnerable code. So, um, I was explaining the bug is in the, uh, subnet mask option, and the way DHCP works is, like, a tag length value, like, type of stuff. So you say, oh, this option is a, uh, subnet mask. Here's the length, here's the value. And, obviously, it was, like, it should be four, but if you send more, it's fine. But, uh, for the DHCP specs. And so we can use SCAPI for doing that. So, uh, that's my SCAPI, like, a chunk of my SCAPI script. And just the payload in purple is interesting. Um, basically, just sending the subnet mask option with, uh, data that would be, like, AAAA, BBBB, CCCC, and so on and so forth. So that, uh, when it crashes in GDB, uh, we can see, like, all the register we control, and we know, um, exactly, um, you know, if we want to affect which register, which chunk of the shellcode we need to change. And we can see that we actually controlling, uh, PC, so the program counter, so that's good. We know that we have, um, we can exploit, we have control, control for execution. And there, like, a few more details that I'm going to skip over, but, um, we need to scale, to craft a shellcode now. Uh, unfortunately, like, it looks like the stack is, uh, you cannot execute the stack, so we would have to warp it. And that's tedious. But, um, cool stuff is, like, if you look for, there is, like, a system call in that binary that I think also Avaya added. And we do control R4. So, if we put, uh, if we can put a string in memory, in an address we know that could be a valid, like, system command, and put the, the address in R4, we're good. Um, so, if you think about it, DHCP client, DH client, sorry, receive configuration values from the server. So, probably there is going to be stuff that are stored somewhere, and, um, it turns out that ASLR is disabled. Sorry, I forgot to mention that. Uh, but then we, the idea is, like, I just, I started sending, like, AAAAs as, like, a bunch of, uh, options, and look at memory to see if I could find that string somewhere. And eventually, eventually the domain option was a good one. And so, um, now I can show you, uh, a cool demo that's how I happen when you actually run the whole stuff. So, uh, on the, um, on the left side we have the phone that's booting. Can I loop? The phone is booting, and the window, uh, the terminal window is, like, on the left side is a rogue DHCP client running on payload. And on the right side is, um, it's a web server that, uh, will, uh, provide, like, uh, post exploitation kind of stuff. So, we can see the packet is running. To make sure it works, I was, like, cutting, uh, dev random on the, uh, on the screen. So, that's why it looks like noise. It's fetching data from the, um, web server. And I don't know if you can see, but it's loading, like, steve.data. Uh, FYI, like, Steve is actually my, uh, boss. That's him. And, uh, just then, I'm, uh, still, like, ex- I don't know if there's sound, but I'm exfiltrating audio from the main speaker. And you can see it in VLC that when I'm speaking and clapping my hands, it's actually, like, reading the audio on the attacker laptop. So, that's pretty scary because you can turn your, um, phone into, um, you know, listening device. Thank you. So, um, yeah. And just FYI, like, all the tools I use are, like, actually already on the phone. Like, you're, like, Netcat. You're, like, stuff to, like, dump the audio to, like, SDD in. So, you- it's just, like, writing some shell script. Like, bash script, whatever. So, um, as a conclusion, uh, for mitigation, like, you want to make sure you monitor your network so that you don't have, like, punks, like, sending, uh, you know, like, weird DHCP packets. And, uh, actually, like, McAfee, uh, firewall, like, can detect that, uh, FYI. You want to segregate your network, um, to make sure that, for instance, the coffee pot is not able to, like, send weird DHCP packets to your phone. And make sure IT actually patch your phone because, you know, it- it's- the patch got released, like, Avaya released the patch, like, a month ago. So, make sure you want to think about why this kind of bug happened. Like, technical debt is really hard to handle. And, you know, probably, like, someone had, like, in good faith, um, okay, um, someone in good faith, um, forked the stuff and they forget about it. So, um, and just as a really quick, um, embedded systems are not black boxes. So, I would just encourage everyone to, um, look at them. And, uh, you can do it now as well. So, if you have questions, uh, ask me on Twitter or whatever. And thank you for your time, guys. Thank you.