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

XSS attack on redirect #76

Open
SardarNL opened this issue Oct 27, 2015 · 0 comments
Open

XSS attack on redirect #76

SardarNL opened this issue Oct 27, 2015 · 0 comments

Comments

@SardarNL
Copy link

lib/rack/rewrite/rule.rb#redirect_message - this method is passing location as is into a link. Suppose that location contains something like #"><script>alert(1)</script>, then resulting body will be Redirecting to <a href="#"><script>alert(1)</script>">#"><script>alert(1)</script></a>. Not all browsers will evaluate response body, but this is still possible.

Solution: do not place that link at all. You can argue that the link should be properly escaped before passing to rack-rewrite, but people tend to make mistakes and the lib should not make it worse.
Better solution: provide a hook to override that short template and by default do not include the link.

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

No branches or pull requests

1 participant