Insufficient Input Validation Affecting bson-objectid package, versions *


Severity

Recommended
0.0
low
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.12% (47th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-BSONOBJECTID-570765
  • published 1 Jun 2020
  • disclosed 12 Nov 2019
  • credit Feng Xiao (xiaofen9)

How to fix?

There is no fixed version for bson-objectid.

Overview

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)));

References

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
3.7 low
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    None
  • Integrity (I)
    Low
  • Availability (A)
    None
Expand this section

NVD

7.5 high