$ cat writeup.md…
$ cat writeup.md…
fortid2026
Task: a Python 3.10 .pyc validates a FortID{...} flag via a length-preserving T9 keypad transform and a SHA-256 gate. Solution: identify the pyc magic, disassemble with marshal+dis, invert the reversed T9 touchtone string using a wordlist and the Nokia theme, and confirm against the SHA-256 digest.
A flirty "texting" chatbot prompt keeps asking you for the flag. You are given a single file
chall.pyc.
English summary: a compiled Python bytecode file checks a submitted FortID{...} flag. We must reverse the validation logic, invert its transforms, and recover the unique flag that satisfies every check.
The .pyc header starts with magic bytes 6f 0d 0d 0a. Little-endian 0x0d6f = 3439, which is the Python 3.10 (3.10b1) magic number used for all 3.10.x releases (confirmed against the python-xdis magics table). Loading the marshalled code object under any other interpreter raises bad marshal data, so a Python 3.10 interpreter is required.
For Python 3.7+ the code object begins after a 16-byte header:
import marshal, dis data = open('chall.pyc', 'rb').read() code = marshal.loads(data[16:]) # skip 16-byte header dis.dis(code)
user_input must have length 81.startswith('FortID{') and endswith('}').words = user_input[7:-1] strips the wrapper._; each resulting word must be all lowercase ASCII letters OR all digits (two all(... in string.ascii_lowercase) / string.digits list comprehensions).words = '-'.join(words.split('_')) — underscores become dashes.t9text.t9.get_touchtone(words)[::-1] == '33696-7383-3824-4-9465664238-36-32347-878267-8766-348-55487-74-0133-24566'sha256(user_input.encode('utf-8')).hexdigest() == '3576c495f89236515fbbfbfb519dceb9899122e92460d418d2ce37a1ff357e0c't9text.get_touchtone maps each letter to its phone-keypad (T9) digit (a/b/c→2, d/e/f→3, …, w/x/y/z→9) and passes through digits and dashes unchanged. The mapping is length-preserving, so the length-81 constraint holds for any valid letter/digit choice — length alone does not narrow the answer.
Reverse the target string to obtain the forward touchtone, then split on -:
66542-3310-47-78455-843-6678-762878-74323-63-8324665649-4-4283-3837-69633
This yields 14 groups.
Decode each group via a T9-to-words lookup (t9text.t9.get_words with an English wordlist), keeping digit-only groups literal:
| Group | Decode |
|---|---|
| 47 | is |
| 78455 | still |
| 843 | the |
| 6678 | most |
| 762878 | robust |
| 74323 | piece |
| 63 | of |
| 8324665649 | technology |
| 4 | i |
| 4283 | have |
| 3837 | ever |
| 69633 | owned |
The first two groups are resolved with the challenge theme / general knowledge:
66542 = nokia (n6 o6 k5 i4 a2)3310 = the Nokia 3310 phone model (a digit-only word)Join the words with _, wrap with FortID{...}. The decoded sentence is:
nokia 3310 is still the most robust piece of technology i have ever owned
Both the reversed-touchtone equality and the SHA-256 digest match, confirming a unique solution.
#!/usr/bin/env python3 # Solve script for Baby Rev (fortid2026) import hashlib import t9text # pip install t9text TARGET_TOUCHTONE = '33696-7383-3824-4-9465664238-36-32347-878267-8766-348-55487-74-0133-24566' TARGET_SHA256 = '3576c495f89236515fbbfbfb519dceb9899122e92460d418d2ce37a1ff357e0c' # 1. Reverse the target to get the forward touchtone, then split into T9 groups. forward = TARGET_TOUCHTONE[::-1] groups = forward.split('-') # 14 groups # 2. Decode: digit-only groups are literal model numbers / single-letter words; # letter groups come from a T9 wordlist disambiguated by the Nokia theme. # Recovered sentence (spaces shown for readability): # nokia 3310 is still the most robust piece of technology i have ever owned words = [ "nokia", "3310", "is", "still", "the", "most", "robust", "piece", "of", "technology", "i", "have", "ever", "owned", ] inner = "_".join(words) candidate = "FortID{" + inner + "}" # 3. Re-apply the validation transforms exactly as the bytecode does. assert len(candidate) == 81 assert candidate.startswith("FortID{") and candidate.endswith("}") dashed = "-".join(candidate[7:-1].split("_")) assert t9text.t9.get_touchtone(dashed)[::-1] == TARGET_TOUCHTONE assert hashlib.sha256(candidate.encode("utf-8")).hexdigest() == TARGET_SHA256 print("Validated:", "FortID{REDACTED}")
Use this technique when:
.pyc file — identify the interpreter via the 4-byte magic header (6f 0d 0d 0a → Python 3.10) before any marshal.loads + dis.dis.bad marshal data under the wrong interpreter version.t9text) is referenced as the core transform — install it to replicate and invert the function instead of re-implementing from scratch.sha256(...).hexdigest() equality gate — the hash uniquely fixes the answer among T9-ambiguous candidates, and the chatbot/texting theme hints at phone-keypad semantics.$ cat /etc/motd
Liked this one?
Pro unlocks every complete writeup and expanded API access. $9/mo.
$ cat pricing.md