Skip to content
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

Prototype Pollution Vulnerability Affecting [email protected] module #1015

Closed
tariqhawis opened this issue Mar 29, 2024 · 4 comments
Closed

Comments

@tariqhawis
Copy link

tariqhawis commented Mar 29, 2024

Details sent directly to the maintainer

@vtulse
Copy link

vtulse commented May 25, 2024

Team any update on this issues

@artola
Copy link

artola commented Jul 15, 2024

@jrburke It would be possible and cheap to sanitize the config, it is only 1 place to fix.

r.js/require.js

Line 1283 in acec536

//Make sure the baseUrl ends in a slash.

function sanitize(obj) {
  if (obj && typeof obj === 'object') {
    if (obj.hasOwnProperty('__proto__')) {
      delete obj.__proto__;
    }

    for (const key in obj) {
      if (obj.hasOwnProperty(key) && typeof obj[key] === 'object') {
        sanitize(obj[key]);
      }
    }
  }
}

...

            configure: function (cfg) {
               sanitize(cfg);

@prantlf
Copy link

prantlf commented Jul 22, 2024

EDITED

Initially, I couldn't reproduce this vulnerability using the example code. When looking at the code, I saw functions hasProp, getOwn, eachProp, mixin, which allow only own properties accessed. If you copy own properties from one object to another one, they will not be placed to the prototype.

I couldn't reproduce the vulnerability using my fork. I didn't notice that I was testing with that version. I could reproduce it using the official require.js 2.3.6.

@jrburke
Copy link
Member

jrburke commented Jul 22, 2024

This should be fixed in 2.3.7: requirejs/requirejs#1854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants