164 points · by lucb1e · 13y ago · 83 comments
Here's some interesting reading: http://en.wikipedia.org/wiki/TRESOR
And no, I do not trust the TPM in its current iteration. We mere owners are prevented from knowing its private key. Nor can we generate and store away a private key (or buy a known private keyed chip).
Well your remote server prover, is going to need a bunch of unit tests and some kind of load testing "system" for scalability testing, so rather than piling dozens of physical clients on your desk you may as well make a client emulator that can run in a virtual image... Oh whoops. That means anyone can run the emulator until it authenticates, then hit pause and start dumping memory to see your "secret"
Basically if you can define "it" to run on a turing complete machine, "it" can be run on any other turing complete machine. You may have some interesting games to play with timing and speed but that's usually not too hard to work around if the emulator is more powerful than whats being emulated, or if the protocol is sloppily implemented (which is the norm)
Nowadays people have dreamed up applications for it in server hosting, where you can talk to the DRM in your rented server and get some assurance your software running there hasn't been comproimsed.
If one want to leave the OS altogether, One could also use a external physical security device, through it too need to be done in a correct way. Some hardware encryption acceleration devices might have an option to store keys only locally and never give it away to the host, but I doubt this is true for all.
See http://en.wikipedia.org/wiki/Homomorphic_encryption for more.
But there are best practices for passwords, and those reduce the risks; and most attacks need privileges and access to the machine, which again reduces the risk.
If you're worried about stormtroopers kicking the door down and squirting liquid nitrogen on the RAM you probably have enough money to have very strong perimeter defences.
Paper on that: http://citp.princeton.edu.nyud.net/pub/coldboot.pdf
Much safer (but slower) is to hook directly into the bus and communicate with the ram itself. I guess its a trade off between speed and security, which mean it depend on the case specifics.
Everyone should read the mitigation steps and caveats as appropriate.
If you have physical access to an unlocked windows machine, i'd reach for mimikatz. Instant plaintext.
See for example:
0wned by an iPod - hacking by Firewire http://md.hudora.de/presentations/#firewire-pacsec
More papers are linked in the wikipedia page: http://en.wikipedia.org/wiki/DMA_attack
http://msdn.microsoft.com/en-us/library/ms995355.aspx
I've been using it for years, and while nothing is infallible, any sensitive plain text in my apps isn't there for more than it takes to encrypt and then destroy.
I can't comment on Linux or OSX but would be surprised if the OS didn't offer a similar API tied to the principal to protect in-memory data.
> Reading comments here and on stackexchange I'm surprised
> that no mention is made of the Data Protection API (DPAPI)
> on Windows, which is designed specifically for this purpose.
It was mentioned and quickly dismissed as not being effective:1) if it can be decrypted by the API, then it can be cracked by any process given enough time and resources.
2) further to point #1, the Data Protection API was reversed engineered in 2010.
3) security is only as strong as your weakest link, and that API doesn't address the "weakest link" of running malware locally. eg it's much easier to keylog passwords to begin with than to scan the RAM.
I'm inclined to agree with those comments. While that API is a nice idea, I think it's a little ineffective in practice.
Both of those seem easy enough to fix, which I imagine Microsoft has done (the exploit was discovered 3 years ago). I'm going to do a little more research when I have time.
Lastly, and importantly, this attack is an offline attack. I wasn't able to find anything that compromises in-memory data. Granted, nothing other than 2FA will protect anyone (or DPAPI) against key loggers, but that's true for all OSs.
If local malware is the strength of the argument against DPAPI then I might as well go so far as to say that the most secure system is no system.
> Both of those seem easy enough to fix, which I imagine Microsoft has
> done (the exploit was discovered 3 years ago). I'm going to do a little
> more research when I have time.
Well, by your own confession, you've not read about a fix thus far, and Microsoft have been known to let poorer encryption APIs go unpatched for great lengths of time even when a problem is known (eg NTLM passwords aren't salted), so I wouldn't be the slightest bit surprised if this hasn't been patched either.However, regardless of whether it has or hasn't, said patches only increase the CPU time it takes to crack the passwords, it doesn't make the passwords impossible to crack. And, as I'd already said, there's weaker links that can be exploited anyway.
> Lastly, and importantly, this attack is an offline attack.
All the attacks we're talking about here are offline attacks. > Granted, nothing other than 2FA will protect anyone (or DPAPI) against key
> loggers, but that's true for all OSs.
Of course it's true for all OS's. I never once suggested otherwise. Honestly, I'm puzzled why you'd even bring that point up. > If local malware is the strength of the argument against DPAPI then
> I might as well go so far as to say that the most secure system is no system.
Which is what myself and pretty much everyone else in this discussion have already been saying. At some point, there needs to be a balance between usability and security. I think NT (and Linux / BSD / Mach too for that matter) offer enough security to make in-memory password hacking awkward enough that it's a minor security risk while still leaving the host OS highly usable.For the average user, social engineering will always remain the most exploited vector of attack, and for ultra sensitive servers, all we can do is lock them down as best as we can based on the latest fixes and proof-of-concepts. But a sufficiently determined attacker will usually find a way in if there's a sufficiently high enough incentive. Our job (or at least mine), is to make it sufficiently hard that attackers lose interesting trying. But if they've gained root access (in order to run any of the aforementioned attacks), then it's already game over - regardless of whether they manage to decrypt your RAM or not. Which is why I think the aforementioned API is akin to the emperors new clothes (ie all hype, no practical security)
http://docs.oracle.com/javase/tutorial/uiswing/components/pa...
This will leave the "hello" in ram (subject to GC):
String x = "hello"
x = null;
This will clear the "hello" from ram: char[] x = new char[]{'h','e','l','l','o'};
x[0] = '0'; x[1] = '0'; ...
This will leave the "hello" in ram (subject to GC): char[] x = new char[]{'h','e','l','l','o'};
x = null;Even then, the password must reside in memory at some point in order to compute the hash of your password [using bycrypt or whatever scheme], which is necessary for both generating the hash the first time AND generating the hash for authentication attempts. This is the issue described in the given link.
http://en.wikipedia.org/wiki/Cryptographic_hash_function#Pas...
Storing a hash doesn't help because the remote site won't accept it. And if it did then the hash is essentially the password and you've violated the goal.
Fravia said of dongles that they were often great, with nice libraries, but when software vendors implemented them they would use stupid methods.
(http://home.scarlet.be/detten/tuts/dongle_zeezee.htm)
> Don't panic when you read all info about dongle security. They ARE secure. OK. You can't crack them unless they're done by complete idiots. OK. But you want to crack the application, NOT the dongle. When you read about RSA encryption, one-way functions and see in the API some interesting Question/Answer hashing functions, remember that it's only API. No one uses it. Only simple functions like Check/Serial Number/Read and sometimes Write are used.
Combine that with per-application virtualization and various forms of user authentication (other than passwords), and public key cryptography, and you could probably start to build substantially more secure services. Same stuff on clients and servers.
ARM's TrustZones are actually more interesting than TPMs on x86; you can essentially start the general purpose CPU as a trusted device and then partition off less-trusted pieces. If you're going to have a single processor, vs. a specialized security processor, this is probably how to do it, not the x86 + TPM + TXT way.
Probably all meaningless until there's a framework as simple as Ruby on Rails was vs. everything else in 2005, or php, which makes doing things securely the easy default.
A more appropriate question would have been: 'How safe is it to store passwords in memory?'
And even that is not 100% foolproof (the OS can detect it in between these two steps).
Gaining you exactly nothing.
It's using DAPI which derives the encryption key from the user password.
Just don't store it character for character the same as the password when used to authenticate the user.
You could have the even characters in one array and the odd characters in another and this would make it a bit safer.
I'm not sure every app needs to be this paranoid but I offer it as an idea that can be easily implemented for those that do.
You've just described encryption here, whilst saying that its not encryption.
The principle is right though. A simple obfuscation will deter most attacks.
Bottom line: there is no such thing like security against local attacks on almost any kind of commodity hardware (including TPMs, excluding devices explicitly designed to be reasonably secure like gaming consoles). When you need that you also need proper tamper-proof hardware.
edit: finish the sentence