Touch
Touch is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator
Scenario
Touch attack path
Touch 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 Misc evidence, validation, and reusable operator lessons.
Walkthrough flow
Artifact review
Hypothesis
Validated solve path
Proof captured
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.
- Misc/Touch/writeup.md
- htb-challenge/Misc/Touch/notes.md
- htb-challenge/Misc/Touch/memory-summary.md
- htb-challenge/Misc/Touch/hypothesis-board.md
- HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__Misc__Touch__memory-summary.md.f362fb21b9.md
- HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__Misc__Touch__notes.md.e9e0a4be31.md
Technical Walkthrough
Writeup
Challenge
- Name: Touch
- Category: Misc
- Difficulty: Easy
- Mode: remote
Summary
The remote service exposes a Bash shell as ctf. The intended weakness is a
SUID/SGID /bin/touch. Normal touch is not directly useful for reading files,
but with umask 000 it can create root-owned world-writable files. That allows
creating /etc/ld.so.preload, pointing it to a controlled shared object, and
triggering the preload through the SUID touch binary.
The shared object cleans up /etc/ld.so.preload, marks /bin/bash SUID-root,
and copies /root/flag.txt to a readable temp file. The raw flag is stored only
in loot/flag.txt.
Artifact Inventory
Remote-only challenge:
- Target:
<TARGET>:30353 - No downloadable challenge artifact was provided.
analysis/tcp-probes.txtrecords the shell prompt behavior.analysis/touch-binary-behavior.txtrecords the SUIDtouchprimitive.analysis/preload-exploit-redacted.txtrecords the final exploit transcript
with the flag redacted.
Analysis
- Connected to the TCP service and confirmed it exposes
/bin/bash -ias user
ctf.
- Enumerated filesystem metadata and found
/home/ctf/touch -> /usr/bin/touch
and /bin/touch with mode 6755.
- Confirmed SUID
touchcreates root-owned files. - Confirmed
/root/flag.txtexists withtouch -r /root/flag.txt /tmp/ref. - Used
umask 000and SUIDtouchto create a writable
/etc/ld.so.preload.
- Uploaded a Linux x86_64 shared object and pointed
/etc/ld.so.preloadto it. - Triggered SUID
touch; the shared object ran as root, copied the flag to
/tmp/touch_flag.txt, and removed /etc/ld.so.preload.
Solve
Run:
python3 solve/solve.py --host <TARGET> --port 30353Then capture with:
scripts/challenge_harness.py capture-flag Misc/Touch --from loot/flag-candidate.txtThe solve script builds solve/preload_touch.so with Zig if needed, uploads it
over the shell, executes the preload chain, writes the raw flag candidate to
loot/flag-candidate.txt, and keeps the normal transcript redacted.
Flag
Raw flag is stored in loot/flag.txt and intentionally not reproduced here.
Lessons
- SUID binaries that seem low-impact can become powerful when they can create
privileged files with attacker-controlled permissions.
umaskmatters:touchcreates files using process permissions masked by the
current shell umask.
- Keep
/etc/ld.so.preloadcleanup inside the payload so a failed exploit does
not leave the target in a noisy state.
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: Touch
- Category: Misc
- Difficulty: Easy
- Mode: remote
- Remote instance: <TARGET>:30353
- Start time: 2026-06-09T13:22: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 |
|---|---|---|---|---|
| — | 0 | — | remote-only or no provided files | No local artifacts found under files/ |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-09T13:22:40Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-09T13:22:40Z | artifact inventory | analysis/artifact-inventory.json | 0 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-09T13:23:00Z | TCP probe | analysis/tcp-probes.txt | Service exposes an interactive ctf Bash shell, not a text-only prompt | High | Enumerate bounded shell metadata |
| 2026-06-09T13:26:00Z | SUID triage | analysis/touch-binary-behavior.txt | /bin/touch is mode 6755 and creates root-owned files when executed by ctf | High | Use SUID touch as the privilege primitive |
| 2026-06-09T13:28:00Z | root-file oracle | analysis/touch-reference-root-probe.txt | touch -r /root/flag.txt succeeds, proving a root-only flag file exists | High | Build a safe preload payload |
| 2026-06-09T13:31:00Z | exploit | analysis/preload-exploit-redacted.txt | umask 000 plus SUID touch created writable /etc/ld.so.preload; preloaded shared object copied the flag to /tmp and marked Bash SUID | High | Capture flag with harness |
| 2026-06-09T13:23:03Z | hypothesis recorded | hypothesis-board.md | Interactive TCP state-machine or command-word puzzle driven by the scenario words push/touch/satisfaction | Medium | Capture banner and test harmless newline/keyword probes. |
| 2026-06-09T13:23:03Z | research skip | analysis/research/research-skip.md | Research intentionally skipped with recorded reason | Medium | Gate before exploit |
| 2026-06-09T13:24:12Z | checkpoint recorded | analysis/checkpoint-analysis-20260609T132412426390Z-bcd68f7c.md | Checkpoint for ANALYSIS | High | Use checkpoint to drive next decision |
| 2026-06-09T13:24:30Z | RAG query | analysis/rag/rag-query-20260609T132420528486Z-f5346cb6.txt | RAG helper exited 0; output saved | Medium | Record retrieval tag and validation |
| 2026-06-09T13:24:57Z | local memory search | analysis/research/local-memory-search-20260609T132457366187Z-d6030060.md | Found 5 safe prior-note result(s) | Medium | Record useful result or skip |
| 2026-06-09T13:25:09Z | RAG record | analysis/rag-records.md | Retrieved memory tagged MISSING | Medium | Validate or reject with live evidence |
| 2026-06-09T13:25:22Z | local memory record | analysis/local-memory-records.md | Prior local notes reviewed as fallback/advisory context | Medium | Validate against current evidence |
| 2026-06-09T13:25:33Z | evaluator | analysis/evaluator-20260609T132533376566Z-75ffaf09.md | Proceed | High | Enumerate shell environment and identify the required touch/push condition. |
| 2026-06-09T13:35:06Z | source audit | analysis/source-audit.md | Source audit recorded | High | Gate before exploit |
| 2026-06-09T13:35:07Z | flag capture | loot/flag.txt | HTB-format flag captured; raw value kept in loot only | High | Write solution and run completion gate |
| 2026-06-09T13:35:19Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
- Remote service drops to a
ctfBash shell. /bin/touchis SUID/SGID root (6755), and/home/ctf/touchlinks to it.- With
umask 000, SUIDtouchcan create a root-owned but world-writable/etc/ld.so.preload. - A Linux x86_64 shared object preloaded through that file runs as root when SUID
touchis invoked. - The payload removes
/etc/ld.so.preload, marks/bin/bashSUID-root, and copies/root/flag.txtto/tmp/touch_flag.txt.
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: Misc
- Challenge: Touch
- 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.
1.
Reusable Lessons
-
Dead Ends
-
Tool Quirks
-
Evidence Paths
-
Ingestion Decision
- Proposed for LightRAG: yes/no
- 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 | Interactive TCP state-machine or command-word puzzle driven by the scenario words push/touch/satisfaction | Remote-only Misc service is reachable on <TARGET>:30353 and scenario text emphasizes push/touch/satisfaction verbs. | Capture banner and test harmless newline/keyword probes. | 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: Misc
- Challenge: Touch
- 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.
1.
Reusable Lessons
-
Dead Ends
-
Tool Quirks
-
Evidence Paths
-
Ingestion Decision
- Proposed for LightRAG: yes/no
- Requires user approval before ingestion: yes
Notes
Notes
Scope
- Challenge: Touch
- Category: Misc
- Difficulty: Easy
- Mode: remote
- Remote instance: <TARGET>:30353
- Start time: 2026-06-09T13:22: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 |
|---|---|---|---|---|
| — | 0 | — | remote-only or no provided files | No local artifacts found under files/ |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-09T13:22:40Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-09T13:22:40Z | artifact inventory | analysis/artifact-inventory.json | 0 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-09T13:23:00Z | TCP probe | analysis/tcp-probes.txt | Service exposes an interactive ctf Bash shell, not a text-only prompt | High | Enumerate bounded shell metadata |
| 2026-06-09T13:26:00Z | SUID triage | analysis/touch-binary-behavior.txt | /bin/touch is mode 6755 and creates root-owned files when executed by ctf | High | Use SUID touch as the privilege primitive |
| 2026-06-09T13: <REDACTED>, proving a root-only flag file exists | High | Build a safe preload payload | |||
| 2026-06-09T13: <REDACTED> | |||||
| 2026-06-09T13:23:03Z | hypothesis recorded | hypothesis-board.md | Interactive TCP state-machine or command-word puzzle driven by the scenario words push/touch/satisfaction | Medium | Capture banner and test harmless newline/keyword probes. |
| 2026-06-09T13:23:03Z | research skip | analysis/research/research-skip.md | Research intentionally skipped with recorded reason | Medium | Gate before exploit |
| 2026-06-09T13:24:12Z | checkpoint recorded | analysis/checkpoint-analysis-20260609T132412426390Z-bcd68f7c.md | Checkpoint for ANALYSIS | High | Use checkpoint to drive next decision |
| 2026-06-09T13:24:30Z | RAG query | analysis/rag/rag-query-20260609T132420528486Z-f5346cb6.txt | RAG helper exited 0; output saved | Medium | Record retrieval tag and validation |
| 2026-06-09T13:24:57Z | local memory search | analysis/research/local-memory-search-20260609T132457366187Z-d6030060.md | Found 5 safe prior-note result(s) | Medium | Record useful result or skip |
| 2026-06-09T13:25:09Z | RAG record | analysis/rag-records.md | Retrieved memory tagged MISSING | Medium | Validate or reject with live evidence |
| 2026-06-09T13:25:22Z | local memory record | analysis/local-memory-records.md | Prior local notes reviewed as fallback/advisory context | Medium | Validate against current evidence |
| 2026-06-09T13:25:33Z | evaluator | analysis/evaluator-20260609T132533376566Z-75ffaf09.md | Proceed | High | Enumerate shell environment and identify the required touch/push condition. |
| 2026-06-09T13:35:06Z | source audit | analysis/source-audit.md | Source audit recorded | High | Gate before exploit |
| 2026-06-09T13: <REDACTED> | |||||
| 2026-06-09T13:35:19Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
- Remote service drops to a
ctfBash shell. /bin/touchis SUID/SGID root (6755), and/home/ctf/touchlinks to it.- With
umask 000, SUIDtouchcan create a root-owned but world-writable/etc/ld.so.preload. - A Linux x86_64 shared object preloaded through that file runs as root when SUID
touchis invoked. - The payload removes
/etc/ld.so.preload, marks/bin/bashSUID-root, and copies/root/flag.txtto/tmp/touch_flag.txt.
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 challenge like a timed puzzle booth. If the task is too fast or repetitive for a person, the intended move is usually to write a small helper that performs the simple action perfectly.
For Touch, 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.