Advisory

RUSTSEC-2021-0027

Also known as: CVE-2021-28027, GHSA-cpqj-r29q-chrh

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.

Severity

Critical Basis: CVSS v3 score 9.8, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Dates

Published
2021-01-07 12:00 UTC
Modified
2023-11-08 04:05 UTC

Affected packages and fixes

bam

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 0.1.3 (semver)

Fixed versions

0.1.3

Fix

  • Fixed version 0.1.3
    cargo update -p bam --precise 0.1.3

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: RustSec Advisory Database · CC0-1.0

Sources & licences