CS 142 Winter Session Management. Dan Boneh

Similar documents
CS155. *Original slides were created by Prof. Dan Boneh

NET 311 INFORMATION SECURITY

Web Security II. Slides from M. Hicks, University of Maryland

Web basics: HTTP cookies

How is state managed in HTTP sessions. Web basics: HTTP cookies. Hidden fields (2) The principle. Disadvantage of this approach

Web basics: HTTP cookies

Web Security: XSS; Sessions

2/16/18. CYSE 411/AIT 681 Secure Software Engineering. Secure Coding. The Web. Topic #11. Web Security. Instructor: Dr. Kun Sun

WEB SECURITY: XSS & CSRF

Web 2.0 and AJAX Security. OWASP Montgomery. August 21 st, 2007

Information Security CS 526 Topic 11

WHY CSRF WORKS. Implicit authentication by Web browsers

Computer Security CS 426 Lecture 41

Information Security CS 526 Topic 8

CSCD 303 Essential Computer Security Fall 2018

CSC 482/582: Computer Security. Cross-Site Security

Web Security, Part 2

CSCD 303 Essential Computer Security Fall 2017

P2_L12 Web Security Page 1

Robust Defenses for Cross-Site Request Forgery

2/16/18. Secure Coding. CYSE 411/AIT 681 Secure Software Engineering. Web Security Outline. The Web. The Web, Basically.

CSE361 Web Security. Attacks against the client-side of web applications. Nick Nikiforakis

Security and Privacy. SWE 432, Fall 2016 Design and Implementation of Software for the Web

Web Security: Vulnerabilities & Attacks

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

CS 161 Computer Security

Web Security: Vulnerabilities & Attacks

Security for the Web. Thanks to Dave Levin for some slides

Lecture Overview. IN5290 Ethical Hacking

Lecture 6: Web hacking 2, Cross Site Scripting (XSS), Cross Site Request Forgery (CSRF), Session related attacks

Is Browsing Safe? Web Browser Security. Subverting the Browser. Browser Security Model. XSS / Script Injection. 1. XSS / Script Injection

CIS 4360 Secure Computer Systems XSS

Web Attacks, con t. CS 161: Computer Security. Prof. Vern Paxson. TAs: Devdatta Akhawe, Mobin Javed & Matthias Vallentin

Application Layer Attacks. Application Layer Attacks. Application Layer. Application Layer. Internet Protocols. Application Layer.

Computer Security 3e. Dieter Gollmann. Chapter 18: 1

Advanced Web Technology 10) XSS, CSRF and SQL Injection

Security for the Web. Thanks to Dave Levin for some slides

Web Security IV: Cross-Site Attacks

Web Application Security. Philippe Bogaerts

RKN 2015 Application Layer Short Summary

Lecture 17 Browser Security. Stephen Checkoway University of Illinois at Chicago CS 487 Fall 2017 Some slides from Bailey's ECE 422

CS 155 Project 2. Overview & Part A

Perslink Security. Perslink Security. Eleonora Petridou Pascal Cuylaerts. System And Network Engineering University of Amsterdam.

Hacking Intranet Websites from the Outside

Robust Defenses for Cross-Site Request Forgery

Lecture Notes on Safety and Information Flow on the Web: II

Title: Multiple Remote Command Execution vulnerabilities on Avaya Intuity Audix LX (plus some client-side bugs)

GUI based and very easy to use, no security expertise required. Reporting in both HTML and RTF formats - Click here to view the sample report.

CS526: Information security

Web Security. Thierry Sans

OWASP Thailand. Proxy Caches and Web Application Security. OWASP AppSec Asia October 21, Using the Recent Google Docs 0-Day as an Example

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security.

Web Security EITF05 Department of Electrical and Information Technology Lund University

Bank Infrastructure - Video - 1

Web Security Part 2. Professor Ristenpart h9p:// rist at cs dot wisc dot edu

Attacks Against Websites 3 The OWASP Top 10. Tom Chothia Computer Security, Lecture 14

Content Security Policy

Combating Common Web App Authentication Threats

Sichere Software vom Java-Entwickler

