Executive brief
libyang is a software library used to parse and manage YANG data, often used in network management protocols like NETCONF and RESTCONF. A vulnerability in how it handles XML metadata allows an attacker to send a specially crafted document that causes the application to crash or potentially execute unauthorized code. This could lead to a service outage or a compromise of the system processing the network configuration data.
Technical details
A heap use-after-free write vulnerability exists in libyang's XML data parser within the 'lyd_parser_set_data_flags' function in 'src/parser_common.c'. The root cause is an incorrect update of the metadata linked list head pointer when freeing a non-head 'default' metadata entry. An attacker can trigger this by submitting a crafted YANG XML document with specific metadata attributes to an application using libyang to parse untrusted data. This results in a reference to freed heap memory being subsequently written to in 'lyd_insert_meta', leading to memory corruption, process crashes, or potential remote code execution. The issue is fixed in version 5.2.6.
Affected products
- CESNET libyang < 5.2.6
Timeline
- 2026-03-26: patched: Patch released in version 5.2.6
- 2026-03-26: advisory: GitHub Security Advisory published
- 2026-05-26: disclosed: CVE published to NVD
References
- https://github.com/CESNET/libyang/commit/6b5ed47ee674fbe86b31bbebc4ff26889aeff38c
- https://github.com/CESNET/libyang/security/advisories/GHSA-9f49-8x56-jmjc
- https://red.anthropic.com/2026/cvd/findings/ANT-2026-TZQ1KH7E
- https://www.vulncheck.com/advisories/libyang-heap-use-after-free-write-in-xml-metadata-parsing