Live data from Hacker News

Critical RCE Vulnerabilities in React and Next.js

wiz.io

81–90 of 92 posts

Re: Critical RCE Vulnerabilities in React and Next.js

#81

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.

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

#82

Earlier 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

I'm aware that this is your perspective but you should be aware that it is your subjective opinion. Their intention does not appear to be condescending. They did not assume or imply any of those things. Your anger is misplaced with that individual; they didn't hurt you.

Re: Critical RCE Vulnerabilities in React and Next.js

#84
post #54
post #52

It 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']

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 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
  true

Re: Critical RCE Vulnerabilities in React and Next.js

#85

Who 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.

God, how I miss the day when software came on a disc and wasn't stuffed behind a $10-per-month subscription full of sploits and vulns.

Re: Critical RCE Vulnerabilities in React and Next.js

#86
post #54

Earlier 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…

That was a typo, yeah. It should be

  console.log(config.isAdmin); // true!

Re: Critical RCE Vulnerabilities in React and Next.js

#87
post #6
post #3

Unsafe 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

You win!

Re: Critical RCE Vulnerabilities in React and Next.js

#88
post #52

It 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…

On Node.js there are some hardening flags like --disable-proto=throw and --frozen-intrinsics to mitigate/crash on prototype pollution, and to prevent dynamic evals with --disallow-code-generation-from-strings - however, Vercel doesn't seem to support custom node runtime options.

Re: Critical RCE Vulnerabilities in React and Next.js

#89
post #8

Here'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.

Unrelated but... wow, this is... certainly some code.

      return "*" === metadata[2]
        ? moduleExports
        : "" === metadata[2]
          ? moduleExports.__esModule
            ? moduleExports.default
            : moduleExports
          : moduleExports[metadata[2]];

Re: Critical RCE Vulnerabilities in React and Next.js

#90
post #17

I 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…

Checked. The answer is no (Claude Opus 4.5 with OpenCode). It wasn't even able to write a scanner to check for the vulnerability that worked. I gave it the diffs and various writeups, and the free access to the source and compiled index.js. It kept trying to cheat by editing the source to add a vulnerability and saying that it got an RCE
Post reply on HN