bson-objectid@1.2.1 vulnerabilities

Construct ObjectIDs without the mongodb driver or bson module

Direct Vulnerabilities

Known vulnerabilities in the bson-objectid package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • L
Insufficient Input Validation

bson-objectid is a library that allows you to construct ObjectIDs without the mongodb driver or bson module.

Affected versions of this package are vulnerable to Insufficient Input Validation. The ObjectID() function allows an attacker to generate a malformed objectid by inserting an additional property to the user-input, because bson-objectid will return early if it detects _bsontype==ObjectID in the user-input object. As a result, objects in arbitrary forms can bypass formatting if they have a valid bsontype.

PoC by Feng Xiao (xiaofen9)

var ObjectID = require("bson-objectid");

var json = {
    "mal_formkey": {
        "payload": "xxxx"
    },
    "_bsontype" : "ObjectID"
};

console.log(ObjectID(json));
console.log(ObjectID.isValid(ObjectID(json)));

How to fix Insufficient Input Validation?

There is no fixed version for bson-objectid.

*