-
-
Notifications
You must be signed in to change notification settings - Fork 17k
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 in examples #3992
Comments
While I am not too worried because the examples are just to show express features, not real use, I think it would be good to do one of two things here:
I would approve a PR which did either of the above. |
If it's within the examples odds are this is out in production somewhere. As a developer would look to examples either first starting out with the framework or just day to day. I can speak from experience on developers using example routes to build out there applications. Therefore since there is the possibility of it existing at least once within the base code, it's not a stretch for it to have been implemented into someone's production application. |
By all means, fix it and submit a PR :) |
Hi @Caprico1 and no one is claiming otherwise. But of course fixing the example won't somehow fixes those theoretical production deployments, for example. That's also why the suggestion was as part of a pull request to fix the issue, to add information for the users who are looking at the examples to understand escaping and why the example is doing it, etc. |
Right, it was to explain in an issue why this would be bad if in prod (owasp link) and @jthorpe6 and I's thought process on how this is an issue. I'll look into making a solution or at the least adding an example to sanitize inputs within routes within the framework. |
Adding sanitization may not fix the existing codebases problem but it will address future users. |
Speaking of security issues in the examples, it is possible to read any file (directory traversal) on a server running downloads example.
express/examples/downloads/index.js Lines 19 to 20 in e1b45eb
And for example, it could be used to read a session secret: |
Hello,
just been playing around with the examples and i discovered XSS in the route-map example.
starting the app like so
Then browsing to the following causes the injected javascript to load
http://ip:3000/users/%22%3E%3Csvg%20onload=prompt()%3E
full request
the issue seems to be with the following in the codebase
where
req.params.uid
is not sanitisedthanks
The text was updated successfully, but these errors were encountered: