Saturday, September 2, 2017

tcp over websockets crea túneles TCP sobre WebSockets

tcp over websockets crea túneles TCP sobre WebSockets


Ya hemos visto varias herramientas para realizar t�neles TCP sobre HTTP como  regeorg, tunna,  ABPTTS o Chisel, pero lo que no hab�amos tra�do hasta ahora es una para realizar t�nel TCP sobre WebSockets... as� que hoy vamos a jugar con tcp-over-websockets del alem�n Jannis Redmann aka derhuerst...

tcp-over-websockets est� hecha bajo Node.js, de forma muy similar y sospechosa a su prima-hermana mayor wstunnel, y nos ayudar� a evadir firewalls y otros incautos elementos de (des)protecci�n perimetrales; ideal para una fase de post-explotaci�n en la que ya hemos infectado una m�quina y queremos a continuaci�n pivotar o incluso acceder remotamente a otro servicio de la misma.

Ten�is el repo en https://github.com/derhuerst/tcp-over-websockets/, pero bastar� con ejecutar lo siguiente para instalarlo:

npm install -g tcp-over-websockets

Una vez instalado, para arrancar el servidor (/usr/lib/node_modules/tcp-over-websockets/server.js) simplemente lanzaremos:

tcp-over-websockets-server
listening on 8088

 
Nota: a mi me funcion� con la versi�n 7.7.3 de node pero experiment� problemas con versiones anteriores.

Luego la sintaxis del cliente del cliente es muy sencilla:

# tcp-over-websockets --help

Usage:
    tcp-over-websockets --tunnel wss://example.org --target localhost:22 --port 8022

Parameters:
    --tunnel  the WebSocket address of the tunnel server
    --target  the hostname & port to connect to
    --port    the port to listen on


Sirva de ejemplo el establecimiento de t�nel hacia Github a trav�s del servidor de t�neles p�blico de now que cita el Readme:

tcp-over-websockets --tunnel wss://tcp-over-websockets-abvntgfmzf.now.sh --target github.com:22 --port 8022
listening on 8022, exposing github.com:22 via wss://tcp-over-websockets-abvntgfmzf.now.sh

Finalmente podremos atacar al puerto local especificado (8022) para acceder por SSH a Github a trav�s del servidor indicado:

ssh 192.168.1.23 -p 8022
The authenticity of host [192.168.1.203]:8022 ([192.168.1.203]:8022) cant be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? ^C



download file now