Black Hat 2013 - Exploiting Network Surveillance Cameras Like a Hollywood Hacker

Video Statistics and Information

Video
Captions Word Cloud
Captions
all right so I'm Craig<font color="#CCCCCC"> Kepner this talk</font> <font color="#CCCCCC">is obviously</font><font color="#E5E5E5"> exploiting surveillance</font> cameras like a<font color="#CCCCCC"> Hollywood hacker now as</font> some of<font color="#CCCCCC"> you may or may not know when my</font> talk was first announced<font color="#E5E5E5"> it got a little</font> <font color="#CCCCCC">bit of press which as a speaker</font><font color="#E5E5E5"> is</font> really cool<font color="#CCCCCC"> the problem is</font><font color="#E5E5E5"> that in order</font> <font color="#CCCCCC">to hype</font><font color="#E5E5E5"> their articles</font><font color="#CCCCCC"> all of the news</font> stories who covered my talk<font color="#E5E5E5"> decided to</font> <font color="#CCCCCC">emphasize the fact that</font><font color="#E5E5E5"> I used</font><font color="#CCCCCC"> to work</font> <font color="#CCCCCC">for</font><font color="#E5E5E5"> a particular three-letter agency who</font> <font color="#E5E5E5">has been in the press quite a bit</font> themselves lately and although they couldn't<font color="#E5E5E5"> quite seem to agree what those</font> three<font color="#CCCCCC"> letters actually</font><font color="#E5E5E5"> stood for some of</font> them did go as far<font color="#E5E5E5"> as to</font><font color="#CCCCCC"> claim that what</font> I was<font color="#E5E5E5"> presenting at blackhat was</font> actually work I had done<font color="#E5E5E5"> for said agency</font> <font color="#CCCCCC">now with</font><font color="#E5E5E5"> current events</font><font color="#CCCCCC"> being what they</font> <font color="#E5E5E5">are</font><font color="#CCCCCC"> this resulted</font><font color="#E5E5E5"> in some very</font> interesting<font color="#E5E5E5"> phone calls from my ex</font> employer yeah<font color="#CCCCCC"> luckily we</font><font color="#E5E5E5"> have people who</font> <font color="#E5E5E5">handle the phones for me and they got</font> yelled at instead of me<font color="#E5E5E5"> but while my</font> initial attempts to kind<font color="#CCCCCC"> of assuage</font> their fears<font color="#CCCCCC"> didn't work I was eventually</font> able<font color="#CCCCCC"> to convince them that</font><font color="#E5E5E5"> yes</font><font color="#CCCCCC"> sometimes</font> people on the<font color="#CCCCCC"> internet</font><font color="#E5E5E5"> are wrong so just</font> <font color="#CCCCCC">to be very clear this talk is not about</font> any work<font color="#CCCCCC"> that I've ever done</font><font color="#E5E5E5"> for any ex</font> employer<font color="#CCCCCC"> what this talk is about is work</font> that I do<font color="#E5E5E5"> for my current employer</font><font color="#CCCCCC"> I work</font> as an<font color="#E5E5E5"> embedded vulnerability analyst for</font> <font color="#E5E5E5">tactical Network solutions I also teach</font> our<font color="#CCCCCC"> embedded device exploitation courses</font> and dabble<font color="#CCCCCC"> with wireless hacking from</font> <font color="#E5E5E5">time to time as well</font><font color="#CCCCCC"> what I'm going to</font> be talking<font color="#CCCCCC"> about</font><font color="#E5E5E5"> today obviously</font><font color="#CCCCCC"> is the</font> security and<font color="#E5E5E5"> surveillance cameras or</font> lack thereof as it may be back<font color="#E5E5E5"> in early</font> 2011<font color="#CCCCCC"> last year I started taking a look</font> at the security<font color="#CCCCCC"> that's in the</font><font color="#E5E5E5"> firmware</font> <font color="#E5E5E5">actually running on these network</font> connected<font color="#E5E5E5"> surveillance cameras and</font> since I'm up here talking<font color="#CCCCCC"> about it as</font> you<font color="#E5E5E5"> might surmise</font><font color="#CCCCCC"> I found a lot of</font> <font color="#E5E5E5">interesting</font><font color="#CCCCCC"> things so I'll be dropping</font> <font color="#CCCCCC">some</font><font color="#E5E5E5"> O'Day's as well as some not so</font><font color="#CCCCCC"> Oh</font> days and<font color="#E5E5E5"> we'll talk about that when</font><font color="#CCCCCC"> we</font> get to it but<font color="#E5E5E5"> also demonstrating how these</font> vulnerabilities<font color="#E5E5E5"> ultimately can be</font> leveraged<font color="#CCCCCC"> and true Hollywood</font><font color="#E5E5E5"> style</font> <font color="#E5E5E5">fashion</font><font color="#CCCCCC"> so when I started looking</font><font color="#E5E5E5"> at</font> surveillance<font color="#E5E5E5"> cameras I said well I've</font> <font color="#E5E5E5">looked at a lot</font><font color="#CCCCCC"> of</font><font color="#E5E5E5"> embedded devices</font> <font color="#E5E5E5">before but I haven't looked at</font> <font color="#E5E5E5">surveillance cameras so I kind of wanted</font> <font color="#CCCCCC">to</font><font color="#E5E5E5"> start off with</font><font color="#CCCCCC"> something easy</font> <font color="#E5E5E5">something</font><font color="#CCCCCC"> that would be almost</font> guaranteed to<font color="#E5E5E5"> get me a win</font><font color="#CCCCCC"> so I picked</font> d-link<font color="#E5E5E5"> because they never fail to</font> <font color="#E5E5E5">disappoint specifically I looked at the</font> <font color="#E5E5E5">dcs 7410 which at around $900 is one of</font> their more expensive business IP cameras and like all the cameras that<font color="#E5E5E5"> I'm going</font> to<font color="#E5E5E5"> be</font><font color="#CCCCCC"> talking about today they provide</font> an administrative interface<font color="#CCCCCC"> as well as</font> access<font color="#CCCCCC"> to</font><font color="#E5E5E5"> the video feed through a web</font> server running<font color="#CCCCCC"> on</font><font color="#E5E5E5"> the camera</font><font color="#CCCCCC"> which makes</font> <font color="#E5E5E5">the</font><font color="#CCCCCC"> webserver a very attractive target</font> for<font color="#E5E5E5"> an attacker now specifically this</font> camera uses<font color="#CCCCCC"> light</font><font color="#E5E5E5"> II which is</font><font color="#CCCCCC"> an</font> <font color="#CCCCCC">open-source</font><font color="#E5E5E5"> web server that you find</font> used quite a bit in<font color="#E5E5E5"> embedded devices and</font> they<font color="#CCCCCC"> actually in the</font><font color="#E5E5E5"> lighting</font> configuration they set up<font color="#E5E5E5"> some very sane</font> and restrictive access<font color="#E5E5E5"> rules as to who</font> can get<font color="#CCCCCC"> to what through the web server</font> so<font color="#E5E5E5"> you can see here that if you wanted</font> to<font color="#CCCCCC"> get to anything</font><font color="#E5E5E5"> in the CGI admin</font> directory<font color="#CCCCCC"> you</font><font color="#E5E5E5"> have to be logged in as an</font> admin if you want to get to anything<font color="#CCCCCC"> in</font> the video<font color="#E5E5E5"> directory you can be any user</font> but<font color="#CCCCCC"> you do have</font><font color="#E5E5E5"> to be authenticated you</font> do have to be a valid user so they had entries for<font color="#CCCCCC"> every single directory</font><font color="#E5E5E5"> in</font> their web interface except one they did not have an entry for<font color="#E5E5E5"> CGI bin now as it</font> turns out<font color="#E5E5E5"> there's</font><font color="#CCCCCC"> not much in the CGI</font> bin directory<font color="#E5E5E5"> almost all of the CGI</font> scripts are actually in the CGI directory which<font color="#E5E5E5"> is protected</font><font color="#CCCCCC"> in fact CGI</font> bin<font color="#E5E5E5"> only has one file in it and that</font><font color="#CCCCCC"> was</font> <font color="#E5E5E5">our TPD CGI which is a shell script</font><font color="#CCCCCC"> that</font> can be used to<font color="#E5E5E5"> start and</font> the real-time transport<font color="#E5E5E5"> protocol daemon</font> <font color="#E5E5E5">so for example if you wanted to stop the</font> RTP<font color="#CCCCCC"> daemon</font><font color="#E5E5E5"> you would simply send a</font> request to<font color="#CCCCCC"> RTP D that CGI</font><font color="#E5E5E5"> and in your</font> query string you specify action<font color="#CCCCCC"> equal</font> stop to stop service the problem is the way they handle this query string that you provide is they replace all ampersands with spaces and then<font color="#E5E5E5"> eval the</font> <font color="#E5E5E5">result so they're literally executing in</font> a shell whatever you put in your query string and not only<font color="#E5E5E5"> that it</font><font color="#CCCCCC"> runs as</font> route so<font color="#E5E5E5"> you can do something like this</font> <font color="#CCCCCC">and it reboots the device and I actually</font> had a<font color="#CCCCCC"> hard time categorizing this</font> because it's<font color="#E5E5E5"> not even command injection</font> we're not injecting<font color="#E5E5E5"> anything</font><font color="#CCCCCC"> it's just</font> <font color="#CCCCCC">running whatever</font><font color="#E5E5E5"> we give it</font><font color="#CCCCCC"> so</font><font color="#E5E5E5"> I've</font> dubbed this the<font color="#E5E5E5"> Ron</font><font color="#CCCCCC"> Burgundy because it</font> will literally execute whatever<font color="#E5E5E5"> you put</font> in your query string not<font color="#E5E5E5"> only will it</font> execute what you put in your query string<font color="#E5E5E5"> but it'll send you the response</font> <font color="#E5E5E5">back to your browser so you can do</font> something like<font color="#E5E5E5"> this</font> this particular command<font color="#E5E5E5"> will echo</font><font color="#CCCCCC"> out</font> the admin password<font color="#CCCCCC"> you get that sent</font> back to<font color="#E5E5E5"> your</font><font color="#CCCCCC"> browser</font><font color="#E5E5E5"> and so you now have</font> <font color="#CCCCCC">the admin password and access to</font><font color="#E5E5E5"> the</font> video feed<font color="#E5E5E5"> and so you're not only route</font> you're also<font color="#E5E5E5"> admin now as it turns out</font> d-link like many vendors<font color="#E5E5E5"> really likes to</font> reuse code and so this popped up and a lot of their products<font color="#E5E5E5"> but it didn't just</font> <font color="#E5E5E5">affect d-link because it was also used</font> <font color="#E5E5E5">by TRENDnet and several other off-brand</font> devices as well<font color="#CCCCCC"> and due to</font><font color="#E5E5E5"> the</font><font color="#CCCCCC"> fact that</font> <font color="#E5E5E5">there are so much reuse</font><font color="#CCCCCC"> of this code</font> <font color="#E5E5E5">through within vendors and throughout</font> different<font color="#E5E5E5"> vendors</font><font color="#CCCCCC"> it turns out there's</font> quite<font color="#E5E5E5"> a</font><font color="#CCCCCC"> few</font><font color="#E5E5E5"> of them</font><font color="#CCCCCC"> already publicly</font> accessible in an indexed by<font color="#CCCCCC"> shodhan</font><font color="#E5E5E5"> for</font> you<font color="#CCCCCC"> now this vulnerability might sound</font> familiar<font color="#E5E5E5"> to some people and that's</font> because it probably<font color="#E5E5E5"> is of course after</font> my talk got<font color="#E5E5E5"> accepted</font> someone put a<font color="#CCCCCC"> CBE</font><font color="#E5E5E5"> out for this bug so</font> it's technically not<font color="#E5E5E5"> an eau de anymore</font> however the CVE only addressed d-link devices and did<font color="#E5E5E5"> not mention any</font><font color="#CCCCCC"> of</font><font color="#E5E5E5"> the</font> other vendors affected and the truth is <font color="#CCCCCC">even</font><font color="#E5E5E5"> if every single vendor</font> put out a firmer update fixing this today everyone would still be vulnerable <font color="#E5E5E5">like three</font><font color="#CCCCCC"> years from</font><font color="#E5E5E5"> now because no one</font> updates<font color="#CCCCCC"> firmware</font><font color="#E5E5E5"> or even knows what it</font> is half<font color="#E5E5E5"> the time so I expect this bug</font> even though it's technically not a<font color="#CCCCCC"> know</font> <font color="#E5E5E5">day to be quite useful</font><font color="#CCCCCC"> for some time to</font> come so I said<font color="#E5E5E5"> okay d-link is an easy</font> target<font color="#CCCCCC"> as I mentioned that's why I</font> picked them<font color="#E5E5E5"> let's move on to perhaps a</font> more reputable vendor like Cisco<font color="#CCCCCC"> the</font> Cisco PVC 2300 is kind<font color="#E5E5E5"> of a mid-range</font> <font color="#E5E5E5">business IP camera runs about</font><font color="#CCCCCC"> $500 now</font> it too has a web server and it<font color="#E5E5E5"> enforces</font> authentication by<font color="#E5E5E5"> using HTTP word files</font> which most<font color="#CCCCCC"> people</font><font color="#E5E5E5"> are</font><font color="#CCCCCC"> probably already</font> familiar<font color="#E5E5E5"> with so</font><font color="#CCCCCC"> basically you put an HT</font> password file<font color="#E5E5E5"> or more specifically a sim</font> <font color="#CCCCCC">link to a centralized</font><font color="#E5E5E5"> HT password file</font> in every directory that<font color="#CCCCCC"> you want to be</font> password<font color="#E5E5E5"> protected</font><font color="#CCCCCC"> so looking through</font> the firmware every single directory in the web interface<font color="#CCCCCC"> had a dot</font><font color="#E5E5E5"> HT password</font> file except one<font color="#CCCCCC"> the o amp</font><font color="#E5E5E5"> directory did</font> not have any HT password file<font color="#E5E5E5"> what it</font> had was a bunch<font color="#CCCCCC"> of</font><font color="#E5E5E5"> XML files that were</font> actually sim links to this<font color="#CCCCCC"> om CGI binary</font> so I said<font color="#E5E5E5"> okay well</font><font color="#CCCCCC"> let's let's look</font><font color="#E5E5E5"> at</font> what this<font color="#CCCCCC"> o</font><font color="#E5E5E5"> and CGI thing does and as it</font> turns out it implements kind of its own <font color="#E5E5E5">little mini API that's totally separate</font> from<font color="#E5E5E5"> the rest of everything else running</font> <font color="#CCCCCC">in the</font><font color="#E5E5E5"> web interface</font><font color="#CCCCCC"> so it expects you</font> when you make a request to<font color="#E5E5E5"> it to specify</font> an action<font color="#E5E5E5"> and this actually you can</font> specify it can be one of<font color="#E5E5E5"> many different</font> <font color="#E5E5E5">things</font><font color="#CCCCCC"> including download configuration</font> file<font color="#E5E5E5"> update firmware and many others but</font> they weren't<font color="#E5E5E5"> completely stupid we'll get</font> to the stupid stuff later<font color="#CCCCCC"> but they</font> <font color="#E5E5E5">weren't completely stupid</font><font color="#CCCCCC"> because what</font> they do<font color="#E5E5E5"> is before executing an action</font> <font color="#E5E5E5">they check to make</font><font color="#CCCCCC"> sure</font><font color="#E5E5E5"> that you've</font><font color="#CCCCCC"> also</font> provided a valid session ID<font color="#E5E5E5"> if you have</font> not provided<font color="#E5E5E5"> a valid session ID the only</font> action<font color="#CCCCCC"> it lets you</font><font color="#E5E5E5"> run is the</font><font color="#CCCCCC"> login</font> <font color="#E5E5E5">action</font><font color="#CCCCCC"> I said</font><font color="#E5E5E5"> okay well this in itself</font> is<font color="#CCCCCC"> interesting because they're</font> implementing authentication that's totally separate from<font color="#E5E5E5"> the authentication</font> used<font color="#E5E5E5"> everywhere</font> else in the interface so I started looking<font color="#E5E5E5"> at how they actually handle this</font> <font color="#CCCCCC">login action they expect you to specify</font> <font color="#CCCCCC">a username and a password all</font><font color="#E5E5E5"> right so</font> no<font color="#E5E5E5"> surprises there they then make two</font> calls to<font color="#CCCCCC"> this Pro get stir function</font><font color="#E5E5E5"> now</font> at this<font color="#E5E5E5"> point I have no idea what probe</font> <font color="#CCCCCC">get stirred does presumably it gets a</font> string of some sort<font color="#E5E5E5"> but I do know</font><font color="#CCCCCC"> that</font> on the first<font color="#E5E5E5"> call to this function</font><font color="#CCCCCC"> they</font> pass it<font color="#CCCCCC"> two strings o amp</font><font color="#E5E5E5"> and</font><font color="#CCCCCC"> l1 user</font> and on the second call they pass<font color="#E5E5E5"> o amp</font> <font color="#E5E5E5">and l1 password now the value returned</font> for l1 user is then<font color="#E5E5E5"> compared against the</font> username that<font color="#E5E5E5"> you provided and the value</font> returned for l1 password is compared against the password you<font color="#CCCCCC"> provided</font><font color="#E5E5E5"> so</font> presumably this l1 user<font color="#CCCCCC"> and a</font><font color="#E5E5E5"> one</font> password<font color="#CCCCCC"> whatever</font><font color="#E5E5E5"> their values are are</font> the correct login<font color="#E5E5E5"> for this o amp</font> interface now the<font color="#CCCCCC"> only other place I</font> could<font color="#CCCCCC"> find in</font><font color="#E5E5E5"> the firmware that actually</font> referenced l1 user and l1 password was in the configuration<font color="#E5E5E5"> file these</font><font color="#CCCCCC"> values</font> <font color="#E5E5E5">are hard-coded</font><font color="#CCCCCC"> in the devices</font><font color="#E5E5E5"> running</font> config<font color="#CCCCCC"> under the</font><font color="#E5E5E5"> o amp</font><font color="#CCCCCC"> section of the</font> configuration file<font color="#CCCCCC"> you can</font><font color="#E5E5E5"> see that l1</font> user is set to the string<font color="#E5E5E5"> l1 underscore</font> admin and l1 password is set to the string l1 underscore 51 and this is a real problem<font color="#E5E5E5"> because this whole a lamp</font> interface and these hard-coded accounts are completely undocumented<font color="#E5E5E5"> so no one</font> knows they're there<font color="#E5E5E5"> except for people</font> who bother to look<font color="#E5E5E5"> at the firmware which</font> of<font color="#CCCCCC"> course an admin is never</font><font color="#E5E5E5"> going to do</font> <font color="#CCCCCC">that and even</font><font color="#E5E5E5"> if an admin knew that</font> these were here there's no way for the admin to change this there's no interface for the admin to go in and change these<font color="#CCCCCC"> values and the problem with</font> having<font color="#E5E5E5"> hard-coded secret passwords in</font> your system and<font color="#CCCCCC"> backdoors is that they</font> don't stay secret<font color="#E5E5E5"> for long right</font> so we<font color="#E5E5E5"> can use these these backdoor</font> accounts to<font color="#CCCCCC"> exorcise the</font><font color="#E5E5E5"> login action</font> and sure enough we<font color="#E5E5E5"> get back a session ID</font> <font color="#E5E5E5">now as long as we send the session ID</font> <font color="#E5E5E5">along with all of</font><font color="#CCCCCC"> our</font><font color="#E5E5E5"> other requests we</font> can invoke<font color="#E5E5E5"> any of the other actions</font> <font color="#E5E5E5">supported by</font><font color="#CCCCCC"> om CGI including download</font> configuration file and this gives us back<font color="#E5E5E5"> what appears to</font> be base 64 encoded data<font color="#E5E5E5"> the problem is</font> if<font color="#E5E5E5"> you try to base64 decode this no</font> <font color="#CCCCCC">worky you just get a bunch</font><font color="#E5E5E5"> of junk</font><font color="#CCCCCC"> the</font> reason<font color="#E5E5E5"> for that becomes readily apparent</font> <font color="#E5E5E5">when</font><font color="#CCCCCC"> you</font><font color="#E5E5E5"> look at the actual</font><font color="#CCCCCC"> end code</font><font color="#E5E5E5"> 64</font> function in the binary itself they are <font color="#E5E5E5">doing basics</font><font color="#CCCCCC"> to for encoding</font><font color="#E5E5E5"> but they're</font> using a<font color="#E5E5E5"> non-standard base64 key string</font> luckily<font color="#E5E5E5"> it's very easy and</font><font color="#CCCCCC"> python</font><font color="#E5E5E5"> to</font> substitute<font color="#CCCCCC"> the standard base 64 key</font> string and pythons<font color="#CCCCCC"> base</font><font color="#E5E5E5"> 64 module with a</font> custom key string like<font color="#CCCCCC"> this and so with</font> a<font color="#E5E5E5"> couple lines of Python we can easily</font> decode<font color="#E5E5E5"> the config which gives us</font> <font color="#E5E5E5">plaintext admin creds which lets me see</font> your server room<font color="#E5E5E5"> now the problem with</font> viewing some of<font color="#E5E5E5"> the server rooms is</font> really exciting<font color="#CCCCCC"> for like</font><font color="#E5E5E5"> 10 seconds and</font> then you're<font color="#E5E5E5"> like holy shit this</font><font color="#CCCCCC"> is</font> boring<font color="#CCCCCC"> so I went</font><font color="#E5E5E5"> back and</font><font color="#CCCCCC"> started</font> <font color="#CCCCCC">looking at some more</font><font color="#E5E5E5"> code because that's</font> <font color="#E5E5E5">more</font><font color="#CCCCCC"> exciting now the load firmware</font> action is one of the other actions you can invoke<font color="#E5E5E5"> and it's actually</font><font color="#CCCCCC"> very</font> interesting<font color="#CCCCCC"> because instead of</font><font color="#E5E5E5"> uploading</font> a firmware file to the device<font color="#E5E5E5"> you</font> specify a URL<font color="#E5E5E5"> and then the device goes</font> that URL downloads presumably the firmware<font color="#E5E5E5"> and then flashes it the problem</font> is<font color="#E5E5E5"> that URL that</font><font color="#CCCCCC"> you specify is shoved</font> into a<font color="#E5E5E5"> command line string that's</font> <font color="#E5E5E5">ultimately passed ellipses system and</font> hopefully everyone<font color="#E5E5E5"> here knows that</font> <font color="#E5E5E5">taking unfiltered</font><font color="#CCCCCC"> user-supplied content</font> <font color="#E5E5E5">and passing it to system is bad</font><font color="#CCCCCC"> you</font> don't<font color="#E5E5E5"> do it so we</font><font color="#CCCCCC"> can easily do command</font> <font color="#CCCCCC">injection through</font><font color="#E5E5E5"> this parameter just</font> <font color="#E5E5E5">putting semicolon</font><font color="#CCCCCC"> reboots semicolon</font> somewhere in your<font color="#E5E5E5"> URL reboots the</font> <font color="#CCCCCC">machine and of course we can run</font> whatever<font color="#E5E5E5"> command we want at this point</font> <font color="#CCCCCC">this</font><font color="#E5E5E5"> also affects the</font><font color="#CCCCCC"> wvc 2300 it's</font> basically the<font color="#E5E5E5"> same camera but with</font> antennas and there are hundreds of these cameras already<font color="#E5E5E5"> out there online in</font> hotels obviously server rooms and engineering <font color="#E5E5E5">companies who design things for</font><font color="#CCCCCC"> the</font> <font color="#E5E5E5">International Space</font><font color="#CCCCCC"> Station I'm told</font> so I said okay clearly<font color="#E5E5E5"> d-link and Cisco</font> are doing it wrong in their<font color="#E5E5E5"> defense</font> though you know they're<font color="#E5E5E5"> not really</font> <font color="#E5E5E5">camera companies they</font><font color="#CCCCCC"> don't</font><font color="#E5E5E5"> do cameras</font> cameras isn't really<font color="#CCCCCC"> their their focus</font> <font color="#E5E5E5">so let's look at someone who is a camera</font> <font color="#CCCCCC">company's their bread and butter</font> <font color="#CCCCCC">hopefully they know how to do it right</font> <font color="#CCCCCC">so I picked on IQ and vision partially</font> <font color="#CCCCCC">because they make some really expensive</font> <font color="#E5E5E5">high definition cameras</font><font color="#CCCCCC"> the</font><font color="#E5E5E5"> IQ 832 n for</font> <font color="#CCCCCC">example will run you over a thousand</font> <font color="#CCCCCC">dollars a piece so it was certainly not</font> cheap the main reason though is<font color="#CCCCCC"> that</font><font color="#E5E5E5"> these are</font> <font color="#CCCCCC">the</font><font color="#E5E5E5"> guys who</font><font color="#CCCCCC"> make the cameras that are</font> used in<font color="#E5E5E5"> the business complex where I</font> work<font color="#E5E5E5"> so</font><font color="#CCCCCC"> is a little more personal and</font> what you get for a thousand dollars<font color="#CCCCCC"> per</font> camera<font color="#E5E5E5"> is a</font><font color="#CCCCCC"> high-definition video feed</font> unauthenticated<font color="#E5E5E5"> open to the world</font><font color="#CCCCCC"> by</font> default now admittedly<font color="#E5E5E5"> this is a</font> configurable<font color="#E5E5E5"> option you can require</font> authentication<font color="#E5E5E5"> this is the default</font> <font color="#E5E5E5">setting but you can go in as an admin</font> and<font color="#E5E5E5"> change that now guess how many</font> admins connected their cameras the internet without<font color="#E5E5E5"> changing that default</font> setting almost all of them<font color="#CCCCCC"> so this is</font> <font color="#CCCCCC">really</font><font color="#E5E5E5"> interesting</font><font color="#CCCCCC"> but it's not</font><font color="#E5E5E5"> really</font> that interesting<font color="#CCCCCC"> from a security</font> <font color="#E5E5E5">standpoint right it's like oh</font><font color="#CCCCCC"> okay they</font> don't<font color="#E5E5E5"> know how to secure their stuff</font><font color="#CCCCCC"> big</font> deal<font color="#E5E5E5"> I but I wanted some actual</font> vulnerabilities so I said well let's look at<font color="#E5E5E5"> getting into</font><font color="#CCCCCC"> the admin area</font> which is password<font color="#CCCCCC"> protected</font><font color="#E5E5E5"> and which</font> thankfully<font color="#E5E5E5"> most admins had the presence</font> of<font color="#CCCCCC"> mind</font><font color="#E5E5E5"> to change the default settings</font> for so to do this<font color="#E5E5E5"> I started looking at</font> what else can I get<font color="#E5E5E5"> to without</font> authentication<font color="#CCCCCC"> and one of the few pages</font> <font color="#CCCCCC">that you can get to without</font> authentication<font color="#E5E5E5"> is oh I D table dot CGI</font> and the output from<font color="#CCCCCC"> OID table really</font> <font color="#CCCCCC">isn't</font><font color="#E5E5E5"> that interesting it's a bunch of</font> <font color="#E5E5E5">technicals camera settings like focus</font> and all that other<font color="#E5E5E5"> stuff there's nothing</font> really sensitive<font color="#CCCCCC"> in here like usernames</font> <font color="#E5E5E5">and passwords</font><font color="#CCCCCC"> what's more interesting is</font> the<font color="#E5E5E5"> code behind</font><font color="#CCCCCC"> oh id table because if</font> you if you<font color="#CCCCCC"> disassemble this</font><font color="#E5E5E5"> CGI binary</font> you'll see that it<font color="#E5E5E5"> looks to see</font><font color="#CCCCCC"> if</font><font color="#E5E5E5"> you</font> <font color="#E5E5E5">specified a grep parameter in your query</font> string when<font color="#E5E5E5"> you send your get request</font> <font color="#E5E5E5">to it now if you</font><font color="#CCCCCC"> have it checks</font><font color="#E5E5E5"> to make</font> sure<font color="#E5E5E5"> the value you provided is less than</font> 32 bytes long<font color="#E5E5E5"> and as long as</font><font color="#CCCCCC"> you meet</font> <font color="#E5E5E5">that requirement</font><font color="#CCCCCC"> it'll take that</font><font color="#E5E5E5"> string</font> <font color="#E5E5E5">shove</font><font color="#CCCCCC"> it into</font><font color="#E5E5E5"> a grep command and pass it</font> <font color="#CCCCCC">to P open at which case I facepalm</font> did my best<font color="#E5E5E5"> Kim</font><font color="#CCCCCC"> Jong eagle impression</font> and did some command injection<font color="#CCCCCC"> and again</font> <font color="#E5E5E5">just like with</font><font color="#CCCCCC"> the D link you see I can</font> run a PS command<font color="#CCCCCC"> and I get the output</font> <font color="#CCCCCC">sent back to my</font><font color="#E5E5E5"> browser</font><font color="#CCCCCC"> so I have a</font> built-in unauthenticated web root<font color="#E5E5E5"> shell</font> <font color="#E5E5E5">already on the device</font><font color="#CCCCCC"> it's also worth</font> noting that<font color="#E5E5E5"> while process listings are</font> interesting<font color="#CCCCCC"> these cameras</font><font color="#E5E5E5"> already have</font> netcat installed on them with the<font color="#CCCCCC"> -</font><font color="#E5E5E5"> I</font> option enabled so I'm sure most<font color="#CCCCCC"> people</font> here can think it's more<font color="#E5E5E5"> interesting</font> commands<font color="#E5E5E5"> to</font><font color="#CCCCCC"> run than a process</font><font color="#E5E5E5"> listing</font> but my main<font color="#CCCCCC"> goal and all this</font><font color="#E5E5E5"> was really</font> to get<font color="#E5E5E5"> to the admin area recall so I</font> said well how can<font color="#E5E5E5"> I do</font><font color="#CCCCCC"> that well we can</font> <font color="#CCCCCC">also use this bug to retrieve our the</font> contents of arbitrary of files<font color="#E5E5E5"> now the</font> Etsy<font color="#CCCCCC"> Prive word file</font><font color="#E5E5E5"> is what contains</font> the actual admin credentials<font color="#E5E5E5"> it's not an</font> FC password<font color="#CCCCCC"> it's actually prove password</font> <font color="#CCCCCC">so we can we can pull back the contents</font> <font color="#E5E5E5">of that file and as you can see here it</font> <font color="#CCCCCC">has the username</font><font color="#E5E5E5"> root and the</font> unencrypted password<font color="#E5E5E5"> so at this point we</font> have two<font color="#E5E5E5"> options</font><font color="#CCCCCC"> you can</font><font color="#E5E5E5"> try and decrypt</font> the password<font color="#E5E5E5"> or if</font><font color="#CCCCCC"> that doesn't work I</font> mean screw it we're<font color="#E5E5E5"> root we'll just</font> overwrite the file with<font color="#CCCCCC"> whatever we want</font> <font color="#CCCCCC">in either case we get access</font><font color="#E5E5E5"> to the</font> admin<font color="#E5E5E5"> area and again we're both</font><font color="#CCCCCC"> root and</font> admin on these cameras these bugs<font color="#CCCCCC"> affect</font> <font color="#E5E5E5">most of IQ and visions product line</font> including their<font color="#CCCCCC"> three series cameras the</font> <font color="#CCCCCC">seven series</font><font color="#E5E5E5"> The Sentinel series the</font> <font color="#E5E5E5">Alliance Pro Alliance MX and Alliance</font> <font color="#CCCCCC">miniseries I won't read off all</font><font color="#E5E5E5"> the</font> models<font color="#E5E5E5"> it's I'll be up here</font><font color="#CCCCCC"> forever</font> and there are plenty<font color="#E5E5E5"> of these out online</font> <font color="#E5E5E5">which is a little distressing</font> considering that they're known to<font color="#CCCCCC"> be</font> deployed<font color="#CCCCCC"> by schools police banks</font> <font color="#CCCCCC">government's prisons casinos utility</font> companies financial consulting firms and DHL to name a few<font color="#CCCCCC"> so have</font><font color="#E5E5E5"> fun with that</font> by far the most expensive camera I looked at though was the N<font color="#E5E5E5"> 50 72 from 3s</font> vision<font color="#CCCCCC"> now this one has a list price of</font> contact us which is how I know I can't afford it and I rent to a bit of<font color="#CCCCCC"> a problem with</font> <font color="#E5E5E5">this particular camera</font><font color="#CCCCCC"> a little hiccup</font> at first<font color="#CCCCCC"> because for</font><font color="#E5E5E5"> all the other</font> cameras I had been<font color="#E5E5E5"> able</font><font color="#CCCCCC"> to</font><font color="#E5E5E5"> just go</font><font color="#CCCCCC"> to</font> <font color="#E5E5E5">the vendor website</font><font color="#CCCCCC"> pull down a firmware</font> update<font color="#E5E5E5"> whatever the latest firmware</font> update was and start analyzing the code <font color="#E5E5E5">and the firmware for vulnerabilities so</font> I really didn't<font color="#E5E5E5"> have to buy the device</font> <font color="#CCCCCC">in</font><font color="#E5E5E5"> order to at least do initial testing</font> and things<font color="#E5E5E5"> like</font><font color="#CCCCCC"> that when I went to</font> download the firmware for this camera<font color="#E5E5E5"> it</font> gave<font color="#E5E5E5"> me a</font><font color="#CCCCCC"> little JavaScript</font><font color="#E5E5E5"> pop-up box</font> on the<font color="#E5E5E5"> vendors web page saying</font><font color="#CCCCCC"> ah</font><font color="#E5E5E5"> we</font> want<font color="#CCCCCC"> your password so I immediately</font> tried all the most<font color="#E5E5E5"> common passwords</font><font color="#CCCCCC"> love</font> sex<font color="#E5E5E5"> god of course none</font><font color="#CCCCCC"> of those worked</font> <font color="#E5E5E5">what ended up working though was tab</font> equals<font color="#CCCCCC"> 4</font><font color="#E5E5E5"> because if you look at the</font> JavaScript<font color="#CCCCCC"> it</font><font color="#E5E5E5"> sends your password back</font> to the server<font color="#CCCCCC"> I don't even need</font><font color="#E5E5E5"> to</font> <font color="#CCCCCC">explain to</font><font color="#E5E5E5"> see you guys</font><font color="#CCCCCC"> it's great</font><font color="#E5E5E5"> and</font> as long as<font color="#CCCCCC"> you</font><font color="#E5E5E5"> get the password right it</font> just<font color="#E5E5E5"> redirects you to your current</font><font color="#CCCCCC"> URL</font> with ampersand tab equals for<font color="#E5E5E5"> appended</font> <font color="#E5E5E5">onto the end of it and I said well gee</font> since I'm literate<font color="#E5E5E5"> and all I bet I can</font> do that<font color="#E5E5E5"> myself</font><font color="#CCCCCC"> and sure enough I</font><font color="#E5E5E5"> get the</font> download page so this does<font color="#CCCCCC"> not bode well for the</font> security of their systems nor does<font color="#CCCCCC"> the</font> fact that<font color="#CCCCCC"> they're using a custom web</font> server it's rather innocuous<font color="#CCCCCC"> Lee named httpd</font> <font color="#CCCCCC">but if you actually look just</font><font color="#E5E5E5"> look at</font> the strings in<font color="#CCCCCC"> this binary</font><font color="#E5E5E5"> it's very</font> clear that<font color="#E5E5E5"> this is very custom to their</font> firmware<font color="#CCCCCC"> it's</font><font color="#E5E5E5"> either something that they</font> rolled themselves<font color="#E5E5E5"> from scratch or</font> something that's<font color="#E5E5E5"> been</font><font color="#CCCCCC"> very</font><font color="#E5E5E5"> heavily</font> modified by them<font color="#CCCCCC"> so I said well if this</font> this looks<font color="#E5E5E5"> really custom</font><font color="#CCCCCC"> I really need</font> to<font color="#E5E5E5"> start</font><font color="#CCCCCC"> looking at</font><font color="#E5E5E5"> how their web server</font> handles authentication<font color="#CCCCCC"> now I know that</font> the cameras use basic HTTP basic authentication<font color="#CCCCCC"> so I know</font><font color="#E5E5E5"> that they're</font> going<font color="#E5E5E5"> to be doing some base64 decoding</font> <font color="#E5E5E5">because if you're not familiar with HTTP</font> basic<font color="#E5E5E5"> off your username and password</font><font color="#CCCCCC"> are</font> basically concatenated<font color="#E5E5E5"> and then basic</font><font color="#CCCCCC"> c4</font> <font color="#E5E5E5">encoded so I started looking</font><font color="#CCCCCC"> through</font><font color="#E5E5E5"> the</font> code for<font color="#CCCCCC"> cross references</font><font color="#E5E5E5"> to be 64</font> decode<font color="#CCCCCC"> and so what they do when they</font> when they decode your password is they pass it to be 64 decode<font color="#E5E5E5"> all right that's</font> fine<font color="#CCCCCC"> that's their decoding your</font><font color="#E5E5E5"> stuff</font> they then do<font color="#CCCCCC"> two string comparisons</font> against a hard-coded<font color="#E5E5E5"> string 3s admin and</font> another hard-coded string<font color="#E5E5E5"> two seven</font><font color="#CCCCCC"> nine</font> eight<font color="#CCCCCC"> eight three zero three I saw this</font> <font color="#E5E5E5">when I thought there is no</font><font color="#CCCCCC"> way you were</font> dumb enough<font color="#CCCCCC"> to hard code stuff into your</font> HTTP server these can't possibly be creds but they were and they work great so you can access<font color="#CCCCCC"> any 3's vision camera</font> become admin<font color="#E5E5E5"> with these backdoor creds</font> <font color="#CCCCCC">and that gives you</font><font color="#E5E5E5"> access to video feeds</font> of cash machines<font color="#CCCCCC"> Taiwanese checkpoints</font> and Russian industrial basements<font color="#E5E5E5"> at</font> least that's what<font color="#E5E5E5"> I assume that</font><font color="#CCCCCC"> is</font><font color="#E5E5E5"> now</font> again looking<font color="#E5E5E5"> at video feeds is really</font> boring<font color="#E5E5E5"> so I wanted route luckily their</font> code is littered especially once<font color="#E5E5E5"> you're</font> logged in as admin your<font color="#CCCCCC"> tax surface is</font> wide open <font color="#E5E5E5">and their code is just littered with</font> unsafe function calls is absolutely horrible<font color="#CCCCCC"> probably the best example of</font> this is their<font color="#CCCCCC"> record</font><font color="#E5E5E5"> CGI handler</font><font color="#CCCCCC"> now not</font> all<font color="#CCCCCC"> of the cameras but many of their</font> cameras support<font color="#E5E5E5"> local storage so</font><font color="#CCCCCC"> you can</font> plug in say an SD card<font color="#CCCCCC"> to the camera and</font> <font color="#E5E5E5">it'll save files off to the SD card</font><font color="#CCCCCC"> for</font> you so they also provide a<font color="#CCCCCC"> way</font><font color="#E5E5E5"> to do</font> some<font color="#CCCCCC"> basic file management from the</font> admin<font color="#E5E5E5"> interface</font><font color="#CCCCCC"> and this is done</font><font color="#E5E5E5"> through</font> <font color="#E5E5E5">the record CGI page now record CGI is</font> not a physical CGI page sitting on disk what happens is when the<font color="#E5E5E5"> web server sees</font> that<font color="#E5E5E5"> you requested record CGI and it</font> invokes the do records function handler <font color="#E5E5E5">so the do records function handler</font> checks to see what action you've provided<font color="#E5E5E5"> so for example if you wanted to</font> delete<font color="#CCCCCC"> a file you can tell it action</font> equals remove<font color="#E5E5E5"> now if you're deleting a</font> file<font color="#CCCCCC"> you also have to tell it which</font><font color="#E5E5E5"> file</font> <font color="#E5E5E5">you want to lead it so it checks to make</font> <font color="#CCCCCC">sure</font><font color="#E5E5E5"> that you've specified a file name</font> as well that file<font color="#E5E5E5"> name is then shoved</font> into an RM command<font color="#CCCCCC"> that is passed to</font> system<font color="#E5E5E5"> and I think everyone knows where</font> this<font color="#E5E5E5"> is going</font><font color="#CCCCCC"> yeah</font> setting file name equals<font color="#E5E5E5"> backticks</font> reboot backtick makes it not respond to pings anymore now this affects almost<font color="#E5E5E5"> all</font><font color="#CCCCCC"> 3s visions</font> product line<font color="#E5E5E5"> not only the cameras but</font> also their video servers because<font color="#E5E5E5"> they</font> use the same<font color="#E5E5E5"> web server as well</font><font color="#CCCCCC"> and</font> after<font color="#CCCCCC"> a bit of research I found that</font> another company<font color="#E5E5E5"> named a linking use the</font> same code in their cameras as well<font color="#E5E5E5"> now a</font> linking went through and changed the hard-coded<font color="#E5E5E5"> creds to something else so</font> they still have<font color="#CCCCCC"> all the a linking</font> cameras have the same hard-coded creds they're just<font color="#E5E5E5"> different from</font><font color="#CCCCCC"> 3s visions</font> <font color="#CCCCCC">hard</font><font color="#E5E5E5"> coded creds</font><font color="#CCCCCC"> and I'll leave finding</font> <font color="#E5E5E5">those as an exercise to the reader</font><font color="#CCCCCC"> but</font> they're there<font color="#E5E5E5"> and they're easy to</font><font color="#CCCCCC"> find</font> now these cameras are particularly <font color="#E5E5E5">interesting due to their their cost</font> <font color="#E5E5E5">there's not a whole lot</font><font color="#CCCCCC"> of</font><font color="#E5E5E5"> them you know</font> when compared<font color="#E5E5E5"> to some of the other</font> <font color="#E5E5E5">devices</font><font color="#CCCCCC"> but considering that these</font> cameras are known to<font color="#CCCCCC"> be deployed in</font> foreign military energy and<font color="#CCCCCC"> industrial</font> <font color="#CCCCCC">facilities they're particularly</font> interesting<font color="#E5E5E5"> so all of you who are</font> <font color="#CCCCCC">already like looking these up on shodhan</font> you know be<font color="#E5E5E5"> careful don't blame me when</font> <font color="#E5E5E5">the Chinese military shows up and gets</font> pissed<font color="#E5E5E5"> at you</font><font color="#CCCCCC"> so what all this what this</font> all boils<font color="#E5E5E5"> down to is I'm in your network</font> <font color="#E5E5E5">I can see you and I'm route which is not</font> a bad position<font color="#CCCCCC"> for</font><font color="#E5E5E5"> any attacker to be in</font> most of these cameras with the<font color="#CCCCCC"> way that</font> <font color="#E5E5E5">they're deployed they're actually</font> <font color="#E5E5E5">connected to the internal</font><font color="#CCCCCC"> network so if</font> you can remotely access them and break into them<font color="#E5E5E5"> get</font><font color="#CCCCCC"> route on them you now have</font> a<font color="#E5E5E5"> linux-based</font><font color="#CCCCCC"> or machine</font><font color="#E5E5E5"> sitting inside</font> their network that you can then use<font color="#CCCCCC"> to</font> go after<font color="#E5E5E5"> anything else in the network</font> <font color="#CCCCCC">but</font><font color="#E5E5E5"> I wanted</font><font color="#CCCCCC"> to</font><font color="#E5E5E5"> kind of take a</font><font color="#CCCCCC"> step back</font> from<font color="#E5E5E5"> that and</font><font color="#CCCCCC"> say ok that's</font><font color="#E5E5E5"> great and</font> all<font color="#CCCCCC"> but what</font><font color="#E5E5E5"> can I do to the camera</font> itself<font color="#CCCCCC"> all right I've got</font><font color="#E5E5E5"> root on the</font> camera this<font color="#CCCCCC"> is awesome but if you go</font><font color="#E5E5E5"> up</font> to<font color="#CCCCCC"> noon at</font><font color="#E5E5E5"> average admin to say I got</font> <font color="#E5E5E5">root on your camera he's like I don't</font> <font color="#CCCCCC">even</font><font color="#E5E5E5"> know what that means</font> <font color="#CCCCCC">write it what the hell</font><font color="#E5E5E5"> are</font><font color="#CCCCCC"> you</font><font color="#E5E5E5"> talking</font> about so I wanted<font color="#E5E5E5"> to do something a</font> <font color="#E5E5E5">little more interesting</font><font color="#CCCCCC"> something that</font> would<font color="#CCCCCC"> actually demonstrate</font><font color="#E5E5E5"> what you can</font> do so<font color="#E5E5E5"> skipping slides</font><font color="#CCCCCC"> I wanted to take</font> say a video stream that looks like this and instead make it look like this <font color="#E5E5E5">and this is kind of the classic</font> <font color="#CCCCCC">Hollywood hack right you've got you've</font> <font color="#E5E5E5">got to get into the facility that's</font> guarded<font color="#CCCCCC"> and it's got security</font><font color="#E5E5E5"> cameras so</font> <font color="#CCCCCC">the token hacker</font><font color="#E5E5E5"> of the group has</font><font color="#CCCCCC"> to</font> break into this<font color="#E5E5E5"> camera system</font><font color="#CCCCCC"> and make</font> <font color="#CCCCCC">it look</font><font color="#E5E5E5"> like</font><font color="#CCCCCC"> no one's there when really</font> they are<font color="#E5E5E5"> so to demonstrate</font><font color="#CCCCCC"> this and</font><font color="#E5E5E5"> just</font> do a<font color="#E5E5E5"> little proof of concept</font> I picked a trend net IP<font color="#CCCCCC"> 410</font><font color="#E5E5E5"> WN now I</font> <font color="#CCCCCC">picked this camera</font><font color="#E5E5E5"> for a couple reasons</font> <font color="#CCCCCC">first</font><font color="#E5E5E5"> of all I can afford</font><font color="#CCCCCC"> it which is a</font> big plus<font color="#CCCCCC"> but secondly it has a backdoor</font> account that can access<font color="#E5E5E5"> certain</font> <font color="#E5E5E5">restricted files which have very obvious</font> command injection bugs<font color="#E5E5E5"> which can be</font> trivially exploited by anyone<font color="#CCCCCC"> who can</font> <font color="#E5E5E5">send packets to</font><font color="#CCCCCC"> the camera</font><font color="#E5E5E5"> in other</font> words it's the<font color="#CCCCCC"> same stuff I've done up</font> <font color="#CCCCCC">here talking</font><font color="#E5E5E5"> about the whole time</font><font color="#CCCCCC"> just</font> <font color="#CCCCCC">on a</font><font color="#E5E5E5"> slightly less expensive camera</font><font color="#CCCCCC"> now</font> as it<font color="#E5E5E5"> turns out this</font><font color="#CCCCCC"> particular bug is</font> also not<font color="#E5E5E5"> a</font><font color="#CCCCCC"> node a</font><font color="#E5E5E5"> it was actually first</font> published in 2011<font color="#E5E5E5"> the problem is I</font> didn't<font color="#E5E5E5"> know about it and</font><font color="#CCCCCC"> neither</font><font color="#E5E5E5"> did</font> <font color="#E5E5E5">anyone else because they when they</font> published this they didn't mention<font color="#CCCCCC"> any</font> specific<font color="#E5E5E5"> devices that were affected they</font> didn't mention<font color="#E5E5E5"> any specific firmware</font> versions that were affected so if you went in googled for yo<font color="#CCCCCC"> TV</font><font color="#E5E5E5"> IP</font><font color="#CCCCCC"> 410 WN</font> vulnerabilities or<font color="#E5E5E5"> exploits</font><font color="#CCCCCC"> you didn't</font> <font color="#E5E5E5">find anything</font><font color="#CCCCCC"> and the problem with</font><font color="#E5E5E5"> not</font> providing<font color="#E5E5E5"> this</font><font color="#CCCCCC"> information</font><font color="#E5E5E5"> when you do</font> things like vulnerability reports<font color="#CCCCCC"> is</font> it's difficult<font color="#CCCCCC"> for other people in the</font> <font color="#CCCCCC">security</font><font color="#E5E5E5"> community to validate your</font> claims<font color="#E5E5E5"> first</font><font color="#CCCCCC"> of</font><font color="#E5E5E5"> all but it also makes it</font> impossible for vendors and<font color="#E5E5E5"> customers to</font> <font color="#E5E5E5">determine what models need to be fixed</font> <font color="#CCCCCC">and whether I'm actually</font><font color="#E5E5E5"> vulnerable or</font> not<font color="#E5E5E5"> so the easiest solution here is to</font> <font color="#CCCCCC">just</font><font color="#E5E5E5"> ignore it and hope it goes</font><font color="#CCCCCC"> away</font> which is what<font color="#CCCCCC"> everyone did so these</font> devices<font color="#E5E5E5"> even though this is a known bug</font> <font color="#E5E5E5">since 2011 have been shipping with these</font> bugs ever since<font color="#CCCCCC"> oh yeah there's a lot</font><font color="#E5E5E5"> of them</font> out<font color="#E5E5E5"> there</font><font color="#CCCCCC"> too</font> so let's say hypothetically<font color="#E5E5E5"> this is our</font> admins video feed<font color="#E5E5E5"> we want to make</font><font color="#CCCCCC"> sure</font> it stays that way right<font color="#CCCCCC"> so for purposes</font> <font color="#CCCCCC">of</font><font color="#E5E5E5"> demonstration</font><font color="#CCCCCC"> will assume that the</font> admin is<font color="#CCCCCC"> browsing the video feed through</font> the web interface<font color="#CCCCCC"> rather than</font><font color="#E5E5E5"> maybe</font> through a custom service<font color="#E5E5E5"> or RT PE</font><font color="#CCCCCC"> D or</font> something<font color="#CCCCCC"> like that so if you're on this</font> <font color="#E5E5E5">particular camera when you're browsing</font> <font color="#CCCCCC">excuse me when you're</font><font color="#E5E5E5"> viewing the video</font> feed through your browser<font color="#E5E5E5"> the process</font> responsible for streaming<font color="#E5E5E5"> images to your</font> browser is<font color="#E5E5E5"> M JPEG CGI so with command</font> <font color="#CCCCCC">injection and the ability to see</font><font color="#E5E5E5"> the</font> output from our commands that we're <font color="#CCCCCC">injecting we can run process lists and</font> see what<font color="#E5E5E5"> processes are running and then</font> <font color="#E5E5E5">we can just kill off all the</font><font color="#CCCCCC"> MJPEG CGI</font> processes<font color="#E5E5E5"> and this actually has the</font> <font color="#E5E5E5">effect of temporarily freezing the</font> admins video feed because his browser is only going<font color="#E5E5E5"> to</font><font color="#CCCCCC"> show him whatever</font><font color="#E5E5E5"> the last</font> image it received was and he's no<font color="#CCCCCC"> longer</font> getting<font color="#E5E5E5"> any more images but we don't</font> want<font color="#E5E5E5"> to stop there</font><font color="#CCCCCC"> because if</font><font color="#E5E5E5"> the admin</font> refreshes<font color="#CCCCCC"> his browser or navigates away</font> from the page and<font color="#E5E5E5"> comes back he starts</font> up<font color="#E5E5E5"> a new stream and he's going to see</font> the live<font color="#CCCCCC"> video feed</font><font color="#E5E5E5"> so what we also</font><font color="#CCCCCC"> want</font> to do is<font color="#E5E5E5"> replace M JPEG CGI and this</font> does<font color="#CCCCCC"> not</font><font color="#E5E5E5"> have to</font><font color="#CCCCCC"> be difficult a two line</font> <font color="#E5E5E5">bash script will suffice particularly in</font> a pinch all you have<font color="#E5E5E5"> to do is replace</font> this<font color="#E5E5E5"> CGI page on disk</font><font color="#CCCCCC"> with a bass grip</font> that<font color="#E5E5E5"> echoes out some basic headers to</font> <font color="#E5E5E5">make the browser happy and then cats out</font> the contents<font color="#E5E5E5"> of its static JPEG image</font> <font color="#E5E5E5">presumably this JPEG is a picture</font><font color="#CCCCCC"> of the</font> empty elevator<font color="#E5E5E5"> but you know it can be</font> <font color="#CCCCCC">goatse or whatever you want so while the</font> admin<font color="#E5E5E5"> will all now always</font><font color="#CCCCCC"> see this no</font> matter what is actually<font color="#E5E5E5"> going on</font><font color="#CCCCCC"> in the</font> elevator<font color="#CCCCCC"> so this is actually a lot more</font> <font color="#CCCCCC">fun to see in a live demo so if the demo</font> gods<font color="#E5E5E5"> will work with me today all right</font> so I have<font color="#E5E5E5"> my camera guarding my precious</font> beer here<font color="#E5E5E5"> so you can see if I try and</font> <font color="#CCCCCC">take</font><font color="#E5E5E5"> it</font> whoever's watching will know<font color="#CCCCCC"> however I</font> have a little<font color="#E5E5E5"> exploit script written up</font> and this<font color="#E5E5E5"> exploit script does a couple of</font> <font color="#CCCCCC">things first of all it's</font><font color="#E5E5E5"> going</font><font color="#CCCCCC"> to kill</font> <font color="#E5E5E5">the admins video feed it's going to</font> replace<font color="#E5E5E5"> the M JPEG CGI just like we</font> showed<font color="#E5E5E5"> it's also going to give me the</font> administrative credentials to the<font color="#E5E5E5"> camera</font> <font color="#E5E5E5">and set up a secret URL so that</font><font color="#CCCCCC"> I can</font> still see the live<font color="#CCCCCC"> video feed</font><font color="#E5E5E5"> even</font> <font color="#CCCCCC">though the admins is frozen permanently</font> so sending exploit<font color="#CCCCCC"> ok</font><font color="#E5E5E5"> so you can</font><font color="#CCCCCC"> see</font> here it<font color="#E5E5E5"> gave me back</font><font color="#CCCCCC"> user credentials</font> <font color="#E5E5E5">the login as admin and secure cam one</font> two three four<font color="#CCCCCC"> it also tells</font><font color="#E5E5E5"> me what URL</font> <font color="#CCCCCC">it's set up</font><font color="#E5E5E5"> so</font><font color="#CCCCCC"> that I can view the real</font> <font color="#E5E5E5">video feed</font><font color="#CCCCCC"> so if I go over to</font><font color="#E5E5E5"> my hackers</font> browser here see if I can type this<font color="#CCCCCC"> I</font> can see what's going<font color="#E5E5E5"> on so if I try</font><font color="#CCCCCC"> and</font> take this I know that but the admin doesn't so that's the demo so a couple closing<font color="#E5E5E5"> thoughts</font><font color="#CCCCCC"> I'd like to</font> leave<font color="#CCCCCC"> you with</font><font color="#E5E5E5"> first of all this clearly</font> is not an all-encompassing list of bugs <font color="#CCCCCC">in</font><font color="#E5E5E5"> security cameras not by a</font><font color="#CCCCCC"> longshot</font> so there's lots more<font color="#CCCCCC"> of these to be</font> found if you<font color="#E5E5E5"> want to go look for them</font> yourself<font color="#CCCCCC"> and as you've seen most</font><font color="#E5E5E5"> of</font><font color="#CCCCCC"> them</font> are epically trivial<font color="#E5E5E5"> to exploit</font><font color="#CCCCCC"> another</font> <font color="#CCCCCC">thing I'd like to point out is that</font> <font color="#E5E5E5">almost all of these cameras will reveal</font> their model name even if you're<font color="#E5E5E5"> not</font> authenticated<font color="#E5E5E5"> either on the login</font><font color="#CCCCCC"> page</font> or the login prompt depending on on how they're<font color="#CCCCCC"> doing authentication it'll tell</font> you what<font color="#CCCCCC"> is model number is so if I as</font> an attacker<font color="#CCCCCC"> know the model number even</font> if I know<font color="#E5E5E5"> nothing else about this camera</font> <font color="#CCCCCC">I can go</font><font color="#E5E5E5"> on Google</font><font color="#CCCCCC"> I can google the</font> model number go<font color="#E5E5E5"> to the vendors web page</font> download<font color="#CCCCCC"> the firmware you know maybe</font> have to have you know tab equals<font color="#CCCCCC"> four</font> <font color="#CCCCCC">get the firmware</font><font color="#E5E5E5"> and start</font><font color="#CCCCCC"> analyzing it</font> <font color="#CCCCCC">for vulnerabilities</font><font color="#E5E5E5"> without ever</font><font color="#CCCCCC"> even</font> <font color="#CCCCCC">having to buy the device and</font><font color="#E5E5E5"> this is</font> <font color="#CCCCCC">exactly</font><font color="#E5E5E5"> what I did with</font><font color="#CCCCCC"> all of these</font> cameras<font color="#CCCCCC"> I was able</font><font color="#E5E5E5"> to find the</font> vulnerabilities<font color="#CCCCCC"> and</font><font color="#E5E5E5"> right working</font> exploits without ever having<font color="#E5E5E5"> to buy a</font> single<font color="#E5E5E5"> camera it was all done with</font> firmware analysis<font color="#E5E5E5"> basically using</font><font color="#CCCCCC"> bin</font> <font color="#E5E5E5">walk to do firmware analysis and</font> extraction<font color="#CCCCCC"> and then using Ida</font><font color="#E5E5E5"> and</font><font color="#CCCCCC"> qmu</font> for disassembly<font color="#CCCCCC"> and emulation if</font> necessary so with that<font color="#CCCCCC"> now I know when I</font> open<font color="#CCCCCC"> up for Q&A like half the room</font> <font color="#CCCCCC">always leaves</font><font color="#E5E5E5"> so before you head out</font> please<font color="#CCCCCC"> fill out the surveys or swipe</font> your badge<font color="#CCCCCC"> for surveys or however</font><font color="#E5E5E5"> that</font> <font color="#CCCCCC">works in the back but</font><font color="#E5E5E5"> with that I'll</font> open<font color="#E5E5E5"> up for any</font><font color="#CCCCCC"> questions</font><font color="#E5E5E5"> you guys</font><font color="#CCCCCC"> might</font> have<font color="#E5E5E5"> Oh got</font><font color="#CCCCCC"> one</font> No so<font color="#E5E5E5"> there were a lot more cameras that I</font> looked at<font color="#E5E5E5"> I simply didn't I do need like</font> a<font color="#CCCCCC"> 2-hour slot to talk about all of</font><font color="#E5E5E5"> them</font> <font color="#CCCCCC">I did not run into</font><font color="#E5E5E5"> one that was actually</font> <font color="#E5E5E5">well done and actually</font><font color="#CCCCCC"> secure now with</font> <font color="#E5E5E5">that said there are</font><font color="#CCCCCC"> a lot of larger</font> vendors that<font color="#E5E5E5"> I simply didn't have the</font> <font color="#E5E5E5">resources to look at you know they don't</font> put their firmware up for free<font color="#E5E5E5"> and I</font> don't have the money<font color="#E5E5E5"> to buy their</font> cameras right so I'm not<font color="#E5E5E5"> saying there</font> aren't<font color="#E5E5E5"> secure cameras out there but the</font> ones I've looked<font color="#CCCCCC"> at certainly not anyone</font> else<font color="#CCCCCC"> oh hey you have to speak up</font><font color="#E5E5E5"> I can't</font> can hear you ah<font color="#E5E5E5"> so the easiest way to do</font><font color="#CCCCCC"> that in this</font> case would be<font color="#E5E5E5"> like an animated gif which</font> is you know a<font color="#E5E5E5"> really pretty hacky</font> workaround<font color="#CCCCCC"> certainly this can be taken a</font> lot farther<font color="#CCCCCC"> yeah I mean you could</font><font color="#E5E5E5"> easily</font> write your own<font color="#E5E5E5"> CGI that really does feed</font> a<font color="#E5E5E5"> live video of whatever you want</font><font color="#CCCCCC"> I'm</font> lazy though and<font color="#E5E5E5"> that was my demo</font><font color="#CCCCCC"> but you</font> know the concepts the same you know <font color="#CCCCCC">you're rude on these devices you can do</font> whatever you want<font color="#E5E5E5"> yeah you</font><font color="#CCCCCC"> can certainly</font> <font color="#E5E5E5">do that</font> <font color="#CCCCCC">let it</font>
Info
Channel: HackersOnBoard
Views: 643,078
Rating: 4.9380159 out of 5
Keywords: Black Hat Briefings (Conference Series), 2013, bhb, usa, conference, t810, Network Surveillance Cameras, Hollywood, Surveillance Cameras, Network Surveillance Cameras Like a Hollywood Hacker, Surveillance (Literature Subject)
Id: B8DjTcANBx0
Channel Id: undefined
Length: 33min 36sec (2016 seconds)
Published: Tue Nov 19 2013
Reddit Comments

The biggest thing to take away from this is that regardless of what you are programming never trust unsanitized user input and never leave a process that runs anything as SYSTEM or root exposed on an unauthenticated page

πŸ‘οΈŽ︎ 11 πŸ‘€οΈŽ︎ u/ameyer505 πŸ“…οΈŽ︎ Oct 31 2014 πŸ—«︎ replies

stand-up comedy for geeks, loved it

πŸ‘οΈŽ︎ 5 πŸ‘€οΈŽ︎ u/karmedian πŸ“…οΈŽ︎ Oct 31 2014 πŸ—«︎ replies

Very interesting. I understood nothing, but still interesting.

πŸ‘οΈŽ︎ 11 πŸ‘€οΈŽ︎ u/Sir_Tibbles πŸ“…οΈŽ︎ Oct 31 2014 πŸ—«︎ replies

Somebody get that man a glass of water...

πŸ‘οΈŽ︎ 7 πŸ‘€οΈŽ︎ u/Dreamcrusher69 πŸ“…οΈŽ︎ Oct 31 2014 πŸ—«︎ replies

I literally cannot believe how bad security vendors are at securing their devices. There was a talk I found a little while ago talking about exploits in anti-virus software, and there were just awful holes in nearly all of them that in some cases actually provided root to an attacker. My favourite was one that did login by passing unsanitised user inputted login credentials to a root shell.

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/ProjectAmmeh πŸ“…οΈŽ︎ Oct 31 2014 πŸ—«︎ replies
πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/[deleted] πŸ“…οΈŽ︎ Oct 31 2014 πŸ—«︎ replies

At first I read this as "Exploding Network Surveillance Cameras". Damn, that would be cool...

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/themike03 πŸ“…οΈŽ︎ Oct 31 2014 πŸ—«︎ replies

Still less confusing than hacking in Fallout

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/[deleted] πŸ“…οΈŽ︎ Oct 31 2014 πŸ—«︎ replies

tab=4

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/YouMissedTheHole πŸ“…οΈŽ︎ Nov 01 2014 πŸ—«︎ replies
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.