Relative path traversal is a file-handling flaw where attacker-controlled input changes a path so a program escapes its intended directory. Instead of staying inside a safe upload, cache, or temporary folder, the application resolves something like ../ segments and reads from or writes to another location on the system.
This matters because file paths often control sensitive actions: saving attachments, unpacking archives, loading plugins, or writing logs and configuration files. If an attacker can steer the destination path, they may overwrite security controls, plant executable files, or expose protected data. Defenses include strict path normalization, canonicalization, allowlists for filenames, rejecting traversal sequences, and verifying that the final resolved path still sits inside the approved directory. In security appliances and other parsers of untrusted content, traversal bugs can turn routine processing into a route to code execution or system compromise.


