str.lc

web security ramblings

ctf in 202(6-7)

A rogue-like ASCII-based game hacking CTF challenge created for DiceCTF Finals 2026

game

Loading…

Arrows or wasd move · e attack · f defend · . wait · i inventory · b talk or trade · x pulls 2027's levers · Esc for the menu, which holds save, load, help and restart.

flags

Each replay plays a new game from the start, one key at a time. It stops after each step. Press next step to run the next one. Each step sets its own speed. Move the slider to set your own. Your keys do nothing while a replay runs. Your saves are not touched. The last step opens the inventory and shows the flag.

  1. Shop flag

    Dustfall Village

    The shop subtracts the cost before it checks the quantity.

    spoiler

    confirmPurchase runs gold -= cost * quantity first. Only the inventory write is guarded by quantity > 0. The quantity prompt accepts a minus sign. So buying -100000 arrows at 1 gold each pays the player 100000 gold. The same shop sells the flag for 1000.

  2. Sokoban flag

    The Sunken Storehouse

    A box can be pushed into a wall if that square also holds a button, item, gold or exit.

    spoiler

    The flag is outside a wall four squares thick. canPushBox returns true as soon as the destination holds a button, item, gold or an exit. It checks for a wall after that. pushBox then moves the whole line of boxes without checking again. Pushing five boxes onto one button moves the line one square into the wall each time. That opens a tunnel to walk out through. The five buttons are a decoy. Solving them opens a door further in. The replay takes 517 keys.

  3. Dragon flag

    The Dragon’s Hoard

    No bug. This is the normal route. It unlocks Workshop maps, which the Nowhere flag needs.

    spoiler

    Buy a long spear, chainmail and potions. Take the crypt gate key and the crypt key. Solve the storehouse properly. Kill all seven defenders in the antechamber. The gate stays locked until the last one dies. The dragon has 64 HP and does not move. The long spear reaches two squares. The dragon reaches one. So it is hit from out of reach, with a potion at low health.

  4. Nowhere flag

    Nowhere

    A Workshop map picks the starting level. Nothing checks that the map declared that level.

    spoiler

    The world holds a level called flag. No exit, door or teleport leads to it. The dragon flag unlocks Workshop maps. loadWorkshopText sets currentLevelId = workshop.start.level and teleports there. It never checks that the uploaded map declared that level. So a map whose start level is flag lands in it. The pickup is automatic. The map is served from this site because the fetch runs in the browser and has to pass CORS. The bug is unchanged.

  5. Ember flag

    The Ember Run

    A coin flip decides the fire. 200 flips are enough to recover the generator.

    spoiler

    Each turn the hall burns if random() < 0.5. Standing in it undefended kills the player and wipes all ten save slots. That comparison is the top bit of a draw. Each draw comes from V8’s xorshift128+ state. The state only changes by xors and shifts. So each watched turn is one linear equation in the 128 unknown state bits. The replay watches 200 turns from safety. It solves the system over GF(2) in the browser. It checks the answer against 40 flips it held back. Then it defends on the turns that will burn and moves on the turns that will not.