CVE-2026-27821 Overview
CVE-2026-27821 is a stack buffer overflow vulnerability affecting GPAC, an open-source multimedia framework. In versions up to and including 26.02.0, a stack buffer overflow occurs during NHML file parsing in src/filters/dmx_nhml.c. The value of the xmlHeaderEnd XML attribute is copied from att->value into szXmlHeaderEnd[1000] using strcpy() without any length validation. If the input exceeds 1000 bytes, it overwrites beyond the stack buffer boundary, potentially leading to denial of service or code execution.
Critical Impact
This vulnerability can be exploited remotely via maliciously crafted NHML files to cause denial of service through stack buffer overflow. Network-accessible systems processing untrusted multimedia content are at risk.
Affected Products
- GPAC versions up to and including 26.02.0
- Systems processing NHML multimedia files with GPAC
- Applications embedding the GPAC multimedia framework
Discovery Timeline
- 2026-02-26 - CVE CVE-2026-27821 published to NVD
- 2026-02-26 - Last updated in NVD database
Technical Details for CVE-2026-27821
Vulnerability Analysis
This vulnerability is classified as CWE-121 (Stack-based Buffer Overflow). The flaw exists in the NHML demuxer filter component of GPAC, specifically in how it handles XML attribute parsing. When processing NHML files, the parser reads the xmlHeaderEnd attribute value and copies it directly into a fixed-size stack buffer of 1000 bytes using the unsafe strcpy() function. This classic C programming mistake allows an attacker to craft a malicious NHML file with an oversized attribute value that exceeds the buffer boundary.
The vulnerability is exploitable over the network without authentication or user interaction, as GPAC is commonly used for multimedia streaming and file processing in server environments. While the primary impact is denial of service through application crash, stack buffer overflows can potentially be leveraged for arbitrary code execution depending on platform-specific mitigations.
Root Cause
The root cause is improper input validation when copying user-controlled data from an XML attribute into a fixed-size stack buffer. The vulnerable code uses strcpy(), which performs no bounds checking, instead of safer alternatives like strncpy() or gf_strlcpy(). The lack of length validation before the copy operation allows heap metadata corruption and stack smashing when malicious input is provided.
Attack Vector
An attacker can exploit this vulnerability by crafting a malicious NHML file containing an xmlHeaderEnd attribute with a value exceeding 1000 bytes. When GPAC processes this file, the oversized value overflows the szXmlHeaderEnd buffer on the stack, potentially corrupting adjacent memory, overwriting return addresses, or causing a crash. The attack can be delivered through:
- Direct file processing via command-line tools
- Web-based media streaming services using GPAC
- Media conversion applications embedding GPAC libraries
The patch in commit 9bd7137fded2db40de61a2cf3045812c8741ec52 addresses the vulnerability by adding proper input validation before string operations:
memset(&breaker, 0, sizeof(XMLBreaker));
breaker.id_stack = gf_list_new();
- if (strstr(xmlFrom, ".start")) breaker.from_is_start = GF_TRUE;
- else breaker.from_is_end = GF_TRUE;
- tmp = strchr(xmlFrom, '.');
- *tmp = 0;
- if (stricmp(xmlFrom, "doc")) breaker.from_id = gf_strdup(xmlFrom);
- /*doc start pos is 0, no need to look for it*/
- else if (breaker.from_is_start) breaker.from_is_start = GF_FALSE;
- *tmp = '.';
-
- if (strstr(xmlTo, ".start")) breaker.to_is_start = GF_TRUE;
- else breaker.to_is_end = GF_TRUE;
- tmp = strchr(xmlTo, '.');
- *tmp = 0;
- if (stricmp(xmlTo, "doc")) breaker.to_id = gf_strdup(xmlTo);
- /*doc end pos is file size, no need to look for it*/
- else if (breaker.to_is_end) breaker.to_is_end = GF_FALSE;
- *tmp = '.';
+ if (strstr(xmlFrom, ".")) {
+ if (strstr(xmlFrom, ".start")) breaker.from_is_start = GF_TRUE;
+ else breaker.from_is_end = GF_TRUE;
+ tmp = strchr(xmlFrom, '.');
+ *tmp = 0;
+ if (stricmp(xmlFrom, "doc")) breaker.from_id = gf_strdup(xmlFrom);
+ /*doc start pos is 0, no need to look for it*/
+ else if (breaker.from_is_start) breaker.from_is_start = GF_FALSE;
+ *tmp = '.';
+ }
Source: GitHub Commit Changes
Detection Methods for CVE-2026-27821
Indicators of Compromise
- Unusual crashes or segmentation faults in GPAC processes when handling NHML files
- Core dumps indicating stack corruption in dmx_nhml.c or related parsing functions
- Abnormally large NHML files with excessively long XML attribute values
- Memory access violations in multimedia processing services
Detection Strategies
- Monitor GPAC processes for unexpected terminations or crashes during NHML file processing
- Implement file inspection rules to detect NHML files with XML attributes exceeding normal length thresholds
- Deploy intrusion detection signatures that identify oversized xmlHeaderEnd attribute values in NHML traffic
- Use application-level logging to track NHML parsing operations and flag anomalies
Monitoring Recommendations
- Enable crash dump collection and analysis for GPAC-based services to identify exploitation attempts
- Configure security monitoring to alert on repeated GPAC process restarts that may indicate DoS attacks
- Implement network traffic inspection for suspicious NHML file transfers, particularly those with unusual sizes
- Review system logs for stack smashing detected alerts related to GPAC binaries
How to Mitigate CVE-2026-27821
Immediate Actions Required
- Upgrade GPAC to a version that includes commit 9bd7137fded2db40de61a2cf3045812c8741ec52 or later
- Restrict processing of NHML files from untrusted sources until patching is complete
- Implement input validation at the application layer to reject NHML files with excessively long attributes
- Consider isolating GPAC processes using sandboxing technologies to limit impact of exploitation
Patch Information
The vulnerability has been addressed in commit 9bd7137fded2db40de61a2cf3045812c8741ec52. Users should update to a GPAC version containing this fix. For detailed information about the security patch, refer to the GitHub Security Advisory GHSA-q7qh-8r2r-q559 and the patch commit.
Workarounds
- Disable NHML file processing if not required by your workflow until the patch can be applied
- Implement file size and attribute length limits at the web server or application gateway level
- Use a Web Application Firewall (WAF) to filter malicious NHML content before it reaches GPAC
- Run GPAC services with reduced privileges and in isolated environments to contain potential exploitation
# Configuration example - Compile GPAC from patched source
git clone https://github.com/gpac/gpac.git
cd gpac
git checkout 9bd7137fded2db40de61a2cf3045812c8741ec52
./configure
make
sudo make install
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


