CVSS 8.2 HIGH

MongoDB Python Driver: Out-of-bounds read in BSON decoding via a malformed Regex element

Mã khác
GHSA-98qm-wvgf-w4cf
Công bố
Cập nhật
Lần đầu thấy
Nguồn
GitHub Advisory, OSV.dev

Mô tả

Impact

The C extension's BSON decoder scans a Regex element's pattern and flags strings with strlen before checking the document's remaining length, so a crafted truncated Regex element can read past the end of the caller's buffer. bson.decode and bson.decode_all accept mmap and array buffers, which carry no NUL sentinel; the read can cross into unmapped memory and kill the process with an uncatchable SIGSEGV. Any application decoding untrusted BSON from such buffers is affected — impact is availability only, since the out-of-bounds bytes are never returned as content. NUL-terminated buffers (bytes, bytearray) raise InvalidBSON at worst; the driver's own transport and pure-Python installs are not affected. All releases through 4.18.2 are affected when the C extension is loaded.

Patches

Fixed in PyMongo 4.18.3. Malformed Regex elements now raise InvalidBSON on every accepted buffer type; valid documents decode unchanged.

Workarounds

Decode untrusted BSON only from NUL-terminated buffers — bytes or bytearray — and copy mmap input first, e.g. bytes(mm[:size]).

Điểm và phân loại

CVSS
8.2 HIGH v4.0
Nguồn điểm
GitHub Advisory
Mức độ (theo nguồn)
HIGH
EPSS
0.09%
CWE
CWE-125

Vector CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Ảnh hưởng

Package Bản bị ảnh hưởng Bản đã sửa
pip pymongo >= 3.9.0, <= 4.18.2 4.18.3
pip pymongo >= 3.9.0, < 4.18.3 4.18.3

Vì sao được giữ

  • CVSS 8.2 >= 8.0

Loại tác động

Không nhận ra loại tác động nào từ CWE, vector hay mô tả.

Dữ liệu riêng của nguồn

OSV.dev · ID
GHSA-98qm-wvgf-w4cf

Tham khảo