CVE-2026-96889: Librsvg: use-after-free when xml includes have duplicated entities
A flaw was found in librsvg. When processing an SVG document containing nested XML inclusions (Xincludes) with duplicate entity declarations, a use-after-free error can occur. This vulnerability arises because the library incorrectly frees an XML entity that is still in use by the parser. An attacker could potentially exploit this to cause a denial of service or execute arbitrary code.
Other sources
Librsvg uses libxml2, a C library, to parse XML. When librsvg parses an SVG document which has a nested Xinclude, an XML entity declaration with a duplicate name as an existing one can cause a use-after-free error.
While libxml2 is expanding an internal entity, a recursive XInclude can parse another document that declares an entity with the same name. Both parses use the same XmlState entity map on the librsvg side. entityinsert() replaces the first entry, whose Drop implementation calls xmlFreeNode(). The outer xmlCtxtParseEntity() then keeps using the freed 144-byte xmlEntity.
The included parse should not free an entity that the outer parser is still using.
The fix is in commit 8a1b0cd319e9af2d1e9cf878081dd77f227a0504, where librsvg will no longer free xmlEntity pointers that libxml2 is still using.
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
librsvgto a version that resolves this vulnerability.Patch 8a1b0cd319e9af2d1e9cf878081dd77f227a0504
Event History
Frequently Asked Questions
What level of access does an attacker need to exploit this issue?
The attack vector is local and requires user interaction, but it does not require attacker privileges. Exploitation depends on getting a user or local process to parse a crafted SVG document.
What characteristics must a malicious SVG have?
The SVG must trigger nested XInclude processing and use duplicate XML entity declarations. The duplicate declaration occurs in an included document while an outer parse is expanding an entity with the same name.
How can I determine whether a fix is present?
The described fix is in librsvg commit 8a1b0cd319e9af2d1e9cf878081dd77f227a0504. No fixed release version is provided in the available data.