insecure-temp-files-anti-pattern

Installation
SKILL.md

Insecure Temp Files Anti-Pattern

Severity: Medium

Summary

Insecure temporary file creation exposes three attack vectors: predictable file names enabling symlink attacks, insecure permissions allowing unauthorized access, and missing cleanup leaving sensitive data on disk. Attackers exploit these to read sensitive data, inject malicious content, or cause denial of service. AI-generated code frequently suggests simplistic file handling vulnerable to these attacks.

The Anti-Pattern

Never create temporary files without securing their location, naming, permissions, and lifecycle management.

1. Predictable File Names

Using a predictable name for a temporary file creates a race condition. An attacker can guess the file name and create a symbolic link (symlink) at that location pointing to a sensitive system file. When the application writes to its "temporary" file, it is actually overwriting the linked file.

BAD Code Example

Installs
11
GitHub Stars
5
First Seen
Jan 20, 2026
insecure-temp-files-anti-pattern — igbuend/grimbard