IT lexicon › Security › Rename race

Rename race

Security På svenska → Updated: 2026-11-16

Race condition when a file is renamed while being read or modified, exposing a TOCTOU vulnerability.

A rename race occurs when process A intends to read a file while process B concurrently renames it or swaps it for another. If A doesn't atomically validate and open it, it may read the wrong file or a temporary not meant for its eyes. POSIX open() is atomic, but many programs check stat() then open(), leaving a window for mischief. Robust defenses include O_NOFOLLOW and O_CLOEXEC flags, or openat() with explicit directory handles to prevent path traversal during the race.

← Back to the lexicon