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

Potential XSS issue in the stylesheets #1

Closed
Andreas-Hjortland opened this issue Mar 9, 2020 · 1 comment
Closed

Potential XSS issue in the stylesheets #1

Andreas-Hjortland opened this issue Mar 9, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Andreas-Hjortland
Copy link

Andreas-Hjortland commented Mar 9, 2020

First of all I must thank you for learning me an awesome trick that I didn't know about =)

I noticed that you are inserting the style tag as raw HTML with potentially unescaped parameters. Granted it is not likely this will be exploitable since the web page will need to allow users to set the class name, or any of the drop shadow parameters for this to be exploitable, but it is also relatively simple to fix it.

The fix is replacing

document.head.insertAdjacentHTML('beforeend', `<style>
styles here...
</style>`);

with

const styles = document.createElement('style');
styles.textContent = `
styles here...
`;
document.head.appendChild(styles);

I have attached a JSfiddle here which shows how you can exploit it... Just hit the submit button and you will get an alert.

@robinloeffel robinloeffel self-assigned this Mar 9, 2020
@robinloeffel robinloeffel added the enhancement New feature or request label Mar 9, 2020
@robinloeffel
Copy link
Owner

Love it, fixed in 62a8108!

Thank you for taking the time and looking through the source!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants