# filelock has a TOCTOU race condition which allows symlink attacks during lock file creation

Advisory record · `GHSA-w853-jp5j-5j7f`

- **Identifiers:** `GHSA-w853-jp5j-5j7f` · `CVE-2025-68146` · `PYSEC-2026-1375`
- **State:** Confirmed
- **Severity:** CVSS 6.3 Medium
- **Critical:** No
- **Weakness (CWE):** [CWE-59](https://cwe.mitre.org/data/definitions/59.html) · [CWE-362](https://cwe.mitre.org/data/definitions/362.html) · [CWE-367](https://cwe.mitre.org/data/definitions/367.html)
- **Tags:** [Path traversal](https://agentprime.io/advisories/tag/path-traversal.md) · [Race condition](https://agentprime.io/advisories/tag/race-condition.md)
- **Published:** 16 Dec 2025
- **Updated:** 10 Sept 2026
- **Reviewed by a person:** No

Published by the GitHub Advisory Database at 16 Dec 2025, 20:52 UTC. agentprime has not analysed this yet, so whether it affects any app is not known.

## Affected packages

- `filelock` (PyPI): affected `<3.20.1`; fixed in `3.20.1`

## Machine-written summary

Summary written by Claude Haiku from the source advisory. Not reviewed by a person.

> The filelock Python package (PyPI) versions before 3.20.1 are affected by a time-of-check-time-of-use race during lock file creation on Unix and Windows. A local user who can create symlinks can point a lock file path at another file in the gap between the existence check and the open, causing that file to be truncated. Upgrade to filelock 3.20.1 or later. Restricting write access to lock file directories reduces exposure but does not fully mitigate the issue.

Written 5 Nov 2026.

## Not analysed yet

We haven’t published our analysis of this Advisory yet. Once a person has reviewed it, this page will say what’s vulnerable, what has to be true for your app to be affected, and how to check.

## Severity and exploitation

- 6.3 Medium, CVSS 3.1: `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H`, from CNA (GitHub_M)

- **CISA KEV:** Not listed.
- **EPSS:** 0.0021, the 11th percentile, on 17 Nov 2026: FIRST’s estimate of the chance of exploitation in the next 30 days.

## Timeline

- 31 Oct 2026, 14:34 UTC: First seen by agentprime
- 31 Oct 2026, 14:34 UTC: [Confirmed by OSV](https://osv.dev/vulnerability/GHSA-w853-jp5j-5j7f)

## Sources

- [GitHub Advisory Database: GHSA-w853-jp5j-5j7f](https://github.com/advisories/GHSA-w853-jp5j-5j7f)
- [OSV: GHSA-w853-jp5j-5j7f](https://osv.dev/vulnerability/GHSA-w853-jp5j-5j7f)
- <https://github.com/tox-dev/filelock/security/advisories/GHSA-w853-jp5j-5j7f>
- <https://github.com/tox-dev/filelock/commit/4724d7f8c3393ec1f048c93933e6e3e6ec321f0e>
- <https://github.com/tox-dev/filelock>
- <https://github.com/tox-dev/filelock/releases/tag/3.20.1>
- <https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants>
- <https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html>

Facts on this page come from the GitHub Advisory Database (CC-BY 4.0), OSV and the other sources listed, as published. We don’t reproduce full advisory descriptions, which can contain exploit code.

## Check whether this affects you

A Match means an installed version is in the affected range above. Most don’t affect the app; agentprime hasn’t analysed this one yet.

- With the agentprime MCP server (<https://api.agentprime.io/mcp>), ask your agent to check the project: `check_lockfile` sends a lockfile, `check_packages` a list of installed packages, and both return the Matches and the upgrades that clear them. `get_advisory` returns this record. Setup: <https://agentprime.io/mcp.md>
- In a browser: <https://agentprime.io/check/> reads your lockfile in the browser, never uploading it.
- Whether it touches your code, with file and line: the Claude Code plugin, <https://agentprime.io/plugin.md>
- As JSON: <https://api.agentprime.io/v1/advisories/GHSA-w853-jp5j-5j7f>, or `POST https://api.agentprime.io/v1/match` with your packages (<https://agentprime.io/api.md>)

---

The web page: <https://agentprime.io/advisories/GHSA-w853-jp5j-5j7f/>. Everything for agents: <https://agentprime.io/llms.txt>.
