Tactical LogHuntress CTF 2026 // team archive

Days / Day 14 / Script Analysis / Trust the Process

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

Trust the Process

Script Analysis SSTTMM Modes reported CORRECT in this write-up

Day 14 - Trust the Process (script-analysis)

  • GM id: script-analysis-day-14-msbuild-trusted-project-abuse
  • Lane: script-analysis (family script_inventory, 11th day of the lane)
  • Fields: 971 answer ids | Artifact: artifact_0.bin (challenge artifact, not published) (103827 bytes, WinZip-AES zip, 111 members, password infected)
  • Result: all three modes CORRECT
ModeResultFlag
Single SolveCORRECTToken06cf24c1fed4223b36fd0179161b0674
Time TrialCORRECTToken2b6c35ce3a08cf4750411fea56e28157
MasteryCORRECTTokenbf51fe8edfad944272bc789cc8d6910e

Prompt

An MSBuild project looks like routine build plumbing until you follow its properties into its targets. Recover the property and target flow, compare it with earlier execution chains, and find where a trusted toolchain is doing untrusted work.

Today's layer

Day 14 adds MSBuild project carriers (.proj) to the cumulative script-triage inventory - the carrier that lane_progress.py had listed as a prepared next-layer candidate (msbuild project [PREPARED]). Four new fixtures, 11 question keys each, 33 ids:

  • polyglot-msbuild_xml-benign-utility.proj
  • polyglot-msbuild_xml-downloader.proj
  • polyglot-msbuild_xml-launcher.proj
  • polyglot-msbuild_xml-staged-chain.proj

Every other language in the archive (PowerShell, JScript, Batch, VBScript, Python, Bash, .mjs, PHP, Lua, AutoIt, AppleScript, MOF, TypeScript) was already covered, so the banked adapter answered 938 of 971 ids at claim time and held the Single with a 33-id residue. The .proj extension itself was already registered in autosolve_script.LANGS (line 61, ('.csproj', '.proj', '.targets', ...) -> T1127.001), so the layer was not a new language table entry at all.

The real gap: the marker is wrapped in a host-language comment

Each fixture is an inert MSBuild project that carries the usual HUNTRESS_ANALYSIS_V1 descriptor twice - once in an XML comment and once in a <PropertyGroup> property, which is exactly the "follow its properties into its targets" the prompt points at:

<?xml version="1.0" encoding="utf-8"?>
<!-- HUNTRESS_ANALYSIS_V1:HB64-646a307a66477868626d6431... -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup><HuntressDescriptor>646a307a66477868626d6431...</HuntressDescriptor></PropertyGroup>
  <Target Name="Analyze"><Message Text="Inert analysis fixture" Importance="low" /></Target>
</Project>

The encoding is self-declared by the tag after the marker, and the four fixtures deliberately use one each:

FixtureTagEncodingobfuscation_profile
benign-utilityHB64-hex of a base64 stringhex_base64
downloaderFRAG-dot-fragmented hexfragmented_hex
launcherHEX-plain hexplain_hex
staged-chainB64-base64base64

All four tags were already implemented in solve_poly_d8._decode_known. The break was one character class. MARK is

MARK = re.compile(r'HUNTRESS_ANALYSIS_V1:([A-Z0-9]+)-([^\r\n\'"]+)')

which excludes newlines and quotes but not spaces, so inside an XML comment the payload capture kept the comment terminator:

kind= HB64 payload tail= '526b4c6e4e305957646c -->'

bytes.fromhex() then failed, _peel() failed, and desc_of raised unpeelable. The giveaway in the residue was that exactly 3 of the 4 fixtures were unresolved: B64- survived because base64.b64decode stops at the padding and silently ignores the trailing -->. Every earlier day's carrier put the marker in a line comment with nothing after it, so the bug had never fired.

Fix (challenges/_lib/solve_poly_d8.py)

desc_of now sanitizes before decoding and prefers the most complete descriptor:

  1. clean_payload() cuts the capture at the first whitespace and sheds trailing comment closers (-->, ]]>, */, ?>, #>, --).
  2. If that still will not decode, fall back to the <HuntressDescriptor> / <HuntressMaterial> property element - the second copy MSBuild carries.
  3. Among candidates that decode to a v= descriptor, keep the one with the most fields. A payload truncated by the host container still decodes to a leading v=3|language=... fragment, so a field count is what separates a whole copy from a partial one; a first-match-wins rule would have accepted the fragment.

