# CVE-2025-40908: YAML-LibYAML prior to 0.903.0 for Perl uses 2-args open, allowing existing files to be modified

> An attacker can modify existing files by exploiting unsafe file opening practices in the YAML-LibYAML Perl library.

- **Severity:** Critical 9.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Jun 2025
- **Updated:** 2 Jun 2025
- **Also known as:** ALSA-2025:9329, ALSA-2025:9330, AZL-62242, AZL-62279, DEBIAN-CVE-2025-40908, GHSA-jh9m-3m95-c6hp, MGASA-2025-0275, OESA-2025-1591, RHSA-2025:9329, RHSA-2025:9330, RHSA-2025:9338, RLSA-2025:9329, RLSA-2025:9330, ROOT-OS-DEBIAN-11-CVE-2025-40908, SUSE-RU-2025:03081-1, SUSE-SU-2025:01885-1, SUSE-SU-2025:01885-2, SUSE-SU-2025:01886-1, UBUNTU-CVE-2025-40908, USN-7632-1, openSUSE-SU-2025:15261-1

## What is CVE-2025-40908?

CVE-2025-40908 is a critical path traversal vulnerability in TINITA YAML::LibYAML, published on 1 Jun 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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

Weakness: CWE-552 (Files or Directories Accessible to External Parties)

## Which versions are affected by CVE-2025-40908?

It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `perl-YAML-LibYAML` | AlmaLinux:8 | All versions | 1:0.70-2.el8_10 |
| `perl-YAML-LibYAML` | AlmaLinux:9 | All versions | 1:0.82-6.1.el9_6 |
| `perl-YAML-LibYAML` | Red Hat:enterprise_linux:8::crb | All versions | 1:0.70-2.el8_10 |
| `perl-YAML-LibYAML-debuginfo` | Red Hat:enterprise_linux:8::crb | All versions | 1:0.70-2.el8_10 |
| `perl-YAML-LibYAML-debugsource` | Red Hat:enterprise_linux:8::crb | All versions | 1:0.70-2.el8_10 |
| `perl-YAML-LibYAML` | Red Hat:enterprise_linux:9::crb | All versions | 1:0.82-6.1.el9_6 |
| `perl-YAML-LibYAML-debuginfo` | Red Hat:enterprise_linux:9::crb | All versions | 1:0.82-6.1.el9_6 |
| `perl-YAML-LibYAML-debugsource` | Red Hat:enterprise_linux:9::crb | All versions | 1:0.82-6.1.el9_6 |
| `perl-YAML-LibYAML` | Red Hat:rhel_eus:9.4::crb | All versions | 1:0.82-6.el9_4.1 |
| `perl-YAML-LibYAML-debuginfo` | Red Hat:rhel_eus:9.4::crb | All versions | 1:0.82-6.el9_4.1 |
| `perl-YAML-LibYAML-debugsource` | Red Hat:rhel_eus:9.4::crb | All versions | 1:0.82-6.el9_4.1 |
| `perl-YAML-LibYAML` | Rocky Linux:8 | All versions | 1:0.70-2.el8_10 |
| `perl-YAML-LibYAML` | Rocky Linux:9 | All versions | 1:0.82-6.1.el9_6 |
| `perl-YAML-LibYAML` | SUSE:Linux Enterprise Module for Development Tools 15 SP6 | All versions | 0.890.0-150000.3.11.1 |
| `perl-YAML-LibYAML` | SUSE:Linux Enterprise Module for Development Tools 15 SP6 | All versions | 0.904.0-150000.3.16.1 |
| `perl-YAML-LibYAML` | SUSE:Linux Enterprise Module for Development Tools 15 SP7 | All versions | 0.904.0-150000.3.16.1 |
| `perl-YAML-LibYAML` | SUSE:Linux Enterprise Server 12 SP5-LTSS | All versions | 0.38-11.3.1 |
| `perl-YAML-LibYAML` | SUSE:Linux Enterprise Server LTSS Extended Security 12 SP5 | All versions | 0.38-11.3.1 |
| `perl-YAML-LibYAML` | openSUSE:Leap 15.6 | All versions | 0.890.0-150000.3.11.1 |
| `perl-YAML-LibYAML` | openSUSE:Leap 15.6 | All versions | 0.904.0-150000.3.16.1 |
| `perl-YAML-LibYAML` | openSUSE:Tumbleweed | All versions | 0.904.0-2.1 |

Products: Ingydotnet Yaml-Libyaml.

## How do I fix CVE-2025-40908?

Upgrade to a fixed version.

## Is CVE-2025-40908 being exploited?

There is no known exploitation of CVE-2025-40908 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-40908 and fix it if it is affected.

What it is: CVE-2025-40908 is a critical path traversal vulnerability in TINITA YAML::LibYAML, published on 1 Jun 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-40908 in the wild and no public exploit code.

Affected product: TINITA YAML::LibYAML. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-40908/ (Markdown: https://insights.sbomify.com/CVE-2025-40908/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-40908
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-40908
- OSV: https://osv.dev/vulnerability/CVE-2025-40908

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-40908/
Summaries are generated and may contain mistakes; the official description above is the record.
