-
-
Notifications
You must be signed in to change notification settings - Fork 123
CVE-2025-68146: Fix TOCTOU symlink vulnerability in lock file creation #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+39
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A race condition existed between checking if the lock file exists and opening it with O_TRUNC, allowing local attackers to create a symlink pointing to victim files. When the lock was acquired, os.open() would follow the symlink and truncate the target file, causing data loss or corruption. The vulnerability affected both Unix and Windows platforms and cascaded through dependent libraries: - virtualenv: Could overwrite user configs with virtualenv metadata, leaking file contents - PyTorch: Could truncate CPU ISA cache causing crashes, or corrupt compiled model checkpoints preventing model loading (DoS for ML pipelines) Unix/Linux/macOS fix: - Add O_NOFOLLOW flag to os.open() call in UnixFileLock._acquire() - System returns ELOOP error if lock path is a symlink, preventing the attack Windows fix: - Use GetFileAttributesW API via ctypes to detect reparse points (symlinks/junctions) - Refuse to open lock file if FILE_ATTRIBUTE_REPARSE_POINT flag is set - Raises OSError before attempting to open, closing the race window This addresses CWE-362 (Race Condition), CWE-367 (TOCTOU), and CWE-59 (Link Following). Reported-by: @tsigouris007 Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
ansibuddy
pushed a commit
to ansible/molecule
that referenced
this pull request
Dec 22, 2025
This PR contains the following updates: | Package | Type | Update | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [astral-sh/ruff-pre-commit](https://redirect.github.com/astral-sh/ruff-pre-commit) | repository | patch | `v0.14.9` -> `v0.14.10` |  |  | | [astral-sh/uv-pre-commit](https://redirect.github.com/astral-sh/uv-pre-commit) | repository | patch | `0.9.17` -> `0.9.18` |  |  | | [biomejs/pre-commit](https://redirect.github.com/biomejs/pre-commit) | repository | patch | `v2.3.8` -> `v2.3.10` |  |  | | [filelock](https://redirect.github.com/tox-dev/py-filelock) | dependency-groups | patch | `3.20.0` -> `3.20.1` |  |  | | [mypy](https://redirect.github.com/python/mypy) ([changelog](https://mypy.readthedocs.io/en/latest/changelog.html)) | dependency-groups | patch | `1.19.0` -> `1.19.1` |  |  | | [pre-commit](https://redirect.github.com/pre-commit/pre-commit) | dependency-groups | patch | `4.5.0` -> `4.5.1` |  |  | | [pre-commit/mirrors-mypy](https://redirect.github.com/pre-commit/mirrors-mypy) | repository | patch | `v1.19.0` -> `v1.19.1` |  |  | | [ruff](https://docs.astral.sh/ruff) ([source](https://redirect.github.com/astral-sh/ruff), [changelog](https://redirect.github.com/astral-sh/ruff/blob/main/CHANGELOG.md)) | dependency-groups | patch | `0.14.9` -> `0.14.10` |  |  | | [tombi-toml/tombi-pre-commit](https://redirect.github.com/tombi-toml/tombi-pre-commit) | repository | patch | `v0.7.7` -> `v0.7.8` |  |  | | | | lockFileMaintenance | All locks refreshed | | | Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://redirect.github.com/renovatebot/renovate/discussions/new) if you have any questions. --- ### Release Notes <details> <summary>astral-sh/ruff-pre-commit (astral-sh/ruff-pre-commit)</summary> ### [`v0.14.10`](https://redirect.github.com/astral-sh/ruff-pre-commit/releases/tag/v0.14.10) [Compare Source](https://redirect.github.com/astral-sh/ruff-pre-commit/compare/v0.14.9...v0.14.10) See: <https://github.com/astral-sh/ruff/releases/tag/0.14.10> </details> <details> <summary>astral-sh/uv-pre-commit (astral-sh/uv-pre-commit)</summary> ### [`v0.9.18`](https://redirect.github.com/astral-sh/uv-pre-commit/releases/tag/0.9.18) [Compare Source](https://redirect.github.com/astral-sh/uv-pre-commit/compare/0.9.17...0.9.18) See: <https://github.com/astral-sh/uv/releases/tag/0.9.18> </details> <details> <summary>biomejs/pre-commit (biomejs/pre-commit)</summary> ### [`v2.3.10`](https://redirect.github.com/biomejs/pre-commit/compare/v2.3.9...v2.3.10) [Compare Source](https://redirect.github.com/biomejs/pre-commit/compare/v2.3.9...v2.3.10) ### [`v2.3.9`](https://redirect.github.com/biomejs/pre-commit/compare/v2.3.8...v2.3.9) [Compare Source](https://redirect.github.com/biomejs/pre-commit/compare/v2.3.8...v2.3.9) </details> <details> <summary>tox-dev/py-filelock (filelock)</summary> ### [`v3.20.1`](https://redirect.github.com/tox-dev/filelock/releases/tag/3.20.1) [Compare Source](https://redirect.github.com/tox-dev/py-filelock/compare/3.20.0...3.20.1) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed - CVE-2025-68146: Fix TOCTOU symlink vulnerability in lock file creation by [@​gaborbernat](https://redirect.github.com/gaborbernat) in [tox-dev/filelock#461](https://redirect.github.com/tox-dev/filelock/pull/461) **Full Changelog**: <tox-dev/filelock@3.20.0...3.20.1> </details> <details> <summary>python/mypy (mypy)</summary> ### [`v1.19.1`](https://redirect.github.com/python/mypy/blob/HEAD/CHANGELOG.md#Mypy-1191) [Compare Source](https://redirect.github.com/python/mypy/compare/v1.19.0...v1.19.1) - Fix noncommutative joins with bounded TypeVars (Shantanu, PR [20345](https://redirect.github.com/python/mypy/pull/20345)) - Respect output format for cached runs by serializing raw errors in cache metas (Ivan Levkivskyi, PR [20372](https://redirect.github.com/python/mypy/pull/20372)) - Allow `types.NoneType` in match cases (A5rocks, PR [20383](https://redirect.github.com/python/mypy/pull/20383)) - Fix mypyc generator regression with empty tuple (BobTheBuidler, PR [20371](https://redirect.github.com/python/mypy/pull/20371)) - Fix crash involving Unpack-ed TypeVarTuple (Shantanu, PR [20323](https://redirect.github.com/python/mypy/pull/20323)) - Fix crash on star import of redefinition (Ivan Levkivskyi, PR [20333](https://redirect.github.com/python/mypy/pull/20333)) - Fix crash on typevar with forward ref used in other module (Ivan Levkivskyi, PR [20334](https://redirect.github.com/python/mypy/pull/20334)) - Fail with an explicit error on PyPy (Ivan Levkivskyi, PR [20389](https://redirect.github.com/python/mypy/pull/20389)) </details> <details> <summary>pre-commit/pre-commit (pre-commit)</summary> ### [`v4.5.1`](https://redirect.github.com/pre-commit/pre-commit/blob/HEAD/CHANGELOG.md#451---2025-12-16) [Compare Source](https://redirect.github.com/pre-commit/pre-commit/compare/v4.5.0...v4.5.1) \================== ##### Fixes - Fix `language: python` with `repo: local` without `additional_dependencies`. - [#​3597](https://redirect.github.com/pre-commit/pre-commit/issues/3597) PR by [@​asottile](https://redirect.github.com/asottile). </details> <details> <summary>pre-commit/mirrors-mypy (pre-commit/mirrors-mypy)</summary> ### [`v1.19.1`](https://redirect.github.com/pre-commit/mirrors-mypy/compare/v1.19.0...v1.19.1) [Compare Source](https://redirect.github.com/pre-commit/mirrors-mypy/compare/v1.19.0...v1.19.1) </details> <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.14.10`](https://redirect.github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#01410) [Compare Source](https://redirect.github.com/astral-sh/ruff/compare/0.14.9...0.14.10) Released on 2025-12-18. ##### Preview features - \[formatter] Fluent formatting of method chains ([#​21369](https://redirect.github.com/astral-sh/ruff/pull/21369)) - \[formatter] Keep lambda parameters on one line and parenthesize the body if it expands ([#​21385](https://redirect.github.com/astral-sh/ruff/pull/21385)) - \[`flake8-implicit-str-concat`] New rule to prevent implicit string concatenation in collections (`ISC004`) ([#​21972](https://redirect.github.com/astral-sh/ruff/pull/21972)) - \[`flake8-use-pathlib`] Make fixes unsafe when types change in compound statements (`PTH104`, `PTH105`, `PTH109`, `PTH115`) ([#​22009](https://redirect.github.com/astral-sh/ruff/pull/22009)) - \[`refurb`] Extend support for `Path.open` (`FURB101`, `FURB103`) ([#​21080](https://redirect.github.com/astral-sh/ruff/pull/21080)) ##### Bug fixes - \[`pyupgrade`] Fix parsing named Unicode escape sequences (`UP032`) ([#​21901](https://redirect.github.com/astral-sh/ruff/pull/21901)) ##### Rule changes - \[`eradicate`] Ignore `ruff:disable` and `ruff:enable` comments in `ERA001` ([#​22038](https://redirect.github.com/astral-sh/ruff/pull/22038)) - \[`flake8-pytest-style`] Allow `match` and `check` keyword arguments without an expected exception type (`PT010`) ([#​21964](https://redirect.github.com/astral-sh/ruff/pull/21964)) - \[syntax-errors] Annotated name cannot be global ([#​20868](https://redirect.github.com/astral-sh/ruff/pull/20868)) ##### Documentation - Add `uv` and `ty` to the Ruff README ([#​21996](https://redirect.github.com/astral-sh/ruff/pull/21996)) - Document known lambda formatting deviations from Black ([#​21954](https://redirect.github.com/astral-sh/ruff/pull/21954)) - Update `setup.md` ([#​22024](https://redirect.github.com/astral-sh/ruff/pull/22024)) - \[`flake8-bandit`] Fix broken link (`S704`) ([#​22039](https://redirect.github.com/astral-sh/ruff/pull/22039)) ##### Other changes - Fix playground Share button showing "Copied!" before clipboard copy completes ([#​21942](https://redirect.github.com/astral-sh/ruff/pull/21942)) ##### Contributors - [@​dylwil3](https://redirect.github.com/dylwil3) - [@​charliecloudberry](https://redirect.github.com/charliecloudberry) - [@​charliermarsh](https://redirect.github.com/charliermarsh) - [@​chirizxc](https://redirect.github.com/chirizxc) - [@​ntBre](https://redirect.github.com/ntBre) - [@​zanieb](https://redirect.github.com/zanieb) - [@​amyreese](https://redirect.github.com/amyreese) - [@​hauntsaninja](https://redirect.github.com/hauntsaninja) - [@​11happy](https://redirect.github.com/11happy) - [@​mahiro72](https://redirect.github.com/mahiro72) - [@​MichaReiser](https://redirect.github.com/MichaReiser) - [@​phongddo](https://redirect.github.com/phongddo) - [@​PeterJCLaw](https://redirect.github.com/PeterJCLaw) </details> <details> <summary>tombi-toml/tombi-pre-commit (tombi-toml/tombi-pre-commit)</summary> ### [`v0.7.8`](https://redirect.github.com/tombi-toml/tombi-pre-commit/releases/tag/v0.7.8) [Compare Source](https://redirect.github.com/tombi-toml/tombi-pre-commit/compare/v0.7.7...v0.7.8) See: <https://github.com/tombi-toml/tombi/releases/tag/v0.7.8> </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on monday" in timezone UTC, Automerge - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) in timezone UTC. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/ansible/molecule). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiY2hvcmUiLCJkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A race condition existed between checking if the lock file exists and opening it with O_TRUNC, allowing local attackers to create a symlink pointing to victim files. When the lock was acquired, os.open() would follow the symlink and truncate the target file, causing data loss or corruption.
The vulnerability affected both Unix and Windows platforms and cascaded through dependent libraries:
model loading (DoS for ML pipelines)
Unix/Linux/macOS fix:
Windows fix:
This addresses CWE-362 (Race Condition), CWE-367 (TOCTOU), and CWE-59 (Link Following).
Reported-by: @tsigouris007