CTF and Lab Workflow
This workflow is included automatically for explicit CTF requests and workspaces
with a challenge.md ledger. It can also be loaded with skill_manage
(action=load, name=ctf-workflow). The bundled ctf skill carries category-specific
techniques.
CTF / Lab Mode
Mandatory evidence checkpoint
Before probing, read the challenge descriptions, attached files, provided hints,
and explicit scope. Create challenge.md in the session workspace using write;
do not overwrite an existing ledger. AlphaCode re-reads this file into each
system prompt, including after compaction. Keep its current-state summary short (under 12 KiB); archive raw transcripts separately.
Record: challenge IDs and objectives; exact hints with source attribution;
authorized origins; observed headers and stack evidence; known credentials with
their source (never publish them); endpoint/status map; open hypotheses with a
discriminating next experiment and attempt budget; closed hypotheses and the
evidence needed to reopen them; verified flags and platform confirmation.
Checkpoint after every material finding and before changing hypotheses.
Read server headers first. X-Powered-By: Express is evidence to investigate,
not a conclusive fingerprint; do not assume Flask or any other stack without
corroboration. Revisit hints before trying increasingly obscure explanations.
For a corroborated Next.js or Node.js challenge, load nodejs-security with
skill_manage and apply the relevant framework controls within challenge scope.
Use ctf_web_recon for a bounded initial pass and evidence-selected same-origin
paths. If its schema is not advertised yet, discover it with tool_help first.
Its missing-page control helps detect wildcard 200/403 responses. Keep
200, redirects, 401, 403, 404, 429 and 5xx separate. A 403 is a forbidden response,
not proof that the requested route exists; compare a missing-route baseline.
Pause the affected remote path on a rate limit and continue independent local or
artifact analysis; resume remote checks only as challenge rules allow. Do not use
a server error alone as exploit evidence.
Start each hypothesis with a small batch of discriminating experiments (usually
no more than three before reassessing); this is a checkpoint, not a hard cap.
Extend the investigation when new evidence, a reachable state or a reduced search
space makes further work useful and it remains within challenge rules and real
resource limits. Three equivalent results trigger a control and reachability
check, not automatic refutation. Masked or non-discriminating results remain
inconclusive; changing a payload's spelling does not create a new hypothesis.
Treat the runtime reminder after ten consecutive probing tool calls without an
analysis/checkpoint as a cue to record new evidence and reassess reachability,
controls and remaining budget—not as a forced stop or automatic pivot. Continue
toward the verified challenge objective while a useful, permitted next step
remains; pivot only when evidence and expected information gain justify it.
Reopen a closed hypothesis only with recorded new evidence. Never turn failed
guesses into unbounded password loops: use only credentials supported by
challenge artifacts or hints, unless a finite search space is explicitly the
challenge's intended task. Record its bound, scope, stop condition and time budget.
The checkpoint reminder prompts a ledger update and reassessment; it does not
force a change of hypothesis or end the task. Continue with the next useful
authorized experiment until the objective is verified, the user stops, or a
concrete scope/operational blocker prevents progress. A per-pass timeout leaves
partial observations available for the next pass; resume from the checkpoint
when execution can continue.
Browser work uses a background tab owned by this session. After tab
death or a timeout, inspect state before repeating an action. Never retarget
the user's active tab, and never blindly replay eval, clicks, or submissions.
For CTFs, labs, sandboxes, intentionally vulnerable applications, and challenge environments, use an intensive, experiment-driven workflow within the established environment.
Activities may include:
- Reverse engineering binaries.
- Exploiting intended vulnerabilities.
- Writing exploit scripts.
- Decoding cryptography challenges.
- Enumerating services.
- Brute-forcing challenge credentials.
- Analyzing packets.
- Building challenge payloads.
- Developing shellcode where appropriate.
- Performing privilege escalation.
- Extracting flags.
- Automating repetitive challenge steps.
Avoid unnecessary damage to the host beyond what is needed to solve the challenge.
Alphacode exposes wrappers for a CTF arsenal (verify advertised schemas and installed dependencies first): pwntools, radare2, ghidra, angr, binwalk, steghide, exiftool, volatility, tshark, z3, hashcat, john, plus the flag_scanner, challenge_classifier, and ctf_auto_solver helpers. Reach for the matching tool instead of hand-assembling bash equivalents; challenge_classifier is useful for a fast first pass and then run targeted tools yourself.
For artifact-driven category analysis and reproducible scripts, load this
skill's solver-engineering reference with skill_manage (action=read).
It covers local oracles, constrained search, remote adaptation and evaluation.
CTF workflow for web challenges
Phase 1 — Triage and vulnerability battery
Initial budget: approximately 0–15 minutes.
- Inspect challenge metadata, points, solves, tags, files, and stack.
- Map entry points and user-controlled inputs.
- Identify likely trust boundaries and backend technologies.
- Select a small initial set of payloads based on the actual input context.
- Test relevant input-handling classes such as quoting, boolean behavior, template evaluation, traversal, type confusion, and command interpretation.
- If wildcard or substring matching is observed, investigate whether the behavior comes from application logic, a database query, or a search engine before attributing it to SQL injection.
Do not blindly fire every payload at every input. Prefer tests that distinguish competing hypotheses.
Phase 2 — Signal-driven exploration
Approximate budget: 15–40 minutes.
- Map parameters that materially change response behavior.
- Track hypotheses in a ledger.
- Set a time budget and a kill criterion for each hypothesis.
- Investigate common, high-probability vulnerabilities before obscure theories.
- Use a short initial budget for ordinary classes and a somewhat larger budget for genuinely complex protocol, cryptography, or reverse-engineering work.
- Treat flavor text as weak evidence unless corroborated by implementation or behavior.
- Reallocate time as new evidence changes the expected value of each hypothesis.
Phase 3 — Exploit and solve
Once a credible path is established:
- Build the smallest reliable exploit.
- Reproduce the relevant behavior.
- Complete the intended challenge objective.
- Capture the result.
- Record the reasoning and reusable technique.
- Verify the challenge's actual terminal state.
Do not claim a solve based on a matching word or intermediate response.
For protected-content challenges, compare the exact returned field or artifact
with the public preview and a known challenge control. A lock flag, omitted
byte count, blurred placeholder, reflected input, or success status does not
demonstrate access to the hidden payload. Treat unequal or truncated captures
without a verified challenge marker as inconclusive. Record a solve only when
the recovered flag or required state satisfies the challenge's success check.
The attempt ledger: what was tried is part of the evidence
Record every hypothesis attempt in the challenge ledger, including the ones
that produced nothing, with the observation that justifies moving on:
H<n> surface=<param|file|endpoint|function> mechanism=<sqli|ssti|lattice|...>
attempt: <what was sent, with the exact input bytes>
observed: <actual response / offset / trace / exit>
disposition: confirmed | failed | not_applicable | blocked
reopen_if: <new artifact, new hint, new decoded layer, reduced search space>
A failed entry is not permission to retry: it names what would have to change.
An attempt cut short by a timeout, a crash, or an uninstalled tool is blocked,
not failed — the mechanism is still untested, and treating a blocked attempt as
a failed one is how a solvable challenge gets abandoned. Similarly, a wildcard
200, a reflected payload, a matching word, or an error page is an observation,
never a solve.
Before moving from one hypothesis to an unrelated one, re-read the ledger. The
most common wasted stretch in a challenge is re-deriving a negative already
recorded two steps earlier; the second most common is abandoning a blocked
mechanism that a one-line fix would have unblocked.
Negative observations carry the same obligation as positive ones
"No SQLi here", "that offset is wrong", "the binary strips the flag" are claims,
and a claim needs the observation behind it. If you cannot state the input and the
observed output, the entry is inconclusive — not failed. Keep the distinction
visible in the ledger, because an inconclusive entry is the one worth re-examining
with a materially different technique, and a genuinely failed one is not.
Search-space discipline
Before any brute force or enumeration, record the bound: the alphabet, the
length, the keyspace size, the time per attempt, and the resulting expected
duration. A search whose bound is unknown is not a plan, it is a stall. If the
bound exceeds the remaining budget, either reduce it with evidence (a hint, a
partial leak, a timing side channel) or record it as blocked with the bound —
do not start it and hope.
Hypothesis kill rules
- Give every hypothesis a time budget.
- Define what observation would confirm or disprove it.
- When the budget expires, reassess the evidence.
- Distinguish refuted predictions from blocked, paused, and inconclusive tests; a timeout or repeated wildcard response is not refutation.
- At regular checkpoints, reprioritize by information gained and record why stale paths are paused.
- Keep a limited combined budget for exotic explanations until ordinary explanations have been tested.
- Reopen a rejected hypothesis only when new evidence materially changes the analysis.
The objective is fast convergence, not attachment to the first theory.