> For the complete documentation index, see [llms.txt](https://g4b0.gitbook.io/g4b0-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://g4b0.gitbook.io/g4b0-docs/documentation/cheatsheets/tunneling-and-portforwarding/rdp-and-socks-tunneling-with-socksoverrdp.md).

# RDP and SOCKS Tunneling with SocksOverRDP

SocksOverRDP permite hacer tunneling de paquetes arbitrarios sobre una conexión RDP cuando SSH no está disponible en redes Windows. Se usa en conjunto con **Proxifier** para construir una cadena de pivot completa a través de sesiones RDP encadenadas.

> **DVC (Dynamic Virtual Channels):** mecanismo nativo de RDP diseñado para transferencia de clipboard y audio, reutilizado aquí para encapsular tráfico SOCKS arbitrario sin necesidad de abrir puertos adicionales.

**Herramientas requeridas** (descargar al attack host antes de comenzar):

* SocksOverRDP x64 Binaries

{% embed url="<https://github.com/nccgroup/SocksOverRDP/releases>" %}

* Proxifier Portable Binary (`ProxifierPE.zip`)

{% embed url="<https://www.proxifier.com/download/#win-tab>" %}

### Paso 1 — Registrar el plugin DLL en el foothold Windows

```cmd
C:\Users\htb-student\Desktop\SocksOverRDP-x64> regsvr32.exe SocksOverRDP-Plugin.dll
```

* Registra `SocksOverRDP-Plugin.dll` como servidor COM in-process para inyectarse en `mstsc.exe`.
* Requiere privilegios de administrador.
* **ADVERTENCIA: `regsvr32.exe` modifica el registro de Windows y puede ser detectado por soluciones EDR/AV.**

Output esperado: Dialog de RegSvr32 confirmando el registro exitoso de `SocksOverRDP-Plugin.dll`.

***

### Paso 2 — Conectar al pivot interno vía RDP

Desde el foothold, abrir `mstsc.exe` y conectar a `172.16.5.19`:

* Credenciales: `victor:pass@123`
* Al establecer la sesión, el plugin confirma que está habilitado y escucha en `127.0.0.1:1080`.

***

### Paso 3 — Iniciar el servidor en 172.16.5.19

Transferir `SocksOverRDP-Server.exe` (o `SocksOverRDPx64.zip`) a `172.16.5.19` e iniciarlo con privilegios de administrador.

Output esperado: Terminal mostrando `Socks Over RDP by Balazs Bucsay` con un canal abierto sobre RDP.

***

### Paso 4 — Verificar el listener SOCKS en el foothold

```cmd
C:\Users\htb-student\Desktop\SocksOverRDP-x64> netstat -antb | findstr 1080
```

* `-a`: Todas las conexiones y puertos en escucha.
* `-n`: Formato numérico, sin resolución DNS.
* `-t`: Solo TCP.
* `-b`: Muestra el binario asociado a cada conexión.
* `findstr 1080`: Filtra la salida al puerto SOCKS.

Output esperado:

```
  TCP    127.0.0.1:1080         0.0.0.0:0              LISTENING
```

***

### Paso 5 — Configurar Proxifier en el Windows 10 target

Transferir Proxifier Portable al target en la red `10.129.x.x` y añadir un servidor **SOCKS5** apuntando a `127.0.0.1:1080`.

***

### Paso 6 — Pivotar a 172.16.6.155 vía RDP

Con Proxifier activo, abrir `mstsc.exe` para conectar a `172.16.6.155`. El tráfico sigue esta cadena:

```
Attack Host → 127.0.0.1:1080 (SOCKS5/Proxifier)
  → RDP tunnel → 172.16.5.19 (SocksOverRDP-Server)
    → 172.16.6.155
```

***

### Consideraciones de Rendimiento RDP

Si el rendimiento es lento con múltiples sesiones RDP simultáneas:

* En `mstsc.exe` → pestaña **Experience** → configurar **Performance** en **Modem (56 kbps)**.

***

> **Nota:** Esperar **3-5 minutos** tras iniciar el target del lab antes de conectar, para que todas las configuraciones internas estén completas.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://g4b0.gitbook.io/g4b0-docs/documentation/cheatsheets/tunneling-and-portforwarding/rdp-and-socks-tunneling-with-socksoverrdp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