Decoded descriptors

Once decoded, all 11 keys per fixture are read straight out of the descriptor (steps joined with > instead of ,); nothing needed inference.

fieldbenign-utilitydownloaderlauncherstaged-chain
rolebenign_utilitydownloaderlauncherstaged_chain
verdictbenignsuspicioussuspicioussuspicious
attacknoneT1105T1059T1059
adapterlocal_parserhttp_clientprocess_builderoperation_graph
host_profilestandalonestandalonestandalonestandalone
obfuscation_profilehex_base64fragmented_hexplain_hexbase64
stage_profilethree_stage_decode_write_launchcross_language_handoffsingle_descriptortwo_stage_download_execute
next_languagepowershelljscriptbatchvbscript
stage_count3322
stepsdecode_embedded>write_file>dispatch_processprofile_host>decode_configuration>dispatch_languagedecode_configuration>return_configurationacquire_remote>dispatch_process
campaign_idMSBUILD_XML-28da2eb0MSBUILD_XML-d5e100e6MSBUILD_XML-73d9be88MSBUILD_XML-984e0b62
urlhttps://msbuild_xml-28da2eb05c.example.invalid/stagehttps://msbuild_xml-d5e100e69e.example.invalid/stagehttps://msbuild_xml-73d9be884e.example.invalid/stagehttps://msbuild_xml-984e0b6296.example.invalid/stage
file_path/tmp/huntress-msbuild_xml/.28da2eb05c1ce1dd.stage/tmp/huntress-msbuild_xml/.d5e100e69ea58028.stage/tmp/huntress-msbuild_xml/.73d9be884ea9ba3d.stage/tmp/huntress-msbuild_xml/.984e0b6296cae928.stage

Note on -attack: the descriptor's own attack field is authoritative and was taken verbatim. The GM's precedence rubric would read the benign-utility graph (decode_embedded>write_file>dispatch_process) as a dispatch, but the descriptor declares attack=none / role=benign_utility, and the downloader's T1105 confirmed the field is the modeled ground truth rather than a hint. The lane's T1127.001 (Trusted Developer Utilities Proxy Execution: MSBuild) candidate list stayed unused - it is offered as a probe only when a descriptor leaves an interpreter field unresolved, which never happened here.

Timed modes

Both timed modes passed on the first attempt with no further work: the fix is in the shared descriptor decoder, so the re-randomized variants (Time Trial, and all of Mastery's sets) decoded offline before submission. Both were taken in the LATE slot (T+297 s and T+304 s, rehearsed finish later than the early window), untimed pool, ranked false.

Regression coverage

Added case COMMENT-WRAPPED MARKER to challenges/_lib/_test_autosolve_script.py: the synthetic descriptor is encoded in all four kinds (HEX, B64, HB64, FRAG) and wrapped in seven comment styles (xml_comment, c_block, php_close, ps_block, lua_dash, cdata, bare_line) = 28 combinations, plus a property_fallback case whose comment copy is truncated mid-payload and whose property copy is whole.

COMMENT-WRAPPED MARKER             PASS  29 marker/comment-style combinations decode
                                         (kinds HEX,B64,HB64,FRAG x 7 styles + property fallback), failures []
RESULT: PASS

Also re-ran, all PASS, no regressions: _test_script_probe.py, _test_lang_fingerprint.py, _test_script_memory.py, _test_decode_ps1.py, and the 23 pre-existing _test_autosolve_script.py cases (now 24).

Takeaway for the lane

The carrier format is no longer the interesting variable - every proxy-execution and persistence carrier in the candidate list was already in LANGS. What breaks is the envelope around the marker. Any future carrier whose comment syntax has a terminator (XML/HTML, /* */, <?php ?>, <# #>, Lua --, CDATA) would have hit the same bug, and a base64-tagged fixture will hide it by decoding anyway. The sanitizer plus the property fallback covers that whole class now.

Files