-
Notifications
You must be signed in to change notification settings - Fork 1.7k
JS: recognize sanitizing slashes in URL redirection queries #436
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also LGTM, but I would like clarification on the regexp.
javascript/ql/src/semmle/javascript/security/dataflow/UrlConcatenation.qll
Show resolved
Hide resolved
Performance goes both ways. I suspect the difference is that there are more sinks now (unreachable due to the sanitizer), so the exploratory flow steps reach a larger graph. |
I had also missed that the SSRF query depends on |
Conflicts again. |
a2bcc53
to
c06c9a0
Compare
The sanitizer for our URL redirection queries is now more precise, so we no longer get false positives from things like:
The tricky thing about slashes is that they are used in multiple parts of the URL:
The attacker must not be able to control the hostname, so we need to make sure a slash cannot be interpreted as (1). A redirection such as
is unsafe because it can lead to
//evil.com
.I've also removed the
Sink.maybeNonLocal()
predicate from ServerSideUrlRedirect as it appears to implement the same sanitizer as the sanitizing prefix.I'll run an evaluation, but just putting up for review now.