Web Security, Summer Term 2012

Web Security, Summer Term 2012

Slides adopted from Laurie Williams. OWASP Top Ten. John Slankas

Web Attacks, con t. CS 161: Computer Security. Prof. Vern Paxson. TAs: Devdatta Akhawe, Mobin Javed & Matthias Vallentin

Application Security Introduction. Tara Gu IBM Product Security Incident Response Team

SECURING APACHE : ATTACKS ON SESSION MANAGEMENT

Abusing Windows Opener to Bypass CSRF Protection (Never Relay On Client Side)

Mavituna Security Ltd. Finance House, 522A Uxbridge Rd. Pinner. HA5 3PU / UK

Web Security: Cross-Site Attacks

INF3700 Informasjonsteknologi og samfunn. Application Security. Audun Jøsang University of Oslo Spring 2015

PHP Security. Kevin Schroeder Zend Technologies. Copyright 2007, Zend Technologies Inc.

OWASP Top 10 Risks. Many thanks to Dave Wichers & OWASP

ESORICS September Martin Johns

CS 161 Computer Security

Introduction to Ethical Hacking

CS 161 Computer Security

Computer and Network Security

Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2

PROBLEMS IN PRACTICE: THE WEB MICHAEL ROITZSCH

Lecture 6: Web Security CS /17/2017

The security of Mozilla Firefox s Extensions. Kristjan Krips

This slide shows the OWASP Top 10 Web Application Security Risks of 2017, which is a list of the currently most dangerous web vulnerabilities in

COMP9321 Web Application Engineering

Domino Web Server Security

last time: command injection

7.2.4 on Media content; on XSS) sws2 1

CNIT 129S: Securing Web Applications. Ch 3: Web Application Technologies

XSS Homework. 1 Overview. 2 Lab Environment

Neat tricks to bypass CSRF-protection. Mikhail

EasyCrypt passes an independent security audit

Detecting XSS Based Web Application Vulnerabilities

Web Security Computer Security Peter Reiher December 9, 2014

CNIT 129S: Securing Web Applications. Ch 12: Attacking Users: Cross-Site Scripting (XSS) Part 2

Solution of Exercise Sheet 5

Provide you with a quick introduction to web application security Increase you awareness and knowledge of security in general Show you that any

CHAPTER 8 CONCLUSION AND FUTURE ENHANCEMENTS

1 About Web Security. What is application security? So what can happen? see [?]

Presented By Rick Deacon DEFCON 15 August 3-5, 2007

More attacks on clients: Click-jacking/UI redressing, CSRF

Solutions Business Manager Web Application Security Assessment

Reflected XSS Cross-Site Request Forgery Other Attacks

Transcription:

CS 142 Winter 2009 Session Management Dan Boneh

Sessions A sequence of requests and responses from one browser to one (or more) sites Session can be long (Gmail - two weeks) or short without session mgmt: users would have to constantly re-authenticate Session mgmt: Authorize user once; All subsequent requests are tied to user

Pre-history: HTTP auth HTTP request: GET /index.html HTTP response contains: WWW-Authenticate: Basic realm="password Required Browsers sends hashed password on all subsequent HTTP requests: Authorization: Basic ZGFddfibzsdfgkjheczI1NXRleHQ=

HTTP auth problems Hardly used in commercial sites User cannot log out other than by closing browser What if user has multiple accounts? What if multiple users on same computer? Site cannot customize password dialog Confusing dialog to users Easily spoofed

Session tokens Browser GET /index.html GET /books.html anonymous session token set anonymous session token Web Site POST /do-login Username & password elevate to a logged-in session token check credentials (CS155) POST /checkout logged-in session token Validate token

Storing session tokens: Lots of options (but none are perfect) Browser cookie: Set-Cookie: SessionToken=fduhye63sfdb Embedd in all URL links: https://site.com/checkout? SessionToken=kh7y3b In a hidden form field: <input type= hidden name= sessionid value= kh7y3b > Window.name DOM property

