CVE-2019-19729
Description
An issue was discovered in the BSON ObjectID (aka bson-objectid) package 1.3.0 for Node.js. ObjectID() 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.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
bson-objectid 1.3.0 for Node.js allows malformed ObjectID generation by checking only the _bsontype property, enabling property injection attacks.
Vulnerability
Overview
The bson-objectid package version 1.3.0 for Node.js contains a flaw in its ObjectID() constructor. The constructor attempts to accept user-provided objects and check if they are already valid ObjectID instances. However, the check is insufficient: it only verifies that the input object has a _bsontype property equal to "ObjectID" [1], [3]. This allows an attacker to craft a JavaScript object that sets _bsontype to "ObjectID" while including arbitrary additional properties, causing the constructor to return early and treat the entire object as a valid ObjectID.
Exploitation
Conditions
An attacker can exploit this by providing user-controlled input that is passed to the ObjectID() function. The attacker simply includes a property named _bsontype with the string value "ObjectID" in the input object [1], [3]. Unlike the official MongoDB BSON library, which additionally verifies that the input's constructor is ObjectID, the vulnerable package does not enforce this stricter check [3]. No authentication or special network position is required—any service that uses bson-objectid to parse user-supplied data (e.g., from JSON payloads) is susceptible.
Impact
Successful exploitation results in the generation of a malformed ObjectID [1]. This malformed ObjectID may bypass downstream validation and formatting logic that expects a legitimate, well-formed ObjectID. For example, ObjectID.isValid() would incorrectly return true for such a malformed object [3]. This could lead to application-level issues such as database injection, data corruption, or logic errors in systems that rely on the integrity of ObjectIDs.
Mitigation
Status
The issue was fixed in later versions of the package. Users should upgrade to a patched version (e.g., 2.x releases) to remediate the vulnerability. As of the publication date, no workaround exists for version 1.3.0 other than upgrading or manually validating input before passing it to ObjectID() [2], [3].
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
bson-objectidnpm | <= 1.3.0 | — |
Affected products
3- BSON ObjectID/bson-objectiddescription
- Range: = 1.3.0
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
4- github.com/advisories/GHSA-p84x-5xx8-hff9ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2019-19729ghsaADVISORY
- github.com/williamkapke/bson-objectid/issues/30ghsax_refsource_MISCWEB
- www.npmjs.com/package/bson-objectidghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.