# CVE-2025-40909: Perl threads have a working directory race condition where file operations may target unintended paths

- Severity: Medium 5.9 (CVSS:3.1, scored by CISA-ADP) `CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.50%, higher than 44% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2025-05-30T12:20:11.237Z
- Modified: 2026-06-17T09:22:16.320Z
- Weaknesses: CWE-426, CWE-689
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: CPANSec

## Description

Perl threads have a working directory race condition where file operations may target unintended paths.

If a directory handle is open at thread creation, the process-wide current working directory is temporarily changed in order to clone that handle for the new thread, which is visible from any third (or more) thread already running. 

This may lead to unintended operations such as loading code or accessing files from unexpected locations, which a local attacker may be able to exploit.

The bug was introduced in commit 11a11ecf4bea72b17d250cfb43c897be1341861e and released in Perl version 5.13.6

(As written by CVE List.)

## Affected

- perl: from 5.13.6 before 5.41.13

## References

- <https://www.openwall.com/lists/oss-security/2025/05/22/2> (exploit, mailing-list)
- <https://github.com/Perl/perl5/commit/918bfff86ca8d6d4e4ec5b30994451e0bd74aba9.patch> (patch)
- <https://github.com/Perl/perl5/issues/23010> (issue-tracking)
- <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098226> (related)
- <https://github.com/Perl/perl5/issues/10387> (related)
- <https://perldoc.perl.org/5.14.0/perl5136delta#Directory-handles-not-copied-to-threads> (related)
- <https://github.com/Perl/perl5/commit/11a11ecf4bea72b17d250cfb43c897be1341861e> (related)
- <http://www.openwall.com/lists/oss-security/2025/05/23/1>
- <http://www.openwall.com/lists/oss-security/2025/05/30/4>
- <http://www.openwall.com/lists/oss-security/2025/06/02/2>
- <http://www.openwall.com/lists/oss-security/2025/06/02/5>
- <http://www.openwall.com/lists/oss-security/2025/06/02/6>
- <http://www.openwall.com/lists/oss-security/2025/06/02/7>
- <http://www.openwall.com/lists/oss-security/2025/06/03/1>
- <http://seclists.org/fulldisclosure/2025/Sep/55>
- <http://seclists.org/fulldisclosure/2025/Sep/54>
- <http://seclists.org/fulldisclosure/2025/Sep/53>
- <https://lists.debian.org/debian-lts-announce/2026/04/msg00018.html>

## Sources

- CVE List: [CVE-2025-40909](https://www.cve.org/CVERecord?id=CVE-2025-40909), CVE Terms of Use, modified 2026-04-18
- NVD: [CVE-2025-40909](https://nvd.nist.gov/vuln/detail/CVE-2025-40909), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2025-40909 · Whole record: https://cve.day/CVE-2025-40909.json · Rebuilt by cve.day 2026-11-25T22:58:58.595Z
