start	end	text
540	6680	Good afternoon, ladies, gentlemen, and hackers all around. We are very, very excited to be here with
6680	12140	you today. We're excited to share what we've done this year. The light's a little bright,
12140	17660	so I can't see you, but I'm trusting that there's people out there. So as always,
17660	23520	keep your hands and feet inside of the vehicles at all times and enjoy the ride. We're excited.
25480	29780	Okay, so this is what we're going to go over today. What I really want to point
29780	35180	out is the link at the bottom. It is a GitHub link. If you would like to follow along,
35180	40260	see more details, actual code, and the firmware of what we've gone through,
40260	44540	you can go ahead. We published it about 30 minutes ago, so you can go in and follow through.
44600	49080	Or if you would just like to listen to the talk, follow along, and then maybe view it at the end,
49080	54280	there is a QR code that we have that you can scan. I promise you it's not a rickroll.
54440	56340	It'll just give you this GitHub link.
58460	64000	Okay, first we'll do some introductions. My name is Justin Applegate. I am a rising graduate
64000	70020	student at Brigham Young University. I am an avid CTF-er. I play for Project Sekai and the U.S.
70020	76580	Cyber Team. I am Ava Peterson. I'm also an undergraduate student at BYU, and I go by the
76580	83800	handle DeltaBlueJay. And I am Justin Mott. I am also a graduate student at BYU, and I go by the
83800	90100	handle Kester Burris. Thank you. Yes, I go by LegoClones, if you see me around. The last member
90100	95740	of our team for this project, his name is Wyatt Pangirl. He goes by SpoutingWhale. He just
95740	101100	graduated from BYU. He was not able to make it today, but he was an invaluable member of our
101100	108500	team. So let's just go over the project real quick. But first, I want to present to you the
108500	113960	router graveyard. We managed to break not one, but two, but three routers along the way of this
113960	121560	journey. We really wanted to apply some CTF skills to a real-life situation, so we picked a router,
122420	128200	a device, and tried to hike into it. So we formed our team. We picked a timeline of about a semester
128200	134400	long project and saw what we could get from there. So the device we picked was this Vylo router
134840	144120	a home mesh Wi-Fi device. So as any vulnerability researcher or security researcher does, when you
144120	149180	first start against a new target, you want to do reconnaissance. You want to OSINT. You want to
149180	155000	figure out what has been done before so I don't have to reinvent the wheel. So this is some of
155000	160520	the results of what we went through. Vylo Living is the company that produced the routers that we
160520	166960	went after. They were a startup founded in 2021, so they're pretty new, pretty recent, and they only
166960	173380	have two products as of today. They are both mesh routers. One supports Wi-Fi 5, the other Wi-Fi 6.
173380	178460	We searched for CVEs that have been released, any sort of technical deep dive or breakdown,
178460	182340	or even a consumer review that might go into some of the features a little bit,
182340	187600	and we didn't find anything. So between the fact that it's a new company, the fact that we didn't
187600	192740	see anything, any other research that had been done before, and it was pretty cheap. It was one
192740	197020	of the cheapest routers that we could find on Amazon. We were thinking, all right, this is
197020	202380	perfect for some college students to get our feet wet, get involved, find some CVEs, just get used
202380	208300	to the router hacking scene. A couple of notes, I know a lot of routers, especially the older ones,
208300	214500	are administered through a web interface. You connect to the LAN or to the WAN, you type in
214500	221020	192.168.1.1 in your browser, it pops up, that's how you set it up. This was not the case with us
221020	225960	and with this router. It was all managed through an app on your phone. Kind of a new age thing.
226240	231500	They said they have a bug bounty program. When we did some research, in order to access the bug
231500	238000	bounty program, you had to sign an NDA and be a part of their beta testing group, which we didn't
238000	241860	know what the NDA looked like, so we reached out and said, hey, we want to join the beta testing
241860	246340	group, can you send us the NDA, and they just never got back to us. So we were like, well, I guess we'll
246340	251360	just risk it for the biscuit, go for it anyway, see what we find. And last thing, the firmware was not
251360	255200	released by the vendor, it's not something that we could just download and go through, we had to go
255200	263280	ahead and recover that ourselves. This led to the three main goals for us today. First was to acquire
263280	268640	the firmware, that way it's a white box test and not a black box test, you can see the code, it
268640	274000	makes it a lot easier to actually turn memory corruption vulnerabilities into exploits. Then we
274000	279300	wanted to pop a shell, actually get a shell on the device that makes debugging and extracting the
279300	285660	latest version of the firmware much easier. And our third goal was to find as many pre-authentication
285660	291580	remote code execution vulnerabilities as we could. That's kind of the holy grail, anyone that does
291580	296680	not have administrator access to this router that can run whatever code that they want on it. So
296680	302200	those were the goals that we had when we approached it. So obviously the next step was to start
302200	308860	enumerating our attack surface. So we went and disassembled the router and this is what we ended
308860	315120	up with. And we found some UART pins, so we tried to solder to them and that was the death of router
315120	324060	number one. You may be gone but it will live forever on in our hearts. The second router had
324060	331700	better pins that were easy to solder to. So then we hooked it up, got a Linux log on screen. The
331700	336620	problem is we didn't know the password and it wasn't an easy one. And the UART interface died
336620	341400	after 30 seconds after boot. And it was really hard to even try to put in a password because it
341400	348660	printed out how much time you had left every second. As a result, there was no free shell from
348660	355740	this interface. So we moved on. We went to go and look at the Vilo app. We pulled the APK from
355740	363200	Google Play. And apparently the other members of our team think that mobile rev sucks. I thought it
363200	371540	was a great time. We found some Firebase info, various cloud service stuff on the app. But the
371540	379000	biggest important thing that we found was a custom service running on TCP port 5432. This was
379000	387460	used for app to router interactions when the router had not yet gotten internet access. This was
387460	391520	used to do all that set up. It would spin this up. They would talk to each other over this. They had
391660	400540	a custom protocol that we reverse engineered to learn how that was working. Next slide. So this is
400540	407800	kind of the overview. It had a 15 byte header and a payload. The header had all the fields that you
407800	414080	see there. Not all op codes had payloads, but many did. And they were usually encrypted using this
414080	422380	weird XXT plus custom obfuscation layer random things. Basically the app had a hard coded key
422380	427380	that obfuscated and sent to the router. The router encrypted a new key and sent it back. But it was
427380	433440	all reversible. So we were able to go from the hard coded key and generate our own ones to be able to
433440	441540	talk to it. Which made it really easy to start once we were able to get the source for it, start
441540	451520	sending messages back and forth and exploit some of our some of the things we found. So then we
451520	457000	needed still needed to get the firmware off of it. We saw that there was a flash memory chip of the
457000	464380	model on the slide. We tried some software utilities and they only gave us bad data. So then we got this
464380	471060	Salie logic analyzer and then it just worked. We just hooked it up, we fired up their software, we
471060	476780	turned the router on, we got all of the SPI data straight to their software and then we could just
476780	481380	decode it and there was the binary and we extracted the firmware and then we had everything that was
481380	486860	on the router just like that. We spent about a month getting to this point trying all sorts of
486860	491380	different stuff and like literally it took us about two hours and then we had everything on it
491380	500080	the moment we plugged this in. So this is just a look at what that SPI data looked like in the
500080	506360	software. It was super easy once we had it. We have a more technical deep dive on exactly what
506360	513520	that is and the Python scripts we use to translate this into the binary on the GitHub. Yep, so check
513520	518820	out the GitHub if you want to see more about how that's done. At this point we had the firmware, we
518820	524600	had accomplished goal number one, now we wanted to look for vulnerabilities and establish a shell.
524600	529500	So before you start looking for vulnerabilities it's usually a good idea to figure out how to
529500	537140	emulate the firmware on your own machine. This specific device had a 32-bit little endian MIPS
537140	543180	processor so that's what all the the binaries were compiled to be using. Most of us have x86
543180	547820	or even ARM machines and so that's not something that we can run natively so we decided to use
547820	554320	QEMU which was statically compiled along with chroot and some precise GDB breakpoints that we
554320	559400	had figured out after some reverse engineering in Ghidra in order to actually emulate the firmware
559400	564560	and get it running on one of our machines. This makes it significantly easier to fuzz for
564560	571320	vulnerabilities, to test things out, to create exploits once you find a vulnerability. In addition
571320	576780	we wanted the ability to compile our own executables that we can place on the device
576780	581500	and run them because a lot of these embedded devices do not have the executables that you
581500	586940	would like to have on there, for example Netcat or whatnot. This one didn't even have WhoAmI
587480	594100	and so we wanted to be able to create our own stuff. Now this device used UCLibc as its libc
594100	600220	library. UCLibc was actually pretty much discontinued or unmaintained since 2012
600220	607560	and so someone created a fork called it UCLibc-NG or next generation and so that is what we used
607560	612760	along with Buildroot to build a toolchain so that we could compile our own executables. It worked
613340	618240	for the most part, not all the time. The Bindshell that we had created and used for
618240	623900	one of our exploits worked just fine. We were able to compile GDB server but every time we
623900	629120	tried to connect to it remotely it kept segfaulting. It could be because we're using
629120	634680	UCLibc-NG. It could just be a skill issue on our part. I'm not sure. Something happened there.
635480	640960	This is what it looks like when you actually have it emulated. So like I said we're using chroot
640960	647100	to mount the file system so that the executable can find the libraries that it's looking for
647100	652860	at the hardcoded path that it has. Then we have a statically compiled QEMU which runs it.
652860	658360	Now you can see a "-g1234". If you're not super familiar with QEMU or GDB,
658360	665360	this opens up a remote debugging session on the local port 1234. Which means on a separate
665360	672540	terminal than what you see here, you can open up GDB server or GDB multi-arch and then connect
672540	677920	to that local port and now you're running the firmware here but you can debug it with your
677920	683180	own GDB setup in another terminal. And then because this one opens up a socket and expects
683180	689060	communication, you have to open up a third terminal to actually send data to this service.
689060	692860	We got all that figured out. Again more details are in the GitHub repo if you would like to see
692860	699960	how that's done. At this point we spent about a month and a half, approximately six weeks,
699960	705300	looking for vulnerabilities in the VILO routers. Like we said the holy grail is pre-authentication
705300	711540	RCE. We found nine vulnerabilities total in the the four months that we had for this project.
711540	716620	Six of them were critical and three of them were medium. Out of those six critical vulnerabilities,
716620	721520	four of them were pre-authentication buffer overflow vulnerabilities. Now we had only
721520	726960	figured out how to exploit one of them because three of them were on a version of the firmware
726960	732600	that had canaries enabled for that and so we weren't actually able to overwrite the instruction
732600	739220	pointer and execute our own code, except for one of them we were able to. And while we were working
739220	744800	on trying to develop exploits, see if we can get past these mitigations, we accidentally discovered
745000	750100	a blind authenticated command injection. Now we're going to go over three specific vulnerabilities,
750100	755500	the ones we found most entertaining for you guys today. I also want to note most of these bugs are
755500	761300	present in the service, the custom service running on port 5432 that we talked a little bit about.
762360	766820	These are the vulnerabilities up here. So you can see the four buffer overflows are at the top.
766820	771400	They're all 9.6 criticals. There was an info leak and some lack of authentication.
771680	776100	We have reserved CVE numbers through MITRE. They're not published yet since we just published
776100	781200	our public repo earlier today, but we have reserved the numbers and they're in the same order that you
781200	788840	see up here. Okay, the first vulnerability that I want to talk about today is the lack of authentication
788840	794980	in this custom service. So as my team member said, most of the communications from the app
794980	801340	to the router went through AWS, except if you're not connected to the internet,
801340	805900	you need some way to set it up. So that goes through this service. The thing is,
805900	809840	because it has hard-coded keys and there's really no authentication inside of it,
809840	817260	anyone that is on the LAN and knows how to speak this protocol can control the router,
817260	821600	pretty much. So anything that you can do, they can do. For example, you invite a friend over,
821600	826140	give them the Wi-Fi password, they're now on the Wi-Fi, they can control the router the same way
826140	831960	that you can. They can see and change your SSID, your password, PPPoE, username and password,
831960	836600	they can reboot it, they can even exploit all of these vulnerabilities. That was very useful
836600	842740	for us because then a lot of the buffer overflows that we found became unauthenticated RCE
842740	847380	vulnerabilities and not authenticated RCE vulnerabilities. The other important thing to
847380	853700	note is while this service was used for initial setup when the router didn't have internet access,
853700	859300	it stayed up the whole time that the router was on, even if it did. So it was just always
859300	866640	available no matter what. So we first found the first buffer overflow in this local app set router
866640	871720	token function. We talked about how there are different messages that are differentiated by
871720	879720	opcodes. So the opcode 0x3e updates a token and a time zone using an encrypted JSON object.
879720	883860	Encryption coming from this weird XXT and obfuscation that we talked about.
884040	889780	If you are familiar with C and memory corruption, you'll see this sscanf function immediately will
889780	896360	stand out to you because it takes the token and pulls it into a fixed length buffer token,
896360	901080	but it doesn't check the length of the string. So if token is, for example, only 16 bytes and
901080	906280	you send a token that is 20 bytes, you now have a four byte overflow. Pretty obvious.
906300	910620	So our next goal was, how can we actually exploit this? We don't want to just say,
910620	914140	oh, this is a vulnerability. We want to prove impact. Plus it's kind of fun doing this.
915280	920680	For mitigations, pi and canaries were disabled. Or at least that's what we thought. We had later
920680	926040	learned that in the latest version of the firmware, canaries were enabled and this ended up
926040	929820	not being exploitable, but we didn't know that we were dealing with an older version of the
929820	935100	firmware. It was the newest one that we could get our hands on, but it still wasn't the latest one.
935460	939620	So we were trying to figure out, how can we exploit this? We just have a generic buffer
939620	946580	overflow vulnerability. If you're into binary exploitation, ROP probably comes to mind. ROP
946580	951560	is a little bit difficult in MIPS because it doesn't have a return instruction. Yeah,
951560	956520	you can still kind of get it, but it makes it significantly more difficult. As a side note,
957160	961020	based off of what we had to do here, I decided to make a CTF challenge
961020	967300	with very, very similar conditions that I wrote myself. We released it as a part of BYU CTF 2024.
967660	970920	If you would like to do that yourself, give yourself a challenge, you can look it up.
970940	979900	It's available on GitHub. So how do we exploit this? Well, we wanted to find kind of a one-shot
979900	983520	gadget where we could just return there and then it would do everything for us and we didn't have
983520	989400	to chain multiple gadgets together. Because of the overflow, we could control the RA register or
989400	994960	the return address register and the S8 register, which is pretty much the stack pointer. So we
994960	1001600	figured if we can control S8 and point it to a user-controlled bash command and then set the
1001600	1007500	instruction pointer to go to this gadget, win, right? You profit. ASLR is enabled, so we can't
1007500	1013000	use stack values. But because PI is disabled, we know where all the global variables are.
1013000	1017740	So we started looking through to see what global variables can we control that we can easily put
1017740	1024560	our own command inside of it. So us being the intelligent people that we are, decided to put a
1024560	1029540	semicolon reboot semicolon in there. We ran it and nothing happened. So we rebooted it just to make
1029540	1035200	sure that we hadn't messed anything up and we ended up messing something up by doing that.
1035200	1039880	The router just kept rebooting and it never actually got online. Turns out there's an
1040860	1044360	authenticated command injection vulnerability that Ava will now go over.
1045220	1049800	So after we found our accidental command injection vulnerability, we went back to find the code that
1049800	1055740	was responsible for this. So we ended up finding it in the sysconf binary, which is run on boot.
1055900	1061180	So as you can see here, it formats a UDHCPC bash command with several variables,
1061180	1066260	including the router host name. And then it pipes that directly into the system function.
1067680	1074100	And so because we can control the router host name through the viral app, we can get arbitrary
1074100	1079020	RCE by just setting that host name to a bash command. So we can verify that this command
1079020	1084000	actually has been run by looking at the boot output, which you can see here on the right.
1084000	1089000	You can see the output of that command right there. We got this output from the UR interface
1089000	1094240	that we had connected to initially. So there are a few limitations with this exploit,
1094240	1099020	namely that the injected command is run only once on booting the router, as well as that the router
1099020	1106060	host name is limited to a length of 30 characters. So as a result, we had to write our payload into
1106060	1111300	several 30-byte sections, which what we ended up doing with that is write a script to the
1111300	1116020	slash folly directory, which is one of the few directories that is both writable and persistent
1116020	1122280	on the router. And so we wrote a script that itself then downloads a longer script from the
1122280	1129720	using wget and runs that. Now, we also found that the router does not have an internet connection
1129720	1135560	at the time of running the injected command. So we had to make our script or our payload wait
1135560	1143080	20 seconds before running our first script. So after we wrote our first payload, it then downloads
1143080	1149300	and executes a second payload, which itself then downloads and executes a compiled cbind shell,
1149300	1154240	which we can connect to via netcat. And so through this bind shell, we were able to gain our first
1154240	1159800	shell on the router. So as you can see here, we're able to netcat into the router and find that we
1159800	1171680	have gained a shell as the root user. Okay, so once April had come around, we had reached our
1171680	1175980	four months, it was the end of the semester, we had to wrap up the project and we decided,
1175980	1179740	you know, let's reach out to the vendor, try and get in contact, send them the details for
1179740	1184320	the vulnerabilities, let's see if we can get this patched. It was actually pretty much like it was
1184800	1189340	a pretty big pain to get in contact with them. They had an email address listed in their terms
1189340	1193660	of service, but it didn't exist, it just bounced back. We reached out to a couple other email
1193660	1198520	addresses on their website, we tried to guess the email addresses, none of that worked. We reached
1198520	1203420	out over social media, they have YouTube, they have I think Facebook, maybe an Instagram, we
1203420	1208160	didn't hear back from that. We filed a couple support tickets and eventually we got a response
1208160	1213880	from them. They put us in contact with the actual developers and the developers said, hey,
1213880	1218420	thank you for sending us this, we'll take a look at it, we'll get back to you on it.
1219340	1224100	This is the overall timeline of what we did, so we started the project in January,
1224100	1230080	we finished it up in early April, we reached out to them, and it took us a month before we actually
1230080	1234320	got in contact, and we said, hey, here are the details for these nine vulnerabilities,
1234320	1238360	we are giving you a 90-day deadline, we are happy to help if you have any questions,
1238360	1243740	if you want us to elaborate, et cetera. We followed up a month later, didn't hear anything,
1243740	1247600	followed up two weeks after that, we didn't hear anything, and as we had told them,
1247600	1252500	we went ahead and filed CVE numbers from MITRE, we followed up two weeks later, and they said,
1252500	1256560	we're working on it, we'll publish something pretty soon here, we'll get it out to you.
1256820	1261380	So the 90-day disclosure deadline was a couple days ago, we timed this for our talk today,
1261380	1266680	and the vendors actually reached out to us like the day before we left here for DEF CON and said,
1266680	1271440	hey, we've pushed a new firmware update, can you check that, and we said, yes, just not right now.
1271440	1275360	We haven't looked at it yet, we'll take a look at that there, but they have been
1275360	1278440	somewhat responsive after we finally got in contact with them.
1280160	1285920	Just a quick conclusion, we expected it to be a lot easier to get started,
1285920	1290120	to get the firmware to find the initial vulnerability and get that initial root
1290120	1294700	shell, it took us two months to get to that point, so we were a little surprised about that,
1294700	1299040	that's also probably attributed to the lack of experience on our part,
1299040	1303880	but then once we got in and we got the firmware, we were able to find a lot of bugs and not a lot
1303880	1308820	of time, and we only looked at a very, very small portion of the attack surface,
1308820	1312400	there is still a lot more space for bugs. If that's something that you're interested in looking
1312400	1316760	for, go to the GitHub repo, you'll notice that there are holes in the documentation that we just
1316760	1323760	didn't have time to fill in, and we've hacked into a couple other devices since then, and we found
1323760	1330060	that the cheaper, lower quality devices, hacking them is very, very similar. IoT and embedded
1330060	1337180	products still have a long, long way to go when it comes to security. So this is the QR code,
1337180	1340540	if you want to go ahead and go to the GitHub repo and look at the details,
1340540	1346240	if you would like to connect with us on LinkedIn, we also have our links up here,
1346920	1361640	what time are we at? 53. Are there any questions? Yes. Yeah, feel free, come on up.
1364330	1369570	I did not expect that.
1378470	1387130	Sorry, can you repeat that? He said, like, what method do we use to find the vulnerabilities?
1387130	1393150	Okay, so the question was, what method did you use to find the vulnerabilities? Was it fuzzing?
1393150	1399710	Was it manual code analysis? We did not use any fuzzing. Fuzzing is a little bit more difficult,
1399710	1403750	it's not impossible, but it's a little bit more difficult when you have a closed source binary.
1403930	1408650	Normally you would compile source code with some sort of sanitizer and then fuzz it from there,
1408650	1412730	but because it was closed source, and it was MIPS, and we're not super experienced with fuzzing,
1412730	1418170	we went the manual route. So we just searched through the code by hand in Ghidra, decompiling
1418170	1429400	it to find it. Thank you. Other questions? Going once, going twice. Yes, right here.
1431020	1432300	Yeah, feel free to come up.
1438600	1442880	And if you could speak that protocol, you could do basically any router administration.
1442960	1448000	Could you not set the hostname of the router from there and trigger a reboot and make that
1448000	1453340	authenticated hostname injection, hostname command injection to an unauthenticated injection because
1453340	1461660	there's no credentials from that path? Perfect. So the question was, like, since that...
1461660	1467820	how would you say that? Since the local service is unauthenticated, the question was about,
1467820	1473420	can we use that to turn the router hostname injection to an unauthenticated command injection?
1473620	1478080	I think the answer to that is no, kind of. At least not that we know of. Not that we know of,
1478080	1482480	because the router hostname, the process of setting that actually goes through AWS.
1482800	1487240	And so that was one area that we didn't have a lot of time to explore. There are some keys
1487240	1491640	associated with logging into that AWS service, which it's possible that those itself are
1491640	1496820	vulnerable in some way, but simply having access to the local service is not enough to set the
1496820	1502880	router hostname. Yeah, so a large part of the mobile app was just dealing with the AWS API.
1502960	1506660	We didn't have a whole lot of time to go through that. So it may be possible, but from what we had
1506660	1510520	seen, we could only do that if you were authenticated, if you already had the app set up
1510520	1541110	with the router. Thank you. I think we got one back there. So the question was, for someone who
1541110	1546090	is new to hardware hacking and new to vulnerability research, do you think following these steps would
1546090	1550350	be good to learn some hardware hacking and do you think springboarding off of the research that
1550350	1555570	we've done would be a good way to get started? First off, I'm still kind of a noob, so I don't
1555570	1561550	know that I have the best advice, but I would say this is something that you definitely can do for
1561550	1566190	hardware hacking. This was kind of my first exposure to it. And I learned a lot. There's a lot
1566190	1571130	of resources out there. DEF CON has their hardware hacking village. I think reproducing these steps
1571130	1576630	and going through it would be very, very helpful. We do have some extensive write-ups specifically
1576630	1580870	on the hardware part. We spent more time documenting that because it was newer for us,
1580870	1587990	so hopefully it's helpful. As for finding CVEs, if you want to find CVEs and IoT devices, this is
1587990	1592530	probably the easiest way to do it. It does take a little bit of knowledge when it comes to memory
1592530	1596710	corruption and whatnot, but if you have an introduction to C and assembly and memory
1596710	1600670	corruption and you want to find your own, it's just a matter of looking through the code. There
1600670	1605310	is just so much code that we haven't even gone through. So I would absolutely recommend that.
1605310	1620780	Yes. Any other questions? Yes. Okay, so the question is, how do you get future firmware
1620780	1626980	updates? So this is kind of a tricky question. We looked into it a little bit. Initially, there was
1626980	1632040	an API endpoint, just an HTTP web server, where you were able to say, hey, what is the latest
1632040	1637820	firmware? Can you give me a link to it? The thing is, it didn't actually give you the latest firmware.
1637820	1642620	We talked about one of the buffer overflows that we tried to exploit that did not have stack canaries.
1642640	1646060	We thought that was the latest firmware version because we got it from that endpoint
1646620	1652660	pretty early on in the process. But the actual device had later firmware that I think it gets
1652660	1662280	through the AWS IoT. It uses encrypted MQTT communications, and so somehow it gets the
1662280	1667400	update from that. We have not fully reverse engineered that process. We don't know how it is,
1667400	1674860	but it is somewhere within the AWS MQTT sort of set up in there. Other questions?
1677280	1683620	Going once. Going twice. All right. Thank you for coming to our talk. We appreciate it.
