sharp practice: a c# script, and the same script inside an aspx page

huntress ctf 2026, day 19 · script analysis · all three modes

tools used: script analysis, replay and analysis and timed-attempt pipeline.

the day added one language and one host: a roslyn c# script (.csx), and an aspx page that carries that script inline. the evidence zip held the whole specimen corpus so far plus the new pair, and the questions asked each specimen's descriptor fields and how the stages hand off.

the key insight: the descriptor the questions ask about is written into each specimen behind an analysis header, the same contract every earlier language used, so a new language needs no new reader. the only new thing was where the header sat: inside a c# string literal.

challenge shape

single       1249 fields   137 specimens: descriptor labels and values per
                           specimen, the next stage, corpus relations
time trial   1249 fields   the same corpus on fresh bytes
mastery      6245 fields   five sets of it

55 of the fields were new: four polyglot c# script specimens (benign utility, downloader, launcher, staged chain) and the aspx host (host-aspx-inline-csharp-csharp-script.csx), eleven fields each: role, attack, adapter, campaign, one indicator (a file path for the benign utility, a url for the rest), stage count, steps, host profile, obfuscation, stage profile and next language.

artifact anatomy

each specimen carries one header line:

HUNTRESS_ANALYSIS_V1:<CODEC>-<payload>

where the codec names how the payload encodes the descriptor (HEX, B64, HB64 for hex of base64, FRAG for dotted hex, or SPLIT for pieces in a string array; the five new specimens used the first four), and the descriptor is a v=N|key=value|... record. the aspx host embeds the csx as a c# string, so the script's newlines are the two characters \n, and the header's line ran straight into the next statement:

"// HUNTRESS_ANALYSIS_V1:HEX-763d337c...\n#nullable enable\nusing ..."

extraction method

the header reader takes the codec word and the payload after the dash, decodes the payload with that codec and parses the descriptor. when the header rule fails, a slower search tries every literal of the specimen under every codec and keeps the one that parses; it also leaves a note that a table row is missing, which our replay check turns into a failure.

the aspx specimen read through that search on the day. the fix ends the payload at an escape sequence and, for a hex payload, at the end of the hex run:

def payloads(kind, raw):
    cut = raw.split("\\", 1)[0]               # a literal "\n" ends it
    run = re.match(r"[0-9A-Fa-f]+", raw)
    forms = [raw, raw.rstrip("*/'\";>)"), cut, cut.rstrip("*/'\";>)")]
    if kind == "HEX" and run:
        forms.append(run.group())
    return list(dict.fromkeys(forms))

validation and answer formatting

a payload is accepted only when its codec decodes it and the result parses as a descriptor; a run-on payload fails the hex decode and falls to the next form. labels the grader has confirmed come from the confirmed tables; where nothing is graded yet, ranked candidates go first.

automation across modes

the corpus is the same shape in every mode, so the same reader answers the single, the time trial and each mastery set; 3 time-trial fields and 25 mastery fields went out as ranked candidates.

lessons

solve times

public scoreboard · day 19 finish: top 3

  • 0:05.5singlefirst blood, +0.18 s
  • 0:08.8time trialfirst blood, +3.3 s
  • 0:13.1masteryfirst blood, +9.7 s
  • #3team day finishof 153 teams that cleared it, in 17:56.2
  • #3single orderof the day's 8, 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 2.2s 1 0
time trial 1.5s 1 0
mastery 2.6s 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 50.0s 1.5s 48.5s
mastery 170.0s 2.6s 167.4s

where we got stuck

flags: single, time trial, and mastery [redacted].

{generated by a clanker}