start	end	text
0	5100	Hi, folks. My name is Rik Ramgadi, and I originally had submitted a talk called
5100	9800	Shining a Light on a Black Box. However, things changed, and then after, Ian and I
9800	15000	changed our slides to be So Hopelessly Broken 2.0, Circumventing Security Controls and
15000	20600	Network Accessible Services. So like I said, my name is Rik Ramgadi. I'm the one on the right
20600	27200	here. I am a senior security analyst at ISE, and I like to hack things like web apps, mobile apps,
27200	31700	binaries, and IOT devices, which is why I do a lot of work with the IOT village. I like to read
31820	35080	a lot, and I'm always confused. Then we also have Ian Sinderman.
36340	41460	Well, that would be me. I'm a security analyst at ISE as well. I may have been a low-key
41460	46200	carny as a child. I also like to hack things, web apps, IOT garbage, some hardware, tech
46200	51260	obscura, that sort of stuff. I always like to try and learn new things. I always like to teach
51260	57380	them as well, whether that works. Maybe not. But I'm also always confused, like Rik. I really
57380	58400	like that one.
58800	66240	I guess it's an easy one to like. It's very realistic. So the things, here's the agenda. This
66240	72100	talk is about our research project that we concluded in 2018. During our research project,
72100	80320	we hacked a bunch of embedded devices, 13, we had 13 targets. We got a remotely exploitable
80320	85120	shell in 12 of them, and these are the three best stories that I could fit in half an hour,
85120	89420	that we could fit in half an hour. And the idea behind it was that we were trying to find
89420	94600	remotely exploitable bugs in embedded devices, which is kind of what you do when you play
94600	101400	the So Hopelessly Broken CTF. And throughout the whole presentation, we're going to cover
101400	107200	three devices, the Buffalo Terror Station, the Drobo 5N2, and the Netgear R9000. These are
107200	112140	all devices that we bought, I think, early last year, so I would say March-ish. And then we
112140	116900	hacked in between then, and we ended everything in about October, November. But, as we'll
116900	119720	find out throughout the presentation, just because we concluded testing does not mean that
119720	125280	our job was over. With the Buffalo Terror Station, we're going to be looking at how sometimes
125280	129100	developers may be confused with how some functionality may work. We're going to be
129100	132780	looking at a couple interesting HTTP headers. And then we're going to be talking about an
132780	137580	interesting situation where responsible disclosure, where we responsibly disclosed these
137580	142200	issues to this manufacturer, and then they didn't respond to us, and some stuff happened where
142200	147380	they tweeted some information and then deleted it. And it's all very humorous, yet concerning.
147380	151420	Then we have the Drobo 5N2. We're going to be talking about how we reverse engineered the
151420	154620	protocol, which is what this talk was originally about. And then after that, we're going to be
154620	160020	talking about how we found the keys to get into the Drobo under the device's doormat. And then
160020	166660	last, we have the R9000, which we'll be talking about an interesting authentication mechanism
166660	172460	and how we were able to fake a call from inside of the house. And then after, a tale of bug
172460	176940	bounties and bug bounty companies that we ended up in. And then after that, we're going to have
177040	181700	a conclusion where we talk about responsible disclosure, the stuff that we found, how we
181700	187760	found it, and comparing our study from last year with our original study from 2013. So without
187760	192980	further ado, I'll kick it off with the first one. The Buffalo Terrace Station. This is one of
192980	196860	the devices that's actually in the CTF right now. And after you figure out how easy this is,
196860	203580	you'll score some easy points. The Terrace Station, with this very easy name, is a Soho
203580	209360	enterprise business grade NAS. And it runs between $2,000 to $4,000. It's made in Japan. And
209360	213280	it has an administrative web application. And I'll pass it over now to Ian to explain
213280	221480	everything else. Okay. So this web app has, it has this wonderful JSON API. So one thing that I
221480	226540	really dislike about JSON, at least in the context of, I guess, everything, is application
226540	231560	JSON. So application JSON really sucks when you're trying to do CSRF, assuming they're
231560	236080	actually checking the content type, because you generally need to preflight your requests if you
236080	241660	want to set this content type. But further, we see that there is a authentication cookie, so
241660	247360	they're probably using cookies for some of this. But there's also an authentication, like,
247360	252020	value within the post body. Back to CSRF, that's probably not going to be something that we can
252020	255540	do if that authentication token is there, because we would have to know their authentication
255540	264480	token in order to send a malicious post body. However, we decided to kind of change that. So
264480	268760	first thing we did is, you know, find the source code for this, or at least the code for the
268760	273960	web app. In this case, we found that they were all precompiled Python binaries, which kind of
273960	278300	sucks. Like, it's Python, you should be able to read it nice and easy, but this is not super
278300	283480	readable. However, you just use uncompile 6 and then it's just ready to go in a matter of, like,
283480	288680	one or two minutes. So that was nice. So now we have very nice readable data, and it's in
288680	292720	Python, nice and easy to parse, even if you don't know what you're doing. And then we see
292720	300560	some rather concerning stuff here. Like skip off. Yes, please, I'd very much like to do that.
300740	310780	How do I do this? What do you guys think skip off does? So somebody thinks it's a security
310780	320540	mechanism. We'll talk later. Let's figure out where this is going now. So the next thing I did
320540	324700	after seeing this was just see where else is skip off referenced, like, within this file. So I
324700	330750	just do a search and then we find this chunk of code. Highlight the important parts, and it
331740	339480	looks like if we just set our HTTP host, like, our host header to local host, we skip
339480	345680	authentication. I can kind of see why someone would implement this, so let's talk about that.
346100	352380	So let's say that we have an API that it needs to talk to itself. We could, you know, implement
352380	357440	some sort of authentication, like understanding what the authentication to grant yourself an
357440	361760	auth token for yourself and then use it with yourself, or we could just say, hey, when I talk
361760	366980	to myself, I know it's me, so we're good to go. So I'm pretty sure that's what they were trying
366980	373360	to do. So, you know, if the host header is always a local host and a local request, and it's
373360	378520	never a local host and a client request, then the host header being local host means it's a
378520	383960	local request. You know, good to go, job done. Except there's a problem with this, and I think
383960	387680	many of you have already realized this problem, and it's that the host header is client
387680	395200	controlled. So that's not good. So the host header is usually local host and a local request,
395200	400380	and it's rarely local host and a client request. So the host header being local host just
400380	408440	means it's a request with a weird host header. So one of the reasons that I think this becomes
408440	412780	an issue with a lot of people is that the host header is application layer while routing
412780	419580	decisions are done at the network layer. So although in a lot of our large web applications,
419580	424640	we can expect some routing decisions to be made based on the host header, this is a tiny
424640	429920	little NAS on your LAN. You're not going through a load balancer to talk to your NAS. If you
429920	435980	are, like, that's a hell of a NAS. So since there's no load balancer and since we're talking
435980	441820	to it directly, what can we do? Well, let's find out. So we have a base request here. We
441820	448340	have a junk SID, and it responds with, hey, this is an invalid session ID. That makes
448340	453760	sense. So what if we set our host header to local host? And we still have a junk SID, and
453760	457500	we still get an error, but it's a slightly different error. It's still invalid, but it's
457500	461440	invalid params. And it's saying that, you know, the reboot function doesn't take any
461440	466920	arguments, but we did give it one. As far as I can tell, the only argument that we may have
466920	473380	given it was the SID parameter. So what if we just delete it? Well, if we delete it, we get
473380	479180	result null, and then the device makes some sad beeps and reboots because suddenly we're an
479180	487140	admin. That's probably not good. So I just got a shell. And now I can get a root shell without
487140	491640	authentication. Also probably not good.
492220	496440	Yeah, so I guess if, for those of you keeping track, the authentication is the host header
496440	502160	kind of. So the fact that you could just send, say, your IP address is 127.0.0.1, and then
502160	507600	have to say, this is all you need to know from here on out. We were able to access all the
507600	512440	functionality in the NAS, also the ability to make the device beep. And that was really
512440	516560	interesting as well. So we brought this device to another CTF. I think no one's figured it out
516560	521400	here so far. There's actually a request to make the device play music. And that's one of the
521400	524540	most annoying things that we found out. So remotely we're able to play music in other
524540	528320	people's houses. And on top of the fact that we're able to get a shell, which I'm not sure
528320	529440	which one's more concerning.
534500	538660	So, I don't know, it seems like after all the shells that we got on these devices, getting a
538660	543560	shell kind of got boring. So then it became, hey, we can play music. This is fun. This shell's
543560	551380	boring. So yeah, how about that tweet and delete? So we decided to disclose. As normal, we
552000	556920	disclosed all of the issues that we found to the manufacturer. Gave them at least a month or
556920	561880	two to fix them before doing public disclosure. In this case, you know, we sent an email to
561880	569140	their security contact on 0622 and heard nothing. So we sent another on 0702 and heard
569140	575040	nothing. So then we sent the Volns to the security contact on 07, on the next day, and we
575040	582880	heard nothing. So we sent the CVEs on 0822 and we heard nothing. So we announced our public
582880	588600	release because it had been many months and we tried our best. And then two days later, we
588600	592920	did our public release with a demo live stream showing off the exploits and how to do
592920	598800	this. And then something happened the next day that none of us were anticipating. An
598800	606140	official Buffalo Twitter account retweeted the link to our live stream. What did that link
606140	613200	contain? That link contained a very nice URL to our live stream on YouTube about how to hack
613200	620480	all Buffalo devices. What happened to that tweet Ian? Well, at some point, they must have
620480	625300	realized that something was terribly wrong because they deleted it. However, we do have a
625300	630620	screenshot, so that's nice. So we're not crazy. This actually did happen. Hopefully your
630620	634560	folks in the back can see it. You're laughing, so you can see it in the back and hopefully
634560	638740	you're enjoying it as much as we did. So what ended up happening with the device in the end?
638740	643040	Did we get patches? Well, we'll find out. So clearly they realized that something was
643040	647060	wrong. So at least someone at that company is aware that there's a lot of vulnerabilities
647060	653620	that should be fixed. So clearly, as far as patchability goes, there are patches. There are
653620	661500	no patches. It's been like a year, I think. And for a talk that I did at CypherCon, I did some
661500	667060	more research and found that all TerraStations are vulnerable to the same exploit, including
667060	672160	the ones with the brand new completely redone UI. How much were those devices again? The
672160	678000	devices, I think some of them were upped into 20K, something like that. Like professional
678000	684200	grade network attached storage for businesses. 20K for your own, I guess, C2C server in the
684200	691460	end, pretty much. But yeah, I guess in summary, the host header is client controlled. Unless
691460	695420	you have something that's parsing it and making sure that it's not client controlled, maybe
695420	700680	don't rely on it for authentication. And if you have a security address, please pay attention
700680	706960	to it. We're trying to help you. And if you screw up, oh no. Clearly whoever had deleted
706960	712080	that tweet knew that something was wrong, but they didn't own up to it. Or if they did,
712080	716760	someone didn't listen to them. And all of these devices are still vulnerable, including
716760	720720	the one in the CTF. Like it's running the newest firmware. And you can go over and get a
720720	725980	shell in it if you like. Oh, you want to talk about Maryland Democratic Party real quick?
725980	729100	You get more, you're way more enthusiastic about this issue than I am, so I'm going to let
729100	735880	you take care of this one. So after all of this, we found out that the Maryland Democratic
735880	743860	Party had a Buffalo NAS on the internet with no password. And while we were doing all this
743860	749140	research, another research company found it and contacted them and then like did a release
749140	754300	about it. Apparently like every nation state and their grandmother was in this NAS pulling off
754300	758940	all their data. But the Maryland Democratic Party did take care of it. They put a password
758940	762720	on it. So it was still on the internet, but they put a password on it. And then we released
762720	769780	this. So I guess, I'm pretty sure every nation state and their grandmother can Google. So
769780	777320	sorry Maryland Democratic Party, we tried. Just to be clear on that one, we didn't hack
777320	781880	them at all. That never happened. Let's make sure, I don't want to hear about that later
781880	787540	on from anybody. But it's kind of funny because we give a lot of these presentations where
787540	792220	we tell people about like, hey, there are vulnerabilities that you're seeing are, it's
792220	796260	in the system. It's like you can have the like up-to-date firmware. You can have a good
796260	800240	password. It's like if there are authentication bypasses, it's like false sense of security
800240	803800	that you're leading yourself into. Don't get me wrong, it's important to have good passwords
803800	807240	and important to keep your stuff up to date. But if there's no update and people can just
807240	812200	change the host header to localhost and get in, you're just lying to yourself. Talking
812200	818480	about lying to yourself is our next device, the Drobo 5N2. The Drobo 5N2 is a Soho Enterprise
818480	824460	grade NAS, and it is between $400 and $500, way cheaper than a Buffalo, but just as vulnerable.
824540	825560	This one's made in the great...
825560	826980	I'd say a lot more vulnerable.
826980	830440	This one's probably way more vulnerable. I'll tell you guys how many unauthenticated shells
830440	836860	we got on this thing at the end of this. But this one's made in America. The reason why
836860	843940	we wanted to do research into this device was because you can't manage it through a
843940	848100	web app by default. Almost all these devices, you hook it up, there's a web app, you connect
848100	852740	to it. The Drobo, the only way that you can connect to it by default is by installing
852740	857320	this thing called a Drobo dashboard. And people on Reddit were losing their minds over it
857320	860180	because they thought it was really cool, because it has all these pretty lights and the kids
860180	865960	really like LEDs. And the other reason why is because it's pretty robust and it's also
865960	871660	like a pretty fair price point, I guess. I wanted to get it because it has this custom
871660	879140	protocol that it uses to connect to the device with this only macOS and Windows binary that
879140	884220	you need to install. So we installed it, and this is what the Drobo dashboard looks like.
884460	889360	I think this was the macOS version. You install it, and then it gives you other information
889360	894480	about the device, like the serial number. It tells you how many drives you have installed,
894480	899340	when was the last time you set up RAID and all that, and the life expectancy of all those
899340	904700	drives. I'm not sure how it does that. And you can also install other apps and remotely
904700	910740	access the device through other means as well. The first thing that we did is that I was
910740	913920	really worried that the only way that we'd be able to assess this device is by doing
914080	919260	a lot of hardcore reverse engineering. It's like, oh, they probably have certificate pinning,
919260	925860	they probably encrypted everything with TLS. Ha! It was just plain text. Everything, and
925860	929020	I know it's a little bit hard to see that, but that's just, we opened up Wireshark and
929020	931980	started clicking on a bunch of stuff, and we found out that everything was in plain
931980	938880	text, and I was like, well, cool. But, so it's like, this customer proprietary API was
938880	944280	just XML. And what you had to do is that you sent the, like, that, like, dry net, TM stuff
944280	947960	at the beginning, those dots are just hex characters, I put dots in so it's a little
947960	953220	bit more easy on the eyes, and then some XML data. Well, we still need to reverse engineer
953220	957440	the protocol here. We need to figure out, like, how it all works, what does the 61 here
957440	963240	mean, what is that DRA number, and how does this all work? So, the first step that I said
963240	968020	is like, well, cool, maybe I can just send this message with echo, and then pipe it into
968020	972700	Netcat, connect to the device on port 5001. We saw that whenever we were interfacing with
972700	977680	the device, it was over port 5001, and that it was always listening on that port as soon
977680	983040	as the device turned on. So, maybe we can just send this and figure out if it just gives
983040	988380	us a message back. Maybe there's no authentication. We sent it, we didn't get anything back.
988380	992240	It just froze. We needed to figure out why at that point. So, we need to do some more
992240	997200	protocol reverse engineering and see where that goes. So, I also found out while we were
997200	1003700	looking at it, that if you kill the instance of your Drobo dashboard, it'll restart, and
1003700	1009760	when it restarts, it'll have something listening on port 5000. It's like, cool, well, I can
1009760	1014060	probably just connect to the device on port 5000. If you connect to the device on port
1014060	1018660	5000, it spits out all this XML, and that's really interesting. Notice there's no trickery
1018660	1022880	there, no authentication, I'm not sending anything, connect to the device on port 5000,
1022880	1027980	and that's it. So, I was like, alright, maybe it is that it needs to be connected to the
1027980	1033880	device on port 5000 and also send a message. Well, let's try that out. If we send that
1033880	1040060	and we echo this information, pipe it into Netcat, maybe there's no authentication. It's
1040060	1044100	like, well, that's not working either. Maybe there's something else. So, at this point,
1044100	1047460	we're going through the process of reverse engineering and figuring out how is it that
1047460	1052620	the whole, like, handshake part is happening between these things. So, we killed the Drobo
1052620	1057380	dashboard, and I think the other thing that was very important about this is that every
1057380	1061220	time you kill it, it just automatically restarts. So, we needed to set a script to automatically
1061220	1064240	kill it every time until we were ready, start Wireshark, and then start back there from
1064240	1070780	nothing. And we found out that there is authentication. When the Drobo dashboard starts, so the application
1070780	1078260	that connects to your device, it sends this message. And this message is only, it only
1078260	1082260	happens once at the beginning. Kind of sounds like what happens when you log into an application,
1082260	1087320	right? You log in, you send your username and password once, it sets a session token,
1087320	1089880	it gives it back to you, and then you have all that information and you can just keep
1089880	1094380	on doing the do. So, we needed to reverse engineer the front part here. So, you can
1094380	1100320	see that the DRAINATM part is still the same. There's a bunch of dots and a number there.
1100660	1104920	That number looks pretty long, and it looks, I would say, it looks complex enough that
1104920	1109800	I don't think I'd be able to brute force it. So, we started looking into what it is that
1109800	1117120	this number meant. The first part, the DRAINATM part, was just those hex characters. Ian found
1117120	1121480	out that, after that, it would say if it's coming from the server or if it's being sent
1121480	1125320	to the server with the other bytes, and then the rest of it was the size of the packet.
1125660	1129700	And now that we know all that information, there's something else here that we still
1129700	1135260	need to figure out. What's that? So, the part that's, I guess, kind of highlighted in red,
1135260	1139880	but definitely bolded, that looks like something that's still complex enough that we can't
1139880	1145800	just randomly guess where it belongs to. But, we found out that when we connect to the device
1145800	1153220	on port 5000, it gives us back that number. That here, folks, is the serial number. So,
1153220	1157280	it looks like the thing that you need to authenticate to the device is its serial number. It's like,
1157280	1162600	oh, this is complex enough, serial numbers are pretty long, but you can just do the following.
1162660	1167620	Connect to the target on port 5000, extract the serial number from the XML that's returned
1167620	1173620	to you, send the login request on port 5001, send whatever command you want on port 5001,
1173620	1177580	and then install whatever you want. We found out that you can install pretty much anything.
1177580	1182520	You can install MySQL, you can install Apache, you can install OpenSSH, you can install other
1182520	1187940	malware that you find anywhere, but it pretty much allows you to do anything. And then after,
1187940	1192480	we found out that Drupal also provides this thing called Drupal Access. It's a web application
1192480	1196220	that they provide so that you can connect to the device through something that's not the
1196220	1200960	Drupal dashboard. And we were still wondering, well, we don't really have a shell yet. How
1200960	1207980	are we going to do this? The first application that we installed gave us CVE-2018-14-699,
1207980	1211960	and I think that's a little bit hard to see for everyone in the back, so let's look at
1211960	1218540	this a little bit more closely. Here's the device's IP address, 192.168.1.26. It's on
1218540	1224280	port 8080. It listens on Drupal Access. You send an enable user request, and you say your
1224280	1228000	username to your command injection payload. That goes straight into a shell, and that's
1228000	1232380	the easiest shell I've ever gotten throughout my whole career. And that's pretty much it.
1232380	1235780	There's no authentication or anything. You send this individual request to any Drupal
1235780	1240980	Access, I guess, Drupal, Drupal with Drupal Access, and you automatically get a shell.
1242320	1249600	So let's talk about now the disclosure timeline. We sent everything to them on 07.06. In an
1249600	1252780	email we said like, hey, we want to send you these vulnerabilities over. How do you want
1252780	1256240	to receive them? Do you want us to encrypt them or not? Do you want us to PGP sign it?
1256240	1262160	Ha, they didn't care. We send them back again to a security contact. Ha, they didn't care.
1262780	1269020	We send the CVs over anyways, hopefully stirring something up for them to respond back to us.
1269040	1274840	We got nothing. And then after I did a public release and a live demo of me exploiting this
1274840	1278320	vulnerability, I'm also going to be doing this in other conferences. I'm going to be at
1278320	1281560	BSides Puerto Rico in October. I'm going to be doing the same thing again. And the reason
1281560	1288420	why is because they don't fix anything. So, send a DM to the Drobo CTO. Ian, what happened
1288420	1295340	there? How do we DM the Drobo CTO? So, for that handy dandy protocol that they gave us, I
1295340	1299180	decided to write a little Python utility that makes it very easy to run your own commands.
1299480	1306100	And I accidentally got command injection. Just while writing a script. So, we kind of figured
1306100	1310920	we should probably tell them about that because it's depressingly trivial. So I sent them a
1310920	1321620	DM. Or I sent the CTO of the company that acquired Drobo a DM. We'll get to that. So then
1321620	1328720	after that, we sent all the vulnerabilities that we found to Drobo and to CTO email. Or sent
1328720	1332180	all the vulnerabilities that we found in Drobo to the CTO's email. We didn't hear back from
1332180	1336580	him. I'm pretty sure he doesn't like us. Besides the point, Ian mentioned something
1336580	1341540	interesting. While we were sending all this stuff over, something was happening in the
1341540	1347620	background. Drobo was getting acquired. While Drobo was getting acquired, we found a bunch,
1347620	1354320	we found nine unauthenticated shells, folks. Nine. That's embarrassing to me. Well, not for
1354320	1358800	me. I found them. But they're like, this company is store centric. They were acquiring two
1358800	1365100	companies, Drobo and Nexen, throughout that whole process. Now I'm here in red, which I'm
1365100	1371260	hoping all of you can see. In August 21st, 2018, they released this on the Nexen website.
1371700	1378280	Let's look at that timeline again. We submitted everything on 07-06. So that would be July?
1379120	1386100	Yeah, July. He's shaking his head. July. And then after, on August 22nd, we send them all
1386100	1390860	the CVEs. Throughout that whole process, they could have addressed these issues or just got
1390860	1395680	them back to us. I'll be honest, they could have been just busy with their acquisition and not
1395680	1399960	really in the mood to deal with nine unauthenticated shells. Sounds like their problem,
1399960	1406000	not mine. But let's go to the summary of this issue. Having a proprietary protocol does not
1406000	1410640	make you safe. Just because you're prescribing to the idea behind, like, if it's mine and
1410640	1414640	nobody else knows about it, nobody can find any exploits, that's not true. There are many
1414640	1418640	good reverse engineers out there. They will figure it out. It's a bad idea to authenticate
1418640	1422480	with a thing that you're providing users. They probably shouldn't be authenticating users
1422480	1426080	with a serial name or their serial number. I probably wouldn't be authenticating people with
1426080	1431520	their name. And pay attention to your support tickets. We sent a couple support tickets in
1431520	1436880	hope that they would address these issues. Never got addressed. And then last up, it's like,
1436880	1441440	if you end up screwing up, like Ian said, it's probably just to own up to it. It's like, if
1441440	1445480	somebody submitted these things, maybe it's time to address them. There was also something
1445480	1450160	other, some other thing that happened that was interesting throughout this whole process. When
1450160	1455880	I was sending them these emails, I got, or I guess we got, we got blacklisted. RPA just got
1455880	1461000	blacklisted. Now, that makes no sense. Why would you blacklist somebody who's sending you an
1461000	1465620	email and I'm hacking a device that I have in my house? Those things don't add up. Those are
1465620	1470520	very separate things. But that was, whatever, I could have also, I give them the benefit of
1470520	1474340	the doubt. I actually give all these companies, despite all the headaches, the benefit of the
1474340	1478780	doubt, may have just been that we downloaded the firmware too many times. May have just been
1478780	1484300	that, like, we're a security company and it looked like fishy traffic. It's all, I, they, I, I
1484300	1487680	understand if those things happen. I don't understand not addressing the issues that we
1487680	1494100	reported. So now, I'm passing it over to Ian for the Netgear R9000, which is the last device
1494100	1500520	we're gonna be looking at today. And this one's really a doozy. Have fun, Ian. No idea.
1500520	1507440	So, the R9000 holds a special place in my heart, for good reasons and bad reasons. We'll get to
1507440	1512240	that. So it's a flagship router by Netgear. At the time that we did our research, I think it
1512240	1518620	was like the most expensive one they offered. Something like $350 to $500. It's aimed at like
1518620	1523280	power users, that sort of thing. It has a rich feature set with all sorts of fun applications
1523280	1527560	you can run on your router because you need to run applications on your router. And it's
1527560	1533980	administered via a web app, a mobile app, and Telnet if you cheat. Of course, I cheat. But it
1533980	1540060	also has a bug bounty for vulnerability disclosure. And only a bug bounty for vulnerability
1540060	1546780	disclosure. We'll get to how that kind of broke things in a minute. So, the web app, you know,
1546780	1552490	it was kind of boring. It's what we've seen a lot. It's just basic authorization or like,
1552490	1556910	yeah, basic authentication. No clear bypasses. It's a forum post, but it has C-serve
1556910	1561130	protection. It's very crappy C-serve protection. So if you want to break that, you probably
1561130	1567970	can. I highly recommend trying. So I started poking at other things. Like the mobile API. So
1567970	1573370	it's a SOAP API, which, yeah, ew, it's not fun to work with those. But it's different. It has
1573370	1579570	JWT-based authentication, which, eh, it's okay. But static analysis showed it was a total
1579570	1583890	minefield of command injection. And command injection is one of my favorite things to do. So
1583890	1592010	that instantly got me interested. But, sadly, the API is terribly broken and unreliable. And
1592010	1598670	half of the endpoints just did not work at all. So it kind of ended up being an uphill battle
1598670	1603790	to do anything with this API. But I still got off-bypassing friends, so we'll figure out how.
1604450	1608930	Hey, Rick. Have you ever, like, seen people using the X-Forwarded Foreheader much?
1608930	1612190	I've seen a lot of people use the X-Forwarded Foreheader. I've never seen somebody use it
1612190	1620870	properly. So the X-Forwarded Foreheader, it's a de facto standard. So it's something that a lot
1620870	1627050	of people have agreed on, that it does X thing. But it's not properly standardized. But it's
1627050	1631390	usually used by load balancers to convey a client's actual IP address to some sort of
1631390	1638990	upstream service. Usually. So it's also not as simple as a lot of people think it is. So the
1638990	1643010	X-Forwarded Foreheader is actually a list of IP addresses. Normally we only see it as a
1643010	1647550	single IP address, but it's designed so that when a load balancer or whatever that's working
1647550	1652710	with this header receives a request, it should prepend the IP address that it received that
1652710	1658110	header from to the beginning of the list. And also, it doesn't have to be an IP address. You
1658110	1661730	can put whatever you like in this header and your load balancer is probably just going to stick
1661730	1667530	an IP address on the front of it. So a lot of people don't seem to realize this. And it
1667530	1672450	causes problems. Like what happens if they're just expecting an IP address and dumping that
1672450	1679310	into a database? And I put a little semicolon boy in there. Breaks things. So how does this
1679310	1685410	relate to our router? Well, our SOAP API interprets the X-Forwarded Foreheader. Why? I
1685410	1689750	honestly have no idea. There's no reason that you should need the X-Forwarded Foreheader on
1689750	1694530	your LAN. Again, you're not talking to your router on your LAN through a load balancer.
1694970	1700350	That would be a hell of a router. But static analysis also showed that the R9000 is probably
1700350	1706190	the only Netgear router or device that interprets the X-Forwarded Foreheader. I downloaded all
1706190	1710890	the firmware that I could find, unpacked it, searched through it, and the R9000 was the
1710890	1717110	only one with an instance of the X-Forwarded Foreheader. So that's also weird. But what can we
1717110	1723790	do with it? Well, here's a problem. So HTTP requests are handled by a CGI server. And this
1723790	1732170	is U-H-T-T-P-D. That CGI server sends those requests down to a downstream process. In this
1732170	1737810	case, Net CGI is what handles all of our SOAP API requests. So U-H-T-T-P-D will take
1737810	1741870	something in, take the request, turn all of the headers into environment variables, and
1741870	1747730	then toss that down to a different process. So, Net CGI uses the remote address environment
1747730	1752350	variable to determine if a request is local. And much like the Buffalo, it will whitelist
1752350	1757390	itself so it can talk to itself without having to deal with authentication. Now normally,
1757390	1761710	the remote address environment variable is what you would want to use for this. Because it
1761710	1766670	will be the actual IP address that that request came from in normal circumstances. And even
1766670	1772010	if you try to change it, chances are you're not going to be able to mess with it. However,
1772010	1776390	U-H-T-T-P-D just replaces the remote address environment variable with the contents of
1776390	1784770	the exported for header. For some reason. Like, I'm a complete RE scrub. I graph scrub and
1784770	1788370	everything. But even looking at the assembly, I could tell that that's exactly what that
1788370	1795030	did. Because it was like ten lines of assembly and that was it. So, yeah, that's not good.
1795030	1799850	Because if we can say that we're whatever IP address we want and it uses an IP address to
1799850	1806570	determine if you should bypass authentication, why can't we bypass authentication? Well, we
1806570	1815610	can. We just set exported for colon 192.168.1.1 and suddenly we're an admin on the SOAP API.
1815670	1825010	And we can do whatever we like. So thus, CVE 2019.12.51.0 was born. So, I wasn't thinking
1825030	1831650	satisfied. Because, you know, off bypass isn't fun if you don't get a shell, right? So, I got a
1831650	1841130	shell. CVE 2019.12.51.1. It's kind of big. So, I don't think we're going to focus on this shell
1841130	1847010	because it's got a lot of fun challenges. Like, it can only be 17 characters. It has to be all
1847010	1851110	capitalized, all capitals. It has to have a colon. It has to have a single quote and then a
1851110	1856090	semicolon and you have to comment out everything. But if you want to talk about that, talk to us
1856090	1861470	later. Because we don't have time. Before we get away from this one, the interesting part was Ian
1861470	1866450	found the range header, which is definitely an unexpected header. So, we're able to use the range
1866450	1870990	header to say, like, all right, cool. Let's put the whole thing that we need in that header and
1870990	1876390	then we'll reference that header in the XML body of that SOAP request. And I guess we were just
1876390	1882170	lucky that all those things happened to jive together. Yep. When you're poking at CGI and
1882170	1885630	you're trying to get weird command injection payloads through, the environment variables are
1885630	1892010	very much your friend. But I wasn't quite done yet. Because Netgear has a very fun clause in
1892010	1897110	their bug bounty. If you can get remote unauthorized access to administer a Netgear device via the
1897110	1904530	internet, not LAN, they'll give you 15 grand. I can buy a lot of ice cream with 15 grand. So,
1904530	1910870	I started looking into that. So, the SOAP API requires extra headers. Like, for the SOAP
1910870	1917390	requests and all that good stuff. So, XHR can set these, but it's cross-origin, so it'll have to
1917390	1920690	preflight the requests and chances are the router's just going to slap that right out of the
1920690	1927890	air. So, CSURF isn't going to happen. So, the device isn't exposed to any, it doesn't expose
1927890	1932710	itself over the LAN at all. So, I was kind of out of luck at this point. So, I just kind of
1932710	1937450	decided, well, I guess I'll die. I guess I'm not getting the 15K. Until two weeks later. And I
1937450	1943110	was taking a shower and my brain started just shouting DNS rebinding. And say, two minutes
1943110	1948690	later, I figured out why. The thing with DNS rebinding is that it functions a lot like CSURF,
1948690	1953590	except it's seen as being the same origin. So, you can send whatever request you like without
1953590	1960650	having to deal with these preflighting annoyances. So, yeah, no more preflighting. However,
1960650	1967670	it differs from CSURF in that we cannot send authentication. In our case, well, DEX 4.4 is a
1967670	1974290	de facto standard. So, can we just set that header and make ourself an admin? Well, yes. So,
1974290	1979530	that's what I did. So, it's not a restricted header. So, let's just build a payload. So, this
1979530	1984830	is the workflow that I went with. The victim is anyone on the LAN. They can be authenticated,
1984830	1989070	unauthenticated, does not matter. Mobile devices, does not matter. They just wait for the
1989070	1994710	DNS TTL to wear out. And then once it does, I start issuing post requests via XHR with our
1994710	2000250	off-bypass header to do the following. We start a config change. We enable QOS. We enable
2000250	2005230	advanced QOS. Then we finish the config change and we pop a shell. So, we have to fire off
2005230	2010110	five requests to enable a bunch of services and do configs and stuff. But it actually only
2010110	2015790	takes like 20 seconds to do all of that and then get a shell. So, just threw that into, I
2015790	2023090	guess, a shell and then it was off to the races. So, we started disclosure. So, we got the 15K
2023090	2032410	bounty. Didn't we, Rick? Right? Although I appreciate the applause, something we didn't get
2032410	2038350	the bounty. What was that, Ian? So, you know how our disclosure timelines have been pretty
2038350	2043810	small up until now and we tabbed through them all? This is half of our disclosure timeline. We
2043810	2050670	just put the important bits in here. So, let's go through some of the more important ones. On
2050670	2056990	10.03, or 18.10.03, we submitted all of our vulnerabilities through bug crowd because that was
2056990	2062290	the only disclosure avenue that we had. So, we got an award for crosshead scripting via the
2062290	2065770	X-Ordered Foreheader, a completely different issue that was rather low severity. So, that was
2065770	2070830	nice. But we didn't hear anything else for two months until Netgear stated that they can't
2070830	2075410	reproduce the command injection issue and they had, in the meantime, released new firmware and
2075410	2079510	asked us to test again and record the proof of concept so they could figure out what they were
2079510	2087770	doing. So, we did that. We verified that, yes, I can still get root remotely and I gave them a
2087770	2094290	nice video. So, they marked the command injection exploit as triaged, which was nice. That was a
2094290	2099210	little over two months after the initial release. And then about a month after that, they
2099210	2107570	released the firmware 1.0.4.26. They didn't tell us about that. They just released it. And
2107570	2112770	then about a month after that, or half a month or so, I got a hunch that, you know, I think
2112770	2118630	they fixed everything without telling us or giving us rewards. So, I checked. And they
2118630	2124550	had. So, we confronted them. And they marked everything as unresolved and gave us degraded
2124550	2128430	rewards. Like, you know that command injection and off bypass that lets you do admin and
2128430	2136730	everything? Totally not critical. Totally. So, whatever. That's fine. We just wanted to
2136730	2140830	disclose the issues. We're not actually going for the money, although it would be nice. So,
2140830	2148110	we asked for CVEs. Because Netgear is a, or it was, a CVE numbering authority. So, they should
2148110	2153890	be giving us CVEs for their products. And they just didn't respond. And then something like a
2153890	2159150	month later, we asked for CVEs again. And they said, we're not doing CVEs anymore. Okay,
2159150	2164410	then why are you with CNA? So, we contact MITRE to get CVEs. And they say, we'll give you
2164410	2170610	CVEs once we know that Netgear is not a CNA. Two months later, almost like, what, half a
2170610	2174970	year over? Eight months since we started the disclosure timeline, we got our CVEs from
2174970	2183270	MITRE. And unsurprisingly, Netgear was no longer on the list of CNAs. So, that was fun.
2183270	2184650	Anything to add, Rick?
2185170	2189590	Well, I got plenty to add. So, one of the things that I guess was really problematic about all
2189590	2194210	this was that when we reported all these vulnerabilities through BugCrowd to Netgear, all
2194210	2199710	that time went by and they were just not fixing the issues. They weren't admiring that we had
2199710	2205010	sent them the issues over. I can't, I blame both Netgear and BugCrowd for this situation.
2205170	2209510	Because we had responsibly disclosed all these vulnerabilities through them. And this was
2209510	2215190	the first time ever, I think both of us have ever seen BugCrowd put a blocker, not on the
2215190	2219590	researcher, but on the company for not addressing the issues that we had sent over. Netgear
2219590	2224390	had also put us in a position that we thought that, alright, cool, we could have easily
2224390	2228210	sent them these issues separately and they could have been addressed. And the DNS rebinding
2228210	2232210	was just kind of a nice feature that we knew or, I guess, a nice way to chain all the things
2232210	2237310	together to get unauthenticated command injection on this device with, I guess, 20 seconds
2237310	2245570	of user interaction. The thing about it is that we, I feel, I can't help but feel that I ended
2245570	2250470	up being lied to as a researcher, especially from the fact that we met all the requirements
2250470	2255630	of their program and we didn't get what they promised that they were going to give us. That's
2255630	2259610	beside the points. I guess it's kind of water under the bridge at this point. Ian, the summary?
2260930	2266330	So, in general, like, I highly recommend if you're doing anything with web applications, use
2266330	2270350	the X-Forwarded Foreheader. It is a very fun header to mess with. You can get command
2270350	2277430	injection, SQL injection, a lot of SQL injection, tainting logs, all sorts of good stuff like
2277430	2284210	that. And CMDI, like, yeah, it'll find a way. Even if it's, you know, 17 characters and
2284870	2288250	mangled to all hell, you're still going to get command injection. You just have to try hard
2288250	2293890	enough. So, again, environment variables are your friend. DNS rebinding is remarkably
2293890	2298570	powerful. This was the first time that I had used it and it kind of blew my mind because
2298570	2303370	suddenly all of these attacks that require, you know, authentication tokens or require
2304890	2309390	bypassing CSRF protection become extremely easy to do as long as you don't have to worry
2309390	2313950	about authentication. And, like, yeah, if you have a bug bounty, please communicate with us.
2313950	2318490	Don't just leave us sitting there for two months, five times. And if you stop providing
2318490	2324370	service, communicate. You can, like, say, hey, we're not a CNA anymore. And also, like,
2324370	2331110	communicate in general. It's nice. And for bug bounties, we found out a few times now that bug
2331110	2338010	bounty programs, like, the companies don't have much of an incentive to treat researchers
2338010	2343950	fairly. They can just say, no, and you can't really do much. There's no incentive for them
2343950	2350370	to not really do that aside from just people getting angry. And bug bounties probably
2350370	2354290	shouldn't replace your security contacts. We would not have gone through the bug bounty if we
2354290	2361410	didn't have to. But that was their only security contact. That was the only way that we had. So,
2362090	2366270	that's just how it ended. I guess, anything to add, Rick?
2366990	2369990	No, that's kind of it. I know we're definitely over time, so we're just going to run through
2369990	2374630	these conclusions and answer some questions at the end. For the quick conclusions, these were
2374630	2380070	the things that were different from when we conducted our research project in 2013. In 2013,
2380070	2385390	most of the shells that we ended up getting were through CSRF. We found out now, I think it's
2385390	2391470	more that our security research in general has gotten to a spot where it's more, it's easier to
2391470	2396330	get a hand of different ways to bypass checks, especially authentication checks. So, in this
2396330	2399630	case, we didn't need to use CSRF for any of these. We just used a lot of authentication
2399630	2408010	bypasses. One of the things that was nice now that we didn't see in 2013 is that, in 2013, a
2408010	2414490	lot of the devices had executable stacks. We found, I think, two buffer workflows in one of
2414490	2418650	the ASUS routers that we hacked. Those did not have an executable stack, so we had to do ROP
2418730	2423690	and a bunch of other really fancy stuff to eventually get a shell. That was not the case in
2423690	2428610	2013, where just pretty much it was the bottom of the barrel with regards to security. And
2428610	2433530	software packages were really out of date in 2013. They're really not that much anymore. One
2433530	2439830	of the bugs that we found a lot in that study was that SMB was horribly out of date, so you
2439830	2443730	could do symlink traversal. That's really not the case anymore for a lot of these. It's
2443730	2448230	much more up to date. And I guess nicer from both the security's perspective, because you
2448230	2452910	get to try to find new, interesting security vulnerabilities instead of these old ones. And
2453350	2456550	before we didn't see any publicly documented security contacts, a lot of the times we were
2456550	2461990	just emailing people that we found on LinkedIn. Now we did see some manufacturers, for
2461990	2468490	example, Asus, TerraMaster, Synology, QNAP. A lot of these companies actually tried their
2468490	2473070	best to ensure that the vulnerabilities that we were disclosing were getting addressed. And
2473070	2477910	publicly documented disclosure outlets, the two that I mentioned that I think were the ones
2477910	2483810	that made me the happiest were QNAP and Synology. QNAP and Synology were very good about
2483810	2487610	all the issues that were reported to them. As soon as we reported to them, they responded
2487610	2491530	within a day or two and they addressed the issues and they had us check to make sure that
2491530	2496490	everything was good. Let's find out what stayed the same. Devices that are still remotely
2496490	2501850	exploitable, given the 125 CVEs that we found, I think that's pretty easy to understand.
2502450	2507030	There's still plenty of CSERF, like I said in the previous slide, before we were using that
2507030	2511810	for the exploit chain for a lot of the stuff. Now we don't need to use it as much because we
2511810	2517210	found out about a lot of authentication bypasses. OS command injection is still a problem.
2517210	2522330	That's probably one of the vulnerabilities that we focused on this time around. And security
2522330	2526010	through obscurity is still alive and well. We looked at a lot of manufacturers that the way
2526010	2529530	that they would do stuff, it's like they would try to do their own type of encryption or their
2529530	2535590	own type of file hosting so that it would become kind of problematic but it wasn't in the end.
2535590	2542470	And here's some of the stuff that stayed the same for, or I guess like what changed, but stayed
2542470	2546490	the same in manufacturers. Some manufacturers actually really care. I've been talking about
2546490	2551250	Synology and QNAP a lot, not because I know anybody there, but it's because I was really
2551250	2557030	happy with the disclosure process. Oh yeah, Xiaomi was another one that was very good. I think
2557030	2562250	that's how you say it, right? Xiaomi did a very good job of addressing the issues that we
2562250	2569290	disclosed. They have an interesting bug bounty program. They paid us in toys, never had that
2569290	2576090	happen before, even as a child. And a lot of the companies have bug bounty programs. Needless to
2576090	2579610	say, I'm not very happy with companies like Netgear who were partnering with Bug Crowd and
2579610	2583590	they ended up in this situation where we feel cheated, but a lot of other companies did
2583590	2588610	actually pay out their bug bounties and I'm happy for that. And some companies are really
2588610	2592330	interested in working with researchers to get things addressed. A lot of the stuff that we
2592330	2596810	reported, they were very much happy. They wanted to know, how did you guys find it? What did you
2596810	2601050	do? Do you think that we have more instances? Can you check? Also, it's free work, so why not?
2601070	2605010	But it's a really nice situation where they care about the security and they're trying their
2605010	2613690	best to improve it. And that's kind of it, folks. These are me and Ian's Twitters. And we also
2613690	2617730	love talking shop. We're going to be at the Village for the rest of the day until Sunday we'll be
2617730	2623610	here. We'll leave eventually, but this was a very good experience. And this was the results of
2623610	2627390	our three of the best results from our research project. There are two other people that
2627390	2632210	weren't able to present with us today. That's Josh Meyer and Sean Marani. Those guys found a
2632210	2636590	lot of other vulnerabilities and it was great to work with them. Thanks for your time and I'll
2636590	2639870	open the floor up to questions if any of you have anything to say or ask.
