πŸ•ΈοΈRpivot Web Pivoting

πŸ“‹ Module Overview

Purpose: Reverse SOCKS proxy for web server pivoting Tool: Rpivot - Python-based reverse SOCKS proxy Mechanism: Client connects back to server (reverse connection) Use Case: Access internal web servers through compromised hosts Special Feature: NTLM authentication support for corporate proxies


1. Introduction to Rpivot

What is Rpivot?

  • Type: Reverse SOCKS proxy tool

  • Language: Python (requires Python 2.7)

  • Architecture: Client-server model

  • Direction: Client connects TO server (reverse)

  • Purpose: SOCKS tunneling through compromised internal hosts

Rpivot vs Traditional SOCKS

Aspect

Traditional SOCKS

Rpivot

Connection Direction

Server waits, client connects

Client connects back to server

Firewall Bypass

May be blocked inbound

Better (outbound connections)

Setup Location

SOCKS server on pivot

Server on attack host

Use Case

Direct network access

Compromised internal hosts

Authentication

Basic SOCKS auth

NTLM proxy support

Network Topology

Key Components

  1. server.py - runs on attack host (external)

  2. client.py - runs on pivot host (internal)

  3. SOCKS proxy - created on attack host for tools

  4. proxychains - routes traffic through SOCKS proxy


2. Installation and Setup

Installing Rpivot

Clone Repository

Python 2.7 Dependency

Alternative Python 2.7 Installation

Verification


3. Basic Rpivot Usage

Step 1: Start Rpivot Server (Attack Host)

Server Configuration:

  • --proxy-port 9050: SOCKS proxy port for tools

  • --server-port 9999: Control port for client connections

  • --server-ip 0.0.0.0: Listen on all interfaces

Step 2: Transfer Rpivot to Target

Step 3: Run Rpivot Client (Pivot Host)

Step 4: Confirm Connection (Attack Host)


4. Accessing Internal Web Servers

Configure Proxychains

Web Server Access Methods

Method 1: Firefox with Proxychains

Method 2: Curl with Proxychains

Method 3: Nmap Scanning


5. Advanced Rpivot Features

NTLM Authentication Support

Scenario: Corporate environment with NTLM proxy

Custom Port Configuration

Multiple Client Support


6. HTB Academy Lab Exercises

Lab Question 1: Server Location

"From which host will rpivot's server.py need to be run from? The Pivot Host or Attack Host?"

Answer: Attack Host

Explanation:

  • server.py runs on the attack host (external)

  • Creates SOCKS proxy for tools to use

  • Listens for incoming connections from clients

  • Provides external access point for internal clients

Technical Reasoning:

Lab Question 2: Client Location

"From which host will rpivot's client.py need to be run from? The Pivot Host or Attack Host?"

Answer: Pivot Host

Explanation:

  • client.py runs on the pivot host (internal)

  • Connects back to server on attack host

  • Provides access to internal network resources

  • Acts as bridge between internal and external networks

Technical Reasoning:

Lab Question 3: Web Server Flag

"Using the concepts taught in this section, connect to the web server on the internal network. Submit the flag presented on the home page as the answer."

Complete Solution Steps

Step 1: Setup Rpivot Server

Step 2: Transfer and Run Client

Step 3: Configure Proxychains

Step 4: Access Web Server

Answer: [Flag will be displayed on the web page]


7. Troubleshooting Rpivot

Common Issues

Python 2.7 Not Available

Server Connection Refused

SOCKS Proxy Not Working

File Transfer Issues


8. Operational Considerations

Advantages of Rpivot

  1. Reverse connection - bypasses inbound firewall restrictions

  2. NTLM support - works with corporate proxy authentication

  3. Multiple clients - supports multiple pivot points

  4. Python-based - cross-platform compatibility

  5. Simple setup - minimal configuration required

Limitations

  1. Python 2.7 dependency - legacy Python version

  2. Performance - Python overhead compared to compiled tools

  3. Detection - clear process names and network patterns

  4. Maintenance - Python 2.7 EOL and security concerns

  5. Limited protocols - SOCKS4 only (no SOCKS5 features)

Security Considerations

  1. Process visibility - python processes visible in ps

  2. Network signatures - predictable traffic patterns

  3. Log traces - SSH transfers and connections logged

  4. Python 2.7 vulnerabilities - known security issues

  5. Clear text configuration - command line arguments visible


9. Alternative Tools Comparison

Rpivot vs Other Pivoting Tools

Tool

Language

Direction

Auth Support

Performance

Rpivot

Python 2.7

Reverse

NTLM

Medium

sshuttle

Python 3

Forward

SSH keys

High

Chisel

Go

Both

None

High

ligolo-ng

Go

Reverse

TLS

High

SSH

C

Forward

Keys/password

High

When to Use Rpivot

βœ… Corporate environments with NTLM proxies βœ… Reverse connections needed for firewall bypass βœ… Multiple pivot points required βœ… Python available on target systems βœ… SOCKS tunneling sufficient for needs

When NOT to Use Rpivot

❌ Python 2.7 unavailable on targets ❌ High performance requirements ❌ Stealth operations (process detection risk) ❌ Modern protocols needed (HTTP/3, etc.) ❌ Long-term persistence (maintenance overhead)


10. Integration Examples

Web Application Testing

Database Access

File Share Access


11. Monitoring and Logging

Server-Side Monitoring

Client-Side Monitoring

Traffic Analysis


12. Best Practices

Operational Guidelines

  1. Pre-stage Python 2.7 - ensure availability before engagement

  2. Test connectivity - verify network paths before deployment

  3. Use non-standard ports - avoid default port detection

  4. Monitor connections - track client status and performance

  5. Clean up processes - terminate sessions properly

Security Recommendations

  1. Encrypt transfers - use SSH/HTTPS for rpivot deployment

  2. Rotate ports - change default ports for each engagement

  3. Limit exposure time - minimize active tunnel duration

  4. Clear artifacts - remove rpivot files after use

  5. Monitor logs - watch for detection indicators

Performance Optimization

  1. Single-purpose clients - dedicate clients to specific tasks

  2. Batch operations - minimize interactive session overhead

  3. Compress transfers - use efficient data transfer methods

  4. Monitor bandwidth - track and limit usage patterns

  5. Connection pooling - reuse established tunnels


References

Last updated