{"id":"CVE-2026-116742","summary":"HTSlib through 1.24 Heap Out-of-Bounds Write via Truncated .gzi Index Count","details":"HTSlib through 1.24 contains a heap out-of-bounds write and read vulnerability in bgzf_index_load_hfile() in bgzf.c that allows attackers to corrupt heap memory by supplying a crafted .gzi index entry count. A count of 0xFFFFFFFF truncates noffs to zero, causing writes past a malloc(0) buffer and an offs[-1] read in bgzf_useek(), resulting in heap corruption or crashes in tools like samtools and bcftools.","modified":"2026-10-29T07:23:01.324078832Z","published":"2026-10-26T21:52:41.511Z","database_specific":{"cwe_ids":["CWE-197"],"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/116xxx/CVE-2026-116742.json","cna_assigner":"VulnCheck"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/116xxx/CVE-2026-116742.json"},{"type":"ADVISORY","url":"https://hackmd.io/@haindpwn/htslib-bgzf-gzi-int-truncation-oob"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-116742"},{"type":"ADVISORY","url":"https://www.vulncheck.com/advisories/htslib-through-1.24-heap-out-of-bounds-write-via-truncated-gzi-index-count"},{"type":"REPORT","url":"https://github.com/samtools/htslib/issues/2113"},{"type":"FIX","url":"https://github.com/samtools/htslib/commit/18dddf02bb2c0053b32acec427723555a24b2873"},{"type":"FIX","url":"https://github.com/samtools/htslib/pull/2057"},{"type":"PACKAGE","url":"https://github.com/samtools/htslib"},{"type":"ARTICLE","url":"https://github.com/samtools/htslib/blob/1.24/bgzf.c#L2504"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/samtools/htslib","events":[{"introduced":"0"},{"fixed":"18dddf02bb2c0053b32acec427723555a24b2873"}],"database_specific":{"extracted_events":[{"source":"AFFECTED_FIELD","strategy":"StandardRange","range":[{"introduced":"0"},{"last_affected":"1.24"}]},{"range":[{"fixed":"18dddf02bb2c0053b32acec427723555a24b2873"}],"source":"REFERENCES_COMMIT"}]}}],"versions":["1.10.1","0.2.0-rc12","0.2.0-rc11","0.2.0-rc10","0.2.0-rc9","0.2.0-rc8","0.2.0-rc7","0.2.0-rc6","0.2.0-rc5","0.2.0-rc4","0.2.0-rc3","0.2.0-rc2","vcf-direct-final","stable2","stable1"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-116742.json","vanir_signatures":[{"signature_version":"v1","source":"https://github.com/samtools/htslib/commit/18dddf02bb2c0053b32acec427723555a24b2873","target":{"file":"bgzf.c","function":"bgzf_read_block"},"deprecated":false,"digest":{"function_hash":"159401353288401787128398845028797113896","length":5690},"id":"CVE-2026-116742-28ad32e1","signature_type":"Function"},{"digest":{"function_hash":"176359846422984007815110326638487792072","length":1673},"id":"CVE-2026-116742-3955905c","signature_type":"Function","signature_version":"v1","source":"https://github.com/samtools/htslib/commit/18dddf02bb2c0053b32acec427723555a24b2873","target":{"file":"bgzf.c","function":"bgzf_useek"},"deprecated":false},{"id":"CVE-2026-116742-4c2add60","signature_type":"Function","signature_version":"v1","source":"https://github.com/samtools/htslib/commit/18dddf02bb2c0053b32acec427723555a24b2873","target":{"function":"bgzf_index_add_block","file":"bgzf.c"},"deprecated":false,"digest":{"function_hash":"340132720880524021713881920891413610543","length":542}},{"target":{"file":"bgzf.c"},"deprecated":false,"digest":{"line_hashes":["49819020736608584839996920468199684717","332255814025135705647131801969897150433","205948775425527628874636296712189552733","18240128233351797497477590663522858746","261306021508681971737036265553276982035","218111411291890350497234376147346945253","92199577171097332957174459671173626269","266371215904569804373495029393364227791","108147605629162405088406858719263620580","170840747326042215495708479895283837536","217500156623725864783166218158574911070","87234337352181059390855103796895263014","289405465444416391965211362277574928985","291122779517767085806689697783026778218","164167358656332518646055166543714396199","87110886886282127327337262257526068913","201305248880717749563745034466042863520","102235953727267052061622400472094900356","266301362745655350738184729588953514544","179013623226302014918710134884640811742","98786147987876504862575784386423676856","319135484100329144814397296033475360939","240308616035105868708027674525974047173","62174562293228126799176167785715490951","97760702657836504359594420756762348787","6669677468911412894660908804303909846","296139668203565660697857288407314673476","92807558404628388468410592841525725500","47458275007162915792304754571298438874","138538918303558316817697384208696909376","251368784379652088774852577413999842903","276084590990398080386329908659735943359","302084568409755994208335949218705917608","14696793542905168887157662363388615469","226538314316654850873784048805076122850","282610906880416112460563093857636975981","51158290744655007165847439303553507421","125552577158819666642972429666694539140","304451038183220575748783380839238292571","217604675241860908155916416965867677387","266111621111679244878382217484378722079","319135484100329144814397296033475360939","240308616035105868708027674525974047173","62174562293228126799176167785715490951","97760702657836504359594420756762348787","150993507608091260689007600596265848952","182945382049309804845271067622201714633","144764144854237019511131715829524012596","113238457368682881892926711283035477944","286179386460917372596472896549725999178","242080200366451465720626540327622073647","86733468870690957268953058169369474755","179527191538318908353595453855419697598","189008022983666078456107675073346634411","105099988316858487643127071882724993926","15857214059941973298989543049963655142","169303138083533401119913006037857120552","300536595166383333238918598993567112802","155092760930449227507304225420460946033","243318504057040677243502916262080916450","7874233891154987869906620484498072034","4001226993464202039219829631860626181","224927502715971673169719877234037576790","254805639347721084362737606321581403578","170910867065703202608600124730433575746","214978358597804480158483029810542779736","246462076254182636691948514923710452712","62676959356136812530467577223536210911","276799472106491706297995136001921818979","40164123461682393823618410069644041481","191309400034136305845973030626857318157","33064734287844753086054131082996950450"],"threshold":0.9},"id":"CVE-2026-116742-bb597ee1","signature_type":"Line","signature_version":"v1","source":"https://github.com/samtools/htslib/commit/18dddf02bb2c0053b32acec427723555a24b2873"},{"digest":{"function_hash":"75513821277793139096555000828343066997","length":1711},"id":"CVE-2026-116742-caf36792","signature_type":"Function","signature_version":"v1","source":"https://github.com/samtools/htslib/commit/18dddf02bb2c0053b32acec427723555a24b2873","target":{"file":"bgzf.c","function":"bgzf_mt_writer"},"deprecated":false},{"digest":{"function_hash":"41151240957073499476755387614536312124","length":992},"id":"CVE-2026-116742-dd398ded","signature_type":"Function","signature_version":"v1","source":"https://github.com/samtools/htslib/commit/18dddf02bb2c0053b32acec427723555a24b2873","target":{"file":"bgzf.c","function":"bgzf_flush"},"deprecated":false}],"vanir_signatures_modified":"2026-10-29T07:23:01Z"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N"}]}