CVE-2025-65882: C Insecure Mktemp Toctou

Call to mktemp(3) creates a predictable temporary filename without atomically creating or locking the file. Any subsequent open()/fopen()/ creat() on that name is subject to a TOCTOU race (CWE-377): a local attacker who can write to the target directory can pre-create the predicted path as a symlink (causing arbitrary file write) or as a file whose name cont

Provally CuratedPublic repositoryHighHigh confidenceVerifiedApache-2.0C
greprules fetch cve-2025-65882-c-insecure-mktemp-toctou --engine opengrep

Description

Call to mktemp(3) creates a predictable temporary filename without atomically creating or locking the file. Any subsequent open()/fopen()/ creat() on that name is subject to a TOCTOU race (CWE-377): a local attacker who can write to the target directory can pre-create the predicted path as a symlink (causing arbitrary file write) or as a file whose name cont