Web application security ======================== Originally, much of the security action in web applications was on the server. So far in this class, we have been looking at security of servers. E.g., OKWS (paper from 2004) worried about bugs in server-side code. Web applications were mostly running code on the server. Browser received HTML, displayed it, followed links, etc. This lecture: isolation between sites in a web brwoser. But there's increasingly more happening in the web browsers as well. Modern web applications: HTML, CSS, Javascript, Flash, Native Client, .. Lower latency interactions: no need to wait for server round-trip. Overall plan is called the "same-origin policy". One of the best descriptions is in "The Tangled Web" (today's reading). How did this design come about? Incremental design/development: no single coherent design. Noone expected web browsers to be used in the ways they are today. Security issues patched as they were discovered, with extra rules/checks. Browser vendors competed (and to some extent still compete) on functionality. Adding new features (or even security mechanisms) before standards. Historically, W3C has largely been documenting what browsers already do, instead of proposing new standards that browsers will then implement. Browsers didn't always agree on overall plan, or the implementation details. As a result, many inconsistent corner cases that can be exploited. Now, there's quite a bit of collaboration "behind the scenes". Developers of Chrome, Firefox, IE talk to each other a fair amount. Important issues get fixed slowly over time. Compatibility is a huge constraint, hard to break old sites. (Users will stop using your web browser!) Some of the fixes take place in Javascript libraries (jQuery, etc). When possible, just a compatibility layer on top of raw browser APIs. This lecture's discussion will inevitably be incomplete, possibly buggy.. See "Browser Security Handbook" and "The Tangled Web" for more completeness. Will try to cover some over-arching principles (to the extent they exist). Will also talk about some interesting past/present pitfalls. Web browsers continuously change. New mechanisms have come out since "The Tangled Web". But mostly adding onto the existing design, rather than replacing it. Threat model / assumptions. [ Are they reasonable? ] Attacker controls his/her own web site, attacker.com. Inevitable, with some other domain name. Attacker's web site is loaded in your browser. Advertisements, links, etc. Attacker cannot intercept/inject packets into the network. Will try to solve separately with SSL. Browser/server doesn't have implementation bugs (e.g., buffer overflows). Will try to solve separately with wide variety of techniques. Security goal for web browsers: isolate different web sites from each other. Vague goal: a malicious web site shouldn't interfere with other sites. Example: web sites should not be able to tamper with each other. One web site shouldn't be able to interfere with another web site. Hard to pin down: what is interference vs. what is legitimate interaction? Will look at what this means in various contexts.. Example: user should know what site they're interacting with. Needed if user is relying on page contents, or enters confidential data, or performs some important operation (e.g., xfer money). Phishing attacks often try to mislead the user / violate UI security. Note: identifying site is meaningless if sites can tamper w/ each other. Difficult: web sites must be able interact with each other, in certain ways. Fundamental: sites link to other sites. Can include images from other sites. Mash-ups: Google Maps + craigslist, Facebook "Like" button, ads, Login with Google, ... All sites potentially "running" in the same web browser on user's machine. What does the browser have to worry about? The actor in a web browser is a document loaded in a window. Moral equivalent in Unix: a program running in a process. Most interesting is an HTML document, but can have others (e.g., PDF). What can a document "do"? Link to other pages; user might click on a link: Include image files, style sheet files, etc: Load another document in a frame: