Red Failure
Red Failure is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator
Scenario
Red Failure attack path
Red Failure is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator
Objective
Challenge walkthrough focused on Forensics evidence, validation, and reusable operator lessons.
Walkthrough flow
Reassemble HTTP responses from the PCAP to recover...
Deobfuscate the loader enough to recover the...
Use the DInjector encryptor format as advisory...
Decrypt the stage, then emulate the x86 additive-XOR...
Inspect the decoded stage for the persistence...
Source coverage
High source coverage
Status: complete. This article is generated from 4 sanitized Markdown sources and keeps raw flags, credentials, keys, cookies, and reusable secrets out of the rendered blog.
High confidence: the page is reconstructed from a primary walkthrough plus multiple supporting notes or evidence sources. Treat the chain as source-backed, while still checking the listed source files for sensitive values.
- Forensics/Red-Failure/writeup.md
- htb-challenge/Forensics/Red-Failure/notes.md
- htb-challenge/Forensics/Red-Failure/memory-summary.md
- htb-challenge/Forensics/Red-Failure/hypothesis-board.md
Technical Walkthrough
Writeup
Challenge
- Name: Red-Failure
- Category: Forensics
- Difficulty: Medium
- Mode: file
Summary
The capture shows a staged Windows payload delivery chain. A PowerShell loader
downloads a DInjector assembly and an encrypted shellcode blob, then runs the
blob with currentthread. Reconstructing the HTTP responses, recovering the
loader decryption material, decrypting the DInjector stage, and emulating the
x86 decoder reveals the abandoned persistence command. The flag is the secret
value set for the left-behind local administrator user.
Artifact Inventory
The provided archive extracts to files/extracted/capture.pcap. Local
reassembly recovered three HTTP objects under analysis/extracted-http/:
4A7xH.ps1: obfuscated PowerShell loader.user32.dll: .NET DInjector assembly loaded reflectively by the script.9tVI0: encrypted shellcode stage.
Analysis
analysis/pcap/http-ascii.txt and the reproducible extractor in
solve/solve.py show the HTTP transfer sequence from <TARGET>:80.
The loader constructs a command equivalent to a DInjector currentthread
execution path, with /sc pointing to /9tVI0, /dll set to
msvcp_win.dll, and decryption material assembled from string fragments.
Direct-source review of analysis/research/dinjector-encrypt.py matched the
local behavior: the encrypted stage is IV-prefixed AES-CBC using a SHA-256 hash
of the loader-supplied secret and PKCS7 padding. Decrypting 9tVI0 with the
recovered material produced an x86 encoded payload.
The first stage is an additive-XOR self-modifying decoder. It starts with a
mov esi, imm32 key, uses the 0x48 loop count, decodes from offset 0x19,
and turns the first decoded dword into a loop instruction. After 72 dwords are
decoded, the resulting stage contains the persistence command. The safe
redacted output is stored at analysis/extracted-http/9tVI0.stage2.redacted.txt.
The raw decoded shellcode is kept only in loot/.
Solve
Run:
python3 Forensics/Red-Failure/solve/solve.pyThe script:
- Parses the classic little-endian PCAP and reassembles TCP streams.
- Extracts HTTP response bodies into
analysis/extracted-http/. - Recovers the DInjector decryption material from the PowerShell loader.
- Decrypts
9tVI0as IV-prefixed AES-CBC. - Emulates the x86 decoder loop and searches the decoded stage for the flag.
- Writes the candidate to
loot/flag-candidate.txt.
Flag
Raw flag is stored in loot/flag.txt and intentionally not reproduced here.
Lessons
- For staged payload PCAPs, reconstruct the loader command before carving the
second stage; the command often contains the decryption material.
- DInjector payloads can be validated from the loader arguments plus the
upstream encryptor format before attempting deeper shellcode analysis.
- Keep decoded shellcode that contains embedded flags under
loot/, and store
only redacted views under analysis/.
Source-Backed Dossier
The sections below are merged from companion Markdown notes for the same case. They are rendered after sanitization so the article stays precise without publishing raw flags, credentials, or target-specific secrets.
Notes
Scope
- Challenge: Red-Failure
- Category: Forensics
- Difficulty: Medium
- Mode: file
- Remote instance: none
- Start time: 2026-06-13T08:17:40Z
- Operator: harness
- State file:
challenge-state.json
Harness Status
- Current phase: see
challenge-state.json - Next allowed actions: see
next-action.json - Raw flags and sensitive material stay in
loot/only. Do not paste them here.
Artifact Inventory
| File | Size | SHA256 | Type | Notes |
|---|---|---|---|---|
files/a12c7364-45e9-41b7-8fe2-dcc40c3b7eb4.zip | 51188 | <hash redacted> | Zip archive data, at least v2.0 to extract, compression method=deflate | zip entries: 1 shown in artifact inventory JSON |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-13T08:17:40Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-13T08:17:41Z | artifact inventory | analysis/artifact-inventory.json | 1 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-13T08:18:01Z | hypothesis recorded | hypothesis-board.md | Reconstruct application-layer artifacts from the PCAP and identify a leftover persistence mechanism or malicious artifact that encodes the flag. | Medium | Extract protocols, conversations, HTTP/DNS/TCP payload strings, and file transfers from capture.pcap before attempting any decoding. |
| 2026-06-13T08:18:01Z | research task | analysis/research/task-20260613T081801999021Z-474315ef.md | Research task created for advisory investigation | Medium | Record research output |
| 2026-06-13T08:18:02Z | instrumentation plan | analysis/instrumentation-plan.md | Recover the flag by reconstructing malicious/persistence artifacts from capture.pcap. | High | Stop after two parsing branches produce no new protocol or payload evidence; record closed branches and reassess with RAG/local memory. |
| 2026-06-13T08:18:30Z | checkpoint recorded | analysis/checkpoint-hypothesis_ready-20260613T081830912218Z-32f5267d.md | Checkpoint for <secret redacted> | High | Use checkpoint to drive next decision |
| 2026-06-13T08:18:49Z | RAG query | analysis/rag/rag-query-20260613T081830974192Z-9795cf15.txt | RAG helper exited 0; output saved | Medium | Record retrieval tag and validation |
| 2026-06-13T08:19:16Z | RAG record | analysis/rag-records.md | Retrieved memory tagged GENERIC | Medium | Validate or reject with live evidence |
| 2026-06-13T08:26:46Z | research record | analysis/research/research-records.md | Research tagged MATCHED | Medium | Validate against current evidence |
| 2026-06-13T08:26:56Z | evaluator | analysis/evaluator-20260613T082656459316Z-4fc80c2e.md | Proceed | High | Capture the validated flag candidate and complete the harness. |
| 2026-06-13T08:26:56Z | flag capture | loot/flag.txt | HTB-format flag captured; raw value kept in loot only | High | Write solution and run completion gate |
| 2026-06-13T08:30:02Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
- The PCAP contained three HTTP-delivered artifacts from
<TARGET>:80: a PowerShell loader (4A7xH.ps1), a .NET DInjector DLL (user32.dll), and an encrypted stage (9tVI0). - The PowerShell loader builds a DInjector
currentthreadcommand, recovers the stage decryption material through string formatting, downloadsuser32.dll, and invokesDInjector.Detonator.Boom. - Direct-source review of DInjector's
encrypt.pymatched the local artifact behavior: the stage is IV-prefixed AES-CBC using a SHA-256 hash of the loader-supplied secret and PKCS7-padded shellcode. - AES-CBC decryption produced an x86 encoded payload. The decoder stub self-modifies offset
0x19into a loop instruction and decodes 72 dwords through the end of the shellcode. - The decoded stage contains the leftover persistence command: create a local user, set its secret value to the flag, and add that user to the local administrators group.
- Raw decoded shellcode and raw flag material are stored only under
loot/;analysis/extracted-http/9tVI0.stage2.redacted.txtcontains the safe redacted view.
RAG / Advisory Memory
RAG output is advisory only. Record evaluated retrievals with:
scripts/challenge_harness.py rag-record <workspace> --query "..." --tag MATCHED|PARTIAL|MISSING|<secret redacted>|GENERIC --validation "..."Secrets/Flags
Raw flags and sensitive material stay in loot/ only. Use scripts/challenge_harness.py capture-flag to validate and record flag capture without printing the value.
Memory Summary
Metadata
- Platform: HackTheBox Challenges
- Category: Forensics
- Challenge: Red-Failure
- Difficulty: Medium
- Source workspace:
<local workspace>
Validated Solve Chain
Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.
- Reassemble HTTP responses from the PCAP to recover the PowerShell loader, DInjector assembly, and encrypted stage.
- Deobfuscate the loader enough to recover the DInjector command and decryption material.
- Use the DInjector encryptor format as advisory support: IV-prefixed AES-CBC with a SHA-256-derived key and PKCS7 padding.
- Decrypt the stage, then emulate the x86 additive-XOR self-modifying decoder loop.
- Inspect the decoded stage for the persistence command; the flag is embedded as the secret value used in that command.
Reusable Lessons
- Forensics payload captures often require chaining packet reconstruction, script deobfuscation, tool-format validation, and shellcode decoding.
- DInjector-style encrypted stages should be checked for IV-prefixed AES-CBC when a loader supplies decryption material through
/passwordor/p. - Shikata/SGN-style shellcode may decode by modifying the loop instruction itself; emulate the decoder loop instead of relying only on static strings.
- Store raw decoded shellcode under
loot/if it contains flag material; keep redacted decoded views inanalysis/.
Dead Ends
- Direct strings on the encrypted stage and first decrypted stage did not expose the flag.
- Treating
9tVI0as the file-reported OpenPGP public key type was misleading; the local loader and DInjector context showed it was encrypted shellcode.
Tool Quirks
- The local macOS environment lacked
tshark,binwalk,exiftool, native .NET tooling, and a raw x86 disassembler. - A short local Capstone virtualenv was used for confirmation, then removed. The final solve script does not require Capstone.
tcpdump, Python PCAP parsing, and Pythoncryptographywere sufficient for the final reproducible solve.
Evidence Paths
analysis/pcap/http-ascii.txtanalysis/extracted-http/4A7xH.ps1analysis/extracted-http/user32.dllanalysis/extracted-http/9tVI0analysis/extracted-http/9tVI0.decrypted.binanalysis/extracted-http/9tVI0.stage2.redacted.txtanalysis/research/dinjector-encrypt.pysolve/solve.pyloot/flag.txt
Ingestion Decision
- Proposed for LightRAG: yes
- Requires user approval before ingestion: yes
Hypothesis Board
Keep no more than 3 active hypotheses on Easy/Medium and 5 on Hard unless the user explicitly asks for breadth.
| Rank | Path | Evidence | Missing Proof | Cheapest Validation | Confidence | Status |
|---|---|---|---|---|---|---|
| 1 | Reconstruct application-layer artifacts from the PCAP and identify a leftover persistence mechanism or malicious artifact that encodes the flag. | The challenge scenario says engineers found leftover artifacts and asks to investigate a network capture for active persistence. | Extract protocols, conversations, HTTP/DNS/TCP payload strings, and file transfers from capture.pcap before attempting any decoding. | Medium | Active |
Closed Branches
| Branch | Evidence Tested | Failure Output | Reason Closed | Revisit Condition |
|---|
Technical analogy
How to remember this solve
Think of the challenge as a small system with one rule that matters more than the rest. The solve is finding that rule, validating it, and using it carefully enough to reach the final proof.
For Red Failure, keep the mental model simple: identify the trusted assumption, prove it with the smallest safe test, then automate or repeat only the part that directly leads to the flag.