Overview
When a shell is restricted (rbash, limited sudo, filtered inputs, sandboxed environments), attackers use encoding, obfuscation, and creative shell syntax to bypass these limitations. This page covers the core bypass techniques used in CTFs and real-world penetration tests.Reverse Shell Bypasses
Double Base64 Encoded Reverse Shell
Useful for evading bad-character filters (e.g.,+, =):
Short Reverse Shell (Dikline Trick)
Bypassing Forbidden Words and Paths
- Question Mark Substitution
- Wildcard Substitution
- Character Classes
- Quotes and Backslashes
- Variable Transformations
- Dollar-Sign and History
Bypassing Forbidden Spaces
Bypassing Backslash and Slash
Bypassing Pipes
Hex Encoding Bypass
Bypassing IP Address Filters
Time-Based Data Exfiltration
Getting Characters from Environment Variables
DNS Data Exfiltration
Use OOB DNS channels via services like Burp Collaborator orpingb.in:
Builtins-Only Execution (No External Commands)
When PATH is unset and only shell builtins are available:Polyglot Command Injection
Bypassing Regex Filters
Bashfuscator
RCE with Very Short Payloads
5-Character RCE (Orange Tsai Technique)
Buildls -t>g across multiple short HTTP requests, creating the command as filenames:
4-Character RCE
Read-Only / Noexec / Distroless Bypass
In filesystems withro and noexec protections, or in distroless containers, code execution is still possible via:
- Loading shared libraries from
/dev/shmor tmpfs - Abusing interpreter binaries already present
- Using
memfd_create+execvesyscalls directly
Space-Based Bash NOP Sled (“Bashsledding”)
When a memory corruption vulnerability lets you partially control an argument reachingsystem(), use leading whitespace as a NOP sled — Bash ignores leading spaces before a command:
- Memory-mapped NVRAM entries accessible across processes
- Cases where NULL bytes cannot be written to align the payload
- Embedded devices running BusyBox
ash/sh