MediumCVE-2025-68146

    filelock has TOCTOU race condition that allows symlink attacks during lock file creation (CVE-2025-68146)

    Published Sources: BSI, Msrc Update Guide, OSV, CVE.org

    What is affected, what to do

    filelock is a platform-independent file lock for Python. In versions prior to 3.20.1, a Time-of-Check-Time-of-Use (TOCTOU) race condition allows local attackers to corrupt or truncate arbitrary user files through symlink attacks.

    An exploit is publicly available. Update Tox-dev Filelock to version 3.20.1.

    Affected
    • Tox-dev Filelock lt *..3.20.1
    Fixed in
    • Tox-dev Filelock 3.20.1

    Not sure whether and how you are affected? Ask a question about this vulnerability

    Metrics

    6.5

    Priority

    XIEM Effective CVSS: highest available CVSS rating from NVD and vendor data.

    Source: NVD, CVSS v3

    6.3

    CVSS v3

    Severity Medium on the scale from 0 to 10.

    Source: BSI, Msrc Update Guide, OSV, CVE.org

    0.2 %

    EPSS score

    Low — model estimates < 1% exploitation likelihood.

    Source: FIRST EPSS, percentile 9.5

    Show all metrics
    Severity
    Medium
    Priority (0–325)

    The priority score is a consolidated metric that condenses several individual signals into a single, action-guiding ranking: technical severity (CVSS), exploitation likelihood (EPSS), known-exploited status (KEV) and the context of the affected asset. The aim is to answer the only truly important question in vulnerability management: what first?

    Read in glossary
    45.01 Methodology
    Exploit maturity

    An exploit is code or a technique that specifically uses a concrete vulnerability to force unintended behaviour — such as executing code or escalating privileges. It is the tool that turns a theoretical flaw into a practical attack.

    Read in glossary
    PoC (publicly reported)
    XIEM Effective CVSS

    XIEM® is the tiered managed-security operating model from NEOSEC and a registered trademark of NEOSEC GmbH. It extends classic SIEM — the central collection, normalisation and correlation of security-relevant events — with endpoint forensics, network visibility and deception technology, and consolidates them into three building tiers: Sentry, Orchestrate and Command.

    Read in glossary
    6.5 Methodology
    CVSS v3

    CVSS is the globally established, open standard for assessing the technical severity of a vulnerability on a scale from 0 to 10. It describes how easily a flaw can be exploited and what damage it can cause — but not how likely its actual exploitation is. CVSS and the complementary EPSS deliberately answer different questions.

    Read in glossary
    6.3
    EPSS score

    The EPSS score is the absolute model output for an individual vulnerability: the estimated probability of real-world exploitation within the next 30 days, expressed as a value between 0 and 1 (i.e. 0 % to 100 %). A score of 0.42 means „the model estimates a 42 % chance of real-world exploitation within 30 days“.

    Read in glossary
    0.2 %
    Low — model estimates < 1% exploitation likelihood.
    EPSS percentile

    The EPSS percentile is the relative position of a vulnerability within all EPSS-scored CVEs, expressed as a value between 0 and 1. A percentile of 0.90 means „this CVE has a higher EPSS score than 90 % of all other scored CVEs“. Unlike the EPSS score, it is not a probability — but a positioning within a ranking.

    Read in glossary
    9.5
    Low — this CVE sits in the lower 10% of all CVEs scored today.
    KEV status

    The KEV catalogue is a list maintained by the US authority CISA of vulnerabilities for which active exploitation in the wild has been confirmed. It answers not the question „how severe?“ but „is it already being attacked?“ — thereby sharply prioritising patching.

    Read in glossary
    —
    Published
    CISA assessment (SSVC)
    Exploitation: none known · not automatable · Technical impact: partial
    Source: CISA Vulnrichment, as of 17 December 2025
    CWE

    CWE is a catalogue of typical weakness types in software and hardware — such as flawed input validation, unsafe memory handling or poor authentication. Where a CVE names a concrete vulnerability in a concrete product, a CWE describes the underlying class of defect.

    Read in glossary
    CWE-367, CWE-59, CWE-362

    Detection rules

    No NEOSEC detection rule is available for this vulnerability yet.

    Classification under NIS2 and CRA

    Rule-based classification from exploitation status and severity. It does not replace a case-by-case assessment.

    NIS2

    NIS2 is EU Directive (EU) 2022/2555 to raise the level of cybersecurity across the Union. It substantially broadens obligations compared with the first NIS directive: more sectors, mandatory risk management, staged reporting duties and personal accountability of senior management.

    Read in glossary
    Handle the vulnerability in regular vulnerability handling under Art. 21(2)(e) NIS2.
    CRA

    The CRA is EU Regulation (EU) 2024/2847 setting horizontal cybersecurity requirements for „products with digital elements“ — from industrial controllers and software to connected consumer devices. For the first time manufacturers must ensure security across the entire product lifecycle, handle vulnerabilities and provide security updates.

    Read in glossary
    From 11.12.2027, Annex I Part II CRA requires manufacturers of affected products with digital elements to handle vulnerabilities without delay and provide security updates.
    ISO/IEC 27001

    ISO/IEC 27001 is the internationally leading standard for an information security management system (ISMS). It describes a risk-based, process-oriented framework to systematically plan, implement, review and improve information security.

    Read in glossary
    Control A.8.8, management of technical vulnerabilities: assess relevance to your systems, plan remediation and keep evidence.

    Description

    filelock is a platform-independent file lock for Python. In versions prior to 3.20.1, a Time-of-Check-Time-of-Use (TOCTOU) race condition allows local attackers to corrupt or truncate arbitrary user files through symlink attacks. The vulnerability exists in both Unix and Windows lock file creation where filelock checks if a file exists before opening it with O_TRUNC. An attacker can create a symlink pointing to a victim file in the time gap between the check and open, causing os.open() to follow the symlink and truncate the target file. All users of filelock on Unix, Linux, macOS, and Windows systems are impacted. The vulnerability cascades to dependent libraries. The attack requires local filesystem access and ability to create symlinks (standard user permissions on Unix; Developer Mode on Windows 10+). Exploitation succeeds within 1-3 attempts when lock file paths are predictable. The issue is fixed in version 3.20.1. If immediate upgrade is not possible, use SoftFileLock instead of UnixFileLock/WindowsFileLock (note: different locking semantics, may not be suitable for all use cases); ensure lock file directories have restrictive permissions (chmod 0700) to prevent untrusted users from creating symlinks; and/or monitor lock file directories for suspicious symlinks before running trusted applications. These workarounds provide only partial mitigation. The race condition remains exploitable. Upgrading to version 3.20.1 is strongly recommended.

    Source: BSI WID Portal, BSI CSAF, Microsoft Security Update Guide, OSV (Open Source Vulnerabilities), NVD (NIST), cvelistv5, CVE.org (MITRE)

    Affected products

    The following versions are affected. Older releases of the same product line are also vulnerable unless stated otherwise.

    Affected products
    Affected versionsFixed in
    tox-devfilelock
    • < 3.20.1
    • < 3.20.1
    • 3.20.1
    • 3.20.1
    IBMConcert
    • < 3.0.0
    • 3.0.0
    XeroxFreeFlow Print Server
    • v7
    • v2
    • —
    • —
    pypifilelock
    • 3.15.4
    • 2.0.9
    • 0.2.2
    • 1.0.0
    • 3.10.5
    • 2.0.11
    • 2.0.4
    • 3.13.2
    • 3.16.1
    • 3.15.2
    • 3.0.2
    • 0.2.0
    • 3.5.0
    • 3.8.0
    • 3.10.0
    • 1.0.1
    • 2.0.10
    • 1.0.2
    • 3.0.6
    • 3.12.4
    • 2.0.0
    • 3.0.12
    • 3.17.0
    • 2.0.13
    • 3.3.2
    • 3.0.4
    • 3.8.2
    • 3.7.1
    • 3.10.1
    • 3.10.2
    • 3.10.7
    • 3.0.8
    • 3.15.1
    • 3.0.10
    • 3.0.9
    • 3.7.0
    • 3.18.0
    • 3.14.0
    • 3.10.3
    • 2.0.1
    • 0.2.1
    • 3.10.4
    • 3.13.3
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —

    Vendors and products

    Weakness classes (CWE)

    • CWE-367Time-of-check Time-of-use (TOCTOU) Race Condition

      Base

      The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.

      Entry at MITRE CWE-367
    • CWE-59Improper Link Resolution Before File Access ('Link Following')

      Base

      The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.

      Entry at MITRE CWE-59
    • CWE-362Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')

      Class

      The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.

      Entry at MITRE CWE-362

    Public exploit references

    Publicly reported proof-of-concepts, exploit modules and detection templates for this vulnerability. NEOSEC links to the original sources only and does not provide any exploit code.

    Public exploit references
    Reference tagged as exploitgithub.com (opens in a new tab)PoC (publicly reported)reported, not verified—

    References & sources

    • github.comtox-dev/filelock/security/advisories/GHSA-w853-jp5j-5j7fweb, x_refsource_CONFIRM, Exploit, Mitigation, Vendor advisory
    • github.comtox-dev/filelock/commit/4724d7f8c3393ec1f048c93933e6e3e6ec321f0eweb, x_refsource_MISC, Patch
    • github.comtox-dev/filelockpackage
    • github.comtox-dev/filelock/releases/tag/3.20.1web, x_refsource_MISC, Product, Release notes
    • learn.microsoft.comen-us/windows/win32/fileio/file-attribute-constantsweb
    • pubs.opengroup.orgonlinepubs/9699919799/functions/open.htmlweb
    • github.comtox-dev/filelock/pull/461x_refsource_MISC, Issue tracking, Patch
    Embed badge

    Show the severity and KEV status of this vulnerability on your site – with a link back here. The image is updated hourly.

    Badge preview for CVE-2025-68146
    <a href="https://intel.neosec.eu/en/cve/CVE-2025-68146"><img src="https://intel.neosec.eu/badge/cve/CVE-2025-68146.svg?lang=en" alt="CVE-2025-68146 – NEOSEC Intel" height="20"></a>