-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
update 50.2.1 (v4.0.3-14.4.3) and/or split requirement for content-security-policy #1958
Comments
I politely disagree with this proposal. I do not want to focus on what NOT to do, but instead I would suggest we focus on what TO do. In this vein, I would like to build requirements for strict-csp as highlighted here #1311 |
Positive requirement is up to wording fine-tuning, at the moment is important to validate the idea. For strict-csp, please keep the discussion in "I opened the issue" #1311. |
We had some proposals that I liked in #1311, I want to see where those go first. I want the CSP requirement to be as simple as possible and fall back on the CSP cheatsheet wherever possible. |
As mentioned issue #1311 is full of noise and childish downvotes to my comments, I keep my comments in this issue. I politely and with all respect make it clear here, please do not comment before reading the entire comment or issue. If needed, I'm going to delete "noise-comments" to keep the issue clean and followable. To the topic now. There are so many options to make things (in)correctly and I think we should concentrate on addressing different attack vectors to mitigate, instead of only pointing to certain techniques the Content-Security-Policy header provides. The focus - at the moment, everyone seems to only talk about JavaScript execution vectors. It is the most critical one, but it is not the only one. For example, defense against UI Redress / ClickJacking requires one certain directive ( The question now is - what are all the attack vectors we address with the Problems to avoid - we should not write hidden requirements with the We should not waste time discussing levels before requirement texts are set. As the Attack vectors
Anything else? Information leakage - for this we need to use allow-lists. Some may be allergic to that, but using allow-lists is not the opposite of using nonces or hashes, those can be used together. With allow-lists, we need to be sure, that nothing can be loaded from untrusted sources, not only scripts and styles. Allow-lists - The main issue with allow-list is, that allowed-endpoints must allow only own-controlled and/or trusted end-points. With all related research with a "too-close-to-100%" bypass ratio the problem is on an allow-listed hostname are JSONP endpoints, shared scripts or gadgets etc. This includes widespread problem - when end-users can upload files to allow-listed sphere, e. g. So, what to take into account is that you need to allow images from user-uploaded files, but can not allow script files. In this context, if the application validated images to be in the expected format and size, we can call it "trusted", e.g. an end-user can not create content with WYSIWYG or use HTML injection vulnerability to point thousands of images to external files with Gigabytes in size. Mixing content and functionality - the main reason for JavaScript injection is mixing (untrusted) content and functionality The pre-condition for using hashes - the content must be static. The pre-condition for using nonces - the content must be trusted. If there is a JavaScript injection in inline Requirements It takes some more time to reach the requirement text proposals. Extra arguments and edge-cases are more then welcome. Personally I feel there is a need for 2 requirements (a already was proposed #1311 (comment) and #1311 (comment), but were lost in a noise a bit, although used as a base for the recommendations there):
ping @Sjord @ryarmst (as I have seen valuable fact-based feedback from you on the topic) |
@elarlang I agree and I think it makes the most sense to approach by vector. As far as Attack Vectors, I would just expand "JavaScript execution" to a more general "malicious content execution or rendering" as there are directives preventing more than script execution. |
I think it is quite JavaScript execution-driven. Do you any other examples? Mid-way could be "malicious scripts"? What makes it false for me is that if there is an HTML injection, you can manipulate an HTML document visually and functionality and there is little to no help from Content-Security-Policy to stop that, but HTML syntax is malicious content in this context. |
Good point. There is no CSP feature to prevent modification of HTML content, but it can prevent actions like the submission of forms to untrusted origins via HTML form hijacking. It can also block loading of various non-script resources, so there can be restrictions in the content that can be used to manipulate a document, though I think many of these are not particularly useful for mitigating real attacks. There is also the |
That is addressed/addressable with the first proposed requirement - to allow loading resources and communication only with trusted parties, it includes things like
Note, that for sandbox (which is again just one option to solve the vector), there is already requirement "V50.5 Unintended Content Interpretation"
|
There are so many other ways to steal/exfiltrate data from an injected page that the CSP defenses to stop data leakage are mostly not important. The standard stopped trying to plug those holes. I suggest we just focus on XSS defense and not worry about trying to set standards that prevent data from being stolen once the injection occurs.
|
Sandbox is also meant to protect against malicious payloads in someone elses data. E.g. when you allow users to upload their own files, or otherwise serve third-party content, using sandbox makes it possible to do serve less-trusted content without granting it access to execute JavaScript. |
@Sjord - but this all covered with the mentioned requirement (50.5.3). If not, what else there should be covered? |
@elarlang to try and draft some ideas for this |
closed via #2337 |
Spin-off from #1311
We have 3 Content-Security-Policy related topics to discuss:
Note, that we also have CSP related requirement 50.2.5 (v4.0.3-14.4.7):
As it is a separate attack vector (ui redress), then it can stay separately. Also, it is 1st layer of defense, most of the CSP has the goal to be 2nd layer of defense against the so-called XSS. So it can stay separately.
Discussion 1
#1311 (comment)
Entire discussion is in the #1311, TLDR is - we can not say technically directives and values, which are suitable for every application, but we need to describe the principle - the application must communicate with only trusted parties.
Discussion 2
#1311 (comment)
Instead of saying "Do not use 'unsafe-inline'" we should try to explain the goal of the restriction.
In case there is an HTML injection vulnerability, disallowing using inline scripts should make the attacker's life more interesting.
In case there is a JavaScript injection in an inline script (between
<script> .. </script>
tags in an HTML document), an attacker can do a successful attack without communicating with any external party. Note, that also thenonce
for the<script>
tag does not help in this case.First I though to go for recommendation direction:
If to go for the requirement direction (instead of recommendation), it should carry ideas:
Verify that
.. now, how to make it twice shorter :)
Feels like a level 3 requirement... or recommendation?
For the chapter, maybe this requirement should be together with "SRI" requirement and the current "V50.6 External Resource Integrity" to be renamed to "V50.6 Resource Integrity".
ping @Sjord @tw2as @tghosth - your ideas?
The text was updated successfully, but these errors were encountered: