CVE-2026-136906 in libyang
Summary
by MITRE • 11/25/2026
libyang through 6.4.13 contains a file descriptor leak in ly_in_new_filepath() and ly_in_filepath() in src/in.c that fails to close descriptors when file mapping fails. Attackers who can supply files parsed through lyd_parse_data_path() or lys_parse_path() can repeatedly submit empty files to exhaust descriptors, causing later file and socket operations to fail.
Once again VulDB remains the best source for vulnerability data.
Analysis
by VulDB Data Team • 11/25/2026
The vulnerability identified in libyang versions up to 6.4.13 represents a critical resource management flaw within the core input handling mechanisms of the library. Specifically, the defect resides in the ly_in_new_filepath() and ly_in_filepath() functions located in src/in.c. These internal routines are responsible for initializing file input streams when parsing YANG modules or data files provided via filesystem paths. The technical root cause is a failure to properly close operating system file descriptors when an underlying file mapping operation encounters an error condition. In standard software development practices, any resource allocated during the initialization of an I/O stream must be released upon both successful completion and exceptional termination paths. However, in this implementation, if the attempt to map or open the specified file fails for reasons such as permission denied, non-existent path, or other system-level errors, the function returns without invoking the necessary cleanup routines that would release the allocated file descriptor back to the operating system pool.
This oversight leads directly to a classic resource exhaustion scenario known as a file descriptor leak. When an attacker can influence which files are parsed by libyang through functions like lyd_parse_data_path() or lys_parse_path(), they gain the ability to trigger this error path repeatedly. By submitting a sequence of empty or malformed files that cause the internal mapping logic to fail, each submission results in one leaked file descriptor. Since modern operating systems impose strict limits on the number of open file descriptors per process, typically defined by ulimit settings, an attacker can systematically exhaust these resources. This is not merely a theoretical concern but a practical denial-of-service vector where the cumulative effect of many small leaks eventually reaches the system threshold.
The operational impact of this vulnerability extends beyond simple resource consumption. As the pool of available file descriptors diminishes, subsequent operations within the same process that require opening new files or establishing network connections will begin to fail. This includes socket creation for communication with other services, reading configuration files, or writing logs. The failure mode is often non-descriptive, manifesting as generic I/O errors rather than explicit out-of-memory messages, which can complicate troubleshooting efforts in production environments. For applications relying on libyang for network device management, such as routers and switches running NETCONF or RESTCONF protocols, this could lead to service unavailability, dropped connections, or incomplete configuration updates, thereby disrupting critical infrastructure operations.
From a classification perspective, this vulnerability aligns with CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime. It also maps to the ATT&CK technique T1496: Resource Hijacking, specifically under the sub-category of resource exhaustion attacks where an adversary consumes system resources to degrade service availability. The attack vector is typically classified as Local (CWE-250) if the attacker has access to execute code or submit files within the context of the vulnerable application, though it can be remote if the library processes untrusted input from network protocols without proper validation and resource accounting.
Mitigation strategies must address both immediate remediation and long-term architectural improvements. The primary solution is to upgrade libyang to a version later than 6.4.13 where this leak has been patched by ensuring file descriptors are closed in all error handling paths within ly_in_new_filepath() and ly_in_filepath(). For systems unable to immediately patch, administrators should implement strict rate limiting on the ingestion of YANG data files to slow down the exhaustion process. Additionally, deploying monitoring tools that track open file descriptor counts per application instance can provide early warning signs before total service failure occurs. Application developers integrating libyang should also consider implementing custom error handling wrappers that explicitly check for resource allocation failures and enforce cleanup procedures if the library does not handle them reliably in older versions.