Skip to content
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

Missing *-src directives when default-src is unspecified #67

Closed
hansmach1ne opened this issue Jul 9, 2024 · 1 comment
Closed

Missing *-src directives when default-src is unspecified #67

hansmach1ne opened this issue Jul 9, 2024 · 1 comment

Comments

@hansmach1ne
Copy link

hansmach1ne commented Jul 9, 2024

The following CSP is regarded as secure: Content-Security-Policy: script-src 'none'; object-src 'none'

When default-src is unspecified and if any of the following directives are not present, those are therefore also not specified:

style-src
img-src
connect-src
font-src
media-src
frame-src
child-src
worker-src
manifest-src
prefetch-src

There are a couple of issues here, specifically when default-src is missing:

a) If style-src is explicitly not specified or unsafe-inline, attacker can leak parts of the HTML code with inline CSS injection.

b) if for example img-src is explicitly not specified, attacker can overwrite server-defined Referrer-Policy by injecting <img> tag with it's own referrerpolicy attribute and leak the whole site's URL where the injection is present. Check: https://issuetracker.google.com/issues/332052787 for more info.

c) Firefox and some other browsers have no Dangling Markup protections in place. Which means attacker can reference his/her site via any of those *-src directives and achieve cross-site leakage.

@lweichselbaum
Copy link
Member

Thank you for your comment. The CSP Evaluator is assessing CSPs for their ability to mitigate XSS and does not cover other use cases like mitigating data leaks.

@lweichselbaum lweichselbaum closed this as not planned Won't fix, can't repro, duplicate, stale Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants