Skip to main content

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.
These techniques are documented for authorized security testing and defensive awareness. Always operate within the scope of your engagement.

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

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 or pingb.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)

Build ls -t>g across multiple short HTTP requests, creating the command as filenames:

4-Character RCE

Read-Only / Noexec / Distroless Bypass

In filesystems with ro and noexec protections, or in distroless containers, code execution is still possible via:
  • Loading shared libraries from /dev/shm or tmpfs
  • Abusing interpreter binaries already present
  • Using memfd_create + execve syscalls directly

Space-Based Bash NOP Sled (“Bashsledding”)

When a memory corruption vulnerability lets you partially control an argument reaching system(), use leading whitespace as a NOP sled — Bash ignores leading spaces before a command:
If a ROP chain lands anywhere in the space block, Bash skips to the real command. Useful for:
  • Memory-mapped NVRAM entries accessible across processes
  • Cases where NULL bytes cannot be written to align the payload
  • Embedded devices running BusyBox ash/sh

References