Storing session tokens: problems Browser cookie: browser sends cookie with every request, even when it should not (CSRF) Embed in all URL links: token leaks via HTTP Referer header In a hidden form field: short sessions only Best answer: a combination of all of the above. why? next lecture.

The HTTP referer header Referer leaks URL session token to 3 rd parties

SESSION HIJACKING Attacker waits for user to login; then attacker obtains user s Session Token and hijacks session

1. Predictable tokens Example: counter (Verizon Wireless) user logs in, gets counter value, can view sessions of other users Example: weak MAC (WSJ) token = {userid, MAC k (userid) } Weak MAC exposes k from few cookies. Apache Session Tomcat: tokens must generatesessionid() be unpredicatble to attacker: MD5(PRG) Use underlying but framework. weak PRG [GM 05]. Rails: Predictable token SessionID s = MD5( current time, random nonce )

2. Cookie theft Example 1: login over SSL, but subsequent HTTP What happens as wireless Café? Other reasons why session token sent in the clear: HTTPS/HTTP mixed content pages at site Man-in-the-middle attacks on SSL Example 2: Cross Site Scripting (XSS) exploits Amplified by poor logout procedures: Logout must invalidate token on server

Session fixation attacks Suppose attacker can set the user s session token: For URL tokens, trick user into clicking on URL For cookie tokens, set using XSS exploits Attack: (say, using URL tokens) 1. Attacker gets anonymous session token for site.com 2. Sends URL to user with attacker s session token 3. User clicks on URL and logs into site.com this elevates attacker s token to logged-in token 4. Attacker uses elevated token to hijack user s session.

Session fixation: lesson When elevating user from anonymous to logged-in, always issue a new session token Once user logs in, token changes to value unknown to attacker. Attacker s token is not elevated.

Generating session tokens Goal: prevent hijacking and avoid fixation

Option 1: minimal client-side state SessionToken = [random unpredictable string] (no data embedded in token) Server stores all data associated to SessionToken: userid, login-status, login-time, etc. Can result in server overhead: When multiple web servers at site, lots of database lookups to retrieve user state.

Option 2: lots of client-side state SessionToken: SID = [ userid, exp. time, data] where data = (capabilities, user data,...) SessionToken = Enc-then-MAC (k, SID) (as in CS255) k: key known to all web servers in site. Server must still maintain some user state: e.g. logout status (should be checked on every request) Note that nothing binds SID to client s machine

Binding SessionToken to client s computer; mitigating cookie theft approach: embed machine specific data in SID Client IP Address: Will make it harder to use token at another machine But honest client may change IP addr during session client will be logged out for no reason. Client user agent: A weak defense against theft, but doesn t hurt. SSL session key: Same problem as IP address (and even worse)

MORE ON CROSS SITE SCRIPTING (XSS)

Recall: reflected XSS search field on victim.com: http://victim.com/search.php? term = apple Server-side implementation of search.php: Echo search term directly into HTML response (no filtering of user input) To exploit, attacker crafts a URL containing a script http://victim.com/search.php? term = <script> do_something_bad </script>

Reflected XSS: the exploit browser boom send XSS URL http://site.com/search attacker user logs in respond with attacker s script click on URL site.com Bad things happen: site.com session token sent to attacker rewrite site.com DOM rewrite links and persist

Persistent XSS XSS script is injected into blog, message board, etc. When user s view the block, the malicious script runs in their browser blogs must filter uploaded content The famous MySpace Samy worm: (2005) Bypassed MySpace script filters Script spread from user to user making everyone Samy s friend http://namb.la/popular/tech.html

Persistent XSS using images Suppose pic.jpg on web server contains HTML! request for http://site.com/pic.jpg results in: HTTP/1.1 200 OK Content-Type: image/jpeg <html> fooled ya </html> IE will render this as HTML (despite Content-Type) Consider photo sharing sites that support image uploads What if attacker uploads an image that is a script?

Universal XSS Adobe PDF viewer feature : (version <= 7.9) http://site.com/abc.pdf # whatever=javascript: --- code viewer will execute the javascript in origin of current domain! Any site that hosts a single PDF is vulnerable to XSS! (in fact, PDF files in Windows can also be used)