Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-71436 Overview
CVE-2025-71436 is a heap-based buffer overflow in the Raptor RDF Syntax Library versions 2.0.15 through 2.0.16. The flaw resides in the raptor_new_term_from_counted_literal() function, which truncates the language tag length to an unsigned char. Attackers can supply crafted Turtle, TriG, N-Triples, or N-Quads documents containing language tags of 256 bytes or longer to corrupt heap memory. Successful exploitation can crash parsing applications and may enable arbitrary code execution. The weakness is tracked as CWE-122 (Heap-based Buffer Overflow).
Critical Impact
Processing an untrusted RDF document can corrupt heap memory in any application linked against Raptor 2.0.15–2.0.16, resulting in crashes and potential code execution.
Affected Products
- Raptor RDF Syntax Library 2.0.15
- Raptor RDF Syntax Library 2.0.16
- Downstream applications that embed Raptor for parsing Turtle, TriG, N-Triples, or N-Quads input
Discovery Timeline
- 2026-10-20 - CVE-2025-71436 published to the National Vulnerability Database
- 2026-10-20 - Last updated in the NVD database
Technical Details for CVE-2025-71436
Vulnerability Analysis
Raptor is a widely deployed C library that parses and serializes Resource Description Framework (RDF) data. The vulnerable code path handles typed and language-tagged literals produced by the Turtle, TriG, N-Triples, and N-Quads parsers. When a literal carries a language tag, raptor_new_term_from_counted_literal() records the tag length in an unsigned char field. Any tag of 256 bytes or longer wraps around to a small value, so the subsequent heap allocation reserves far less memory than the parser later writes. The resulting out-of-bounds write corrupts adjacent heap chunks and metadata.
The vulnerability affects any process that feeds attacker-controlled RDF into Raptor, including semantic web services, SPARQL stacks, linked-data importers, and desktop converters such as rapper. Exploitation requires only that a victim parse a malicious document, satisfying the user-interaction requirement reflected in the CVSS vector.
Root Cause
The defect is a numeric truncation error in literal construction. The language tag length is stored in an unsigned char instead of a size_t, so values greater than 255 silently wrap. The allocation sized against the truncated length cannot hold the full tag copied afterward, producing a heap-based buffer overflow. Relevant source is published in raptor_term.c lines 200–218 and raptor_term.c lines 270–287.
Attack Vector
An attacker delivers an RDF document containing a literal with a language tag at least 256 bytes long. Delivery vectors include HTTP responses consumed by an RDF client, uploaded files, federated SPARQL endpoints, and crawler input. When Raptor parses the document, the truncated length triggers the heap overflow. See the related upstream discussion in Raptor GitHub issue #83 and the VulnCheck advisory.
The upstream fix in commit 361a803 also hardens adjacent parsing paths. The following excerpts are taken directly from that patch.
buffer = RAPTOR_MALLOC(unsigned char*, buffer_len + 1);
if(buffer)
raptor_stringbuffer_copy_to_string(grddl_parser->sb,
- buffer, buffer_len);
+ buffer, buffer_len + 1);
uri_string = raptor_uri_as_string(rdf_parser->base_uri);
Source: raptor commit 361a803 (src/raptor_grddl.c). The change ensures the destination buffer accounts for the trailing NUL byte during string copies.
for(ii = 0; ii < ulen; ii++) {
char cc = p[ii];
- if(!isxdigit(RAPTOR_GOOD_CAST(char, cc))) {
+ if(!isxdigit(RAPTOR_GOOD_CAST(unsigned char, cc))) {
raptor_log_error_formatted(world, RAPTOR_LOG_LEVEL_ERROR, locator, "N-Triples string error - illegal hex digit %c in Unicode escape '%c%s...'",
cc, c, p);
n = 1;
Source: raptor commit 361a803 (src/raptor_ntriples.c). The cast to unsigned char prevents sign-extension errors when validating hex digits in Unicode escapes.
Detection Methods for CVE-2025-71436
Indicators of Compromise
- RDF documents containing @ language-tag suffixes with 256 or more bytes between the @ and the terminating whitespace or punctuation.
- Unexpected crashes, SIGSEGV, or heap corruption aborts in processes that embed libraptor2, including the rapper command-line tool.
- Glibc diagnostics such as malloc(): corrupted top size or free(): invalid next size emitted by services that parse untrusted RDF.
Detection Strategies
- Inspect inbound Turtle, TriG, N-Triples, and N-Quads payloads at proxies or ingestion pipelines and flag literals whose language tag length exceeds 64 bytes, which is far beyond any valid BCP 47 tag.
- Enable AddressSanitizer or Valgrind in test environments to surface heap-overflow writes originating in raptor_new_term_from_counted_literal.
- Correlate process crashes of RDF-consuming services with recent parse events in application logs.
Monitoring Recommendations
- Monitor endpoint telemetry for repeated termination of processes linked against libraptor2.so.
- Alert on web and API gateway rules that observe RDF content types (text/turtle, application/n-quads, application/trig, application/n-triples) with payload sizes or language-tag lengths beyond policy baselines.
- Track package inventory for installations of Raptor 2.0.15 or 2.0.16 across Linux fleets.
How to Mitigate CVE-2025-71436
Immediate Actions Required
- Identify all hosts and container images shipping Raptor 2.0.15 or 2.0.16, including transitive dependencies such as Redland and Rasqal consumers.
- Restrict RDF ingestion to trusted sources until a fixed build is deployed.
- Rebuild and redeploy any first-party software that statically links the vulnerable library.
Patch Information
Apply the upstream fix delivered in commit 361a803a72817ae771db2438277229e6541e1575. Consult the VulnCheck advisory for distribution-specific guidance and track Linux vendor updates for backported packages.
Workarounds
- Enforce input validation that rejects RDF literals with language tags longer than the BCP 47 practical maximum before the data reaches Raptor.
- Run RDF parsing workloads inside sandboxed, memory-limited containers with seccomp filters to contain crashes and limit exploit impact.
- Disable language-tagged literal processing in applications that do not require it, or route untrusted input through an alternative hardened parser.
# Verify the installed Raptor version and locate consumers
rapper --version
ldconfig -p | grep libraptor2
# Example: block oversize language tags at an ingestion proxy using a regex deny rule
# Reject any literal with an @ language tag of 256+ characters
grep -E '"@[A-Za-z0-9-]{256,}' suspect.ttl && echo "BLOCK: oversized language tag"
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

