host with the most: safely inspecting obfuscated jscript
huntress ctf 2026, day 2 · script analysis · all three modes
tools used: script-analysis toolkit and timed-attempt pipeline.
the day-1 powershell specimens stayed, and a family of windows script host jscript files joined them. each jscript reconstructed a json descriptor through a different encoding and exposed inspect_* and recover_* functions. the questions were behavioral (role, att&ck, indicators) and stylistic (how the source was written).
the key insight: don't reimplement every obfuscator. evaluate only the specimen's pure inspection function in an empty sandbox, then classify the recovered behavior graph.
artifact anatomy
the same infected winzip-aes zip now held the three day-1 .ps1 files plus nine .js files, and the question set grew to 87 fields: the fifteen powershell fields from day 1, then per jscript file a -role, an -attack, the -adapter, a campaign id or other indicator, and the three style fields.
encodings included byte arrays, base64, hexadecimal, percent encoding, reversal and xor. every file still ended in the same shape: a json descriptor with keys steps (an ordered list), adapter (a windows com/class name), values (campaign id, url, file path, next stage, ...) and stageCount. each file defines a recover_*() that rebuilds the json text and an inspect_*() that evals it and returns those four keys.
extraction method
const ctx = vm.createContext({});
vm.runInContext(src, ctx, { timeout: 2000 });
const inspect = Object.keys(ctx).find(n => n.startsWith("inspect_"));
const json = vm.runInContext(`JSON.stringify(${inspect}())`, ctx,
{ timeout: 2000 });
the empty context is the security boundary: no WScript, activex, require or host process api. only the deliberately pure recovery surface is called, never the specimen's dispatch functions; a file with no inspect_* falls back to calling recover_*(). one persistent node worker (script.INSPECT_JS in our library) accepts json-encoded source lines on stdin, so every file does not pay a process start.
validation and answer formatting
role is a mapping from the complete ordered graph:
| steps | role | att&ck |
|---|---|---|
decode_configuration → return_configuration |
benign_utility |
none |
acquire_remote → dispatch_memory |
stager |
T1105 |
decode_embedded → write_file |
dropper |
T1140 |
acquire_remote → write_file |
downloader |
T1105 |
locate_local → dispatch_process |
launcher |
T1059.007 |
locate_local → prepare_transfer → upload_remote |
uploader |
T1041 |
enumerate_targets → transform_content → write_recovery_note |
impact |
T1486 |
the four-step graph acquire_remote → write_file → dispatch_process → handoff_script is staged_chain, also T1059.007 for jscript, whether the next stage is a .ps1 or a .js. the role field is an enum of eleven values (the eight the question names plus persistence_descriptor, relay and advanced_syntax); relay sits in that list as a filename trap, and the relay file graded staged_chain. the technique fields take T####, T####.### or the literal none.
three answers describe syntax, each one of three words the question itself lists, judged on the body of inspect_* with comments removed and string contents ignored:
- function style:
function inspect_x()isdeclaration,var inspect_x = function()isanonymous_expression,var inspect_x = function body_x()isnamed_expression. - invocation style:
recover_x.call(iscall,recover_x.apply(isapply, a plainrecover_x()isdirect. - property style:
d.steps-style access to a descriptor key isdot,d["steps"]isbracket_literal, both in one body ismixed. the whole inspect body counts, the returned object included.
failed approaches and pivots
classifying by the adapter alone mislabeled several specimens; roles had to come from the full ordered graph, and a file named relay-handoff.js graded as a staged chain, so filenames were not semantic truth. regex over raw source was unsafe for the style answers because comments and strings contained decoys; a small scanner now removes comments, marks string regions, balances braces to isolate the inspection body, and checks member access only in code positions.
automation across modes
mastery carried two sets of 87 answers in one combined bundle (a second delivery index did not exist). pure parsing with the persistent worker handled both sets without executing any host-capable behavior.
lessons
- run only the pure part of hostile code, in a context with no capabilities.
- behavior comes from the whole ordered graph, not one adapter or a filename.
solve times
public scoreboard · day 2 finish: top 3
- 12:35.8single#22 of 348 solvers
- 13:45.9time trial#3 of 323 solvers
- 14:46.4mastery#3 of 310 solvers
- #2team day finishof 264 teams that cleared it, in 18:47.6
- #5single orderof the day's 5, 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 our first start of the mode to its flag; earlier preparation was not recorded.
| mode | work to flag | attempts | wrong submits |
|---|---|---|---|
| single | 3m56s | 1 | - |
| time trial | 2s on the clock (prep not logged) | 1 | - |
| mastery | 14s on the clock (prep not logged) | 1 | - |
the clock
server timer of the winning attempt; used is attempt start to flag, left is what remained on the clock. day 1-2 deadlines were not logged per attempt.
| mode | time available | time used | time left |
|---|---|---|---|
| time trial | not recorded | 1.8s | not recorded |
| mastery | not recorded | 14.5s | not recorded |
where we got stuck
- roles had to come from the full ordered behavior graph; classifying by the adapter alone mislabeled several specimens.
- mastery shipped one combined bundle; asking for a second delivery index returned http 400.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}