SiteShadow
Back to vulnerability library

SCP12 File and Memory Management

What this means

SiteShadow flagged file-handling and memory-safety patterns that can lead to data exposure, tampering, or availability issues (path manipulation, unsafe temp files, unsafe parsing, unbounded reads).

Why it matters

File and memory issues commonly become:

Safer examples

1) Enforce base directories for file access (Python)

from pathlib import Path

base = Path("/srv/uploads").resolve()
candidate = (base / filename).resolve()
if base not in candidate.parents:
    raise ValueError("Invalid path")

2) Use safe temp files

Use OS-managed temp APIs and avoid predictable filenames.

3) Stream large files instead of reading into memory

Process uploads/downloads in chunks; set size limits (see INPUT01-02).

How SiteShadow detects it (high level)

References

---

← Back to Vulnerability Library

Request access View coverage