the full transform: an xslt stylesheet that never has to run

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

tools used: script analysis and timed-attempt pipeline.

"an unseen xslt-led campaign ties together all thirty-one languages, every hosted-source profile, and every finding family you've proven. read all of it, run none of it, and deliver the final analysis." the last day's bundle was day 30's 188 specimens with fresh identifiers plus four xslt stylesheets, and the only new questions were the family's eleven descriptor fields for each stylesheet: 44 of the single's 1846 fields.

the key insight is that a stylesheet is xml, and xml has comments. each stylesheet carries the family's analysis header in a <!-- ... --> comment and the same encoded descriptor as the literal text of the one element its template would emit, so the marker search that read every earlier carrier read these from the raw text, with no xslt processor and no xml parser. the day 30 solver ran unchanged; only its challenge name was edited. the descriptor again stated roles its steps do not support, on all four stylesheets this time, and the grader accepted the stated values.

challenge shape

single         1846 fields   day 30's 188 specimens with fresh identifiers
                             plus four xslt stylesheets (44 fields)
time trial     1950 fields   specimens renamed <6 hex>.<ext>, layered
                             headers, 13 fields per stylesheet (52)
mastery       29250 fields   fifteen sets of 1950

the four stylesheets are a benign utility, a downloader, a launcher and a staged chain (polyglot-xslt-benign-utility.xsl, polyglot-xslt-downloader.xsl, polyglot-xslt-launcher.xsl, polyglot-xslt-staged-chain.xsl). the eleven fields per stylesheet are role, attack, adapter, campaign, url or file path, stage count, steps, host profile, obfuscation, stage profile and next language. the text of the 1802 carried-over questions is word for word day 30's, the attack rubric included, and every carried-over specimen keeps its file name and layout with fresh identifiers and payloads (one of the 188 came back byte-identical).

artifact anatomy

