600 likes | 730 Views
Dagstuhl. October 2012. Science of Web Security and Third-party tracking. John Mitchell. This talk will cover a few topics. Science of security Web modeling Experimental web security study Privacy and third-party tracking. Security modeling and analysis . S ystem of interest
E N D
Dagstuhl October 2012 Science of Web Security and Third-party tracking John Mitchell
This talk will cover a few topics • Science of security • Web modeling • Experimental web security study • Privacy and third-party tracking
Security modeling and analysis • Systemof interest • Properties desired of the system • Can include intended purpose or function • Or just that failure should not be catastrophic • Attacker actions and interface to system • aka Threat model Security: the attacker cannot cause the desired properties to fail
General picture • Users interact with the system • System is intended to serve them in some way • If users enter expected input, system will deliver desired output • Attacker may have a different interface and capabilities. • Disrupt honest user’s use of the system • Learns information intended for others only System Alice Attacker
Network security Network Attacker May intercept and alter network traffic; cannot break crypto System Alice
Web security System Web Attacker Sets up malicious site visited by victim; no control of network Alice
Measurement? • Threat models can be compared • Every mechanism that is secure against a stronger threat model is secure against a weaker one • Properties can be compared • Every mechanism that guarantees a stronger property also guarantees a weaker one
Experiments? • Some properties amenable to experiment • Do users find system convenient? • Do known attacks cause harm? • Which design process appear to produce more secure systems? • Some properties inherently analytical • Does system resist all attacks againsta certain property, within a given threat model?
Outline • Science of security • Web modeling • Experimental web security study • Privacy and third-party tracking
Goals of web security • Safely browse the web • Users should be able to visit a variety of web sites, without incurring harm: • No stolen information (without user’s permission) • Site A cannot compromise session at Site B • Secure web applications • Applications delivered over the web should have the same security properties we require for stand-alone applications • Other ideas?
A formal model of the web • Includes browser, servers, and network • Threat models include: • web attacker with no special network privilege • network attacker that can eavesdrop and/or modify unencrypted traffic at will • Security goals include: • Security invariants • Assumptions about how today’s Web works • Example: no DELETE in cross-origin HTTP requests • Session integrity • Attacker does not participate in the HTTP transaction
Alloy [Jackson] • Concepts expressed by relations • General logical language • User inputs “scope” to determine precision • Tool converts logical expressions to finitary form by allocating specific number of bits to each possible value • SAT-based analysis • Satisfiability checker used to see if formula is satisfiable • Leverage large community working on efficient SAT checkers
Web modeling examples abstract sig NetworkEvent extends Event { from: NetworkEndpoint, to: NetworkEndpoint } abstract sig HTTPEvent extends NetworkEvent { host: Origin } sig HTTPRequest extends HTTPEvent { method: Method, path: Path, headers: set HTTPRequestHeader} sig HTTPResponse extends HTTPEvent { statusCode: Status, headers: set HTTPResponseHeader }
Principals • A Principal is an entity that controls a set of NetworkEndpoints and owns a set of DNSLabels, which represent fully qualified host names: abstract sig Principal { servers: set NetworkEndpoint, dnslabels: set DNS } abstract sig PassivePrincipal extends Principal{} { servers in HTTPConformist }
Browsers • A Browser is an HTTPClient together with a set of trusted CertificateAuthorites and a set of ScriptContexts. (For technical convenience, we store the Browser as a property of a ScriptContext.) abstract sig Browser extends HTTPClient { trustedCA: set CertificateAuthority } sig ScriptContext { owner: Origin, location: Browser, transactions: set HTTPTransaction }
Cookies (modeled as a fact) • Idea: HTTPRequestsfrom Browsers contain only appropriate cookies from previous SetCookieHeaders fact { all areq:HTTPRequest | { areq.fromin Browser hasCookie[areq] } implies all acookie: reqCookies[areq] | some aresp: getBrowserTrans[areq].resp | { aresp.host.dnslabel= areq.host.dnslabel acookiein respCookies[aresp] happensBeforeOrdering[aresp,areq] } }
Property: session integrity fun involvedServers[t:HTTPTransaction] : set NetworkEndpoint { (t.*cause & HTTPTransaction).resp.from + getTransactionOwner[t].servers } predwebAttackerInCausalChain[t:HTTPTransaction] { some (WEBATTACKER.servers & involvedServers[t]) }
Sample case studies • HTML5 Forms • Referer validation • WebAuth protocol
Referer Validation • A proposed defense against Cross-Site Request Forgery (CSRF) and Cross-Site Scripting (XSS) [F. Kerschbaum, 2007] • Websites reject a request unless • the referer header is from the same site, or • the request is directed at an “entry” page vetted for CSRF and XSS vulnerabilities
Modeling • Referer header already part of model • Add check: RefererProtected principals allowHTTP requests with external Referers only on the “LOGIN” page: fact { all aReq:HTTPRequest | { (getTransaction[aReq].resp.from in RefererProtected.servers ) and isCrossOrigin[aReq] } implies aReq.path = LOGIN }
Referer header and redirects referer: http://www.site.com referer: http://www.site.com
Referer Validation - Countermeasure • Exploitation • CSRF and XSS can be carried out on websites protected with Referer Validation • Countermeasure • This vulnerability is difficult to correct as Referer header has been widely deployed • Websites can try to suppress all outgoing Referer headers using, for example, the noreferrer relation attribute on hyperlinks. • Web extension • Origin header records path of redirects
WebAuth • Web-based Single Sign-On protocol • WebAuth and a similar protocol, Central Authentication Service (CAS), are deployed at over 80 universities worldwide • Although we analyze WebAuth specifically, we have verified the same vulnerability exists in CAS
WebAuthAnalysis • Attack • An insider can share privileged web resources with unprivileged users without sharing login credentials • Attacker can steal sensitive user information by logging users into attacker’s account • Countermeasure • Store a nonce in a host cookie to bind messages 3 and 9, and splice in messages in between by including the nonce in the request and id tokens. • Verified the fix up to a finite size in our model
Challenge • Does CSP prevent XSS?
Statistics for the case studies • The base model contains some 2,000 lines of code • Tests were performed on an Intel Core 2 Duo 3.16GHz CPU with 3.2 GB memory
Conclusion of case studies • Identified previously unknown attacks in HTML5 Forms, Referer validation, and WebAuth • Proposed countermeasures to the attacks • These attacks are identified based on a formal model the Web that is implemented in Alloy • Modeling approach can discover practical new attacks and verify the security of alternate designs, up to a certain size of the model
Outline • Science of security • Web modeling • Experimental web security study • Privacy and third-party tracking
Experimental Study • What factors most strongly influence the likely security of a new web site? • Developer training? • Developer team and commitment? • freelancer vs stock options in startup? • Programming language? • Library, development framework? • How do we tell? • Can we use automated tools to reliably measure security in order to answer the question above?
Approach • Develop a web application vulnerability metric • Combine reports of 4 leading commercial black box vulnerability scanners and • Evaluate vulnerability metric • Using historical benchmarks and our new sample of applications • Use vulnerability metric to examine the impact of three factors on web application security: • developed by startup company or freelancers • developer security knowledge • Programming language framework
Data Collection and Analysis • Evaluate 27 web applications • from 19 Silicon Valley startups and 8 outsourcing freelancers • using 5 programming languages. • Correlate vulnerability rate with • developed by startup company or freelancers • developer security knowledge (assessed by a simple quiz • programming language used
Language usage in sample Number of applications
Summary of Results • Security scanners are useful but not perfect • Tuned to current trends in web application development • Tool comparisons performed on single testbeds are not predictive in a statistically meaningful way • Combined output of several scanners is a reasonable comparative measure of code security, compared to other quantitative measures • Based on scanner-based evaluation • Freelancers are more prone to introducing injection vulnerabilities than startup developers, in a statistically meaningful way • PHP applications have statistically significant higher rates of injection vulnerabilities than non-PHP applications; PHP applications tend not to use frameworks • Startup developers are more knowledgeable about cryptographic storage and same-origin policy compared to freelancers, again with statistical significance. • Low correlation between developer security knowledge and the vulnerability rates of their applications Warning: don’t hire freelancers to build secure web site in PHP.
Outline • Science of security • Web modeling • Experimental web security study • Privacy and third-party tracking
Health Information Financial Information Shopping History . . . Browsing History
Public opinion on Web tracking 80+% 90+% third-party tracking should be illegal opt outs should be legally binding Source: Turow et al. 2009
Tracking technology stateful tracking tagging stateless tracking fingerprinting
HTTP cookies Flash Local Shared Objects HTTP authentication Silverlight Isolated Storage HTTP ETags TLS session ID & resume content cache browsing history IE userData window.name HTML5 protocol & content handlers HTTP STS HTML5 session/local/global/database storage DNS cache Source: [Aggrawal10]
this is blue link
this is purple link
User Agent installed fonts HTTP ACCEPT Headers cookies enabled? browser plug-ins browser add-ons MIME support screen resolution clock skew Sources: [Eckersley10], [Mayer09]
Anti-tracking efforts Black lists are difficult to produce and maintain
opt out = Do Not Target Ads