SokobanHTB
SokobanHTB is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator
Scenario
SokobanHTB attack path
SokobanHTB 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 GamePwn evidence, validation, and reusable operator lessons.
Walkthrough flow
Extract and inventory the archive; identify the...
Use PE section mapping and disassembly to locate the...
Recover the Sokoban map table from .rdata; use the...
Decrypt the embedded ciphertext offline with TEA and...
Source coverage
High source coverage
Status: complete. This article is generated from 6 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.
- GamePwn/SokobanHTB/writeup.md
- htb-challenge/GamePwn/SokobanHTB/notes.md
- htb-challenge/GamePwn/SokobanHTB/memory-summary.md
- htb-challenge/GamePwn/SokobanHTB/hypothesis-board.md
- HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__GamePwn__SokobanHTB__memory-summary.md.2067ac9a7c.md
- HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__GamePwn__SokobanHTB__notes.md.65174b4ed8.md
Technical Walkthrough
Writeup
Challenge
- Name: SokobanHTB
- Category: GamePwn
- Difficulty: Easy
- Mode: file
Summary
SokobanHTB is a native Windows x64 GamePwn challenge. The level is intentionally impossible from normal gameplay, but the win path embeds enough state to recover the flag offline.
The decisive path was static reverse engineering: validate the executable and assets, locate the embedded Sokoban map, identify the TEA decrypt routine and ciphertext constants, derive the same key material from the map target coordinates, and decrypt the flag locally. The raw flag is stored only in loot/flag.txt.
Artifact Inventory
files/a12c73a3-f9b4-4665-8b99-9d0320dc157e.zip: original challenge archive, preserved unmodified.files/extracted/gamepwn_sokobanhtb/out/build/x64-release/SokobanHTB/SokobanHTB.exe: native Windows PE32+ x86-64 executable.files/extracted/gamepwn_sokobanhtb/assets/X.png,box.png,player.png: image assets referenced by the game.analysis/artifact-inventory.json,analysis/file-types.txt, andanalysis/sha256-extracted.txtrecord the inventory and hashes.
Analysis
analysis/interesting-strings.txtconfirms the binary is the Sokoban game and references SFML/OpenGL plus the three bundled assets. No plaintext flag was found through normal string search.analysis/pe-section-table.txtmaps PE sections so static virtual addresses can be tied back to file offsets. The relevant data lives in.rdata, with the executable code in.text.analysis/map-cells-validated.txtvalidates a 6x7 map table recovered from.rdata. The cell layout contains targets, player, and box state matching the challenge premise.analysis/disasm-tea-cipher-grep.txtshows the TEA final sum0xc6ef3720, which indicates a 32-round TEA-style decrypt routine.- The same disassembly output shows ten immediate ciphertext words loaded near VA
0x140005751. - Local validation in
analysis/tea-decrypt-validation.txtconfirms that decrypting those words with the recovered key material produces an HTB-format flag. The flag text in that analysis file is redacted. - Public challenge research was treated only as a lead. The accepted evidence is the local binary disassembly, map extraction, and local decrypt validation.
Solve
Run:
cd <local workspace>
python3 solve/solve.pyThe script:
- Uses the ciphertext words recovered from the executable.
- Uses the Sokoban-derived TEA key
[154, 512, 384, 640]. - Decrypts the ciphertext block-by-block.
- Verifies that the result is flag-shaped.
- Writes the raw flag only to
loot/flag.txt.
The harness then captures the flag with:
cd <local workspace>
python3 scripts/challenge_harness.py capture-flag GamePwn/SokobanHTB --from loot/flag.txtFlag
Captured through the harness. Raw flag is stored in loot/flag.txt and intentionally not reproduced here.
Lessons
- For native GamePwn binaries, an impossible map often means the intended route is to inspect the win/decrypt path rather than brute force gameplay.
- Public writeups are useful leads, but they should not be accepted until the local artifact proves the same constants and flow.
- Keep flag-bearing decrypt output in
loot/only; redact validation transcripts inanalysis/.
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: SokobanHTB
- Category: GamePwn
- Difficulty: Easy
- Mode: file
- Remote instance: none
- Start time: 2026-06-09T14:02:42Z
- 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/a12c73a3-f9b4-4665-8b99-9d0320dc157e.zip | 538807 | <hash redacted> | Zip archive data, at least v1.0 to extract, compression method=store | zip entries: 10 shown in artifact inventory JSON |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-09T14:02:42Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-09T14:02:58Z | artifact inventory | analysis/artifact-inventory.json | 1 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-09T14:03:19Z | hypothesis recorded | hypothesis-board.md | Windows game binary with an impossible Sokoban level; recover or bypass the map/win condition by static analysis of SokobanHTB.exe and bundled assets. | Medium | Run file/strings on the PE, search for map/flag/win strings, then inspect asset references and embedded constants before dynamic execution. |
| 2026-06-09T14:03:21Z | research skip | analysis/research/research-skip.md | Research intentionally skipped with recorded reason | Medium | Gate before exploit |
| 2026-06-09T14:05:05Z | research record | analysis/research/research-records.md | Research tagged MATCHED | Medium | Validate against current evidence |
| 2026-06-09T14:09:02Z | flag capture | loot/flag.txt | HTB-format flag captured; raw value kept in loot only | High | Write solution and run completion gate |
| 2026-06-09T14:11:47Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
- The archive extracts to a native Windows x64 console/game executable plus three PNG assets:
SokobanHTB.exe,X.png,box.png, andplayer.png. - Static strings identify the executable as an SFML/OpenGL Sokoban game and show asset references, but no plaintext flag string.
- PE section mapping and disassembly identify a TEA-style decrypt routine: the binary loads the TEA final sum
0xc6ef3720and ten 32-bit ciphertext words near VA0x140005751. - The relevant
.rdatamap cells are a 6x7 Sokoban grid. The validated X-mark / target coordinate material supports the key[154, 512, 384, 640]used by the decrypt path. solve/solve.pyreproduces the decrypt path locally, writes the raw flag only toloot/flag.txt, and prints only a sanitized status line.- The harness captured the flag from
loot/flag.txt; no raw flag value is present in analysis notes.
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: GamePwn
- Challenge: SokobanHTB
- Difficulty: Easy
- Source workspace:
<local workspace>
Validated Solve Chain
Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.
- Extract and inventory the archive; identify the native Windows x64
SokobanHTB.exeand bundled SFML-style assets. - Use PE section mapping and disassembly to locate the TEA-style decrypt routine and embedded ciphertext constants.
- Recover the Sokoban map table from
.rdata; use the target-coordinate-derived key material that the binary's win/decrypt path expects. - Decrypt the embedded ciphertext offline with TEA and write the raw flag only to
loot/flag.txt.
Reusable Lessons
- In impossible-map GamePwn challenges, inspect the win condition and decrypt path before trying to patch or solve gameplay.
- A recognizable crypto constant such as TEA's final sum can quickly anchor the reverse engineering path.
- Treat public writeups as leads only; validate constants, map state, and decrypt output against the local binary.
- Redact flag-shaped decrypt validation output in
analysis/; keep raw flag material inloot/.
Dead Ends
- Plain string search did not reveal a flag.
- PNG metadata and direct asset inspection did not contain the flag.
- Dynamic game execution was unnecessary once the decrypt path and constants were validated statically.
Tool Quirks
- macOS
/usr/bin/stringsdid not support the GNU-eusage attempted during triage; normal ASCII strings and LLVM tools were sufficient. llvm-objdumpand PE section mapping were enough to validate the static route without Ghidra/radare2.
Evidence Paths
analysis/file-types.txtanalysis/pe-section-table.txtanalysis/map-cells-validated.txtanalysis/disasm-tea-cipher-grep.txtanalysis/tea-decrypt-validation.txtsolve/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 | Windows game binary with an impossible Sokoban level; recover or bypass the map/win condition by static analysis of SokobanHTB.exe and bundled assets. | Archive contains SokobanHTB.exe and assets/X.png, box.png, player.png; scenario says a box is outside the walls. | Run file/strings on the PE, search for map/flag/win strings, then inspect asset references and embedded constants before dynamic execution. | Medium | Active |
Closed Branches
| Branch | Evidence Tested | Failure Output | Reason Closed | Revisit Condition |
|---|
Memory Summary
approval_required: true
Sanitized Memory Summary
Metadata
- Platform: HackTheBox Challenges
- Category: GamePwn
- Challenge: SokobanHTB
- Difficulty: Easy
- Source workspace:
<local workspace>
Validated Solve Chain
Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.
- Extract and inventory the archive; identify the native Windows x64
SokobanHTB.exeand bundled SFML-style assets. - Use PE section mapping and disassembly to locate the TEA-style decrypt routine and embedded ciphertext constants.
- Recover the Sokoban map table from
.rdata; use the target-coordinate-derived key material that the binary's win/decrypt path expects. - Decrypt the embedded ciphertext offline with TEA and write the raw flag only to
loot/flag.txt.
Reusable Lessons
- In impossible-map GamePwn challenges, inspect the win condition and decrypt path before trying to patch or solve gameplay.
- A recognizable crypto constant such as TEA's final sum can quickly anchor the reverse engineering path.
- Treat public writeups as leads only; validate constants, map state, and decrypt output against the local binary.
- Redact flag-shaped decrypt validation output in
analysis/; keep raw flag material inloot/.
Dead Ends
- Plain string search did not reveal a flag.
- PNG metadata and direct asset inspection did not contain the flag.
- Dynamic game execution was unnecessary once the decrypt path and constants were validated statically.
Tool Quirks
- macOS
/usr/bin/stringsdid not support the GNU-eusage attempted during triage; normal ASCII strings and LLVM tools were sufficient. llvm-objdumpand PE section mapping were enough to validate the static route without Ghidra/radare2.
Evidence Paths
analysis/file-types.txtanalysis/pe-section-table.txtanalysis/map-cells-validated.txtanalysis/disasm-tea-cipher-grep.txtanalysis/tea-decrypt-validation.txtsolve/solve.pyloot/flag.txt
Ingestion Decision
- Proposed for LightRAG: yes
- Requires user approval before ingestion: yes
Notes
Notes
Scope
- Challenge: SokobanHTB
- Category: GamePwn
- Difficulty: Easy
- Mode: file
- Remote instance: none
- Start time: 2026-06-09T14:02:42Z
- 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/a12c73a3-f9b4-4665-8b99-9d0320dc157e.zip | 538807 | <hash redacted> | Zip archive data, at least v1.0 to extract, compression method=store | zip entries: 10 shown in artifact inventory JSON |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-09T14:02:42Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-09T14:02:58Z | artifact inventory | analysis/artifact-inventory.json | 1 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-09T14: <REDACTED>, search for map/flag/win strings, then inspect asset references and embedded constants before dynamic execution. | |||||
| 2026-06-09T14:03:21Z | research skip | analysis/research/research-skip.md | Research intentionally skipped with recorded reason | Medium | Gate before exploit |
| 2026-06-09T14:05:05Z | research record | analysis/research/research-records.md | Research tagged MATCHED | Medium | Validate against current evidence |
| 2026-06-09T14: <REDACTED> | |||||
| 2026-06-09T14:11:47Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
- The archive extracts to a native Windows x64 console/game executable plus three PNG assets:
SokobanHTB.exe,X.png,box.png, andplayer.png. - Static strings identify the executable as an SFML/OpenGL Sokoban game and show asset references, but no plaintext flag string.
- PE section mapping and disassembly identify a TEA-style decrypt routine: the binary loads the TEA final sum
0xc6ef3720and ten 32-bit ciphertext words near VA0x140005751. - The relevant
.rdatamap cells are a 6x7 Sokoban grid. The validated X-mark / target coordinate material supports the key[154, 512, 384, 640]used by the decrypt path. solve/solve.pyreproduces the decrypt path locally, writes the raw flag only toloot/flag.txt, and prints only a sanitized status line.- The harness captured the flag from
loot/flag.txt; no raw flag value is present in analysis notes.
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.
Technical analogy
How to remember this solve
Think of the game like an arcade cabinet with a score counter behind the glass. The solve is finding where the game stores state and reading or changing it at the right moment.
For SokobanHTB, 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.