Cloudanix VulnDB

CVE-2025-40909

Medium · 5.9

CVSS

5.9

EPSS

0.5%

Published

May 30, 2025

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A flaw in how Perl creates new threads can cause programs to read or write the wrong files when multiple tasks run at once, which a local attacker might use to access data they should not reach.

Exploitation
Local Privilege
Attacker needs
Local User
Complexity
Low
Impact
Data Tampering
Component
Library
Class
Race Condition
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Race condition in Perl thread creation that temporarily alters the process-wide current working directory when cloning an open directory handle, allowing concurrent threads to observe and perform file operations against unintended paths.

Why it matters to the business

Multi-threaded Perl applications may load code or access files from unexpected locations, creating risk of data exposure, integrity issues, or unintended execution in environments running affected Perl versions.

How an attack unfolds

A local attacker crafts or influences a Perl program that opens a directory handle and spawns multiple threads; during thread creation the CWD is altered in a window visible to other threads, causing subsequent file operations such as require, open, or stat to resolve against attacker-controlled paths.

How to fix it

Upgrade perl/perl5 to the version containing commit 11a11ecf4bea72b17d250cfb43c897be1341861e or later; rebuild and restart all services using the updated interpreter.

How to confirm the fix worked

Confirm the installed Perl interpreter reports a version built after commit 11a11ecf4bea72b17d250cfb43c897be1341861e; run regression tests that exercise directory-handle thread creation under concurrent load.

Typical attack path

  1. Identify or deploy a multi-threaded Perl application that opens directory handles before spawning threads
  2. Time thread creation so the temporary CWD change is visible to a third thread
  3. Cause the affected thread to perform a file operation that resolves to an attacker-influenced path
  4. Achieve loading of malicious code or access to sensitive files

How to detect it

Review application and system logs for Perl processes performing file operations against paths that differ from expected working directories during periods of thread creation; correlate with process listings showing concurrent threads.

What your security team should do

  • Prioritize patching Perl interpreters on all systems that run multi-threaded Perl code
  • Inventory applications that use threads and directory handles
  • Monitor for unexpected file-access patterns in Perl processes until patches are applied

The record

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

Affected packages

Ecosystem Package Introduced Fixed
AlmaLinux:8 perl 0 4:5.26.3-423.el8_10
AlmaLinux:8 perl-Attribute-Handlers 0 0.99-423.el8_10
AlmaLinux:8 perl-Devel-Peek 0 1.26-423.el8_10
AlmaLinux:8 perl-Devel-SelfStubber 0 1.06-423.el8_10
AlmaLinux:8 perl-Errno 0 1.28-423.el8_10
AlmaLinux:8 perl-ExtUtils-Embed 0 1.34-423.el8_10
AlmaLinux:8 perl-ExtUtils-Miniperl 0 1.06-423.el8_10
AlmaLinux:8 perl-IO 0 1.38-423.el8_10
AlmaLinux:8 perl-IO-Zlib 0 1:1.10-423.el8_10
AlmaLinux:8 perl-Locale-Maketext-Simple 0 1:0.21-423.el8_10
AlmaLinux:8 perl-Math-Complex 0 1.59-423.el8_10
AlmaLinux:8 perl-Memoize 0 1.03-423.el8_10
AlmaLinux:8 perl-Module-Loaded 0 1:0.08-423.el8_10
AlmaLinux:8 perl-Net-Ping 0 2.55-423.el8_10
AlmaLinux:8 perl-Pod-Html 0 1.22.02-423.el8_10
AlmaLinux:8 perl-SelfLoader 0 1.23-423.el8_10
AlmaLinux:8 perl-Test 0 1.30-423.el8_10
AlmaLinux:8 perl-Time-Piece 0 1.31-423.el8_10
AlmaLinux:8 perl-devel 0 4:5.26.3-423.el8_10
AlmaLinux:8 perl-interpreter 0 4:5.26.3-423.el8_10
AlmaLinux:8 perl-libnetcfg 0 4:5.26.3-423.el8_10
AlmaLinux:8 perl-libs 0 4:5.26.3-423.el8_10
AlmaLinux:8 perl-macros 0 4:5.26.3-423.el8_10
AlmaLinux:8 perl-open 0 1.11-423.el8_10
AlmaLinux:8 perl-tests 0 4:5.26.3-423.el8_10
AlmaLinux:8 perl-utils 0 5.26.3-423.el8_10
Chainguard miniperl 0 5.40.2-r1
Chainguard perl 0 5.40.2-r1
Chainguard perl-dev 0 5.40.2-r1
Chainguard perl-doc 0 5.40.2-r1
Chainguard perl-utils 0 5.40.2-r1
Debian:11 perl 0 No fix
Debian:12 perl 0 No fix
Debian:13 perl 0 No fix
Debian:13 perl 0 5.40.1-5
Debian:14 perl 0 5.40.1-5
Mageia:9 perl 0 5.36.0-1.2.mga9
SUSE:Linux Enterprise Micro 5.1 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Micro 5.2 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Micro 5.3 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Micro 5.4 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Micro 5.5 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Module for Basesystem 15 SP6 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Module for Basesystem 15 SP7 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Module for Development Tools 15 SP6 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Module for Development Tools 15 SP7 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Module for Package Hub 15 SP6 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Module for Package Hub 15 SP7 perl 0 5.26.1-150300.17.20.1
SUSE:Linux Enterprise Server LTSS Extended Security 12 SP5 perl 0 5.18.2-12.29.1
Wolfi miniperl 0 5.40.2-r1
Wolfi perl 0 5.40.2-r1
Wolfi perl-dev 0 5.40.2-r1
Wolfi perl-doc 0 5.40.2-r1
Wolfi perl-utils 0 5.40.2-r1
openSUSE:Leap 15.6 perl 0 5.26.1-150300.17.20.1
openSUSE:Tumbleweed perl 0 5.40.2-3.1

Related vulnerabilities