RUSTSEC-2021-0027

Source
https://rustsec.org/advisories/RUSTSEC-2021-0027
Import Source
https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2021-0027.json
JSON Data
https://api.osv.dev/v1/vulns/RUSTSEC-2021-0027
Aliases
Published
2021-01-07T12:00:00Z
Modified
2023-11-08T04:05:27.546593Z
Severity
  • 9.8 (Critical) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
Loading a bgzip block can write out of bounds if size overflows.
Details

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.

Database specific
{
    "license": "CC0-1.0"
}
References

Affected packages

crates.io / bam

Package

Affected ranges

Type
SEMVER
Events
Introduced
0.0.0-0
Fixed
0.1.3

Ecosystem specific

{
    "affected_functions": null,
    "affects": {
        "os": [],
        "functions": [
            "bam::bgzip::Block::load"
        ],
        "arch": []
    }
}

Database specific

{
    "cvss": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
    "informational": null,
    "categories": [
        "memory-corruption"
    ]
}