{"id":"CVE-2021-28027","aliases":["CVE-2021-28027","GHSA-cpqj-r29q-chrh","RUSTSEC-2021-0027"],"related":[],"kind":"vulnerability","state":"published","title":"Loading a bgzip block can write out of bounds if size overflows.","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"Affected versions of `bam` set the length of an internal buffer using\n`self.compressed.set_len(block_size - HEADER_SIZE - MIN_EXTRA_SIZE)` and then\nwrote into it. While `block_size` was constrained to a proper maximum, when it\nwas too small the subtraction could overflow negatively to a large number past\nthe capacity of `self.compressed`.\n\nThis can result in memory corruption in the form of writing out of bounds when\nloading a `bgzip` file with a small `block_size`.\n\nCommit `061eee38d4` fixed this issue by checking for the underflow when setting\nthe buffer size.","format":"markdown","source":"rustsec"},{"lang":"es","text":"Se detectó un problema en la crate bam versiones anteriores a 0.1.3 para Rust.&#xa0;Se presenta un subdesbordamiento de enteros y una escritura fuera de límites durante la carga de un bloque bgzip","source":"nvd"}],"published":"2021-01-07T12:00:00.000Z","modified":"2026-06-17T03:45:44.477Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","score":7.5,"rating":"HIGH"}],"cwes":["CWE-191"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.1.3"}],"ecosystem":"crates.io","package":"bam","purl":"pkg:cargo/bam","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.1.3"}],"ecosystem":"crates.io","package":"bam","purl":"pkg:cargo/bam","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"0.1.3"}],"vendor":"bam_project","product":"bam","cpe":"cpe:2.3:a:bam_project:bam:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0027.html","tags":["advisory","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28027","tags":["advisory"],"sources":["ghsa"]},{"url":"https://gitlab.com/tprodanov/bam","tags":["package"],"sources":["ghsa"]},{"url":"https://gitlab.com/tprodanov/bam/-/issues/4","tags":["report","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/bam","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-28027","url":"https://www.cve.org/CVERecord?id=CVE-2021-28027","licence":"CVE Terms of Use","modified":"2024-08-03T21:33:17.315Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cpqj-r29q-chrh","url":"https://github.com/advisories/GHSA-cpqj-r29q-chrh","licence":"CC-BY-4.0","modified":"2023-11-08T04:05:27.546Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2021-0027","url":"https://rustsec.org/advisories/RUSTSEC-2021-0027.html","licence":"CC0-1.0","modified":"2023-11-08T04:05:27.546Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-28027","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28027","licence":"Public domain","modified":"2026-06-17T03:45:44.477Z"}],"updatedAt":"2026-11-25T22:58:00.152Z","epss":{"score":0.01311,"percentile":0.70788,"date":"2026-11-30T12:00:22.000Z"}}