{"id":"CVE-2021-28027","aliases":["EUVD-2022-3606","GHSA-cpqj-r29q-chrh","RUSTSEC-2021-0027"],"status":"published","title":"Loading a bgzip block can write out of bounds if size overflows.","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.","severity":{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-10","score":0.01295,"percentile":0.70569,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-191"],"published":"2021-01-07T12:00:00Z","modified":"2026-06-17T03:45:44Z","fixes":[{"ecosystem":"crates.io","package":"bam","fixed_in":["0.1.3"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"bam","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.1.3"}]}]},{"source":"osv","ecosystem":"crates.io","package":"bam","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.1.3"}]}]},{"source":"osv","ecosystem":"crates.io","package":"bam","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.1.3"}]}]}],"products":[{"vendor":"bam_project","product":"bam"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0027.html","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","web","advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-28027","tags":["advisory"]},{"url":"https://gitlab.com/tprodanov/bam/-/issues/4","tags":["web","report"]},{"url":"https://github.com/advisories/GHSA-cpqj-r29q-chrh"},{"url":"https://gitlab.com/tprodanov/bam","tags":["package"]},{"url":"https://crates.io/crates/bam","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2021-28027","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.","status":"published","published":"2021-03-05T08:40:52Z","modified":"2024-08-03T21:33:17.315Z","updated_at":"2026-11-02T14:33:09.175141Z"}],"euvd":[{"id":"EUVD-2022-3606","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.","status":"published","published":"2021-03-05T08:40:52Z","modified":"2024-08-03T21:33:17Z","updated_at":"2026-11-03T03:24:47.350261Z"}],"ghsa":[{"id":"GHSA-cpqj-r29q-chrh","title":"Loading a bgzip block can write out of bounds if size overflows.","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.","status":"published","published":"2022-05-24T17:43:47Z","modified":"2023-01-27T05:02:35Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-191"],"updated_at":"2026-11-02T14:36:19.144959Z"}],"nvd":[{"id":"CVE-2021-28027","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.","status":"published","published":"2021-03-05T09:15:13.77Z","modified":"2026-06-17T03:45:44.477Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"primary"},{"version":"2.0","score":7.5,"vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","level":"high","assessor":"primary"}],"cwes":["CWE-191"],"updated_at":"2026-11-02T14:06:50.399901Z"}],"osv":[{"id":"GHSA-cpqj-r29q-chrh","title":"Loading a bgzip block can write out of bounds if size overflows.","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.","status":"published","published":"2022-05-24T17:43:47Z","modified":"2023-11-08T04:05:27.546593Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-191"],"updated_at":"2026-11-02T15:46:45.28161Z"},{"id":"RUSTSEC-2021-0027","title":"Loading a bgzip block can write out of bounds if size overflows.","description":"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.","status":"published","published":"2021-01-07T12:00:00Z","modified":"2023-11-08T04:05:27.546593Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"updated_at":"2026-11-02T15:53:39.492624Z"}]}}
