Earlier quoted context omitted.
[flagged]
You're missing the point. You shouldn't take it personally. > Assuming everyone is an idiot who a) doesn't know something common and b) isn't able to figure out how to google it and c) isn't able to figure out how to say "where's that from?" in a reply These things were neither assumed nor implied.
Critical RCE Vulnerabilities in React and Next.js
81–90 of 92 posts
Re: Critical RCE Vulnerabilities in React and Next.js
#82Earlier quoted context omitted.
You're missing the point. You shouldn't take it personally. > Assuming everyone is an idiot who a) doesn't know something common and b) isn't able to figure out how to google it and c) isn't able to figure out how to say "where's that from?" in a reply These things were neither assumed nor implied.
They are implied when someone feels like they need to cite commonly known, easily found, and easily asked about stuff. That’s like the whole reason why it’s condescending
Re: Critical RCE Vulnerabilities in React and Next.js
#83RCE Vulnerability in React and Next.js
Re: Critical RCE Vulnerabilities in React and Next.js
#84It seems like this vulnerability is yet another prototype pollution vulnerability. There was a TC39 proposal a few years ago [0] that proposed to block the getting/setting of object prototypes using the bracket notation, which would have prevented this vulnerability. At the moment, every single get/set with a square bracket, which uses untrusted data, needs to do some manual check to see whether variables contain "ba…
Note however, that proposal does not cover some other types of prototype pollution, such as: > let config = {}; > Object.assign(config, JSON.parse('{"__proto__": {"isAdmin": true}}')); console.log({}.isAdmin); // true! or: > console.log({}['constructor'] ? {}['constructor']('THIS MUST NOT BE EXPOSED') : 'pub') [String: 'THIS MUST NOT BE EXPOSED']
> let config = {};
> Object.assign(config, JSON.parse('{"__proto__": {"isAdmin": true}}'));
console.log({}.isAdmin); // undefined
That being said, it _will_ happen if you use your own merge() function like the TC-39 proposal demonstrates, but its because you are using the [] syntax to implement it which can affect __proto__Side note, JSON.parse() also doesn't let you set the actual prototype:
> JSON.parse('{"__proto__": {"isAdmin": true}}')
{ ['__proto__']: { isAdmin: true } }
> JSON.parse('{"__proto__": {"isAdmin": true}}').isAdmin
undefined
A normal JS object can do it, but of course that isn't attacker controlled unless you are using `eval()`, in which case the battle is lost anyway. > {"__proto__": {"isAdmin": true}}.isAdmin
true
But even if JSON itself doesn't set the actual prototype, combining it with a user-written merge() function that copies __proto__ will indeed pollute. > Object.entries(JSON.parse('{"__proto__": {"isAdmin": true}}')).reduce((o, [k, v]) => o[k] = v, {}).isAdmin
trueRe: Critical RCE Vulnerabilities in React and Next.js
#85Who knew react server components was a bad idea.... They'll fix it, and it will probably be fine. But every single old school PHP developer and or developer with commonsense knew this was coming.
Re: Critical RCE Vulnerabilities in React and Next.js
#86Earlier quoted context omitted.
Note however, that proposal does not cover some other types of prototype pollution, such as: > let config = {}; > Object.assign(config, JSON.parse('{"__proto__": {"isAdmin": true}}')); console.log({}.isAdmin); // true! or: > console.log({}['constructor'] ? {}['constructor']('THIS MUST NOT BE EXPOSED') : 'pub') [String: 'THIS MUST NOT BE EXPOSED']
For the first case, it doesn't work because Object.assign() does not copy the prototype or non-enumerable properties, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... > let config = {}; > Object.assign(config, JSON.parse('{"__proto__": {"isAdmin": true}}')); console.log({}.isAdmin); // undefined That being said, it _will_ happen if you use your own merge() function like the TC-39 proposal demonstra…
console.log(config.isAdmin); // true!Re: Critical RCE Vulnerabilities in React and Next.js
#87Unsafe deserialization is a very 2010 Ruby on Rails sort of vulnerability. It is strangely interesting that such a vulnerability was introduced so late in the lifetime of these frameworks. It must be a very sneaky vulnerability given how cautious we have become around deserialization since then.
I'm willing to bet that this is linked to the magic __proto__ object namespace in JavaScript
Re: Critical RCE Vulnerabilities in React and Next.js
#88It seems like this vulnerability is yet another prototype pollution vulnerability. There was a TC39 proposal a few years ago [0] that proposed to block the getting/setting of object prototypes using the bracket notation, which would have prevented this vulnerability. At the moment, every single get/set with a square bracket, which uses untrusted data, needs to do some manual check to see whether variables contain "ba…
Re: Critical RCE Vulnerabilities in React and Next.js
#89Here's a patch diff: https://github.com/vercel/next.js/compare/v15.0.4...v15.0.5 It looks like the fix is checking hasOwnProperty, so it's almost certainly an issue with prototype chain pollution.
return "*" === metadata[2]
? moduleExports
: "" === metadata[2]
? moduleExports.__esModule
? moduleExports.default
: moduleExports
: moduleExports[metadata[2]];Re: Critical RCE Vulnerabilities in React and Next.js
#90I don't have time to look into it right now (def later)! However, I was curious to see if github copilot can reverse engineer it based on the latest commits and seems that what it is saying aligns with both advisories. It pointed out that it has to do with circular reference handling which sounds to me something that can be easily overlooked. While this analysis might be completely off, the simple fact that I could g…