How to rootkit a router

Started by dlots, October 12, 2015, 10:57:19 AM

Previous topic - Next topic

deanwebb

:shock:

Now, for security reasons, we will no longer deploy routers.
Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.

that1guy15

I just want to play snake on my ISRs. Is that too much to ask?
That1guy15
@that1guy_15
blog.movingonesandzeros.net

dlots

Quote from: that1guy15 on October 12, 2015, 01:50:24 PM
I just want to play snake on my ISRs. Is that too much to ask?
Hmmm
:challenge-considered:
I don't see an issue with that since all the cool kids are doing it
:challenge-accepted:

AnthonyC

I think if Cisco actually implement some sort of code signing check in IOS it could've prevented this...
"It can also be argued that DNA is nothing more than a program designed to preserve itself. Life has become more complex in the overwhelming sea of information. And life, when organized into species, relies upon genes to be its memory system."

Otanx

Quote from: AnthonyC on October 12, 2015, 05:37:58 PM
I think if Cisco actually implement some sort of code signing check in IOS it could've prevented this...

Nothing against you AnthonyC, but this is a pet peeve of mine. After SYNful Knock everyone is saying Cisco should have done code signing. The thing is they give you the md5 sum for all their images on the website. The modifications to the file in the paper linked above as well as SYNful Knock would cause the md5 to change. So if you follow best practices you will be validating the md5 of your image with the one supplied on the Cisco download site. If they don't match don't boot the image. As far as I know nobody is installing a backdoor in Cisco firmware, and managing it while performing a hash collision. SYNful Knock is sneaky, and faking the output of a verify /md5 with the correct output, but if you download the file to a known good system and do an md5 there it will show it really is invalid.

Now that I have said that I am also going to point out that SYNful Knock was loaded by hackers gaining normal priv 15 access using stolen passwords, and updating the firmware themselves. So checking the md5 on images you are uploading isn't going to stop that. So would code signing have helped in this case? Maybe. Any system doing code signing has to have a way to revoke old or compromised keys, and issue new ones. So how would you do that? Probably with priv 15 access, and running a few commands to revoke the old, and install the new public keys. Also you would need to update to a new IOS that is signed by the new key because the next time you reboot with an image signed by the revoked one it will break. So now the SYNful Knock actors just need to sign their code with their own fake key, and then using their priv 15 access revoke the Cisco key, load their own, then load the image, and reboot. Now you must run their code because the real Cisco code will not be accepted because the signature fails.

-Otanx



AnthonyC

What Cisco (or any other company) could have done is to sign the firmware with encryption like AES and then have it checked by hardware. This will ensure that only verified firmware will be allowed to boot up. It would have prevented the SYNful Knock attacks or even ROMMON hack because when the new modified image was inserted and the device reboot, it would have checked for the digital signature and it'd have refused to accept the firmware update.

Also actually Cisco did eventually implement code signing as a feature in IOS v15 & XE (they just took a long time); it is implemented as a CLI command but not sure if it checks during boot up.

Lastly MD5 is rudimentary and proven to be insecure due to collision for an least a decade, go with SHA1 as a minimum.

"It can also be argued that DNA is nothing more than a program designed to preserve itself. Life has become more complex in the overwhelming sea of information. And life, when organized into species, relies upon genes to be its memory system."

wintermute000

Quote from: AnthonyC on October 12, 2015, 07:40:17 PM
What Cisco (or any other company) could have done is to sign the firmware with encryption like AES and then have it checked by hardware. This will ensure that only verified firmware will be allowed to boot up. It would have prevented the SYNful Knock attacks or even ROMMON hack because when the new modified image was inserted and the device reboot, it would have checked for the digital signature and it'd have refused to accept the firmware update.

Also actually Cisco did eventually implement code signing as a feature in IOS v15 & XE (they just took a long time); it is implemented as a CLI command but not sure if it checks during boot up.

Lastly MD5 is rudimentary and proven to be insecure due to collision for an least a decade, go with SHA1 as a minimum.
If they did all that, then how are the NSA supposed to rootkit properly [emoji14]

Otanx

Yes, MD5 has been shown in a lab to have collision issues(So has SHA1). As far as I know only Flame has actually used an MD5 collision in the wild. This isn't something everyone is doing. Also as I just found out Cisco is also listing the SHA512 sum for files on the website. So use that.

So I looked at the XE code signing. It is interesting. I knew one model had it, but couldn't remember which. So to get around my issue of being able to revoke and reissue certificates they are using two different trust chains. Then to revoke certificates from one chain you have to be signed by the other. Actually a cool idea I hadn't thought of. However, as you pointed out they are not checking during boot. You have to run a command to verify the image. If I got a rooted image on the system I can boot from it, and then when you try to verify the image I can just intercept the call to verify the image, and return what the right output should be. So a step in the right direction, but not there yet.

Just to be clear I don't think code signing is bad, or a waste of time, and shouldn't be done. Just that it isn't a silver bullet that protects you magically from firmware hijacks, and it has to be thought out before implementing. A lot of the people I talk to think Cisco should just make it happen, and make it happen on all the equipment that already is installed. This can't happen, and where my pet peeve comes from. Doing code signing for this is hard, and is not just a software fix. You need a secure place to store keys. Typically a HSM of some kind. If you just store them in flash that isn't going to do anyone any good.

As for the NSA, according to that photo going around they have physical access before you even get the box so they don't have any issues.

Going to get off my soap box now. I don't think anyone here is actually one of the people I need to rant at. The ones that need to be educated are my security team that should know better.

-Otanx