Tactical LogHuntress CTF 2026 // team archive

Days / Day 30 / Script Analysis / Spill the Beans

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

Spill the Beans

Script Analysis SSTTMM Modes reported CORRECT in this write-up

Spill the Beans — Mastery solution and faster workflow

Result

Mastery completed on the active untimed attempt. The Game Master returned CORRECT with flag:

  • Token136d583034da2458a08125a12c6edf38

The attempt had 26,572 answer fields across 14 assigned evidence archives. The assigned outer archive SHA-256 was:

c3fbc11011391341847c1a5764d01d33cf4e93f4fe788a10dfeb8205fbf5f270

I resumed the already-active attempt and used its assigned artifact; I did not start a replacement attempt. Its status was untimed (run_for_time: false, no deadline).

What the puzzle’s host and execution evidence says

The Single Solve evidence contained a JSP host fixture and a BeanShell source file intended to be read together:

EvidenceFinding
host-jsp-webshell-jsp.jspAn inert JSP host fixture. It models a request surface and explicitly does not execute commands. SHA-256: f7e60df90324545e6a53f2b60069ec5083b0671c9a86d0b3a1cf86e9c86f24b2.
host-jsp-beanshell-beanshell.bshBeanShell source with host_profile=jsp_beanshell, stage_profile=cross_language_handoff, and next_language=jscript. Its declared steps are profile_host, decode_configuration, and dispatch_language. SHA-256: cc7459a636bfdb9113c131bc43d31a34a456d434ad7bc806aeaf274c55a6c8eb.

The connecting declared graph edge is therefore:

JSP host → BeanShell configuration/dispatch → JScript

This is an evidence and handoff relationship, not proof of runtime execution. The BeanShell file imports bsh.Interpreter, but keeps an encoded inert descriptor in a constant, does not evaluate it, and prints inert-analysis-fixture. The JSP fixture also does not execute commands. Keep this host-embedded chain distinct from the separate standalone BeanShell sample, whose next_language is VBScript.

How the Mastery fields were reconstructed

  1. Read the current Mastery status and kept the existing attempt ID. This supplied the authoritative question list, answer IDs, set numbers, artifact names, and assigned archive hash.
  2. Downloaded the assigned archive through the Game Master proxy and checked its SHA-256.
  3. Extracted the 14 nested evidence ZIPs statically. No samples were executed. Each nested archive used the supplied infected password.
  4. Decoded the inert descriptors from the exact extracted bytes. The local helpers handled the listed encodings and source wrappers; answer values were mapped to question IDs using both the set number and artifact filename.
  5. Built answers for all non-style fields in /tmp/spill-mm-nonstyle-answers.json. It contained 26,194 values, including 1,554 file-path values and 1,554 path-leaf values.
  6. Submitted answer classes and used Game Master responses—not local parser guesses—to establish progress. The service reported 24,556 accepted IDs and 2,016 remaining. The remaining IDs were exactly 1,008 file-path and 1,008 path-leaf fields.
  7. Before changing decoders, submitted one exact outstanding path/leaf pair from evidence-07.zip -> fada7b.bsh:
    file path: /tmp/huntress-beanshell/.5808a4086ecc5eb3.stage
    path leaf: .5808a4086ecc5eb3.stage

    Both IDs appeared in the accepted-ID response, and remaining fell from 2,016 to 2,014. This established that these decoded values were valid and exposed the real issue: the corresponding fields in the bulk answer file had not reached the service as accepted submissions.

  8. Submitted the other 2,014 still-outstanding path and leaf answers from that same answer file. The Game Master returned CORRECT.

The misleading diagnosis, corrected

The previous in-progress note blamed truncated path extraction and cited an older PHP example. That was not demonstrated by a known expected answer; an incorrect class submission only showed that the submitted batch had not been accepted. For the current assigned artifacts, the direct decoder returned the complete embedded paths. The BeanShell canary then passed exactly as decoded.

The available request/response records do not identify the precise earlier code path that omitted the classes, so the write-up does not claim a specific source-code bug. The operational lesson is decisive: when the server’s remaining IDs form a complete answer class, first verify whether that class was actually included in a successful request. Do not rewrite a decoder until a concrete submitted value is disproved.

Improvements for future agents

1. Audit coverage before making a request

Compare the generated answer map against the status response’s answer_ids. Require an exact one-to-one match for the intended batch:

  • missing = expected IDs - submitted IDs
  • extra = submitted IDs - expected IDs
  • assert both are empty for a full submission
  • for a class submission, assert the submitted IDs equal the intended class exactly

Save the serialized request body and a compact response summary locally. Do not rely on a console message that says values were decoded or “are being submitted.”

audit_answer_coverage.py now performs the local ID/value coverage check and recognizes compound suffixes such as file-path and path-leaf. For the saved full answer map, audit those two classes with:

python3 agent-1-day30-work/audit_answer_coverage.py \
  --status /tmp/spill-mastery-status.json \
  --answers /tmp/spill-mm-nonstyle-answers.json \
  --field-class file-path \
  --field-class path-leaf

This checks only that IDs and values are present in the local answer map. The Game Master response still decides acceptance.

2. Treat compound field suffixes explicitly

Splitting IDs with rsplit("-", 1) turns ...-file-path into path. That can be useful for rough grouping, but it erases the distinction between compound and simple suffixes and makes omissions hard to spot. Match known suffixes longest-first, for example:

FIELD_SUFFIXES = ("-path-leaf", "-file-path", "-campaign-token", "-stage-count")

def field_class(answer_id):
    for suffix in FIELD_SUFFIXES:
        if answer_id.endswith(suffix):
            return suffix[1:]
    return answer_id.rsplit("-", 1)[-1]

Report counts by exact field class and by set. For this attempt, the expected count was 1,554 each for file-path and path-leaf; after earlier submissions, the server’s remaining count showed exactly 1,008 each.

3. Use set-qualified artifact keys

Index decoded records by (set_number, artifact_filename), not filename alone. The question’s artifact reference includes both pieces, and this prevents one set’s sample from satisfying another set’s question if names ever collide.

4. Use server progress as the source of truth

After each batch:

  • Compare remaining before and after.
  • Compare returned accepted_ids with IDs in the request.
  • Save only a short summary to the terminal: result, remaining, number submitted, number newly accepted, and outstanding field classes.
  • If a class does not move the count, test one exact byte-derived value from that still-outstanding class before investigating parser logic.

An exact one- or two-field canary is much faster to diagnose than decoding every artifact again. On an untimed active attempt, accepted answers remain saved, so continue the same attempt.

5. Keep source analysis static and evidence-linked

Parse the descriptor and the host fixture as separate evidence nodes, then record their explicit relationships (host_profile, steps, next_language, stage profile, and any matching IDs or paths). An import of an interpreter is not evidence that it was invoked; require a call/evaluation site before describing runtime execution.

Useful local files from this solve

  • /tmp/spill-mastery-status.json — full active-attempt status and question list.
  • /tmp/spill-the-beans-mastery.zip (challenge artifact, not published) — downloaded assigned Mastery archive.
  • /tmp/spill-beans-sets/evidence-01 through evidence-14 — extracted nested evidence.
  • /tmp/spill-mm-nonstyle-answers.json — reconstructed non-style answers, including the correct path fields.
  • /tmp/spill-mm-final-response.json — final Game Master CORRECT response.
  • /tmp/spill_helpers.py — static descriptor parsing helpers used during analysis.
  • audit_answer_coverage.py — reusable local answer-ID coverage audit.