What is Self-XSS?
Dr. Evil has several options for getting his script to execute in the page of another site. Generically we call this XSS. Self-XSS involves using social engineering to coerce a user into manually executing javascript using the location bar or developer tools. For more, see socially-engineered XSS attacks.
The recent Facebook attack signals that something needs to be done, but knowing the right response is tricky.
What is Mozilla doing about it?
We’re proposing adding a directive to CSP that says ‘Please disallow user supplied Javascript in the context of this resource’.
It will probably look something like this:
X-Content-Security-Policy: no-user-js
We’re also going to add a way for developers to opt out of this protection. Effectively saying ‘I can take care of the JavaScript that I ask my browser to execute’.
How does this affect other Firefox developer tools?
It doesn’t. The Highligher, Style Inspector, Style Editor and Tilt are all unaffected. This is only about JavaScript executed via the Web Console and Scratchpad.
How does this affect users?
| User | Is a developer? | ||
|---|---|---|---|
| No | Yes | ||
| Can recognize Self-XSS attack? | No | Added Self-XSS attacks protection. | Warned about Self-XSS, may benefit from protection. |
| Yes | Unchanged | Minor inconvenience of having to set a preference (one time only) to enable user JavaScript on sites using this Self-XSS protection. | |
I think this is a fairly clear net win: Minor, one time only, inconvenience to a sub-set of web developers, vs. full-time protection for the many that wouldn’t recognize a self-xss attack.
Objections: This is a user problem
The goal of educating 7 billion people about what JavaScript can do is lofty, grandiose, ambitious and utterly unattainable. There has to be another solution.
Objections: This is a Facebook problem
While it’s true that allowing untrusted, unvetted third party dynamic content onto your site is something that I would generally advise against. However I don’t think that fixing this would fix the problem. The attack could easily forward you to another site to see the clipboard injecting flash, before returning you to the original site for the ‘paste’ step
Objections: This is a Flash problem
While it’s true that Adobe’s clipboard policies are more relaxed than those of major web browsers, we’ve seen people caught by instructions that ask people to select/copy their own attack script. We think that the level of pain caused to developers by the CSP solution is low enough that we can justify the additional protection.