Encoding and Double-Encoding Bypasses
What you'll learn: How attackers use URL encoding, Unicode, and double-encoding to disguise path traversal payloads and slip past input filters.
Why Filters Miss Encoded Attacks
When you learned about path traversal, you saw payloads like ../../../etc/passwd. Many web applications have filters that block these obvious patterns. But what if you could disguise the dangerous characters so the filter doesn't recognize them?
Encoding transforms characters into alternative representations. For example, the forward slash / becomes %2F in URL encoding. A naive filter looking for literal ../ won't catch ..%2F — but when the application decodes it later, the server sees ../ and processes the traversal.
Common Encoding Techniques
URL Encoding (Percent Encoding): Replace special characters with % followed by hexadecimal values:
../becomes..%2F.becomes%2E- Fully encoded:
%2E%2E%2F
Double-Encoding: Some applications decode input multiple times. If a filter checks after the first decode but the application decodes again, you can double-encode:
/→%2F(first encoding) →%252F(second encoding)- After first decode:
%2F(passes filter) - After second decode:
/(traversal executes)
Unicode and UTF-8 Encoding: Represent characters using Unicode overlong sequences or alternative encodings:
/can become%C0%AF(overlong UTF-8).might be encoded as%C0%AE
The Attack Window
Think of it like smuggling contraband in a wrapped package. The security checkpoint (filter) only reads the label on the outside. When the package is unwrapped later (decoded by the application), the hidden payload emerges.
Key Takeaway: Attackers use URL encoding, Unicode, and double-encoding to transform path traversal payloads into forms that bypass string-matching filters but still execute after the application decodes them — always validate input after all decoding steps.