-
Notifications
You must be signed in to change notification settings - Fork 20
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
Unsafe use of eval #7
Comments
What I should really do is switch this to use I'd accept a push request for changing to |
Ok I changed to using Does this prevent the danger you were worried about? |
Thanks for the fast response! I am a researcher investigating possible server side command injections. Unfortunately, your commit did not solve the problem. :( Try passing something like this: var query = "} + eval(\'console.log(\"my ver evil stuff here\");\')//" JavaScript is pretty crazy I know! :| I guess you need some kind of validation on the query parameter. |
I see. Well adding any sort of function sanitizer directly into mongo-parse is pretty out of scope. What could make sense is adding the ability to pass in a function validator/sanitizer. I'd be willing to accept a pull request for that. Something with an API like |
🛠️ A fix has been provided for this issue. Please reference: 418sec#1 🔥 This fix has been provided through the https://huntr.dev/ bug bounty platform. |
In file mongoParse.js the following use of eval is dangerous:
An attacker may craft a query that may lead to code execution. I suggest either refactoring out eval, use some regular expression for validation or use a sanitization package like:
https://www.npmjs.com/package/eval-sanitizer
The text was updated successfully, but these errors were encountered: