# CVE-2026-41401: CESNET libyang heap use-after-free in lyd_parser_set_data_flags

Source: https://junglewise.ai/threats/cve-2026-41401-cesnet-libyang-heap-use-after-free-in-lyd-parser-set-data-flags  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-26. Updated: 2026-05-26  
License: CC BY 4.0 with a link back

CVE-2026-41401 · Severity: medium · CVSS 6.5 · Published 2026-05-26

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.

Technologies: [CESNET Libyang](https://junglewise.ai/threats/technologies/libyang). Vendors: [CESNET](https://junglewise.ai/threats/vendors/cesnet).

## Quick answers

**Is CVE-2026-41401 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-41401 being exploited in the wild.

**How severe is CVE-2026-41401?** Medium severity, with a CVSS score of 6.5, published 26 May 2026.

**Which products and versions are affected?** CESNET Libyang < 5.2.6.

**Is there a fix for CVE-2026-41401?** A patch was published on 2026-03-26: Patch released in version 5.2.6 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-41401 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-41401?** Check whether you run CESNET Libyang at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## 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/commit/6b5ed47ee674fbe86b31bbebc4ff26889aeff38c)
- [https://github.com/CESNET/libyang/security/advisories/GHSA-9f49-8x56-jmjc](https://github.com/CESNET/libyang/security/advisories/GHSA-9f49-8x56-jmjc)
- [https://red.anthropic.com/2026/cvd/findings/ANT-2026-TZQ1KH7E](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](https://www.vulncheck.com/advisories/libyang-heap-use-after-free-write-in-xml-metadata-parsing)

## Related threats

- [libyang uninitialized pointer free in NETCONF RPC parsing](https://junglewise.ai/threats/cve-2026-115327-libyang-through-6-4-13-contains-an-uninitialized-pointer-free)
- [CESNET libyang heap buffer overflow in lyb_read_string](https://junglewise.ai/threats/cve-2026-44673-cesnet-libyang-heap-buffer-overflow-in-lyb-read-string)
