by tptacek · 14y ago · 0 comments
"Yes, definitely build custom crypto for your single signon system, especially if you think HMAC is an "encryption" but just "not as secure" as DSA because it's "shared secret"."
SSO schemes are one of the primary reasons people build crypto for their web apps (they don't want the database dependency between the shared apps). These schemes usually fail calamitously, sometimes a year or two into production, when your app coughs up the ability for one person to log in as any other person without a password.
If you have a real app with a real customer base or doing real revenue and feel the need to put something like this in the field, please ping me. I'm not going to try to charge you. I may try to talk you out of it, though. I will absolutely talk you out of using RSA or DSA.
For SSO, the other apps can ping the cookie-originating app: "Hey, who is this browser with this cookie token" ?
1 http://en.wikipedia.org/wiki/SAML_2.0#Artifact_Resolution_Pr...
(Note also that if we had reviewed them, we probably wouldn't be able to talk about it here. But: we haven't.)
But I guess we should have also signed the encrypted value to know that we generated it?
What's the process to break this scheme?
1) Know what type of value is being encrypted: email, username, tokenid 2) Gather several pairs of usernames/encrypted usernames 3) Use some brute force method to uncover the key and IV 4) generated fake cookies since you know the key/IV
If you're not authenticating your ciphertext, you might as well not encrypt it; attackers can rewrite the plaintext, if not outright decrypt it (the adaptive chosen plaintext attacks on AES block modes all rely on messages not being authenticated).
I'd enjoy talking more about the methods to break this stuff but am concerned that HN will read that comment as "well then we just need to stop those attacks and then we're safe". I have roughly 5 years of experience on HN to back that concern up. :)
† (At least, with enough specificity to attack it.)
That said, while I appreciate your perspective, I'm quite disappointed that you aren't offering any solutions besides asking people to contact you.
Offering solutions on how to implement a secure single signon scheme with RSA or DSA on Hacker News is like explaining how to perform an appendectomy in Youtube comments.
Sorry, not interested in hurting people.
I know I sound super snippy here, and I'm sorry about that, but this problem comes up a lot. We keep finding applications that get almost everything right; locked down database layer, bulletproof authorization, reliable output filtering to stop Javascript injection... and then they go build single signon, and 3 days after we see that we can turn a guest account into the sitewide admin.
People would be a lot better off if they did not try to build this particular feature themselves. (We don't build SSO systems for people, in case you think this is a sales pitch.)
Meanwhile, the utility of public-key cryptography in SSO systems is minimal. Public key is useful, and sometimes the only viable solution, when you have a potentially unbounded population of verifiers or signers. But that's never the case in SSO schemes, which have a bounded number of cryptographic participants (or, if they don't, are badly broken).
Long story short: public key crypto is a last resort for systems that can't be deployed in any other way.