Перейти к основному содержимому
Capstone Simulation & Reproducible Writeup Discipline
Урок 8 из 8

Capstone Simulation & Reproducible Writeup Discipline

Run an end-to-end expert CTF simulation using clean evidence handling, canonical challenge records in Git, and reproducible Markdown writeups that verify cleanly from scratch.

Эксперт 30 мин CTF
Этого урока пока нет на выбранном языке — показана версия на другом языке. Перевод готовится.

Цели обучения

  • Execute a disciplined capstone triage workflow from artifact hashing through root-cause confirmation
  • Maintain canonical challenge records in Git without creating duplicate entries or conflicting flags
  • Author reproducible Markdown writeups containing self-contained verification scripts and exact environment details
  • Validate finished writeups in a clean-room directory before merging or sharing results

Рекомендуется заранее: CTF Formats, Toolkits, Ethics & Structured Note-TakingMulti-Stage CTF Chains: Combining Recon, Crypto, Web & Pwn

#Why this matters

Solving an expert CTF challenge once inside a cluttered terminal does not prove you understand the vulnerability or that another engineer can reproduce your result. In real incident response, penetration testing, and team competitions, findings only become useful when someone else can verify the evidence, re-run the proof of concept, and understand the root cause without guessing missing steps.

A capstone simulation combines technical triage under uncertainty with engineering discipline. You must preserve raw forensic or web artifacts, avoid duplicating existing challenge records in shared repositories, and deliver a Markdown writeup that replays cleanly from scratch.

#Capstone triage and evidence isolation

When starting an unsolved expert-tier task, separate immutable evidence from your working experiments. In forensics (raqamli-izquarlik) and multi-category misc challenges, opening an image or archive directly with editing tools can alter timestamps, metadata, or compressed headers.

  1. IngestHash raw artifacts with sha256sum
  2. Check IndexSearch Git for existing challenge record
  3. IsolateWork inside a clean copy or branch
  4. VerifyReplay final script in a fresh directory

Begin every capstone session with four lightweight checks:

  1. Record baseline hashes: Compute sha256sum on every downloaded file before extracting or mounting it.
  2. Search before creating: Check the repository index and git log so you extend an existing record instead of creating a duplicate folder.
  3. Timebox dead ends: After 25-30 minutes on one hypothesis without progress, log what you ruled out in a short negative-result note and pivot.
  4. Keep raw vs. derived files apart: Store untouched inputs in artifacts/ (read-only) and place extracted files or scripts in work/.
Hashing artifacts and checking repository records before analysis
$ sha256sum artifacts/capture.pcapng artifacts/app.tar.gz
9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08  artifacts/capture.pcapng
4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a  artifacts/app.tar.gz
$ git grep -i "vault-audit" challenges/
$ git status -sb
## main...origin/main

If git grep returns an existing entry, read its notes first. You may discover a teammate already decoded part of the traffic or disproved a tempting false lead.

#Canonical challenge records in Git

Teams and security knowledge bases break down quickly when analysts create duplicate records for the same challenge (vault-audit, vault-audit-2, vault-audit-final). Duplicate records split flags, scatter scripts, and hide prior root-cause notes.

Enforce a single canonical challenge record rule: one challenge slug maps to one directory and one primary README.md or writeup.md. When two team members find different solve paths for the same task, append an ## Alternate Solve Path section or place a linked script inside that same canonical folder rather than opening a second challenge entry.

Practice Fragile habit Canonical discipline
Record naming task1-new, task1-v2, misc-copy Single slug challenges/<event>/<slug>/writeup.md
Alternate solves New folder with copied artifacts Section or linked script under the existing record
Artifact storage Large binaries re-committed twice Hash-verified reference or single tracked archive
Merge conflicts Overwriting teammate triage notes Feature branch per update, fast-forward or clean merge
Updating an existing challenge record without duplicationUpdating an existing challenge record without duplicationAnalystRepoBranchWriteupSearch index by slug and artifact SHA-256Existing partial triage record foundCreate feature branch update/vault-audit-solveAppend verified solve path and scriptClean merge into single canonical record

