No lecture on Week 3. Focus on attacks on web sessions.
HTTP initially started off as a simple stateless protocol for server scalability. This means authentication needs to be established during each connection, which can be achieved either via:
<input type="hidden" value="xxx"/>
which can be read by CGI program via stdin
One point of vulnerability during an account compromise is to fetch session cookies via the filesystem, e.g. Mozilla Firefox in Windows stores the cookies in a cookies.sqlite
database located in [HOME_DIR]\AppData\Roaming\Mozilla\Firefox\Profiles\[RANDOM_STR].default-release\
.
Some mitigations:
Basically cross-site request forgery (CSRF), which triggers when user is logged in to a legitimate site, and a malicious website requests a browser to make a HTTP request, e.g.
<img src="http://cross-site.com/"></img>
Another alternative mode of attack is via session feeding (inject attacker's session), as well as "drive-by pharming" (Stamm, 2007).
CSRF defence by checking the HTTP referrer header of the request (Referer
or HTTP Origin
) / random numbers in all steps of transaction. Additionally using graphical turing test to check if a human initiated the request.
In the end, the access control mechanism in a browser should only allow the same site to run its javascript, etc. This gives rise to the Same-Origin Policy (SOP): scripts from one origin can only access objects and services from the same origin. During current deprecation via SOP, browsers can have inconsistent handling of SOP policies across different resources, e.g. cookies (even on different subdirectories), clipboard, browser history, geolocation. Sidetrack to secure clipboard using a secure OS, Qubes OS.
Main takeaway: different services should be nested within their own subdomain, instead of different subdirectory.
Other related stuff includes:
Access-Control-Allow-Origin
postMessage()
cross-frame communication channelWe can define a strictly weaker (compared to network attacker) threat model as a web attacker, which by definition owns a valid domain with SSL certificate, can entice victims to visit the site, and cannot intercept/read traffic for other sites (i.e. browser is assumed bug-free).
Sidenote, good resource for external events: NUS Computing Events.
Other stuff:
Same content as CS3235 Lecture 2.
Foundation of secure channel using SSL.
//example.com/img.gif
Content Security Policy: upgrade-insecure-requests;
to request browser to upgrade protocol for insecure HTTPRoot CA is not a recommended method, since every certificate signed will be trusted in the client browser. The trust anchor is the union of all CAs, i.e. certification only as strong as the weakest root CA.
Public-Key-Pins
header)Some implementation errors:
Contact information: liangzk@comp.nus.edu.sg
For web security stuff, consider reading up on OWASP. Regarding new top 10 vulnerabilities, now to consider broken access controls, crypto failures and injection attacks. "Principle of easiest penetration", which also includes data and people (rubber hose cryptanalysis).
Approach: Read the code and understand the architectural components + intercomponent communication protocols.
Adminstrative:
python3 -m http.server --cgi 80
)#!/bin/sh echo "Content-Type: text/html" echo "<document><head></head><body><h1>Hello</h1>" echo $* # pass URL arguments via command line args echo "</body></document>"