Skip to content

Bypasses via attributes #28

Closed
Closed
@koto

Description

@koto

In the Chrome version, when require-trusted-types is enabled

a = document.createElement('script')
a.src = 'http://foo.bar' // throws
a.setAttribute('src', 'http://foo.bar') // does not throw, and...
a.outerHTML == "<script src="http://foo.bar"></script>"

In the polyfill this is fixed, but this works:

a = document.createElement('script');
a.setAttribute('src', TrustedScriptURL.unsafelyCreate('http://foo.bar'));
a.attributes.src.value = 'http://evil.com'; // does not throw, and...
a.outerHTML == "<script src="http://evil.com"></script>"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions