07 Week8 10 Web Security A
07 Week8 10 Web Security A
• Resource: http://www.w3schools.com/
• Example:
http://stanford.edu:81/class?name=cs155#homework
Protocol
Fragment
Hostname
Port Path
Query
Blank line
Data – none for GET
executing
JavaScript GET /list.php?id=3 HTTP/1.1
Cookie: SessionId=87325
HTTP/1.1 200 OK
HTTP/1.0 200 OK
Date: Sun, 21 Apr 1996 02:20:42 GMT
Server: Microsoft-Internet-Information-Server/5.0
Connection: keep-alive
Content-Type: text/html Data
Last-Modified: Thu, 18 Apr 1996 17:39:05 GMT
Set-Cookie: …
Content-Length: 2543
Cookies
• CSS:
<link rel="stylesheet" type="text /css” href=“//site/com/theme.css" />
• Other ideas?
System
Alice
OS Attacker
Network Attacker
System
Web Attacker
• easy to develop
• not so easy to develop well and securely
• Confidentiality
– Read your information
– Steal passwords
= a must
– Read your email Isolation is Indispensable
Isolation is a sandbox
• Approach
– Isolate sites in different security contexts
– Browser manages resources, like an OS
???
CS4293 Topics on Cybersecurity
50
Safe to type your password?
• Trivially spoofable
<a href=“http://www.paypal.com/”
onclick=“this.href = ‘http://www.evil.com/’;”>
PayPal</a>
Clickjacking
Example: Delete Twitter account
Clickjacking Aspects
• Comprise visual integrity of target
– Hide target
– Partial overlay
• Compromise visual integrity of pointer
– Manipulate pointer feedback
Example: User Webcam
Fake link to lead to an access requirement of
webcam
ClickJacking Defence
• Require confirmation for actions (annoys users)
• Frame-busting: Web site ensures that its
“vulnerable” pages can’t be included as a frame
inside another browser frame
– So user can’t be looking at it with something
invisible overlaid on top …
– … nor have the site invisible above something else
– Conceptually implemented with Javascript like:
If (top.location != self.location)
top.location=self.location;
(Note: actually quite tricky to get this right!)"
COOKIES: CLIENT STATE
Browser POST …
Server
Cookie: NAME = VALUE
POST login.cgi
Username & pwd Validate user
GET restricted.html
Cookie: auth=val restricted.html
auth=val Check val
If YES, YES/NO
restricted.html
• … but no integrity
• Can rewrite secure cookies over HTTP
Þ network attacker can rewrite secure cookies
Þ can log user into attacker’s account
CS4293 Topics on Cybersecurity 66
httpOnly Cookies
GET …
Browser
Server
HTTP Header:
Set-cookie: NAME=VALUE ;
httpOnly