HTSlib is a library for reading and writing bioinformatics file formats. CRAM is a compressed format which stores DNA sequence alignment data using a variety of encodings and compression methods. While most alignment records store DNA sequence and quality values, the format also allows them to omit this data in certain cases to save space. Due to some quirks of the CRAM format, it is necessary to handle these records carefully as they will actually store data that needs to be consumed and then discarded. Unfortunately the `CONST`, `XPACK` and `XRLE` encodings did not properly implement the interface needed to do this. Trying to decode records with omitted sequence or quality data using these encodings would result in an attempt to write to a NULL pointer. Exploiting this bug causes a NULL pointer dereference. Typically this will cause the program to crash. Versions 1.23.1, 1.22.2 and 1.21.1 include fixes for this issue. There is no workaround for this issue.
PUBLISHED5.2CWE-476
HTSlib CRAM decoder has a NULL Pointer Dereference
Problem type
Affected products
samtools
htslib
< 1.21.1 - AFFECTED
>= 1.22, < 1.22.2 - AFFECTED
= 1.23 - AFFECTED
References
https://github.com/samtools/htslib/security/advisories/GHSA-5w97-85gf-86rm
https://github.com/samtools/htslib/security/advisories/GHSA-5w97-85gf-86rm
https://github.com/samtools/htslib/commit/e64e68da567d2309509d059ace016d5d7fc7514f
https://github.com/samtools/htslib/commit/e64e68da567d2309509d059ace016d5d7fc7514f
JSON source
https://cveawg.mitre.org/api/cve/CVE-2026-31964Click to expand
{
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"cveMetadata": {
"cveId": "CVE-2026-31964",
"assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"assignerShortName": "GitHub_M",
"dateUpdated": "2026-03-18T18:46:29.177Z",
"dateReserved": "2026-03-10T15:40:10.484Z",
"datePublished": "2026-03-18T18:27:26.099Z",
"state": "PUBLISHED"
},
"containers": {
"cna": {
"providerMetadata": {
"orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
"shortName": "GitHub_M",
"dateUpdated": "2026-03-18T18:27:26.099Z"
},
"title": "HTSlib CRAM decoder has a NULL Pointer Dereference",
"descriptions": [
{
"lang": "en",
"value": "HTSlib is a library for reading and writing bioinformatics file formats. CRAM is a compressed format which stores DNA sequence alignment data using a variety of encodings and compression methods. While most alignment records store DNA sequence and quality values, the format also allows them to omit this data in certain cases to save space. Due to some quirks of the CRAM format, it is necessary to handle these records carefully as they will actually store data that needs to be consumed and then discarded. Unfortunately the `CONST`, `XPACK` and `XRLE` encodings did not properly implement the interface needed to do this. Trying to decode records with omitted sequence or quality data using these encodings would result in an attempt to write to a NULL pointer. Exploiting this bug causes a NULL pointer dereference. Typically this will cause the program to crash. Versions 1.23.1, 1.22.2 and 1.21.1 include fixes for this issue. There is no workaround for this issue."
}
],
"affected": [
{
"vendor": "samtools",
"product": "htslib",
"versions": [
{
"version": "< 1.21.1",
"status": "affected"
},
{
"version": ">= 1.22, < 1.22.2",
"status": "affected"
},
{
"version": "= 1.23",
"status": "affected"
}
]
}
],
"problemTypes": [
{
"descriptions": [
{
"lang": "en",
"description": "CWE-476: NULL Pointer Dereference",
"cweId": "CWE-476",
"type": "CWE"
}
]
}
],
"references": [
{
"url": "https://github.com/samtools/htslib/security/advisories/GHSA-5w97-85gf-86rm",
"name": "https://github.com/samtools/htslib/security/advisories/GHSA-5w97-85gf-86rm",
"tags": [
"x_refsource_CONFIRM"
]
},
{
"url": "https://github.com/samtools/htslib/commit/e64e68da567d2309509d059ace016d5d7fc7514f",
"name": "https://github.com/samtools/htslib/commit/e64e68da567d2309509d059ace016d5d7fc7514f",
"tags": [
"x_refsource_MISC"
]
}
],
"metrics": [
{}
]
},
"adp": [
{
"providerMetadata": {
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP",
"dateUpdated": "2026-03-18T18:46:29.177Z"
},
"title": "CISA ADP Vulnrichment",
"metrics": [
{}
]
}
]
}
}