MediumCVE-2026-112935

    Tox-dev Filelock: Time-of-check Time-of-use (TOCTOU) Race Condition (CVE-2026-112935)

    Published Last modified Sources: OSV, Hersteller, CVE.org

    Share

    What is affected, what to do

    An exploit is publicly available. Update filelock to version 4.2.1.

    Affected
    • Tox-dev Filelock gte 3.22.0, < 4.2.1..*

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

    Metrics

    4.7

    Priority

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

    Source: Vendor (CNA), CVSS v3

    4.7

    CVSS v3

    Severity Medium on the scale from 0 to 10.

    Source: OSV, Hersteller, CVE.org

    0.1 %

    EPSS score

    Low — model estimates < 1% exploitation likelihood.

    Source: FIRST EPSS, percentile 2.8

    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
    53.56 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
    4.7 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
    4.7
    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.1 %
    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
    2.8
    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: proof of concept · not automatable · Technical impact: partial
    Source: CISA Vulnrichment, as of 28 October 2026
    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

    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

    The stale-lock break shared by SoftFileLock, MarkerSoftFileLock and SoftFileLease (and their async variants, and a FileLock that has fallen back to a soft lock on ENOSYS, the "not implemented" error) recognises the marker it judged stale by two values. The marker is the lock file at <path>, whose presence says a process holds the lock. The values are its inode number (the kernel's identity for a file, independent of its name) and its modification time (mtime) not being newer. The check runs after the contender has already closed the marker, so nothing keeps the inode allocated.

    On a filesystem that hands a freed inode number straight to the next file (ext4, xfs, overlayfs on them) the next holder's marker can carry that number. A contender still between its read and its break then renames and unlinks the live marker. Another local user (the other user below) who can create files in the lock's directory, a sticky /tmp included (the sticky bit is a directory flag that lets only a file's owner remove it), forces this at will. It plants a marker with a stale owner record and a modification time in the future and unlinks it as soon as a contender has read it. Two processes of the user running the lock (the lock user below) then hold the same default-configured lock at once, and nothing raises or logs. Affected versions: filelock >= 3.22.0 and <= 4.2.0 (finding ANT-2026-KIIS96IX).

    Severity

    CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N, 4.7 (Medium).

    AV:L (local): the other user needs an account on the same host. AC:H (high attack complexity): a race, though one the other user starts, lengthens (by making the lock user's /proc read slow) and retries at every release. The scanner measured 10 to 26 overlaps per 20-second run. PR:L (low privileges): an unprivileged account is enough. UI:N (no user interaction): the lock user's processes act on their own. C:N (no confidentiality impact): the other user reads nothing. I:H (high integrity impact): two holders write the data the lock protects, and neither learns of the other. A:N (no availability impact): the lock keeps working.

    Classification from the review: security, conditional on a sticky shared directory, ext4-style inode reuse and at least two contenders of the lock user. Our review verified it across UIDs (a UID is a user account's numeric id): the other user as uid 1001, the lock user's processes as uid 1000, BUG on 4.2.0 over ext4. The scanner rated it high (CWE-367).

    Scope and preconditions

    • The other user can create files in the lock's directory; a root-owned 1777 directory such as /tmp or /var/tmp is enough. It creates, utimes (sets the timestamps of) and unlinks only its own file. The sticky bit stops it removing the lock user's marker (checked: EPERM, operation not permitted), so the lock user's own stale break does the deletion.
    • The directory is on a filesystem that hands a freed inode number straight to the next file. ext4 does (six create/unlink rounds returned one number six times, in the image's overlayfs /tmp and on a loop-mounted ext4), and xfs does. tmpfs returned six increasing numbers and the same run there gave no overlap, and btrfs does not hand a freed number back.
    • The lock user has at least two processes contending for the lock, and the displaced holder is still inside when the next contender polls (the breaker itself comes back one poll_interval, 50 ms by default, later).
    • The lock is SoftFileLock, MarkerSoftFileLock or SoftFileLease (or async forms). The default flock-based FileLock joins them only after it has fallen back to SoftFileLock on ENOSYS. StrictSoftFileLock does not call break_lock_file, so it is not affected.
    • The same overlap also occurs with no other user involved, under heavy same-account contention, when a contender breaks a dead holder's marker and a successor creates its marker within the same timestamp tick (about once in 750 crashes with 64 workers on a 2-CPU machine, not on tmpfs).

    filelock's checks against another local user hold only when no other user can replace the lock's directory or any of its ancestors. That is the case when each ancestor belongs to the lock user or root and is either not writable by others or sticky. A user who can rename entries in a non-sticky directory above the lock controls every name below it. No file-based lock can defend against that.

    Affected code

    At the scanned commit b831496, the re-check sits in break_lock_file. Its callers are SoftFileLock._try_break_stale_lock, MarkerSoftFileLock._try_break_stale_lock and SoftFileLease._try_break_stale_lock. The reader _read_lock_file closes the judged marker before the verdict.

    Introduced

    e35c3afac473 ("feat(soft): detect and break stale locks", #476, 2026-02-13), first released in 3.22.0 (verified against the tags). Every release since, up to 4.2.0, carries the check.

    Mechanism

    _try_break_stale_lock reads the marker through _read_lock_file (lstat, O_RDONLY | O_NONBLOCK | O_NOFOLLOW open, fstat, read, close), decides with owner_is_stale that the owner is gone, and calls break_lock_file(lock_file, mtime, ino):

    # src/filelock/_util.py:113-118
    if (current := os.lstat(lock_file)).st_mtime > mtime_before or current.st_ino != ino_before:
        return
    break_path: Final[str] = f"{lock_file}.break.{os.getpid()}.{secrets.token_hex(16)}"
    Path(lock_file).rename(break_path)
    if (st_after := os.lstat(break_path)).st_mtime <= mtime_before and st_after.st_ino == ino_before:
        Path(break_path).unlink()
    

    Between the close in _read_lock_file and the lstat on line 113 nothing keeps the inode allocated. An inode number identifies a file only while something holds that inode. The release path already says so ("Our open descriptor keeps the inode allocated, so its number cannot name a successor's marker yet"); the break path does not. That leaves the modification time, which the file's owner sets to any value and which the code compares by order. With two jobs A and B of the lock user and the other user:

    1. The other user creates app.lock (inode I) with the record <its own pid>\n<host>\n1\n and sets its time to the year 2100 with os.utime(). A live PID with a wrong start token (the value that identifies one incarnation of a PID) is a recycled PID, so every contender judges the owner stale. On its own this marker only makes the lock user's processes wait: they cannot rename another user's file in a sticky directory (EPERM, and acquire(timeout=1) raises Timeout).
    2. A polls, reads (record, mtime=2100, ino=I), closes the file and enters owner_is_stale().
    3. The other user unlinks its marker. Inode I is free.
    4. B polls. The path is empty, so O_EXCL (create only if absent) succeeds and ext4 gives the new marker inode number I. B holds the lock.
    5. A reaches line 113 and looks at B's marker: its time (now) is not newer than 2100 and its inode number is I. A renames it (it is the lock user's own file, so the sticky bit does not object), line 117 passes for the same reason, and line 118 unlinks the live marker.
    6. The path is empty again while B is still inside. The next contender to poll, A included, creates its marker and holds the lock as well.

    When B releases, _unlink_open_marker finds another file at the path and leaves it alone, so neither side raises or logs a

    Source: OSV (Open Source Vulnerabilities), GitHub Security Advisories, cvelistv5, NVD (NIST)

    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.22.0, < 4.2.1
    • 3.22.0 – < 4.2.1
    • —
    • 4.2.1
    pipfilelock
    • >= 3.22.0, <= 4.2.0
    • 4.2.1
    pypifilelock
    • 3.32.5
    • 3.25.2
    • 4.0.12
    • 3.29.1
    • 3.24.1
    • 3.30.3
    • 3.22.0
    • 4.0.0
    • 3.30.2
    • 4.0.9
    • 4.2.0
    • 3.31.1
    • 3.32.7
    • 3.32.4
    • 3.29.0
    • 4.0.7
    • 4.0.4
    • 4.0.8
    • 4.0.11
    • 3.30.1
    • 4.1.1
    • 3.30.0
    • 3.29.3
    • 3.24.3
    • 4.1.2
    • 3.31.2
    • 4.0.6
    • 4.0.1
    • 3.29.4
    • 3.32.3
    • 3.29.5
    • 3.24.0
    • 3.29.7
    • 3.23.0
    • 4.0.2
    • 3.32.2
    • 3.24.2
    • 3.31.0
    • 3.25.1
    • 4.0.5
    • 4.1.0
    • 3.32.6
    • 3.25.0
    • 3.32.0
    • 4.0.3
    • —
    • —
    • —
    • —
    • —
    • —
    • 4.2.1
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —
    • —

    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

    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/commit/740ff666b62a88496c8d7394e4e6230605e4d62bx_refsource_MISC, Patch, web
    • github.comtox-dev/filelock/pull/843x_refsource_MISC, Patch, web
    • github.comtox-dev/filelock/releases/tag/4.2.1x_refsource_MISC, Release notes, web
    • github.comtox-dev/filelock/security/advisories/GHSA-fq56-3cx3-fjxpx_refsource_CONFIRM, Exploit, Mitigation, Patch, Vendor advisory, web
    • NVD (NIST)vuln/detail/CVE-2026-112935advisory
    • github.comtox-dev/filelockpackage

    Changes to this CVE

    Who changed this CVE and when: NVD (analysis, affected products, CVSS), the CVE publisher (CNA) and additional providers such as CISA (ADP).

    1. Record modifiedCISA ADP

      CISA assessment (SSVC): exploitation: proof of concept, automatable: no

      Show 2 original changes
      Individual changes of this event as published by NVD
      TypeActionBeforeAfter
      Referenceadded
      —
      https://github.com/tox-dev/filelock/security/advisories/GHSA-fq56-3cx3-fjxp
      SSVC assessmentadded
      —
      {"id":"CVE-2026-112935","role":"CISA Coordinator","options":[{"exploitation":"poc"},{"automatable":"no"},{"technicalImpact":"partial"}],"version":"2.0.3","timestamp":"2026-10-28T14:16:43.594543Z"}

      Source identifier: 134c704f-9b21-4f2e-91b3-4a467353bcc0

    2. Initial analysis by NVDNVD

      Show 5 original changes
      Individual changes of this event as published by NVD
      TypeActionBeforeAfter
      Product configurationadded
      —
      OR *cpe:2.3:a:tox-dev:filelock:*:*:*:*:*:python:*:* versions from (including) 3.22.0 up to (excluding) 4.2.1
      Reference typeadded
      —
      GitHub, Inc.: https://github.com/tox-dev/filelock/commit/740ff666b62a88496c8d7394e4e6230605e4d62b Types: Patch
      Reference typeadded
      —
      GitHub, Inc.: https://github.com/tox-dev/filelock/pull/843 Types: Patch
      Reference typeadded
      —
      GitHub, Inc.: https://github.com/tox-dev/filelock/releases/tag/4.2.1 Types: Release Notes
      Reference typeadded
      —
      GitHub, Inc.: https://github.com/tox-dev/filelock/security/advisories/GHSA-fq56-3cx3-fjxp Types: Exploit, Mitigation, Patch, Vendor Advisory

      Source identifier: nvd@nist.gov

    3. ReceivedGitHub

      Show 8 original changes
      Individual changes of this event as published by NVD
      TypeActionBeforeAfter
      Descriptionadded
      —
      filelock is a platform-independent file lock for Python. From 3.22.0 until 4.2.1, SoftFileLock can break a stale marker after an attacker frees its own marker following the stale read, an honest contender creates a live successor on the reused inode, and the successor's modification time is not newer than the saved observation, causing the live marker to be removed and two holders to be admitted. This issue is fixed in version 4.2.1.
      CVSSadded
      —
      AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N
      Weakness type (CWE)added
      —
      CWE-367
      Affected versions (publisher)added
      —
      New affected value received. <a href="https://github.com/CVEProject/cvelistV5/blob/main/cves/2026/112xxx/CVE-2026-112935.json">CVE-2026-112935</a>
      Referenceadded
      —
      https://github.com/tox-dev/filelock/commit/740ff666b62a88496c8d7394e4e6230605e4d62b
      Referenceadded
      —
      https://github.com/tox-dev/filelock/pull/843
      Referenceadded
      —
      https://github.com/tox-dev/filelock/releases/tag/4.2.1
      Referenceadded
      —
      https://github.com/tox-dev/filelock/security/advisories/GHSA-fq56-3cx3-fjxp

      Source identifier: security-advisories@github.com

    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-2026-112935
    <a href="https://intel.neosec.eu/en/cve/CVE-2026-112935"><img src="https://intel.neosec.eu/badge/cve/CVE-2026-112935.svg?lang=en" alt="CVE-2026-112935 – NEOSEC Intel" height="20"></a>