Tactical LogHuntress CTF 2026 // team archive

Days / Day 06 / Script Analysis / Shell We Begin

DAY 06//LANE: SCRIPT ANALYSIS//STATUS: CORRECT x3

Shell We Begin

Script Analysis SSTTMM Modes reported CORRECT in this write-up

Challenge

  • Lane: script-analysis (Day 06), GM id script-analysis-day-06-bash-behavior-graphs
  • Prompt: "Six Bash behavior graphs, none of which will ever run. Read them like a native: map the adapters, count the stages, tag the ATT&CK techniques, and pull the exact indicators hiding in the final bytes."
  • Modes: Single Solve (399 fields), Time Trial (399 fields, ~7 s window after a retry), Mastery (798 fields = 2 deliveries x 399, ~7 s window)
  • Flags: completion tokens returned by the Game Master (not stored here; see state.json)

Artifacts

An AES zip (password infected) of ~50 inert fixtures: PowerShell, JScript, VBScript, Batch, Python carriers, and the new layer, six Bash scripts. Nothing is ever executed.

Triage

Known family script_inventory (Day 01-05): per-field answers derived from fixture bytes. New layer this day: Bash.

Investigation

  1. Each .sh holds Material_<id> plus Codec_<id>='<representation>|<transform>|<key>'. The decoded text is a v=1|steps=...|adapter=...|stage_count=...|campaign_id=...|... descriptor. Role comes from steps (for example profile_host,acquire_remote,write_file,change_mode,dispatch_process is the staged chain).
  2. Single Solve: static decoder decode_sh.py plus the existing PS1/JS/BAT/VBS/Python-carrier solvers, unified in scripts/solve_shell.py.
  3. Time Trial failed twice before it was solved. First run: unknown encodings. Then the retry re-randomized the files, giving different codecs and a ~7 s window. Codecs seen across draws: representations hex_compact, hex_colon, decimal_space, decimal_colon, reversed_decimal, base64_chunks, base64_literal; transforms identity, single_byte_xor, reverse_then_xor, repeating_key_xor, add_modulo_256, subtract_modulo_256, reverse_bytes. Some fixtures also use case-obfuscated identifiers. Fix: a generic decoder (challenges/_lib/decode_bash.py) that tries the declared codec first, then every loader x transform, accepting the output that starts with v=1|steps=. Validated offline on two captured timed fixture sets (fixtures_tt1, fixtures_tt2).
  4. Mastery: the start response lists one download, but the questions span two deliveries (set1.*, set2.*). The second delivery is fetched with op=artifact&delivery=1. The solver fetches it, solves each set from its own bytes, and submits all 798 fields as one batch.
  5. Each timed run is retry + solve + submit in a single WSL call (1-3 s end to end).

Flag Recovery

Single, Time Trial and Mastery each returned CORRECT from the Game Master; completion tokens are in state.json.

Minimal Reproduction

wsl python3 "challenges/Day 06/Shell_We_Begin/scripts/solve_shell.py" time_trial   # after op=retry
wsl python3 "challenges/Day 06/Shell_We_Begin/scripts/solve_shell.py" mastery      # after op=retry

Lessons Learned

  • A timed retry re-randomizes the material, so test the decoder on captured fixtures from several draws and make it generic (validate against the known descriptor prefix).
  • Windows are seconds long: one WSL invocation for retry + solve + submit.
  • Mastery can have several deliveries; check the question ids (setN.) against the artifact list.
  • Do not edit the same file as another agent. Two writers produced a broken merge on decode_sh.py.