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

frame-src is not effective in restricting the possible origins of subframes #662

Open
antosart opened this issue May 21, 2024 · 3 comments

Comments

@antosart
Copy link
Member

As noticed here, since CSP sources match against the URL to be loaded and not against the origin, and since about:blank is always allowed by CSP, Content-Security-Policy: frame-src 'self' does not prevent child frames of the current document to have different origins than the document itself. For example, in the frame tree 1.A > 2.B > 3.B with origins A and B, the top-level A can always navigate the grandchild to about:blank, making it have origin A and resulting into the frame tree 1.A > 2.B > 3.A, even if 2.B comes with CSP: frame-src 'self'.

This might be surprising to web developers, who might assume in their security model that this would never happen. I wonder if it's something we'd want to change.

@qabandi
Copy link

qabandi commented Oct 7, 2024

+1 about:srcdoc too, see https://issues.chromium.org/issues/40052152

@NDevTK
Copy link

NDevTK commented Oct 8, 2024

Well at least .srcdoc cant be set by a cross-origin embedder.

@NDevTK
Copy link

NDevTK commented Oct 8, 2024

For context this CSP "bypass" was used in https://ndevtk.github.io/writeups/2024/09/19/drive/ without agreement not much can change. The chromium bug for this https://issues.chromium.org/338248596 is currently marked as a ExternalDependency.

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

3 participants