Domain 5Pivoting & MetasploitCORE

Evading Detection with Tunnels

Complete guide to evading detection when using tunnels, covering IDS/IPS evasion, traffic shaping, HTTPS tunnels, and stealth techniques for OSCP.

Domain: Domain 5: Pivoting, Tunneling & Metasploit•Updated: 2026-09-01
#evasion#detection#ids-ips#encryption#stealth#oscp

Evading Detection with Tunnels

While OSCP labs typically don’t have active IDS/IPS, understanding tunnel detection and evasion is valuable for real-world engagements and advanced certifications.

Detection Vectors

Detection Method What It Detects Example
IDS/IPS Known tunnel signatures, unusual protocols Suricata alert on Chisel traffic
DLP Data exfiltration patterns Large outbound data transfers
NetFlow Unusual volume, timing, or destinations Constant high-volume traffic to single IP
Proxy Logs Long-lived connections, large payloads SSH tunnel running for hours
Endpoint Detection Suspicious processes, binary hashes Chisel binary flagged by AV
DNS Monitoring Unusual DNS query patterns High-frequency TXT queries to single domain
ICMP Analysis Abnormal ICMP volume/payload size Large ICMP packets with data

Evasion Techniques

Technique Description Effectiveness
Use HTTPS (443 + TLS) Tunnel over port 443 with TLS encryption High — looks like normal web traffic
Domain Fronting Use legitimate CDN domain as cover High — matches legitimate traffic
Traffic Shaping Add delays, limit throughput Medium — mimics normal usage patterns
DNS over HTTPS Encrypt DNS queries themselves Medium — prevents DNS inspection
Packet Fragmentation Split packets to evade signature matching Low-Medium — may trigger alerts
Time Blending Operate during business hours only Medium — blends with normal traffic
Legitimate Cover Mix tunnel traffic with real web browsing Medium — harder to distinguish

Encrypted Chisel over HTTPS

The most practical evasion technique for OSCP and real-world use.

Certificate Generation

# Generate self-signed certificate
openssl req -newkey rsa:2048 -nodes -keyout key.pem \
    -x509 -days 365 -out cert.pem -subj "/CN=www.example.com"

Server with TLS

# Listen on port 443 with TLS
chisel server --port 443 --reverse \
    --tls-cert cert.pem --tls-key key.pem

Client with TLS

# Connect with TLS, skip verification for self-signed cert
./chisel client --tls-skip-verify 10.10.14.3:443 R:socks

Why This Works

  • Traffic appears as HTTPS to network monitors.
  • Port 443 is almost never blocked.
  • TLS encryption prevents payload inspection.
  • Looks like normal web traffic in netflow.

Best Practices for Stealth Tunneling

1. Use Standard Ports

# Use port 443 (HTTPS) — least suspicious
chisel server --port 443 --reverse

# Use port 80 (HTTP) — also common
chisel server --port 80 --reverse

# Avoid unusual ports like 8000, 9000, 31337

2. Encrypt Everything

# Always use TLS when possible
chisel server --port 443 --tls-cert cert.pem --tls-key key.pem --reverse

# SSH is always encrypted
ssh -D 1080 -N user@pivot

# OpenVPN with AES-256-GCM

3. Limit Bandwidth

# Shape traffic to look normal
# Use tc (traffic control) on Linux
tc qdisc add dev eth0 root tbf rate 1mbit burst 32kbit latency 400ms

4. Use Legitimate Timing

  • Operate during business hours.
  • Avoid constant high-volume transfers.
  • Add natural pauses between operations.

5. Binary Obfuscation

# Rename suspicious binaries
cp chisel /tmp/system-update
cp ligolo-ng-client /tmp/diagnostic-tool

# Remove strings and symbols
strip /tmp/system-update

OSCP Relevance

In OSCP labs:

  • IDS/IPS is typically not active — evasion is not required.
  • Focus on functionality — get the tunnel working reliably.
  • Use encryption anyway — good practice and may be tested.
  • Port 443 is your friend — if SSH (22) is blocked, try 443.

OSCP Tips

  1. TLS-encrypted Chisel on port 443 is your most stealthy option.
  2. SSH is always encrypted — no extra effort needed.
  3. Don’t overthink evasion in OSCP — focus on getting tunnels working.
  4. Use standard ports (22, 80, 443) to avoid firewall blocks.
  5. For advanced certs (OSCP+), evasion becomes more important.

Further Reading