CVE-2026-136905 in libyang
Summary
by MITRE • 11/25/2026
CESNET libyang through 6.4.13 contains an incomplete cleanup vulnerability in ly_out_reset() in src/out.c that tests a stale errno ESPIPE value after a successful seek. Applications reusing one output handler for different clients rewind but do not truncate the file, leaking leftover bytes of a previous client's output.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 11/25/2026
The vulnerability identified within CESNET libyang versions up to 6.4.13 represents a critical flaw in the library's internal output handling mechanism, specifically residing in the ly_out_reset function located in src/out.c. This issue stems from an incomplete cleanup procedure that fails to properly manage file state when reusing an output handler for multiple distinct clients or contexts. The core technical defect involves the interaction between file seeking operations and error code preservation. When the library attempts to rewind a file descriptor to prepare it for new data, it performs a seek operation which may succeed even if subsequent write operations are not immediately attempted. In such scenarios, the system retains stale errno values from previous failed or interrupted operations, specifically ESPIPE, which indicates an illegal seek on a pipe stream. The code incorrectly tests this stale error state rather than resetting it to zero after a successful seek, leading to erroneous logic paths that assume the file descriptor is in an invalid state when it is actually ready for use.
This architectural oversight results in significant data leakage across client boundaries within applications utilizing libyang as their underlying XML processing engine. Because the output handler is reused without truncating the existing content of the target stream or buffer, leftover bytes from a previous client's output remain appended to the file. When new data is written during the subsequent operation, it follows these residual bytes rather than overwriting them from the beginning. Consequently, sensitive information intended for one user or process can be inadvertently exposed to another who receives the combined output containing both their own data and the remnants of prior sessions. This constitutes a classic case of improper resource cleanup where state is not fully reset between uses, violating fundamental principles of secure coding regarding isolation of resources in multi-tenant environments.
From an industry standard perspective, this vulnerability aligns closely with CWE-209, which describes the generation of error messages that contain sensitive information, and more broadly with CWE-672, involving the use of operations on variables or data after they have been freed or reset improperly. The failure to clear stale state indicators like errno falls under CWE-481, assigning variable values incorrectly, as the code assigns a misleading status based on outdated system calls rather than current execution context. In terms of attack vectors and tactical mapping within the MITRE ATT&CK framework, this flaw facilitates Data Leakage via Unintended Info Exposure (T1560). An attacker or malicious actor could exploit this condition by orchestrating sequential requests that trigger the reuse of output handlers under specific timing conditions to capture residual data from previous transactions.
The operational impact extends beyond simple privacy violations; it compromises the integrity and confidentiality guarantees expected in network management systems, configuration databases, and any application relying on libyang for structured data serialization. For organizations deploying these libraries in high-security environments such as telecommunications infrastructure or financial services platforms, this vulnerability introduces a persistent risk of cross-client data contamination. Mitigation strategies must prioritize immediate updates to versions 6.4.14 and later where the ly_out_reset function has been corrected to properly clear errno after successful seek operations and ensure that output buffers are truncated before reuse. Additionally, developers integrating libyang should implement defensive coding practices by explicitly resetting file handles or using fresh instances for each client session when possible, thereby reducing reliance on internal cleanup mechanisms until patches are fully deployed across all affected systems.