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 using .parse() #60

Closed
keerok opened this issue Feb 23, 2022 · 14 comments · Fixed by #62
Closed

Prototype Pollution using .parse() #60

keerok opened this issue Feb 23, 2022 · 14 comments · Fixed by #62

Comments

@keerok
Copy link

keerok commented Feb 23, 2022

Hi, There's a prototype pollution vulnerability in .parse() related to the xml that are being parsed in it. In the following example the prototype pollution will affect the length parameter.

var plist = require('simple-plist');

var xml = `
<plist version="1.0">
    <key>metadata</key>
    <dict>
      <key>bundle-identifier</key>
      <string>com.company.app</string>
    </dict>
  </plist>`;

console.log(plist.parse(xml));
/**
 * * * * * * * * * * * * * * * * * * * * * * * * * *
 * * * * END OF THE NORMAL CODE EXAMPLE! * * * * * * 
 * * * * * * * * * * * * * * * * * * * * * * * * * * 
 **/


/**
 * * * * * * * * * * * *
 * PROTOTYPE POLLUTION *
 * * * * * * * * * * * *
 **/
var xmlPollution = `
<plist version="1.0">
  <dict>
    <key>__proto__</key>
    <dict>
      <key>length</key>
      <string>polluted</string>
    </dict>
  </dict>
</plist>`;
console.log(plist.parse(xmlPollution).length); // polluted

More information about the vulnerability: https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf

@SimenB
Copy link

SimenB commented Mar 30, 2022

Since GHSA-gff7-g5r8-mg8m is a thing now, maybe a ping to @wollardj could get this fixed? 😀

@Sujay-shetty
Copy link

could you please update plist package to latest version (3.0.5) where this vulnerability is fully fixed?
TooTallNate/plist.js#114

mergify bot pushed a commit to valora-inc/wallet that referenced this issue Mar 30, 2022
### Description

There is a new vulnerability alert for simple-plist GHSA-gff7-g5r8-mg8m however the issue is not yet resolved from the project. For now ignore the vulnerability to unblock the CI, but we should bump the resolved version of simple-plist once [issue #60](wollardj/simple-plist#60) is resolved.

### Other changes

N/A

### Tested

N/A


### How others should test

N/A
### Related issues
N/A

### Backwards compatibility

Yes
@wollardj
Copy link
Owner

I'm re-opening this for a bit. I want to write some tests to go along with this before I cut a new release, but I won't have time until later this evening.

@wollardj wollardj reopened this Mar 30, 2022
@SimenB
Copy link

SimenB commented Mar 30, 2022

Seems weird the advisory points to this module if the bug is in a dependency...

@wollardj
Copy link
Owner

I've just published v1.3.1 to npm (https://www.npmjs.com/package/simple-plist/v/1.3.1) and tagged it as latest. Let me know if anyone sees any issues or if any additional audits are failing.

@srithar21
Copy link

Hi ,

I am getting the same issue in 1.3.1 version.

https://security.snyk.io/vuln/SNYK-JS-SIMPLEPLIST-2413671
Screen Shot 2022-04-01 at 10 28 48 AM

@wollardj
Copy link
Owner

wollardj commented Apr 2, 2022

@srithar21 - I'm not sure how they're able to do that. I attempted to verify their POC by adding a test for it and the underlying plist.js library throws when it detects a __proto__ key.

image

Less important, but also a little suspicious, their POC wouldn't work anyway because the first byte is an unexpected ASCII sequence which would have made simple-plist attempt to use the binary parser. Since the file isn't binary, their example results in a different error with the message "Unable to determine format for plist aStringOrBuffer".

It's entirely possible if not likely that their POC is suffering from a formatting problem, but it's still worth noting since the POC doesn't appear to be valid.

Happy to be wrong about this if someone can point out something that I might be missing.

@oanatinus
Copy link

I wonder if you need to close this GitHub issue in order to trigger the various vulnerability databases to "recheck" the vulnerability...

@elopezanaya
Copy link

Hello, does someone know the status of this issue?, it seems like it was already solved , but this issue still is open, and in all CVE references is marked as not patched

@MaeveOReilly
Copy link

npm audit still listing it as open with no patch for me; I'm guessing @oanatinus is correct and this issue needs to be closed?

@oanatinus
Copy link

@wollardj what do you think, do you want to try closing this issue to see if that triggers the vulnerability databases to mark 1.3.1 as the fixed version?

@wollardj
Copy link
Owner

It's worth a shot

@brice-noowu
Copy link

Still an issue here, npm audit still listing it as open with no patch

@darakian
Copy link

darakian commented Jun 1, 2022

It's worth a shot

In the future give us a shout over at https://github.com/github/advisory-database/ if we're out of date 😉

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

Successfully merging a pull request may close this issue.

10 participants