-
Notifications
You must be signed in to change notification settings - Fork 182
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
Security vulnerability for non-HTTP URLs #172
Comments
@redonkulus Good find! Adding |
@rrdelaney do you care to open a PR with the fix? |
Sure! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rrdelaney @okuryu
We got a report internally that the new URL option can introduce a security vulnerability in the code.
When URLs are serialized, unsafe HTML characters can still be introduced through non-http URLs. When reflected into a
<script>
element, the serialized code can escape out of the script tag by introducing</script>
in the URL.Steps to reproduce
Expected Output: The
<
,/
and>
characters should be escaped (throughescapeUnsafeChars
).Actual Output:
Impact
When reflected into a
<script>
element, XSS can occur. This requires the attacker to control the URL being serialized.Potential Fix
The string in the
new URL
constructor could be sanitized by passing it through theserialize
function.Output change:
I've tried out this fix, but it will also escape the characters in the URL as well. I am not sure if this will introduce any breaking changes.
Opening this up for thoughts and ideas on a fix.
The text was updated successfully, but these errors were encountered: