A Python expression with a confessional theme: confess one expression, the warden
evals it with no builtins except getattr, and never tells you the value - only bit 1,
bit 0, or frown <why> on a forbidden expression or an exception. The description is explicit
that the flag lives only in the warden function's own closure cell, never a namespace name.
Every confession costs a proof-of-work, and the forbidden-word list re-rolls every time.
rules WARDEN, __builtins__, cell_contents, eval, globals, mro, open, popen, subclasses, subprocess
pow 689c471f1cb0f3e3 24
Getting a confession accepted
Pitfall
My first guess was to find a nonce so sha256(suffix+nonce) starts with 24 zero bits and send
confess <suffix+nonce> <expr>. "bad proof-of-work." The booth keeps the suffix server-side and
rebuilds the string itself - it only wants the nonce. confess <nonce> <expr> gets a real
answer (bit 1 for 1 == 1).
What's actually in scope
The forbidden list keeps naming WARDEN and Relic, which read like grabbable variable names -
both are dead ends (NameError). Probing further: __builtins__ returns bit 0 (exists,
falsy), while open, __import__, object all raise NameError. So the namespace is
{'__builtins__': {}, 'getattr': getattr} - the only object available at all is getattr
itself.
Walking out to the closure
Insight
getattr is a builtin function, so getattr.__self__ is the builtins module - and its
__dict__ still holds __import__ even though that name isn't in the eval namespace, which is
enough to reach gc. From there gc.get_objects() sees every live function object, including
the warden, and its closure cell.
The rotating ban is a plain substring check on what gets written, so every dunder splits across
two adjacent string literals - '__di'+'ct__' never appears in the source as __dict__, and
the same trick covers cell_contents, __class__, __name__:
1IMP = "getattr(getattr(getattr,'__self__'),'__di'+'ct__')['__im'+'port__']"
2CONT = "getattr(c,'cell_'+'contents')"
3S = ("[" + CONT + " for c in " + IMP + "('gc').get_objects()"
4 " if getattr(getattr(c,'__cl'+'ass__'),'__na'+'me__')=='cell'"
5 " and getattr(getattr(getattr(c,'cell_'+'contents'),'__cl'+'ass__'),'__na'+'me__')=='str'"
6 " and " + CONT + ".startswith('RxR{')][0]")
One truth at a time
A single boolean per confession is enough to read the whole string, since Python compares
strings by code point - S[i] <= 'm' is a question the warden answers honestly, so a binary
search per character over printable ASCII (seven confessions each) reads it out directly. First
four characters: R, x, R, { - confirming the cell really is the flag.
i= 0 -> 82 'R' R
i= 1 -> 120 'x' Rx
...
i=39 -> 56 '8' RxR{126e4996-094e-47f3-91a3-917bd16efc18
i=40 -> 125 '}' RxR{126e4996-094e-47f3-91a3-917bd16efc18}
Then one final confirming question - S == 'RxR{126e4996-094e-47f3-91a3-917bd16efc18}' - comes
back bit 1.
solve_full.py runs the whole thing, proof-of-work included.
Note
The challenge also ships a hidden decoy, RxR{R4lly_i_g0t_213_kdn4h}, challenge id baked right
in. Asking the oracle whether the closure cell equals it returns bit 0 - bait for scrapers,
confirmed false by the oracle itself.
Flag
RxR{126e4996-094e-47f3-91a3-917bd16efc18}