CVE-2025-40908 in YAML-LibYAMLinfo

Summary

by MITRE • 06/01/2025

YAML-LibYAML prior to 0.903.0 for Perl uses 2-args open, allowing existing files to be modified

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 06/23/2025

The vulnerability identified as CVE-2025-40908 affects YAML-LibYAML versions prior to 0.903.0 in Perl implementations where the library employs a two-argument open() function call. This flaw stems from improper file handling practices that can lead to unintended file modifications. The issue manifests when the library attempts to open files for processing YAML content without adequate security checks or file access controls, creating a potential attack surface for malicious actors to manipulate existing files.

This technical weakness represents a classic case of insufficient input validation and file access control mechanisms. The two-argument open() function in Perl typically requires a filehandle and filename as arguments, but when used without proper mode specifications or file existence checks, it can inadvertently modify existing files rather than creating new ones. The vulnerability falls under CWE-22, which describes improper limitation of a pathname to a restricted directory, and also relates to CWE-362, which covers concurrent execution use of a resource. The flaw enables an attacker to exploit the library's file handling routines to potentially overwrite or corrupt existing files in the system.

The operational impact of this vulnerability extends beyond simple file modification, as it can lead to more severe consequences depending on the system configuration and file permissions. When YAML-LibYAML processes untrusted input containing file paths, an attacker might manipulate the processing flow to target critical system files or configuration files. The vulnerability could be exploited in contexts where the library is used to parse user-supplied YAML data, potentially allowing for privilege escalation or data corruption attacks. This represents a significant concern in environments where YAML processing is common and where the library operates with elevated privileges or in security-sensitive contexts.

Mitigation strategies for this vulnerability should focus on immediate version upgrades to 0.903.0 or later, which contain the necessary fixes for proper file handling. System administrators should also implement strict file access controls and ensure that the library operates with minimal required privileges. Additional protective measures include validating all file paths before processing, implementing proper file mode specifications in open() calls, and monitoring for suspicious file modification patterns. Organizations should also consider implementing runtime protections such as file integrity monitoring and intrusion detection systems to detect potential exploitation attempts. The ATT&CK framework categorizes this vulnerability under T1059.001 for command and scripting interpreter and T1078 for valid accounts, as exploitation might involve legitimate file operations that appear normal to security monitoring systems.

Responsible

CPANSec

Reservation

04/16/2025

Disclosure

06/01/2025

Moderation

accepted

CPE

ready

EPSS

0.00368

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!