CVE-2021-28027
JSON

9.8critical

Loading a bgzip block can write out of bounds if size overflows.

Severity
9.8critical CVSS:3.1 by NVD
Exploit likelihood
1.31% (higher than 71% of CVEs)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-cpqj-r29q-chrhRUSTSEC-2021-0027

Description

An issue was discovered in the bam crate before 0.1.3 for Rust. There is an integer underflow and out-of-bounds write during the loading of a bgzip block.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
bam (crates.io)before 0.1.3, from 0.0.0-0 before 0.1.3GitHub Advisory Database, RustSec Advisory Database
bam_project bambefore 0.1.3NVD

All scores

GitHub9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
RustSec Advisory Database9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD7.5high CVSS:2.0AV:N/AC:L/Au:N/C:P/I:P/A:P

Classification

What each source says

CVE List

An issue was discovered in the bam crate before 0.1.3 for Rust. There is an integer underflow and out-of-bounds write during the loading of a bgzip block.

RustSec Advisory Database

Affected versions of bam set the length of an internal buffer using self.compressed.set_len(block_size - HEADER_SIZE - MIN_EXTRA_SIZE) and then wrote into it. While block_size was constrained to a proper maximum, when it was too small the subtraction could overflow negatively to a large number past the capacity of self.compressed.

This can result in memory corruption in the form of writing out of bounds when loading a bgzip file with a small block_size.

Commit 061eee38d4 fixed this issue by checking for the underflow when setting the buffer size.

NVD (es)

Se detectó un problema en la crate bam versiones anteriores a 0.1.3 para Rust. Se presenta un subdesbordamiento de enteros y una escritura fuera de límites durante la carga de un bloque bgzip

References

Sources

SourceRecordLicence
CVE ListCVE-2021-28027 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-cpqj-r29q-chrh changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2021-0027 changed 2023-11-08CC0-1.0
NVDCVE-2021-28027 changed 2026-06-17Public domain