1 The ../ Attack
Path traversal (also called directory traversal) allows attackers to read files outside the intended directory by inserting ../ sequences into file path parameters.
# VULNERABLE
filename = request.args.get('file')
path = '/var/app/uploads/' + filename
with open(path) as f:
return f.read()
# Attacker: ?file=../../etc/passwd → reads /etc/passwd
URL-encoded variants (%2e%2e%2f) and double-encoded variants can bypass naive string checks. The attack works on Windows too with .. separators.