the evidence zip's 192 members are aes-256 encrypted under the lane's standing password (7z x -pinfected). triage reads a stylesheet as three lines of ascii text whose only url is the xslt namespace (http://www.w3.org/1999/XSL/Transform): every indicator is inside the encoded payload. the launcher, 1251 bytes, trimmed:

<?xml version="1.0" encoding="UTF-8"?>
<!-- HUNTRESS_ANALYSIS_V1:B64-dj0zfGxhbmd1YWdlPXhzbHR8cm9sZT1sYXVuY2hlcnx2ZXJk... -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><descriptor>dj0zfGxhbmd1YWdlPXhzbHR8cm9sZT1sYXVuY2hlcnx2ZXJk...</descriptor></xsl:template></xsl:stylesheet>

the comment is the family header, HUNTRESS_ANALYSIS_V1:<CODEC>-<payload>. the stylesheet has one template, matching the document root, whose whole body is a literal result element <descriptor> holding the same payload without the codec name. applied to any input document the transform would output that one element, so running it shows nothing the file does not already hold as text.

the single's four stylesheets used four codecs: FRAG (hex split into dot-separated fragments) for the benign utility, HEX for the downloader, B64 for the launcher and HB64 (hex of base64) for the staged chain. the payload decodes to the family's descriptor, fifteen pipe-separated key=value pairs; the downloader's:

v=3|language=xslt|role=downloader|verdict=suspicious|attack=T1105|adapter=http_client|host_profile=standalone|obfuscation_profile=plain_hex|stage_profile=single_descriptor|next_language=jscript|stage_count=2|steps=decode_configuration,return_configuration|campaign_id=XSLT-d2a5a0a2|url=https://xslt-d2a5a0a267.example.invalid/stage|file_path=/tmp/huntress-xslt/.d2a5a0a26752c1ac.stage

extraction method

the script analysis reader searches the raw text for HUNTRESS_ANALYSIS_V1: followed by a codec name, a hyphen and a run of non-blank characters. in an xml comment the payload is followed by a space and -->, so the run ends exactly at the payload's last character; no xml parsing is needed and none happens. of the two copies the reader takes the comment's because it is the one that names its encoding: the <descriptor> element holds the bare payload and says nothing about how it was encoded.

the four single codecs are special cases of the layered codec the timed modes use (FRAG is hex then fragments, HB64 is base64 then hex), so one undo table covers every header of the day. by hand:

import base64
import re

HEADER = re.compile(r"HUNTRESS_ANALYSIS_V1:([A-Za-z0-9_]+)-(\S+)")
SINGLE_CODECS = {"FRAG": "hex_frag", "HEX": "hex", "B64": "b64", "HB64": "b64_hex"}


def undo(layer: str, text: str) -> str:
    if layer == "b64":
        text = text.rstrip("=")
        return base64.b64decode(text + "=" * (-len(text) % 4)).decode("latin-1")
    if layer == "b32":
        text = text.rstrip("=")
        return base64.b32decode(text + "=" * (-len(text) % 8)).decode("latin-1")
    if layer == "hex":
        return bytes.fromhex(text).decode("latin-1")
    if layer == "rev":
        return text[::-1]
    if layer == "frag":
        return text.replace(".", "")
    raise ValueError(f"unknown layer {layer}")


def descriptor(text: str) -> dict[str, str]:
    codec, payload = HEADER.search(text).groups()
    if codec == "LYR":
        layers, _, payload = payload.partition("-")
    else:
        layers = SINGLE_CODECS[codec]
    for layer in reversed(layers.split("_")):
        payload = undo(layer, payload)
    return dict(pair.split("=", 1) for pair in payload.split("|"))

the layer names are listed in the order they were applied, so they are undone right to left. this reads all eight stylesheets of the single and the time trial. the solver's own version also accepts a chain only when its result parses as a descriptor, and tries the written order second in case a chain is ever listed in decode order.

the field mapping is day 30's: campaign is campaign_id, obfuscation is obfuscation_profile, steps is the descriptor's comma list joined with >, and every other field is the key of the same name, verbatim. no code for xslt was added on day 31.

validation and answer formatting

all 1846 fields of the single were accepted on its first run. the four stylesheets, as graded:

specimen                      codec  role            attack  obfuscation     steps
polyglot-xslt-benign-utility  FRAG   benign_utility  none    fragmented_hex  profile_host>decode_configuration>dispatch_language
polyglot-xslt-downloader      HEX    downloader      T1105   plain_hex       decode_configuration>return_configuration
polyglot-xslt-launcher        B64    launcher        T1059   base64          acquire_remote>dispatch_process
polyglot-xslt-staged-chain    HB64   staged_chain    T1059   hex_base64      decode_embedded>write_file>dispatch_process

the adapters were local_parser, http_client, process_builder and operation_graph; the host profile standalone for all four; the campaigns XSLT-785fb622, XSLT-d2a5a0a2, XSLT-9e8ecd19 and XSLT-df6b044a; the stage counts 3, 2, 2 and 3; the stage profiles cross_language_handoff, single_descriptor, two_stage_download_execute and three_stage_decode_write_launch; and the next languages powershell, jscript, batch and vbscript, in the same order. every descriptor carries both a url and a file path; the questions asked the benign utility's file path (/tmp/huntress-xslt/.785fb62221dd61aa.stage) and the other three urls (https://xslt-d2a5a0a267.example.invalid/stage, https://xslt-9e8ecd196d.example.invalid/stage, https://xslt-df6b044a9d.example.invalid/stage). the obfuscation answer is the descriptor's own name for the header codec, not the codec tag.

the steps are where the stylesheets disagree with themselves. day 30's jsp specimens gave each role its own steps; here each stylesheet carries the steps of the role before it in the order benign utility, downloader, launcher, staged chain (the benign utility has the staged chain's, the downloader the benign utility's, and so on). the attack question's rubric maps "decode_configuration followed by return_configuration" to benign/none, so applied to the downloader it gives none; the descriptor states T1105. the solver submits a descriptor's stated role and attack whenever it has them and derives a role from the steps only when the descriptor names none; the grader accepted all four stated pairs and the rubric's values were never tried. the stage count matched the number of steps on every stylesheet of every mode, which is a cheap check that the payload was decoded whole.

failed approaches and pivots

none on day 31.

automation across modes

the time trial renamed every specimen to six hex characters and its extension (b0348a.xsl, 4683b1.xsl, 86f948.xsl, 3f7778.xsl) and moved every header to the layered codec, LYR-<layers>-<payload>. the four stylesheets:

b0348a.xsl  LYR-b64-dj0zfGxhbmd1YWdlPXhzbHR8...        base64
4683b1.xsl  LYR-b32_rev_hex-3d495a4f57515...           hex of the reversed base32
86f948.xsl  LYR-hex_frag_rev-5676164737e29356.834...   the reversed text of fragmented hex
3f7778.xsl  LYR-hex_hex_hex-33373336333336...          hex three times

the <descriptor> element carried only the encoded body, without the LYR-<layers>- prefix, so the comment was the only place that named the layers. hex_hex_hex is the size outlier: the 431-character descriptor becomes 3448 characters of hex, written twice, in a 7143-byte file.

the obfuscation answer was the layer list as written (b64, b32_rev_hex, hex_frag_rev, hex_hex_hex), which is also what each descriptor states as its obfuscation_profile. the timed descriptors widened the vocabulary, all read verbatim: roles uploader and persistence_descriptor, attacks T1041 and T1053, stage profiles teal_ladder, umber_weave, ruby_ladder and cobalt_weave, next languages awk, tcl, swift and kotlin, and up to seven steps. 86f948.xsl states persistence_descriptor and T1053 over a graph with no build_schedule in it (decode_configuration>profile_host>acquire_remote>change_mode>read_file>write_file>dispatch_memory); the stated pair was graded correct. each stylesheet dropped adapter and host profile, asked both the url and the file path, and added three composite fields: the url's host (xslt-57ea848172.example.invalid for b0348a.xsl), the file path's last segment (.57ea848172eab935.stage) and the campaign id after its first hyphen (57ea8481 from XSLT-57ea8481).

the mastery's fifteen sets reused the time trial's file names, the same four stems in every set with different contents, so nothing can be cached by file name across sets; the solver reads each set's bytes on their own. its 60 stylesheets used 43 distinct layer lists of one to three layers (the obfuscation answers start b32_b32_b64, hex_b64, hex_frag, 60 in all), with two to eight steps each and attacks including T1140. the solve took 0.58 seconds on the single, 0.21 on the time trial and 2.4 for the mastery's fifteen sets; no field came back rejected.

lessons

solve times

public scoreboard · day 31 finish: below top 10

  • 0:04.1singlefirst blood, +0.07 s
  • 0:06.9time trial#2 of 114 solvers
  • 0:14.3mastery#3 of 112 solvers
  • #14team day finishof 90 teams that cleared it, in 10:51.3
  • #3single orderof the day's 7, 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 the mode's first attempt start to its flag (server times). attempts counts our solver runs.

mode work to flag attempts wrong submits
single 1.6s 1 0
time trial 0.7s 1 0
mastery 5.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 50.0s 0.7s 49.3s
mastery 610.0s 5.0s 605.0s

where we got stuck

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

{generated by a clanker}