Skip to content
Adam Omar Saleh

TVX CTF 2026 placeholder badge (unofficial)TVX CTF 2026Cryptography

What a waste of tokens...

A file of hex hides a flag behind four encodings, one of which (CyberChef's Enigma in strict mode) silently discards information.

Competition
TVX CTF 2026 placeholder badge (unofficial)TVX CTF 2026
Category
CryptographyHard · estimated
Source status
Platform acceptance recorded in source
Document
PDF edition7 min read

Brief

The challenge

Competition
TVX CTF 2026
Category
Cryptography (platform category: Crypto)
Difficulty
Hard — estimated, not an official rating
Points
500
Challenge author
gl1tt3rpuff0
Verification
Platform acceptance recorded in the source writeup

Difficulty: Hard (estimated). TVX CTF 2026 did not publish difficulty ratings; the challenge cards show only points and solve counts. It combines breaking an Enigma configuration with recovering data that CyberChef's strict mode destroyed (case and all non-letters of a Base64 layer). The lossy step cannot be inverted directly and needs a forward-encoding search. The challenge was worth 500 points.

01

Overview

We took you slopping every single cryptography challenge we uploaded personally. Enjoy the rest of these stages <3

A file of hex hides a flag behind four encodings, one of which (CyberChef's Enigma in strict mode) silently discards information.

Solution path in brief

The author built the file by encoding the flag four times:

Text
flag → Base100 (emoji) → Base64 → CyberChef Enigma (strict output) → To Hex

The twist is CyberChef's Enigma in strict mode. It uppercases its input and silently drops everything that isn't a letter, so the Base64 lost its case and every 0-9, +, / and =. That loss can't be undone directly. Instead, the flag is rebuilt three characters at a time by encoding every candidate forward and matching the result. The full chain, run forward, reproduces flag.txt byte for byte.

02

Initial investigation

The first layer was identified from the character set and spacing of flag.txt.

Hex

flag.txt holds space-separated lowercase hex. It decodes to 191 uppercase letters in 5-letter groups, which is how CyberChef formats Enigma output in strict mode.

03

Tools used

  • Python Enigma I implementation (enigma.py) with index-of-coincidence scans

  • Block-wise Base100 → Base64 forward-encoding search (agent2/base100_lossy.py)

  • agent2/verify_chain.py for the end-to-end check

04

Step-by-step process

Step 1: Enigma

An index-of-coincidence scan over rotor orders and start positions, followed by a ring-setting search, finds the key:

SettingValue
ModelEnigma I (3 rotors)
Rotors (left → right)I, II, III
ReflectorUKW-B
Ring settingsA, B, C
Start positionA A A
Plugboardnone

The decrypted text is highly structured (IoC 0.074):

Text
JRICFKYWNGP JRSVCFKZNWNGY JRQVCFKZZWNCO JQPCFKKFWNGW JQQPCFKKZWNGW ...

A plugboard hill-climb that rewards repetition finds no improvement, so this is exactly the text the author typed into the Enigma.

Step 2: Why the text repeats

Every unit follows the template J [Q|R] … CFK … WN [C|G] …. That shape comes from Base64 applied to Base100 output. Base100 maps each byte v to a 4-byte emoji:

Text
F0 9F (0x8F + (v+55)//64) (0x80 + (v+55)%64)

Three emoji take 12 bytes, which Base64 turns into 16 characters. The constant F0 9F bytes produce the fixed fragments: every emoji's Base64 starts with 8J+, and strict mode strips that to J. Likewise CF/K and WN survive from the other constant positions. The third emoji byte is 0x90 or 0x91, depending on whether v+55 ≥ 64, and that shows up as the Q/R and C/G slots. Once digits and symbols are dropped, each 16-character block keeps 11–13 letters, which is why the units have irregular lengths.

Step 3: Recovering the flag

The lossy step can't be inverted directly, but each 3-byte block is independent:

  1. Encode every printable 3-character string with Base100 and then Base64.

  2. Keep only the letters and uppercase them.

  3. Keep the strings that match the next chunk of stage 2. Stage 2 splits into blocks in only one valid way.

The result has a few unavoidable ambiguities, shown in brackets:

Text
T[VWX][Xr]{b[a{]se100[_y]15[_y]4l[Ke]4y5_[678][Nh]3r3_9081234[b|]b38ds673[Mg]}

The flag format and plain reading pick most of them. The text reads "base100 is always there". The w you'd expect in "always" is impossible: the Enigma output at that spot rules it out, so the character is e (or K).

agent2/verify_chain.py runs the whole chain forward and compares it with flag.txt:

Text
TVX{base100_15_4le4y5_7h3r3_9081234bb38ds673g} -> MATCH

05

Commands and code

Scripts

  • enigma.py: Enigma I implementation used to break and verify layer 2.

  • agent2/base100_lossy.py: block-by-block recovery of the flag through the lossy Base64 step.

  • agent2/show_blocks.py: lists every valid candidate for each block.

  • agent2/verify_chain.py: forward check from the flag to flag.txt.

Full source: agent2/verify_chain.py

Python
"""Forward chain: flag -> Base100 (emoji) -> Base64 -> CyberChef Enigma (strict) -> To Hex == flag.txt."""import base64import osimport sys​import numpy as np​HERE = os.path.dirname(os.path.abspath(__file__))sys.path.insert(0, os.path.join(HERE, ".."))from enigma import run, FWD, BWD, NOTCH, REF, text  # noqa: E402​flag_hex = open(os.path.join(HERE, "..", "flag.txt")).read().split()​​def chain(flag):    emoji = b"".join(bytes([0xF0, 0x9F, 0x8F + (v + 55) // 64, 0x80 + (v + 55) % 64]) for v in flag.encode())    b64 = base64.b64encode(emoji).decode()    letters = "".join(c for c in b64 if c.isalpha()).upper()    pt = np.array([ord(c) - 65 for c in letters], dtype=np.int64)    ct = text(run(pt, np.array([0, 1, 2]), np.zeros(3, dtype=np.int64), np.array([0, 1, 2]),                  np.arange(26), REF["B"], FWD, BWD, NOTCH))    grouped = " ".join(ct[i:i + 5] for i in range(0, len(ct), 5))    return emoji.decode("utf-8"), b64, [f"{ord(c):02x}" for c in grouped]​​for cand in sys.argv[1:] or ["TVX{base100_15_4le4y5_7h3r3_9081234bb38ds673g}"]:    emoji, b64, hx = chain(cand)    print(cand, "->", "MATCH" if hx == flag_hex else "no match")    print("  emoji:", emoji.encode("unicode_escape").decode()[:60], "...")    print("  base64:", b64[:48], "...")

Full source: agent2/base100_lossy.py

Python
"""stage2 = Base64(Base100(flag)) after Enigma strict mode dropped digits/+/ and uppercased.​Base100 maps byte v -> F0 9F (0x8F + (v+55)//64) (0x80 + (v+55)%64).Three emoji = 12 bytes = 16 Base64 chars, so every 3 plaintext bytes form anindependent block. For each block enumerate the printable byte triples whoselossy Base64 (letters only, uppercased) matches the next piece of stage2."""import base64import itertoolsimport os​HERE = os.path.dirname(os.path.abspath(__file__))s2 = open(os.path.join(HERE, "..", "stage2.txt")).read().strip()​​def b100(bs):    return b"".join(bytes([0xF0, 0x9F, 0x8F + (v + 55) // 64, 0x80 + (v + 55) % 64]) for v in bs)​​def lossy(bs):    return "".join(c for c in base64.b64encode(bs).decode() if c.isalpha()).upper()​​table = {}for n in (1, 2, 3):    for t in itertools.product(range(32, 127), repeat=n):        table.setdefault((n, lossy(b100(bytes(t)))), []).append(bytes(t))​​def blocks(pos):    """Yield (consumed, options) for the block starting at stage2[pos]."""    for (n, key), opts in table.items():        if n == 3 and s2.startswith(key, pos):            yield len(key), opts        elif n < 3 and pos + len(key) == len(s2) and s2.endswith(key):            yield len(key), opts​​def main():    paths = [(0, [])]    done = []    while paths:        pos, acc = paths.pop()        if pos == len(s2):            done.append(acc)            continue        for k, opts in blocks(pos):            paths.append((pos + k, acc + [opts]))    print(len(done), "segmentations")    for acc in done:        line = ""        for opts in acc:            cols = list(zip(*opts))            line += "".join(                chr(c[0]) if len(set(c)) == 1 else "[" + "".join(sorted({chr(x) for x in c})) + "]"                for c in cols            )        print(line)​​if __name__ == "__main__":    main()

06

Technical explanation

Base100 maps each byte to a 4-byte emoji that begins with F0 9F, so its Base64 has constant fragments (8J+ and others). Strict-mode Enigma uppercases its input and drops digits, +, / and =, which turns those fragments into the repeating J…CFK…WN units seen after decryption. Because every 3-byte block of the flag encodes independently, candidates can be enumerated block by block and kept only if their letters-only encoding matches the Enigma output.

Key lessons

  • CyberChef's Enigma, Typex and similar ops in strict mode drop non-letters and fold case. If the layer under them is Base64, that data is partly lost and has to be recovered by forward-encoding candidates.

  • Repeating fragments like 8J+ (shown here as J) are the Base64 signature of 4-byte UTF-8 emoji, and Base100 produces exactly that pattern.

07

Flag

Flag

TVX{base100_15_4le4y5_7h3r3_9081234bb38ds673g}

Platform acceptance recorded in source

Notes from the source writeup: The platform accepted this flag. Other strings that re-encode to the same file are 4lK4y5 instead of 4le4y5, 6h3r3/8h3r3 instead of 7h3r3, and N in place of h.

08

Verification status

Status: Platform acceptance recorded in the source writeup.

The source writeup states that the platform accepted this flag. Independently of that, verify_chain.py re-encodes the flag through Base100, Base64, Enigma and hex and reproduces flag.txt byte for byte. The source also lists other strings that re-encode to the same file.

Source evidence in the archive: WRITEUP.md, flag.txt, enigma.py, agent2/base100_lossy.py, agent2/verify_chain.py.

09

Conclusion

The hardest crypto challenge in this set. Information lost in an encoding step can still be recovered when the input space is small enough to search forwards.

Prepared by Adam Omar Saleh from the archived solve notes in what_a_waste_of_tokens/. Commands, code, output and screenshots are reproduced from the source; no results were added. Difficulty is an estimate.

PDF edition

Writeup PDF

Formatted edition of this walkthrough, built from my source notes · 5 pages.