Re:How I Tricked Symantec with a Fake Private Key
by scintill76 on Thursday July 20, 2017 @07:24PM
(#14817019)
I cry a little when someone says something is wrong, without explaining how to do it right. What's insecure with this, and how should it be done instead?
[ Parent
| on HN ]
Re:How I Tricked Symantec with a Fake Private Key
by rrix2 on Thursday July 20, 2017 @07:42PM
(#14817107)
The default umode of /tmp is usually world-writeable, so files created like this could be manipulated by bad actors on the same system. Not so critical in this case, but it can be seen as "code smell"
Re:How I Tricked Symantec with a Fake Private Key
by mioelnir on Thursday July 20, 2017 @08:52PM
(#14817355)
This of course assumes you are running around an actual multiuser system without 1777 /tmp and 077 umask like it is 1989.
Re:How I Tricked Symantec with a Fake Private Key
by jwilk on Friday July 21, 2017 @05:15AM
(#14819106)
All the attacker has to do is:
touch /tmp/pubkey.pem
chmod a+w /tmp/pubkey.pem
before the victim runs the code.No sticky bit, no restrictive umask, also no protected_hardlinks/protected_symlinks is going to save you.
Re:How I Tricked Symantec with a Fake Private Key
by scintill76 on Thursday July 20, 2017 @09:07PM
(#14817386)
Proof-of-concept code like this can't anticipate everything about the environment it's going to run in, without risking distracting from its point. I guess it would be better to just put the files in the current directory, to not encourage the use of /tmp. The script[0] looks safer.
While we're on the subject of the openssl tool and file permissions, I've been disappointed... On my system, this command creates key.pem word-readable: "openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -nodes" I've been meaning to set my umask to fix issues like this, as I have rare need to let another user account access my files. On the other hand, there aren't supposed to be any other users on my systems, and it's more likely my browser will get pwned and have access to my self-readable private keys anyway.
[0] https://github.com/hannob/tlshelpers/blob/46c50b27adf79476ae...