Good afternoon, ladies, gentlemen, and hackers all around. We are very, very excited to be here with you today. We're excited to share what we've done this year. The light's a little bright, so I can't see you, but I'm trusting that there's people out there. So as always, keep your hands and feet inside of the vehicles at all times and enjoy the ride. We're excited. Okay, so this is what we're going to go over today. What I really want to point out is the link at the bottom. It is a GitHub link. If you would like to follow along, see more details, actual code, and the firmware of what we've gone through, you can go ahead. We published it about 30 minutes ago, so you can go in and follow through. Or if you would just like to listen to the talk, follow along, and then maybe view it at the end, there is a QR code that we have that you can scan. I promise you it's not a rickroll. It'll just give you this GitHub link. Okay, first we'll do some introductions. My name is Justin Applegate. I am a rising graduate student at Brigham Young University. I am an avid CTF-er. I play for Project Sekai and the U.S. Cyber Team. I am Ava Peterson. I'm also an undergraduate student at BYU, and I go by the handle DeltaBlueJay. And I am Justin Mott. I am also a graduate student at BYU, and I go by the handle Kester Burris. Thank you. Yes, I go by LegoClones, if you see me around. The last member of our team for this project, his name is Wyatt Pangirl. He goes by SpoutingWhale. He just graduated from BYU. He was not able to make it today, but he was an invaluable member of our team. So let's just go over the project real quick. But first, I want to present to you the router graveyard. We managed to break not one, but two, but three routers along the way of this journey. We really wanted to apply some CTF skills to a real-life situation, so we picked a router, a device, and tried to hike into it. So we formed our team. We picked a timeline of about a semester long project and saw what we could get from there. So the device we picked was this Vylo router a home mesh Wi-Fi device. So as any vulnerability researcher or security researcher does, when you first start against a new target, you want to do reconnaissance. You want to OSINT. You want to figure out what has been done before so I don't have to reinvent the wheel. So this is some of the results of what we went through. Vylo Living is the company that produced the routers that we went after. They were a startup founded in 2021, so they're pretty new, pretty recent, and they only have two products as of today. They are both mesh routers. One supports Wi-Fi 5, the other Wi-Fi 6. We searched for CVEs that have been released, any sort of technical deep dive or breakdown, or even a consumer review that might go into some of the features a little bit, and we didn't find anything. So between the fact that it's a new company, the fact that we didn't see anything, any other research that had been done before, and it was pretty cheap. It was one of the cheapest routers that we could find on Amazon. We were thinking, all right, this is perfect for some college students to get our feet wet, get involved, find some CVEs, just get used to the router hacking scene. A couple of notes, I know a lot of routers, especially the older ones, are administered through a web interface. You connect to the LAN or to the WAN, you type in 192.168.1.1 in your browser, it pops up, that's how you set it up. This was not the case with us and with this router. It was all managed through an app on your phone. Kind of a new age thing. They said they have a bug bounty program. When we did some research, in order to access the bug bounty program, you had to sign an NDA and be a part of their beta testing group, which we didn't know what the NDA looked like, so we reached out and said, hey, we want to join the beta testing group, can you send us the NDA, and they just never got back to us. So we were like, well, I guess we'll just risk it for the biscuit, go for it anyway, see what we find. And last thing, the firmware was not released by the vendor, it's not something that we could just download and go through, we had to go ahead and recover that ourselves. This led to the three main goals for us today. First was to acquire the firmware, that way it's a white box test and not a black box test, you can see the code, it makes it a lot easier to actually turn memory corruption vulnerabilities into exploits. Then we wanted to pop a shell, actually get a shell on the device that makes debugging and extracting the latest version of the firmware much easier. And our third goal was to find as many pre-authentication remote code execution vulnerabilities as we could. That's kind of the holy grail, anyone that does not have administrator access to this router that can run whatever code that they want on it. So those were the goals that we had when we approached it. So obviously the next step was to start enumerating our attack surface. So we went and disassembled the router and this is what we ended up with. And we found some UART pins, so we tried to solder to them and that was the death of router number one. You may be gone but it will live forever on in our hearts. The second router had better pins that were easy to solder to. So then we hooked it up, got a Linux log on screen. The problem is we didn't know the password and it wasn't an easy one. And the UART interface died after 30 seconds after boot. And it was really hard to even try to put in a password because it printed out how much time you had left every second. As a result, there was no free shell from this interface. So we moved on. We went to go and look at the Vilo app. We pulled the APK from Google Play. And apparently the other members of our team think that mobile rev sucks. I thought it was a great time. We found some Firebase info, various cloud service stuff on the app. But the biggest important thing that we found was a custom service running on TCP port 5432. This was used for app to router interactions when the router had not yet gotten internet access. This was used to do all that set up. It would spin this up. They would talk to each other over this. They had a custom protocol that we reverse engineered to learn how that was working. Next slide. So this is kind of the overview. It had a 15 byte header and a payload. The header had all the fields that you see there. Not all op codes had payloads, but many did. And they were usually encrypted using this weird XXT plus custom obfuscation layer random things. Basically the app had a hard coded key that obfuscated and sent to the router. The router encrypted a new key and sent it back. But it was all reversible. So we were able to go from the hard coded key and generate our own ones to be able to talk to it. Which made it really easy to start once we were able to get the source for it, start sending messages back and forth and exploit some of our some of the things we found. So then we needed still needed to get the firmware off of it. We saw that there was a flash memory chip of the model on the slide. We tried some software utilities and they only gave us bad data. So then we got this Salie logic analyzer and then it just worked. We just hooked it up, we fired up their software, we turned the router on, we got all of the SPI data straight to their software and then we could just decode it and there was the binary and we extracted the firmware and then we had everything that was on the router just like that. We spent about a month getting to this point trying all sorts of different stuff and like literally it took us about two hours and then we had everything on it the moment we plugged this in. So this is just a look at what that SPI data looked like in the software. It was super easy once we had it. We have a more technical deep dive on exactly what that is and the Python scripts we use to translate this into the binary on the GitHub. Yep, so check out the GitHub if you want to see more about how that's done. At this point we had the firmware, we had accomplished goal number one, now we wanted to look for vulnerabilities and establish a shell. So before you start looking for vulnerabilities it's usually a good idea to figure out how to emulate the firmware on your own machine. This specific device had a 32-bit little endian MIPS processor so that's what all the the binaries were compiled to be using. Most of us have x86 or even ARM machines and so that's not something that we can run natively so we decided to use QEMU which was statically compiled along with chroot and some precise GDB breakpoints that we had figured out after some reverse engineering in Ghidra in order to actually emulate the firmware and get it running on one of our machines. This makes it significantly easier to fuzz for vulnerabilities, to test things out, to create exploits once you find a vulnerability. In addition we wanted the ability to compile our own executables that we can place on the device and run them because a lot of these embedded devices do not have the executables that you would like to have on there, for example Netcat or whatnot. This one didn't even have WhoAmI and so we wanted to be able to create our own stuff. Now this device used UCLibc as its libc library. UCLibc was actually pretty much discontinued or unmaintained since 2012 and so someone created a fork called it UCLibc-NG or next generation and so that is what we used along with Buildroot to build a toolchain so that we could compile our own executables. It worked for the most part, not all the time. The Bindshell that we had created and used for one of our exploits worked just fine. We were able to compile GDB server but every time we tried to connect to it remotely it kept segfaulting. It could be because we're using UCLibc-NG. It could just be a skill issue on our part. I'm not sure. Something happened there. This is what it looks like when you actually have it emulated. So like I said we're using chroot to mount the file system so that the executable can find the libraries that it's looking for at the hardcoded path that it has. Then we have a statically compiled QEMU which runs it. Now you can see a "-g1234". If you're not super familiar with QEMU or GDB, this opens up a remote debugging session on the local port 1234. Which means on a separate terminal than what you see here, you can open up GDB server or GDB multi-arch and then connect to that local port and now you're running the firmware here but you can debug it with your own GDB setup in another terminal. And then because this one opens up a socket and expects communication, you have to open up a third terminal to actually send data to this service. We got all that figured out. Again more details are in the GitHub repo if you would like to see how that's done. At this point we spent about a month and a half, approximately six weeks, looking for vulnerabilities in the VILO routers. Like we said the holy grail is pre-authentication RCE. We found nine vulnerabilities total in the the four months that we had for this project. Six of them were critical and three of them were medium. Out of those six critical vulnerabilities, four of them were pre-authentication buffer overflow vulnerabilities. Now we had only figured out how to exploit one of them because three of them were on a version of the firmware that had canaries enabled for that and so we weren't actually able to overwrite the instruction pointer and execute our own code, except for one of them we were able to. And while we were working on trying to develop exploits, see if we can get past these mitigations, we accidentally discovered a blind authenticated command injection. Now we're going to go over three specific vulnerabilities, the ones we found most entertaining for you guys today. I also want to note most of these bugs are present in the service, the custom service running on port 5432 that we talked a little bit about. These are the vulnerabilities up here. So you can see the four buffer overflows are at the top. They're all 9.6 criticals. There was an info leak and some lack of authentication. We have reserved CVE numbers through MITRE. They're not published yet since we just published our public repo earlier today, but we have reserved the numbers and they're in the same order that you see up here. Okay, the first vulnerability that I want to talk about today is the lack of authentication in this custom service. So as my team member said, most of the communications from the app to the router went through AWS, except if you're not connected to the internet, you need some way to set it up. So that goes through this service. The thing is, because it has hard-coded keys and there's really no authentication inside of it, anyone that is on the LAN and knows how to speak this protocol can control the router, pretty much. So anything that you can do, they can do. For example, you invite a friend over, give them the Wi-Fi password, they're now on the Wi-Fi, they can control the router the same way that you can. They can see and change your SSID, your password, PPPoE, username and password, they can reboot it, they can even exploit all of these vulnerabilities. That was very useful for us because then a lot of the buffer overflows that we found became unauthenticated RCE vulnerabilities and not authenticated RCE vulnerabilities. The other important thing to note is while this service was used for initial setup when the router didn't have internet access, it stayed up the whole time that the router was on, even if it did. So it was just always available no matter what. So we first found the first buffer overflow in this local app set router token function. We talked about how there are different messages that are differentiated by opcodes. So the opcode 0x3e updates a token and a time zone using an encrypted JSON object. Encryption coming from this weird XXT and obfuscation that we talked about. If you are familiar with C and memory corruption, you'll see this sscanf function immediately will stand out to you because it takes the token and pulls it into a fixed length buffer token, but it doesn't check the length of the string. So if token is, for example, only 16 bytes and you send a token that is 20 bytes, you now have a four byte overflow. Pretty obvious. So our next goal was, how can we actually exploit this? We don't want to just say, oh, this is a vulnerability. We want to prove impact. Plus it's kind of fun doing this. For mitigations, pi and canaries were disabled. Or at least that's what we thought. We had later learned that in the latest version of the firmware, canaries were enabled and this ended up not being exploitable, but we didn't know that we were dealing with an older version of the firmware. It was the newest one that we could get our hands on, but it still wasn't the latest one. So we were trying to figure out, how can we exploit this? We just have a generic buffer overflow vulnerability. If you're into binary exploitation, ROP probably comes to mind. ROP is a little bit difficult in MIPS because it doesn't have a return instruction. Yeah, you can still kind of get it, but it makes it significantly more difficult. As a side note, based off of what we had to do here, I decided to make a CTF challenge with very, very similar conditions that I wrote myself. We released it as a part of BYU CTF 2024. If you would like to do that yourself, give yourself a challenge, you can look it up. It's available on GitHub. So how do we exploit this? Well, we wanted to find kind of a one-shot gadget where we could just return there and then it would do everything for us and we didn't have to chain multiple gadgets together. Because of the overflow, we could control the RA register or the return address register and the S8 register, which is pretty much the stack pointer. So we figured if we can control S8 and point it to a user-controlled bash command and then set the instruction pointer to go to this gadget, win, right? You profit. ASLR is enabled, so we can't use stack values. But because PI is disabled, we know where all the global variables are. So we started looking through to see what global variables can we control that we can easily put our own command inside of it. So us being the intelligent people that we are, decided to put a semicolon reboot semicolon in there. We ran it and nothing happened. So we rebooted it just to make sure that we hadn't messed anything up and we ended up messing something up by doing that. The router just kept rebooting and it never actually got online. Turns out there's an authenticated command injection vulnerability that Ava will now go over. So after we found our accidental command injection vulnerability, we went back to find the code that was responsible for this. So we ended up finding it in the sysconf binary, which is run on boot. So as you can see here, it formats a UDHCPC bash command with several variables, including the router host name. And then it pipes that directly into the system function. And so because we can control the router host name through the viral app, we can get arbitrary RCE by just setting that host name to a bash command. So we can verify that this command actually has been run by looking at the boot output, which you can see here on the right. You can see the output of that command right there. We got this output from the UR interface that we had connected to initially. So there are a few limitations with this exploit, namely that the injected command is run only once on booting the router, as well as that the router host name is limited to a length of 30 characters. So as a result, we had to write our payload into several 30-byte sections, which what we ended up doing with that is write a script to the slash folly directory, which is one of the few directories that is both writable and persistent on the router. And so we wrote a script that itself then downloads a longer script from the using wget and runs that. Now, we also found that the router does not have an internet connection at the time of running the injected command. So we had to make our script or our payload wait 20 seconds before running our first script. So after we wrote our first payload, it then downloads and executes a second payload, which itself then downloads and executes a compiled cbind shell, which we can connect to via netcat. And so through this bind shell, we were able to gain our first shell on the router. So as you can see here, we're able to netcat into the router and find that we have gained a shell as the root user. Okay, so once April had come around, we had reached our four months, it was the end of the semester, we had to wrap up the project and we decided, you know, let's reach out to the vendor, try and get in contact, send them the details for the vulnerabilities, let's see if we can get this patched. It was actually pretty much like it was a pretty big pain to get in contact with them. They had an email address listed in their terms of service, but it didn't exist, it just bounced back. We reached out to a couple other email addresses on their website, we tried to guess the email addresses, none of that worked. We reached out over social media, they have YouTube, they have I think Facebook, maybe an Instagram, we didn't hear back from that. We filed a couple support tickets and eventually we got a response from them. They put us in contact with the actual developers and the developers said, hey, thank you for sending us this, we'll take a look at it, we'll get back to you on it. This is the overall timeline of what we did, so we started the project in January, we finished it up in early April, we reached out to them, and it took us a month before we actually got in contact, and we said, hey, here are the details for these nine vulnerabilities, we are giving you a 90-day deadline, we are happy to help if you have any questions, if you want us to elaborate, et cetera. We followed up a month later, didn't hear anything, followed up two weeks after that, we didn't hear anything, and as we had told them, we went ahead and filed CVE numbers from MITRE, we followed up two weeks later, and they said, we're working on it, we'll publish something pretty soon here, we'll get it out to you. So the 90-day disclosure deadline was a couple days ago, we timed this for our talk today, and the vendors actually reached out to us like the day before we left here for DEF CON and said, hey, we've pushed a new firmware update, can you check that, and we said, yes, just not right now. We haven't looked at it yet, we'll take a look at that there, but they have been somewhat responsive after we finally got in contact with them. Just a quick conclusion, we expected it to be a lot easier to get started, to get the firmware to find the initial vulnerability and get that initial root shell, it took us two months to get to that point, so we were a little surprised about that, that's also probably attributed to the lack of experience on our part, but then once we got in and we got the firmware, we were able to find a lot of bugs and not a lot of time, and we only looked at a very, very small portion of the attack surface, there is still a lot more space for bugs. If that's something that you're interested in looking for, go to the GitHub repo, you'll notice that there are holes in the documentation that we just didn't have time to fill in, and we've hacked into a couple other devices since then, and we found that the cheaper, lower quality devices, hacking them is very, very similar. IoT and embedded products still have a long, long way to go when it comes to security. So this is the QR code, if you want to go ahead and go to the GitHub repo and look at the details, if you would like to connect with us on LinkedIn, we also have our links up here, what time are we at? 53. Are there any questions? Yes. Yeah, feel free, come on up. I did not expect that. Sorry, can you repeat that? He said, like, what method do we use to find the vulnerabilities? Okay, so the question was, what method did you use to find the vulnerabilities? Was it fuzzing? Was it manual code analysis? We did not use any fuzzing. Fuzzing is a little bit more difficult, it's not impossible, but it's a little bit more difficult when you have a closed source binary. Normally you would compile source code with some sort of sanitizer and then fuzz it from there, but because it was closed source, and it was MIPS, and we're not super experienced with fuzzing, we went the manual route. So we just searched through the code by hand in Ghidra, decompiling it to find it. Thank you. Other questions? Going once, going twice. Yes, right here. Yeah, feel free to come up. And if you could speak that protocol, you could do basically any router administration. Could you not set the hostname of the router from there and trigger a reboot and make that authenticated hostname injection, hostname command injection to an unauthenticated injection because there's no credentials from that path? Perfect. So the question was, like, since that... how would you say that? Since the local service is unauthenticated, the question was about, can we use that to turn the router hostname injection to an unauthenticated command injection? I think the answer to that is no, kind of. At least not that we know of. Not that we know of, because the router hostname, the process of setting that actually goes through AWS. And so that was one area that we didn't have a lot of time to explore. There are some keys associated with logging into that AWS service, which it's possible that those itself are vulnerable in some way, but simply having access to the local service is not enough to set the router hostname. Yeah, so a large part of the mobile app was just dealing with the AWS API. We didn't have a whole lot of time to go through that. So it may be possible, but from what we had seen, we could only do that if you were authenticated, if you already had the app set up with the router. Thank you. I think we got one back there. So the question was, for someone who is new to hardware hacking and new to vulnerability research, do you think following these steps would be good to learn some hardware hacking and do you think springboarding off of the research that we've done would be a good way to get started? First off, I'm still kind of a noob, so I don't know that I have the best advice, but I would say this is something that you definitely can do for hardware hacking. This was kind of my first exposure to it. And I learned a lot. There's a lot of resources out there. DEF CON has their hardware hacking village. I think reproducing these steps and going through it would be very, very helpful. We do have some extensive write-ups specifically on the hardware part. We spent more time documenting that because it was newer for us, so hopefully it's helpful. As for finding CVEs, if you want to find CVEs and IoT devices, this is probably the easiest way to do it. It does take a little bit of knowledge when it comes to memory corruption and whatnot, but if you have an introduction to C and assembly and memory corruption and you want to find your own, it's just a matter of looking through the code. There is just so much code that we haven't even gone through. So I would absolutely recommend that. Yes. Any other questions? Yes. Okay, so the question is, how do you get future firmware updates? So this is kind of a tricky question. We looked into it a little bit. Initially, there was an API endpoint, just an HTTP web server, where you were able to say, hey, what is the latest firmware? Can you give me a link to it? The thing is, it didn't actually give you the latest firmware. We talked about one of the buffer overflows that we tried to exploit that did not have stack canaries. We thought that was the latest firmware version because we got it from that endpoint pretty early on in the process. But the actual device had later firmware that I think it gets through the AWS IoT. It uses encrypted MQTT communications, and so somehow it gets the update from that. We have not fully reverse engineered that process. We don't know how it is, but it is somewhere within the AWS MQTT sort of set up in there. Other questions? Going once. Going twice. All right. Thank you for coming to our talk. We appreciate it.