Challenge
- Lane: Script Analysis (Day 04), id
script-analysis-day-04-shell-contrast - Prompt: "These VBScript specimens hide their material behind character codes, reversible transforms, and winding control flow. Unwind every representation on paper, classify each behavior, and find out which stage passes the baton to which."
- Scoring: 231 per-field answers per set (Mastery = 2 sets = 462). Partial credit via the Game Master; a batch containing any wrong field is rejected whole.
- Single Solve: CORRECT (completion token
<REDACTED_TOKEN>) - Time Trial: CORRECT (completion token
<REDACTED_TOKEN>) - Mastery: CORRECT (completion token
<REDACTED_TOKEN>) (tokens are per attempt/identity; redacted per project policy, see Lessons Learned)
Artifacts
evidence.zip (challenge artifact, not published) (AES, password infected): 30 inert fixtures = 3 PS1, 9 JScript, 9 Batch, 9 VBScript. The VBS layer is the new part; PS1/JS/BAT are the Day 03 "Expansion Pack" family.
Triage
Known family script_inventory (KB match). Reused challenges/_lib/solve_script_inventory.py for PS1/JS/BAT (159 fields resolved unchanged) and added only the VBS layer (72 fields).
Investigation
- Each
.vbsholdsConst Material_x(encoded bytes),Const Codec_x = "<representation>|<transform>|<param>"and Load/Decode/Recover/Inspect functions. Decoding is static: parse the representation, undo the transform, check the plaintext isv=1|steps=...|adapter=...|campaign_id=...|key=value.- Representations seen: decimal_pipe/dash/comma, hex_compact/colon/dash, reversed_decimal, reversed_hex, base64_literal, base64_chunks.
- Transforms seen: identity, subtract_modulo_256 (code adds N), single_byte_xor, repeating_key_xor (key in
keyBytes = Array(..)), rolling_xor (prev = previous ciphertext byte), reverse_bytes, reverse_then_xor.
- Role comes from the
stepssignature (same table as Day 03; relay-handoff with 4 steps isstaged_chain). VBS attack id for launcher/chain/relay is the language techniqueT1059.005; others as Day 03 (T1105/T1140/T1041/T1486/none). representation/transformanswers are the Codec tokens verbatim (GM accepted).- Control-flow label, read from the body of
Recover_*only (decoy wrappers such asIf True Then,LCase(UCase("Host")),If (2 > 1) ...are noise):- plain straight line ->
direct;Select Case->select_case;Do ... Exit Do ... Loop->do_once;While p < 1 ... Wend->while_once;For i = 0 To 0->for_once;On Error Resume Next+Err.Numbercheck ->error_guard. - Batch:
for /lform ->call_subroutine(first confirmed Day 04); other batch labels as Day 03. Batch expansion/control are form-derived (27/27 predicted correctly on the single solve).
- plain straight line ->
- Failed guesses worth keeping:
do_loop,while_wendwere rejected; the GM label is<keyword>_once. Found by probing the untimed Single Solve per field.
Flag Recovery
Single Solve (untimed lab): submitted the 204 byte-derived fields in one batch (accepted), then probed the 27 expansion/control fields one at a time (accumulates accepted fields) until CORRECT. Time Trial / Mastery: windows are about 6-7 seconds. First two Time Trial shots failed (decoder crashed on a new codec; a brute-force decoder accepted an off-by-one key because it only checked the first 4 bytes). Fixes: generic parser plus strict validation (fully printable, v=1|steps=[a-z_,]+|adapter=), per-thread GM clients, and a parallel per-field fallback. A lab run (lab_probe.py) inside a window produced ground-truth control labels; the next attempt was CORRECT. Mastery was CORRECT on the first full submit (2.4 s from start).
Minimal Reproduction
wsl python3 "challenges/Day 04/Dim and Dimmer/scripts/run_timed.py" single|time_trial|mastery # from framework root
(run_timed.py handles time_trial/mastery; single solve was run with run_single.py.) Needs node in WSL (wsl sudo apt-get install -y nodejs).
Lessons Learned
- The raw 32-hex completion tokens were originally printed in plain text in this file's Challenge section - a direct violation of the project's own redaction rule (and the global secrets-handling standard). Found and fixed on review 2026-10-04 before this file could be published to the shared repo. Never print a real completion token into a writeup; use
<REDACTED_TOKEN>. - Never use
\binside heredoc-built Python strings: it becomes a backspace byte and the regex silently never matches (cost one wrong timed shot). - Brute-forcing a decoder with a 4-byte prefix check is not validation; require full-text sanity.
- GM HTTP client is not thread-safe: one
GM()per thread. - Timed windows are about 6 s: probe labels in the untimed Single Solve or in a lab window, never debug inside the window.
- Reusable code:
challenges/_lib/solve_dim_dimmer.py,decode_vbs.py,run_timed.py.