-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Further granularity of unsafe-inline styles #45
Comments
For example @marumari's new site pokeinthe.io she was required to use https://pokeinthe.io/theme/images/icons/linkedin.svg Which uses these:
This sort of thing is common place in an SVG however all other browsers besides Firefox don't block this when loading an external document. |
I will say that it's near impossible to find any site of a significant size that doesn't have In my scanning of the top 100000 or so sites, of the sites that use CSP, very few of them don't have The fact that My messed up nginx config, just to make SVGs work:
|
It is unsafe. An adversary who has control over a I would support separating |
@arturjanc, et al: Anyone interested in squeezing a proposal into CSP3? |
Repinging here due to the panic around: https://news.ycombinator.com/item?id=16422696 I also want to highlight we could probably do something about the font range attack in CSS too (restricting unicode-range to bigger ranges), however @annevk thinks that might become a wackamole exercise. |
@jonathanKingston: It's not clear what that PoC has to do with inline styles. It relies on attribute selectors, which you can't put into |
@mikewest the proposal here is regarding the attack vector of If we added a new directive (or two) My issue here isn't with attributes and perhaps this thread has taken a turn in this direction. The original topic here and the attack vector described in the Hacker News thread is regarding |
I'm not sure why I never commented here (sorry!), but I like this approach, as evidenced in #202 which is duped to this issue. +1 to what @jonathanKingston is saying: it would be valuable for developers to allow The main problem here is, as usual, backwards-compatibility with CSP2. If we add
The problem is that in CSP2 browsers, the nonce will cause the browser to ignore
This would work properly in CSP<=2 browsers (only |
A different name might assist the issue @arturjanc speaks of. Perhaps |
I would also like to second work on this issue. Many of the legacy websites we are working with have hundreds of style attributes. They are often prepared with automatic frameworks and it is going to be very difficult to make these websites CSP compatible. The new spelling proposal of @arturjanc looks good. |
As another data point, this proposal would also mitigate (at least partly) issues such as https://gist.github.com/securityMB/d9e84bd3c7c245895360808360b9dc4e because inline style attributes do not allow an attacker to style other elements in a way that allows for CSS-only exfiltration. JFYI. |
Just adding this for reference, but a couple weeks ago I expanded on the CSS keylogger attack to create a much more reliable attack. I also stood up a permanent demo site here: |
I have sent an e-mail on public-webappsec but in case someone follows this thread more closely, I will also leave a comment here. I have put together an explainer for this and I would like to hear your thoughts. https://docs.google.com/document/d/1_nYS4gWYO2Oh8rYDyPglXIKNsgCRVhmjHqWlTAHst7c/edit?usp=sharing |
For what it’s worth, on a website with a (I just discovered this browser inconsistency on my website and wanted to state it here, for the record.) |
That doesn't seem to be the case anymore, as of right now, serving an SVG with |
@andypaicu isn't this issue resolved by your PR #325 |
Could we consider decoupling
<style>
andstyle="..."
usage instyle-src 'unsafe-inline'
CSP setup?The rationale is that as far as I am aware
style="..."
has no modern security issues in CSP supporting browsers; where as given selector support<style>
could be manipulated to check for data on the page and load images.For example there are various teams wanting to implement CSS parsers to get around the
style="..."
support issue, where as<style>
seems mostly easy to move to a secure setup. So for example Ember team is willing to take the property in and set it as JavaScript attributes after parsing to mitigate the warning.There could also be room to discuss if granularity for SVG
<style>
tags could be separate too I guess?@mozfreddyb mentioned that he would like to see scoped styles granularity also which probably makes sense too.
/cc @mikewest
The text was updated successfully, but these errors were encountered: