Re:A single byte write opened a root execution exploit
by umanwizard on Friday October 14, 2016 @11:50PM
(#12712616)
It's not really surprising that writing one byte can break software. For a really simple example, consider the following function:
Now imagine you know a way to change the first byte in the password entry (i.e, what becomes correct_pass) to \0. Now pass a blank password to this function and it will always return true for any username.
[ Parent
| on HN ]
Re:A single byte write opened a root execution exploit
by brobinson on Saturday October 15, 2016 @01:02PM
(#12714703)
I know you were intentionally using strcmp() to prove a different point, but I want to point out that strcmp() does not run in constant time and this function also contains a completely different vulnerability: timing attacks. You could retrieve the correct password by measuring how long it takes passwords to be rejected even if you weren't able to inject a null byte.
Re:A single byte write opened a root execution exploit
by umanwizard on Saturday October 15, 2016 @01:24PM
(#12714805)
I'm curious, has this ever been demonstrated to be feasible in practice? I mean a real example of someone getting a full password through a timing attack in a real-life (or reasonably similar to real-life) scenario.
Re:A single byte write opened a root execution exploit
by l_zzie on Saturday October 15, 2016 @02:59PM
(#12715213)
It's pretty hard with strcmp. On modern x86_64 strcmp is vectorised and the first N bytes are compared simultaneously.
I have code samples + remote exploit code against nonvectorised strcmp; I can write this up if anyone thinks it would be helpful.
Re:A single byte write opened a root execution exploit
by brobinson on Saturday October 15, 2016 @03:41PM
(#12715367)
That might be worthy of a HN post of its own!
Re:A single byte write opened a root execution exploit
by dream__ on Tuesday October 18, 2016 @08:45PM
(#12740042)
Would love to read this writeup!
Re:A single byte write opened a root execution exploit
by Jefff on Sunday October 16, 2016 @02:38AM
(#12717322)
It was used to great effect on the Xbox 360 until later vulnerabilities rendered it obsolete: http://beta.ivc.no/wiki/index.php/Xbox_360_Timing_Attack
It was literally just a careless use of memcmp to check an HMAC that allowed for it to work.
Re:A single byte write opened a root execution exploit
by ufo on Saturday October 15, 2016 @01:30PM
(#12714831)
I don't remember a concrete example out of the top of my head but it has been demonstrated that it is possible to pull of this kind of timing attack if the attacker has a computer in the same datacenter as the target.
Re:A single byte write opened a root execution exploit
by ryanlol on Saturday October 15, 2016 @01:32PM
(#12714844)
It's rather trivial.
Google finds some pocs, http://www.scasploit.org/?p=9
Re:A single byte write opened a root execution exploit
by l_zzie on Saturday October 15, 2016 @03:04PM
(#12715234)
"it's rather trivial"? Have you done it?
Re:A single byte write opened a root execution exploit
by rasz_pl on Saturday October 15, 2016 @07:51PM
(#12716165)
I vaguely remember using script kiddie tool in ~1998 that used timing attack to guess windows 95 share passwords one letter at a time.
Re:A single byte write opened a root execution exploit
by gpderetta on Saturday October 15, 2016 @10:05AM
(#12713950)
The initial Wii boot firmware had a similar issue when checking the signature of the next stage firmware as it used strcmp instead of memcmp. A carefully crated firmware would bypass the check.
Re:A single byte write opened a root execution exploit
by lawnchair_larry on Saturday October 15, 2016 @03:41PM
(#12715370)
That was a null byte issue, fairly different.
Re:A single byte write opened a root execution exploit
by jacquesm on Saturday October 15, 2016 @03:57AM
(#12713169)
A strategy to mitigate that kind of exploit would be to re-validate any passwords passed to the system against the rules for entering the password in the first place (for instance: minimum password length).
Then you might still get some mileage out of it (you'd be able to shorten the password).
You'd also hope that in all production systems live at the moment the passwords stored would not be in plaintext but properly hashed so writing random nuls into either one of the hashes would simply result in a mismatch.
Re:A single byte write opened a root execution exploit
by uola on Saturday October 15, 2016 @07:55AM
(#12713652)
I don't think one should mix validation and safety as such since it risks becoming non-obvious. When the validation criteria changes six month later someone might rewrite the validation without considering that it's also a safety feature. By making the proper way to use it restrictive one might end up bypassing the validation and using the unsafe part by re-implementation if not directly. It could also be that the error isn't malicious, but that the hash for some reason ends up being faulty.
Re:A single byte write opened a root execution exploit
by umanwizard on Saturday October 15, 2016 @12:48PM
(#12714636)
Yep, that's all true -- this type of attack can be mitigated in various easy ways. But there are lots of other examples where writing one byte can break a system. I was just trying to prove the point by showing a particularly simple one.