Dos and Don’ts of Client Authentication on the Web Kevin Fu UMass-Amherst Department of Computer Science www.cs.umass.edu Based on USENIX Security 2001 paper by same name. Versions of this talk were given several times. History on: http://www.cs.umass.edu/~kevinfu/talks.html
What this talk is about • Improving the security of client authentication on the Web
Where are we now? • We have HTTP authentication
Where are we now? • We have HTTP authentication • We’ve had SSL for nearly a decade
Where are we now? • We have HTTP authentication • We’ve had SSL for nearly a decade • Client authentication should be easy, right?
Many Web sites get it wrong Site Security problem WSJ.com crypto misuse, secret key exposed tiffany.com SQL injection opentable.com guessable user IDs cooking.com guessable user IDs SprintPCS.com leaks authenticator in plaintext FatBrain.com predictable session ID HighSchoolAlumni.com circumvent password authentication PerformanceBike.com predictable session ID ihateshopping.net circumvent password authentication
Toolkits are vulnerable too Toolkit Security problem BlueMartini missing authentication check Allaire ColdFusion predictable session IDs, LCNG ArsDigita ACS signs ambiguous messages Jakarta TomCat predictable session IDs, random seed PHP session IDs based on time of day
How is it done? So how do Web sites implement user authentication?
Cookies: what are they? • A Web server can store key/value pairs on a client • The browser resends cookies in subsequent requests to the server • Cookies can implement login sessions
Sample cookie domain .wsj.com Path /cgi SSL? FALSE Expiration 941452067 Variable name fastlogin Value bitdiddleMaRdw2J1h6Lfc
Cookies for login sessions Web browser Web server POST /login.cgi 1
Cookies for login sessions Web browser Web server POST /login.cgi 1 "Welcome in" Web page Set − Cookie: authenticator 2
Cookies for login sessions Web browser Web server POST /login.cgi 1 "Welcome in" Web page Set − Cookie: authenticator 2 GET /restricted/index.html Cookie: authenticator 3
Cookies for login sessions Web browser Web server POST /login.cgi 1 "Welcome in" Web page Set − Cookie: authenticator 2 GET /restricted/index.html Cookie: authenticator 3 Content of restricted page 4
What adversaries do we fear? Active adversary Passive adversary Interrogative adversary • Adaptively query a server • Eavesdrop on traf fi c • Modify/inject traf fi c, man-in-the-middle attack A system must AT LEAST protect against the interrogative adversary!
Interrogative adversary • Adaptively query a Web server a reasonable number of times • Treat server as an oracle for an adaptive chosen message attack • Extremely limited, but surprisingly powerful
Types of breaks • Replay • Existential forgery • Selective forgery • Total break
The cookie crumbles... Many Web sites that have invented their own homebrew cookie-based authentication schemes.
Case studies of Web authentication • Lack of cryptography: HighSchoolAlumni.com • Trusting user input: Instant Shop • Leaking secrets: SprintPCS.com • Predictable sequence numbers: FatBrain.com • Missing authentication check: BlueMartini • Misuse of cryptography: WSJ.com
Lack of cryptography • Site: HighSchoolAlumni.com • Problem: No cryptographic authentication • Adversary: Interrogative • Break: Universal forgery • Today: Sold to another reunion site
Instant Shop: What’s inside < form action=commit sale.cgi > < input type=hidden name=item1 value=10 > Batteries $10 < input type=hidden name=item2 value=99 > Biology textbook $99 < input type=hidden name=item3 value=25 > Britney Spears CD $25 < input type=submit > Con fi rm purchase < /form >
Instant Shop: Malicious user < form action=commit sale.cgi > < input type=hidden name=item1 value=0 > Batteries $10 < input type=hidden name=item2 value=0 > Biology textbook $99 < input type=hidden name=item3 value=0 > Britney Spears CD $25 < input type=submit > Con fi rm purchase < /form >
Trusting user input • Site: Instant Shop • Problem: Server trusts users not to modify HTML variables • Adversary: Interrogative • Today: Out of business
Leaking secrets • Site: SprintPCS.com • Problem: Secure content can leak through plaintext channels • Adversary: Eavesdropper • Break: Replay • Today: A leading provider of mobile phone service...
FatBrain URL authenticator Start: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=attacker@mit.edu&p2=540555758 Try: https://www.fatbrain.com/HelpAccount.asp? ! t=0&p1=victim@mit.edu&p2=540555757 Target: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=victim@mit.edu&p2=540555752
FatBrain URL authenticator Start: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=attacker@mit.edu&p2=540555758 Try: https://www.fatbrain.com/HelpAccount.asp? ! t=0&p1=victim@mit.edu&p2=540555756 Target: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=victim@mit.edu&p2=540555752
FatBrain URL authenticator Start: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=attacker@mit.edu&p2=540555758 Try: https://www.fatbrain.com/HelpAccount.asp? ! t=0&p1=victim@mit.edu&p2=540555755 Target: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=victim@mit.edu&p2=540555752
FatBrain URL authenticator Start: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=attacker@mit.edu&p2=540555758 Try: https://www.fatbrain.com/HelpAccount.asp? ! t=0&p1=victim@mit.edu&p2=540555754 Target: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=victim@mit.edu&p2=540555752
FatBrain URL authenticator Start: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=attacker@mit.edu&p2=540555758 Try: https://www.fatbrain.com/HelpAccount.asp? ! t=0&p1=victim@mit.edu&p2=540555753 Target: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=victim@mit.edu&p2=540555752
FatBrain URL authenticator Start: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=attacker@mit.edu&p2=540555758 Try: https://www.fatbrain.com/HelpAccount.asp? " t=0&p1=victim@mit.edu&p2=540555752 Target: https://www.fatbrain.com/HelpAccount.asp? t=0&p1=victim@mit.edu&p2=540555752
Predictable sequence numbers • Site: FatBrain.com • Problem: Customer can determine the authenticator for any other user • Adversary: Interrogative • Break: Selective forgery • Today: Acquired by Barnes & Noble
FatBrain response “It’s frustrating that programmers ... continue to fall prey to the same old tricks. Simple problems like lazy sequence numbers and buffer over fl ows in most cases can be easily eliminated if we as programmers would be a little vigilant about sound design and solid code reviews. I just *love* being at work on a Friday at midnight managing unscheduled production releases. :)”
Missing authentication check • Sites: saks fi fthavenue.com, kohls.com, iomega.com, et al • Problem: Customers can download order history of all users • Adversary: Interrogative • Break: Universal forgery • Today: The sites have added the check
BlueMartini: missing authentication check https://www.saks fi fthavenue.com/ POST /myaccount/order history new.jsp HTTP/1.0 Host: www.saks fi fthavenue.com bmForm=order history new& bmHidden=VIEW ORDER <> & VIEW ORDER <> orh id=12366456
WSJ.com login process • User enters name and password • If the password is correct, WSJ.com issues a cookie • User surfs to restricted content and attaches cookie • If the cookie is authentic, WSJ.com returns content
WSJ.com analysis • Design: cookie = { user, MACk (user) } • Reality: cookie = user + UNIX-crypt (user + server secret)
WSJ.com analysis cont. username crypt() Output Authenticator cookie bitdiddl MaRdw2J1h6Lfc bitdiddlMaRdw2J1h6Lfc bitdiddle MaRdw2J1h6Lfc bitdiddleMaRdw2J1h6Lfc • Usernames matching fi rst 8 characters have same authenticator • No expiration
Obtaining the server secret? • Adaptive chosen message attack • Perl script queried WSJ with invalid cookies • Runs in max 128 × 8 queries rather than intended 128 8 (1024 vs. 72057594037927936) • 1 sec/query yields 17 minutes vs. 10 9 years • The key is “March20”
How our attack works Secret guess username crypt input worked? " bitdiddl bitdiddl
How our attack works Secret guess username crypt input worked? " bitdiddl bitdiddl ! A bitdidd bitdiddA
How our attack works Secret guess username crypt input worked? " bitdiddl bitdiddl ! B bitdidd bitdiddB
How our attack works Secret guess username crypt input worked? " bitdiddl bitdiddl ! C bitdidd bitdiddC
How our attack works Secret guess username crypt input worked? " bitdiddl bitdiddl ! D bitdidd bitdiddD
Recommend
More recommend