The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2025-40909

CVE-2025-40909: Perl Threads Race Condition Vulnerability

CVE-2025-40909 is a race condition in Perl threads affecting working directory handling during thread creation, allowing local attackers to exploit unintended file operations. This article covers technical details, impact, and mitigation.

Updated: January 22, 2026

CVE-2025-40909 Overview

CVE-2025-40909 is a race condition vulnerability in Perl's threading implementation that affects the working directory during thread creation. When a directory handle is open at thread creation time, the process-wide current working directory is temporarily changed to clone that handle for the new thread. This change is visible to any third (or subsequent) threads already running, creating a window where file operations may target unintended paths.

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

Critical Impact

Local attackers can exploit the race condition window to manipulate file operations in multi-threaded Perl applications, potentially leading to untrusted code execution or unauthorized file access.

Affected Products

  • Perl versions 5.13.6 and later (introduced in commit 11a11ecf4bea72b17d250cfb43c897be1341861e)
  • Multi-threaded Perl applications using directory handles
  • Systems running threaded Perl scripts with open directory handles

Discovery Timeline

  • May 30, 2025 - CVE-2025-40909 published to NVD
  • November 3, 2025 - Last updated in NVD database

Technical Details for CVE-2025-40909

Vulnerability Analysis

This vulnerability is classified under CWE-426 (Untrusted Search Path). The flaw exists in how Perl handles directory handles when creating new threads. During the thread cloning process, Perl temporarily modifies the process-wide current working directory to properly duplicate directory handles for the new thread. This creates a Time-of-Check Time-of-Use (TOCTOU) race condition window.

The vulnerability requires local access and affects multi-threaded Perl applications where directory handles are open during thread creation. An attacker who can influence the timing of file operations in another running thread could potentially redirect file operations to attacker-controlled locations.

Root Cause

The root cause is the temporary modification of the process-wide current working directory during thread creation. When Perl clones a directory handle for a new thread, it changes the working directory at the process level rather than using thread-local operations. This design decision, introduced in Perl 5.13.6 via commit 11a11ecf4bea72b17d250cfb43c897be1341861e, creates a race condition where concurrent threads may observe an unexpected working directory state.

Attack Vector

The attack vector is local, requiring the attacker to have access to the system running the vulnerable Perl application. The attack scenario involves:

  1. A multi-threaded Perl application with at least three threads
  2. One thread opens a directory handle
  3. During thread creation, the process working directory temporarily changes
  4. A concurrent thread performs file operations during this window
  5. File operations resolve against the temporary working directory instead of the expected path

This could allow an attacker to trick the application into loading malicious code or accessing sensitive files from unexpected locations, particularly if the attacker can control or predict the temporary directory path.

The vulnerability mechanism involves Perl's internal thread cloning behavior. When a new thread is created with an open directory handle, the runtime temporarily changes the process-wide current working directory to clone that handle. During this brief window, any file operations performed by other running threads will resolve paths relative to the temporary directory rather than the expected working directory. For detailed technical analysis, see the GitHub Issue #23010 and the Openwall OSS-Security Discussion.

Detection Methods for CVE-2025-40909

Indicators of Compromise

  • Unexpected file access patterns in Perl application logs showing operations on unintended paths
  • Multi-threaded Perl scripts experiencing intermittent file operation failures or accessing wrong files
  • Application errors related to missing files or incorrect file content in threaded Perl programs
  • Audit logs showing file operations in unexpected directories during high thread creation activity

Detection Strategies

  • Monitor for Perl processes with multiple threads that open directory handles during thread creation
  • Implement file integrity monitoring on critical directories accessed by Perl applications
  • Use strace or similar tools to trace working directory changes (chdir syscalls) in suspicious Perl processes
  • Deploy behavioral analysis to detect anomalous file access patterns in multi-threaded Perl applications

Monitoring Recommendations

  • Enable detailed audit logging for file system operations by Perl processes
  • Monitor thread creation events in production Perl applications using system call tracing
  • Set up alerts for unexpected working directory changes in critical Perl services
  • Review Perl application logs for path-related errors that may indicate race condition exploitation

How to Mitigate CVE-2025-40909

Immediate Actions Required

  • Audit multi-threaded Perl applications for directory handle usage during thread creation
  • Avoid opening directory handles before creating threads, or close them prior to thread creation
  • Use absolute paths for all file operations in multi-threaded Perl code to avoid working directory dependencies
  • Consider migrating critical applications to forking instead of threading where feasible

Patch Information

A patch is available for this vulnerability. The fix is documented in the GitHub Patch for the Perl interpreter. System administrators should update Perl to a patched version when available from their distribution vendor. The Debian Bug Report #1098226 tracks the issue for Debian-based systems.

Workarounds

  • Close all directory handles before creating new threads in Perl applications
  • Use absolute paths exclusively in multi-threaded Perl code to eliminate working directory dependencies
  • Implement application-level locking around file operations when directory handles must remain open during thread creation
  • Isolate critical file operations in single-threaded code sections where possible
bash
# Configuration example - Use absolute paths in Perl scripts
# Instead of relative paths, always use fully qualified paths

# Verify Perl version to check if vulnerable (5.13.6 and later)
perl -v | grep version

# Check for open directory handles in running Perl processes
lsof -c perl | grep DIR

# Monitor chdir syscalls to detect race condition exploitation
strace -f -e chdir -p <perl_pid>

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRace Condition

  • Vendor/TechPerl

  • SeverityMEDIUM

  • CVSS Score5.9

  • EPSS Probability0.01%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • CWE-426
  • Technical References
  • Debian Bug Report #1098226

  • GitHub Commit - Perl Changes

  • GitHub Patch - Perl Update

  • GitHub Issue #10387 - Perl

  • GitHub Issue #23010 - Perl

  • Perl Documentation - Threads

  • Openwall OSS-Security Discussion

  • Full Disclosure Mailing - Sep 53

  • Full Disclosure Mailing - Sep 54

  • Full Disclosure Mailing - Sep 55

  • Openwall OSS-Security Discussion

  • Openwall OSS-Security Discussion

  • Openwall OSS-Security Discussion

  • Openwall OSS-Security Discussion

  • Openwall OSS-Security Discussion

  • Openwall OSS-Security Discussion

  • Openwall OSS-Security Discussion
  • Related CVEs
  • CVE-2026-4176: Perl Compress::Raw::Zlib Vulnerability

  • CVE-2024-57854: Net::NSCA::Client Weak RNG Vulnerability

  • CVE-2018-25160: HTTP::Session2 Perl RCE Vulnerability

  • CVE-2026-2474: Perl Crypt::URandom Heap Overflow DoS Flaw
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English