#Anatomy of a reproducible Markdown writeup

A strong writeup reads like an engineering postmortem, not a stream-of-consciousness chat log. Anyone holding the original challenge archive should be able to read your document and reproduce the flag within minutes.

Structure every capstone writeup with these core sections:

  • Metadata header: Challenge title, category, target lab endpoint (such as http://lab.local:8080), artifact SHA-256 digests, and tool/runtime versions (Python 3.11, Git 2.43).
  • Root cause summary: Two to four sentences explaining why the vulnerability existed, not just which command worked.
  • Step-by-step reconstruction: Numbered commands, exact offsets or HTTP requests, and key output snippets showing how each clue led to the next.
  • Self-contained solve script: One runnable script with no hardcoded home-directory paths, expired cookies, or unrecorded manual clicks.
  • Verification and remediation: Expected output when re-run, plus concrete engineering fixes.
markdown
# Challenge: vault-audit (veb-tahlil / raqamli-izquarlik)

- **Artifact SHA-256:** `9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08`
- **Environment:** Python 3.11, curl 8.5, lab target `http://lab.local:8080`
- **Root Cause:** Backup archive leaked in PCAP exposed an unauthenticated admin header check.

## Reproduction
1. Extract the leaked endpoint path `/internal/export` from HTTP stream 4.
2. Run `python3 solve.py --url http://lab.local:8080` from a clean directory.
3. Confirm output prints the verification marker `FLAG{...}`.

## Remediation
Remove debug exports from production builds and enforce server-side session validation.

#Clean-room replay and verification

Before declaring a capstone task complete, run a clean-room replay. Copy only the original artifacts (verified by SHA-256) and your solve.py or shell script into a temporary directory, then execute the verification steps exactly as written in your Markdown file.

bash
# Clean-room verification inside an isolated temporary directory
TMP_VERIFY=$(mktemp -d)
cp artifacts/capture.pcapng "$TMP_VERIFY/"
cp solve.py "$TMP_VERIFY/"
(
  cd "$TMP_VERIFY" || exit 1
  sha256sum -c <(echo "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08  capture.pcapng")
  python3 solve.py --input capture.pcapng --target http://lab.local:8080
)
rm -rf "$TMP_VERIFY"

If solve.py fails inside $TMP_VERIFY, you have caught a hidden dependency: an environment variable, a leftover temporary file, or a missing Python package that was not documented. Fix the script or add requirements.txt before committing to Git.

#Common mistakes and defensive takeaways

  • Duplicating existing records: Creating task-final or task-alt directories fragments knowledge. Always check existing slugs and hashes first, then update or extend the canonical record.
  • Mutating original artifacts: Running repair tools or editors directly on the sole copy of a disk image or PCAP destroys forensic chain of custody. Work on copies and keep baseline SHA-256 digests.
  • Screenshots instead of text: Images of terminal windows cannot be searched with git grep, copied by defenders, or diffed in code review. Always record exact commands and text outputs.
  • Undocumented state: Relying on an old browser cookie or hardcoded /home/user/ctf/... path breaks reproducibility. Verify from a fresh directory.
  • Committing secrets: Pushing real API keys, competition server credentials, or unredacted internal hostnames into Git history creates persistent exposure even after a later commit deletes them.

#Summary

  • Capstone simulations test both technical triage and reproducible engineering documentation.
  • Hash raw artifacts first, isolate working files from evidence, and log disproven hypotheses to avoid wasted effort.
  • Never duplicate existing challenge records: maintain one canonical slug per challenge in Git and attach alternate solves to it.
  • Validate every Markdown writeup with a clean-room replay in an empty directory before committing.

Проверка знаний

Войдите, чтобы проходить тест, завершать уроки и сохранять прогресс. Войти в систему

Практика: проверьте свои знания