Intel

AIKIDO-2026-190770

filelock is vulnerable to Race Condition (TOCTOU)

Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published Sep 18, 2026
September 18, 2026

59

CVE Score

Medium

Race Condition (TOCTOU)

Are you affected? Scan for Free

TL;DR

filelock's Unix backend opens the lock file with O_TRUNC and calls fchmod before it confirms exclusive access through fcntl.flock, so any process attempting to acquire the lock, including one that ultimately fails to get it, first truncates and re-permissions the file the current holder relies on. The Windows backend has a parallel timing gap: its reparse-point check runs against the lock path rather than the already-opened handle, so the path can be swapped to a symlink between the check and the open. Both gaps let a co-resident process on the same lock directory corrupt or redirect another process's lock state while that process still believes it holds exclusive access. The fix defers file mutation until after the OS lock is confirmed and binds the Windows reparse check to the opened handle.

How do I fix this?

Upgrade the filelock library to the patch version.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and another process with write access to the same lock file or directory can run concurrently while you hold or attempt to acquire the lock.

Package

Versions

0.2.0 - 3.29.7

Fixed in 3.30.0

Background info

filelock is vulnerable to Race Condition (TOCTOU) in versions 0.2.0 - 3.29.7.

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea