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

fix: errorMsg may cause XSS attack #1747

Closed
wants to merge 1 commit into from
Closed

Conversation

Innei
Copy link

@Innei Innei commented Apr 26, 2021

Hi, guy, I found a bug which will cause XSS attack, in errorMSg, you use innerHTML to replace %url, but origin image src url maybe an unsafe url, like this https://example.com/"/>"<script>alert("1")</script>"<a . So, must escape origin image url, replace < > ' or " .

This bug not only in default error message, but also in custom error.
image

@dimsemenov
Copy link
Owner

PhotoSwipe does not sanitize the content, not for images, not for the caption. Escape the URLs before passing them to PhotoSwipe.

This is also partly fixed in v5 version.

@dimsemenov dimsemenov closed this Apr 29, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants