off the rails: a rail fence, whole and as a line
huntress ctf 2026, day 18 · warmups · all three modes
tools used: decoding engine and timed-attempt pipeline.
the prompt: "three rails. one very zigzag commute." the single and the time trial were one blob of ordinary letters, spaces and punctuation in a scrambled order; the mastery was a zip of 88 blobs of eighteen numbered lines, the eighteenth in the same form.
the key insight: a rail fence is a transposition. it moves characters and keeps them, so the blob has english letter frequencies and no alphabet beyond the message's own; "three rails" says how many rows the zigzag has. the keyless rail reading of the whole blob is the message; on a short line chunk, the rail count has to be the stated one.
challenge shape
single 1 field one rail-fence blob, the whole message
time trial 1 field one rail-fence blob
mastery 88 fields 88 blobs of 18 numbered lines, line k in day k's form
the field is message (setK.message in mastery): the slug the final decoded line names, in the question's syntax "three lowercase words separated by hyphens, followed by a hyphen and a two-digit number; submit the slug only" (word-word-word-NN).
artifact anatomy
a rail fence writes the text down and up across n rows, then reads the rows one after another. with three rails the first row holds every fourth character starting at 0, the middle row the ones at odd positions, the last row every fourth starting at 2:
positions by row, 3 rails, 12 characters
row 0: 0 4 8
row 1: 1 3 5 7 9 11
row 2: 2 6 10
the blob is the three rows concatenated. the mastery's numbered lines are the message cut into eighteen chunks, one per day so far; line 18 is a chunk in this form, six to eight characters long.
extraction method
the engine already had a keyless rail reading (day 13 prep): one reading per rail count the text is long enough for, two to eight rails, refused when the letters are mostly outside the common english ones. on the whole blob it returns the three-rail reading first and the slug search accepts it. the mastery read line 18 by the per-line search, which tries every transform on the one line past the known schedule and keeps the reading that spells a slug.
the new schedule row is the fixed three-rail transform, because the keyless reading is wrong on a short chunk: with seven characters, two, three and four rails all give plausible readings and the one ranked first by english is not always the three-rail one.
def rail_positions(n, rails):
rows = [[] for _ in range(rails)]
row, step = 0, 1
for i in range(n):
rows[row].append(i)
step = 1 if row == 0 else -1 if row == rails - 1 else step
row += step
return [i for r in rows for i in r]
def unrail(text, rails):
plain = [""] * len(text)
for ch, i in zip(text, rail_positions(len(text), rails)):
plain[i] = ch
return "".join(plain)
validation and answer formatting
the message decodes to english with the slug on its last line; the slug must match the question's shape. a reading of the wrong rail count is letters in the wrong order, which the english score rejects on the whole blob; on a line chunk the fixed row leaves nothing to rank.
automation across modes
the one-blob modes read the whole text by the keyless search; the mastery's eighteenth line reads by its row in the line schedule, like the seventeen before it.
lessons
- a transposition keeps letter frequencies: when a blob reads as english letters in the wrong order, try the keyless transpositions before any substitution.
- a keyless search is fine on a whole message and unreliable on a seven character chunk; once a day's rail count is known, pin it.
solve times
public scoreboard · day 18 finish: 1st
- 0:02.8single#2 of 183 solvers
- 0:04.9time trial#2 of 175 solvers
- 0:06.7masteryfirst blood, +2.5 s
- #1team day finishof 155 teams that cleared it, in 0:45.5
- #2single orderof the day's 5, by our flag time
from the public scoreboard: 09:00 et release to our flag; the table below counts from our attempt's start.
from when we started working on the mode to its flag.
| mode | work to flag | attempts | wrong submits |
|---|---|---|---|
| single | 1.1s | 1 | 0 |
| time trial | 1.0s | 1 | 0 |
| mastery | 1.0s | 1 | 0 |
the clock
server timer of the winning attempt; used is attempt start to flag, left is what remained on the clock.
| mode | time available | time used | time left |
|---|---|---|---|
| time trial | 30.0s | 1.0s | 29.0s |
| mastery | 105.0s | 1.0s | 104.0s |
both timed modes ran without a hall-of-fame time: the game master listed no ranked pool for them that day and reported zero ranked attempts before our first start, so the timer ran but the times were not ranked.
where we got stuck
- nowhere: every mode's first attempt was correct. the fixed row is a day 18 change made once a readiness check showed the eighteenth line had been read by the search rather than by its schedule row.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}