CWE-689
Permission Race Condition During Resource Copy
The product, while copying or cloning a resource, does not set the resource's permissions or access control until the copy is complete, leaving the resource exposed to other spheres while the copy is taking place.
CVE-2025-40909 (GCVE-0-2025-40909)
Vulnerability from cvelistv5
{ "containers": { "adp": [ { "providerMetadata": { "dateUpdated": "2025-06-03T03:23:21.080Z", "orgId": "af854a3a-2127-422b-91ae-364da2661108", "shortName": "CVE" }, "references": [ { "url": "http://www.openwall.com/lists/oss-security/2025/05/23/1" }, { "url": "http://www.openwall.com/lists/oss-security/2025/05/30/4" }, { "url": "http://www.openwall.com/lists/oss-security/2025/06/02/2" }, { "url": "http://www.openwall.com/lists/oss-security/2025/06/02/5" }, { "url": "http://www.openwall.com/lists/oss-security/2025/06/02/6" }, { "url": "http://www.openwall.com/lists/oss-security/2025/06/02/7" }, { "url": "http://www.openwall.com/lists/oss-security/2025/06/03/1" } ], "title": "CVE Program Container" }, { "metrics": [ { "cvssV3_1": { "attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "LOW", "baseScore": 5.9, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L", "version": "3.1" } }, { "other": { "content": { "id": "CVE-2025-40909", "options": [ { "Exploitation": "poc" }, { "Automatable": "no" }, { "Technical Impact": "partial" } ], "role": "CISA Coordinator", "timestamp": "2025-05-30T14:05:00.839656Z", "version": "2.0.3" }, "type": "ssvc" } } ], "providerMetadata": { "dateUpdated": "2025-05-30T14:09:50.842Z", "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "shortName": "CISA-ADP" }, "title": "CISA ADP Vulnrichment" } ], "cna": { "affected": [ { "collectionURL": "https://cpan.org/modules", "defaultStatus": "unaffected", "packageName": "perl", "product": "perl", "programRoutines": [ { "name": "threads" } ], "repo": "https://github.com/perl/perl5", "vendor": "perl", "versions": [ { "lessThan": "5.41.13", "status": "affected", "version": "5.13.6", "versionType": "custom" } ] } ], "credits": [ { "lang": "en", "type": "finder", "value": "Vincent Lefevre" } ], "descriptions": [ { "lang": "en", "supportingMedia": [ { "base64": false, "type": "text/html", "value": "Perl threads have a working directory race condition where file operations may target unintended paths.\u003cbr\u003e\u003cbr\u003eIf a directory handle is open at thread creation, the process-wide current working directory is temporarily changed in order to clone\u0026nbsp;that handle for the new thread, which is visible from any third (or\u0026nbsp;more) thread already running. \u003cbr\u003e\u003cbr\u003eThis may lead to unintended operations\u0026nbsp;such as loading code or accessing files from unexpected locations,\u0026nbsp;which a local attacker may be able to exploit.\u003cbr\u003e\u003cbr\u003eThe bug was introduced in commit\u0026nbsp;11a11ecf4bea72b17d250cfb43c897be1341861e and released in Perl version 5.13.6" } ], "value": "Perl threads have a working directory race condition where file operations may target unintended paths.\n\nIf a directory handle is open at thread creation, the process-wide current working directory is temporarily changed in order to clone\u00a0that handle for the new thread, which is visible from any third (or\u00a0more) thread already running. \n\nThis may lead to unintended operations\u00a0such as loading code or accessing files from unexpected locations,\u00a0which a local attacker may be able to exploit.\n\nThe bug was introduced in commit\u00a011a11ecf4bea72b17d250cfb43c897be1341861e and released in Perl version 5.13.6" } ], "problemTypes": [ { "descriptions": [ { "cweId": "CWE-689", "description": "CWE-689 Permission Race Condition During Resource Copy", "lang": "en", "type": "CWE" } ] }, { "descriptions": [ { "cweId": "CWE-426", "description": "CWE-426 Untrusted Search Path", "lang": "en", "type": "CWE" } ] } ], "providerMetadata": { "dateUpdated": "2025-09-05T13:24:00.827Z", "orgId": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "shortName": "CPANSec" }, "references": [ { "tags": [ "patch" ], "url": "https://github.com/Perl/perl5/commit/918bfff86ca8d6d4e4ec5b30994451e0bd74aba9.patch" }, { "tags": [ "mailing-list", "exploit" ], "url": "https://www.openwall.com/lists/oss-security/2025/05/22/2" }, { "tags": [ "issue-tracking" ], "url": "https://github.com/Perl/perl5/issues/23010" }, { "tags": [ "related" ], "url": "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098226" }, { "tags": [ "related" ], "url": "https://github.com/Perl/perl5/issues/10387" }, { "tags": [ "related" ], "url": "https://perldoc.perl.org/5.14.0/perl5136delta#Directory-handles-not-copied-to-threads" }, { "tags": [ "related" ], "url": "https://github.com/Perl/perl5/commit/11a11ecf4bea72b17d250cfb43c897be1341861e" } ], "solutions": [ { "lang": "en", "supportingMedia": [ { "base64": false, "type": "text/html", "value": "Update perl to an unaffected version, or apply the patch provided in the references section." } ], "value": "Update perl to an unaffected version, or apply the patch provided in the references section." } ], "source": { "discovery": "UNKNOWN" }, "title": "Perl threads have a working directory race condition where file operations may target unintended paths", "x_generator": { "engine": "Vulnogram 0.2.0" } } }, "cveMetadata": { "assignerOrgId": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "assignerShortName": "CPANSec", "cveId": "CVE-2025-40909", "datePublished": "2025-05-30T12:20:11.237Z", "dateReserved": "2025-04-16T09:05:34.360Z", "dateUpdated": "2025-09-05T13:24:00.827Z", "state": "PUBLISHED" }, "dataType": "CVE_RECORD", "dataVersion": "5.1" }
No mitigation information available for this CWE.
CAPEC-26: Leveraging Race Conditions
The adversary targets a race condition occurring when multiple processes access and manipulate the same resource concurrently, and the outcome of the execution depends on the particular order in which the access takes place. The adversary can leverage a race condition by "running the race", modifying the resource and modifying the normal execution flow. For instance, a race condition can occur while accessing a file: the adversary can trick the system by replacing the original file with their version and cause the system to read the malicious file.
CAPEC-27: Leveraging Race Conditions via Symbolic Links
This attack leverages the use of symbolic links (Symlinks) in order to write to sensitive files. An attacker can create a Symlink link to a target file not otherwise accessible to them. When the privileged program tries to create a temporary file with the same name as the Symlink link, it will actually write to the target file pointed to by the attackers' Symlink link. If the attacker can insert malicious content in the temporary file they will be writing to the sensitive file by using the Symlink. The race occurs because the system checks if the temporary file exists, then creates the file. The attacker would typically create the Symlink during the interval between the check and the creation of the temporary file.