Hunt: SQLi - error-based expert (microskill)
Error-based extraction expert of the sqli split: the database error text IS the output channel. The core (hunt-sqli) owns vector mapping, baselines, quote-context probes, and the sqlmap escalation contract; this skill owns the fold technique and its discipline.
Load-bearing ideas: (1) a write endpoint whose result never renders
STILL throws errors - error-based fires where SLEEP/UNION cannot;
(2) MySQL 1265/1366/1054 "errors" are frequently connector
COERCION artifacts, not injection proof - the multi-token test kills
them.
Wiki
Hub: [[sql-injection]] - Primary page: [[sql-injection]] Anchors: [[sql-injection]] (if harvested) REFS: [[sql-injection]]
qmd on hint only: "error based sqli extractvalue updatexml fold error oracle coercion" - the sqli page first.
Shared obfuscation arsenal: hunt-sqli/references/waf-bypass.md -
blocked token ladder (one-dimension rotation), DIOS one-shot dump for
rate-limit windows, MySQL error-set beyond extractvalue/updatexml
(GTID_SUBSET, JSON_KEYS, EXP, NAME_CONST).
Paths (binding - shared with the core run)
# seat side (wsl):
ENG_DIR=/mnt/c/Users/Lenovo/Desktop/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/sqli/<host> # SHARED with hunt-sqli
# VM side:
ENG_DIR=/mnt/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/sqli/<host>
Experts write probes/sqli-error.jsonl into the core's $RUN tree.
Transport
Every VM-native command block ships through ONE documented transport:
wsl.exe -d kali-linux -u root bash -c "cd /mnt/c/Users/Lenovo/Documents/ObisidianVaults/ZTorch/ZTorch && bash scripts/vm-ssh.sh '<command>'"
- vm-ssh lands as user tz (NOT root); one argument per call; quotes
ship as base64 (
echo <b64> | base64 -d | bash). - Target-facing curls MUST use /opt/scope-shim/bin/curl by absolute path; out-of-scope dies rc 126 (never work around); UNKNOWN = ADVISORY, self-deny.
- sqlmap escalation lives in the CORE's canonical contract (vm-bg + --ignore-stdin + bounded sample) - BY REFERENCE, never a second copy here.
Entry gate
All four must pass; each is falsifiable:
Active engagement exists; the injection point is on targets//scope.md in-scope. Scope-guard is the deny.
hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md).
Core verified: $RUN/raw/vector-map.md exists AND the core pointer carries SQLI-HUNT-DONE with error named in next=. Missing = dispatch hunt-sqli core first.
Toolchain preflight (fails LOUD):
for t in /usr/bin/jq /usr/bin/python3 \ /opt/scope-shim/bin/curl; do [ -x "$t" ] || { echo "MISSING TOOL: $t"; exit 1; } done
Checklist (mandatory)
Copy checklist.md (this skill's dir) to
$ENG_DIR/hunt/sqli/<host>/sqli-error-checklist.md at run start.
Unchecked at stop = UNCHECKED lane, re-run from the first unchecked
step. SKILL.md and the checklist header agree byte-for-byte on that
copy target.
Nudge
Review-skill re-injection text (pinned; NOTE: completion-gate emits its own generic nudge - both mean: resume at the first unchecked box):
Your work was just reviewed by the review skill and it was found
that you either missed a step of analysis, or didn't generate an
artifact of sufficient proof. Look at the markdown based checklist
and the output for each step, find what you missed, and complete
that step.
Confirmation gate
NOT confirmation: a single error string containing your token (connector coercion); an error from a payload that also errors on the baseline.
IS confirmation: a fold whose output CHANGES with the payload token (multi-token decisive test), extracting real schema/data values (version()/user()/db() first, then rows), reproduced from your own written steps.
Methodology
Step 1 - Oracle establishment
Controlled syntax error -> engine-specific text? Record the engine conclusion per error shape (MySQL 1265/1366/1054 connector family, Postgres ERROR: shape, MSSQL ODBC shape, ORA- shapes). No error text anywhere = this technique closes with evidence.
Steps 2-4 - Extraction
- Folds per engine: MySQL
extractvalue(1,concat(0x7e,(SELECT ...)))/updatexml(1,concat(0x7e,(SELECT ...)),1)(~32 chars per fold - substring-walk longer values); Postgres cast errors; MSSQL CONVERT/overload shapes. - Bounded manual extraction ranked by the core's data targets: schema first, then the juicy table. Every row cites the fold output verbatim.
- Zero-row sink caveat: write endpoints that never render results still throw - error-based fires where SLEEP/UNION cannot; record the reverse too (rendering sinks where error text is swallowed).
Step 5 - FP discipline
1265/1366/1054 connector-coercion FP: fire a SECOND fold with a
different token - if the output does not track the token, it is
coercion, not injection. Multi-token decisive test on EVERY claimed
fold.
Step 6 - Exit
Append rows to the core's $RUN/candidates.jsonl;
SQLI-ERROR-DONE folds=<n> rows=<n> appended to the core pointer
$ENG_DIR/hunt-sqli-.md; _requests.md rows (lane =
hunt-sqli-error); Deadends per dead fold.
Chaining
- Fold output truncated at ~32 chars and the value matters -> substring-walk or hand off to hunt-sqli-union when a reflective sink exists.
- No error oracle -> the core's next technique (boolean/time/oob).
Validation
- Proof = fold output tracking the token, extracting real values.
- Negative control: the same request with a benign value returns no error.
False Positives
- Connector coercion errors (the multi-token test kills these).
- Framework-handled errors (logged, not rendered).
- Honeypot/WAF canary pages that "error" on anything.
Severity
CRITICAL = admin-credential/data extraction. HIGH = schema + one sensitive table. MEDIUM = version()/user() only.
N/A escapes
- "N/A: no error oracle" (error-hunt evidence recorded) An N/A tick is a claim with a reason, never a silent pass. Identical strings in SKILL.md and checklist.md.
Bitter-pill variant
Freehand run: skip checklist + numbered steps, one freehand pass over the vector map, output ONLY $RUN/analysis/bitter-pill.md. The multi-token gate survives freehand. Declare with a _requests.md row (lane = hunt-sqli-error-bitterpill).
Depth walk (mandatory)
Walk EVERY applicable row of the payload arsenal page cited above.
Record each row in $RUN/coverage-depth.md as a table
| row | state | evidence | where state is probed, blocked, or
N/A, and evidence is a probe-pair path or a Deadends.md line. A bare
probed with no evidence reference fails the completion gate
(NEEDS-REVIEW). N/A rows cite why (surface shape forbids it).
Blocked implies research: before any Deadend is claimable on a blocked
row, (a) walk the arsenal page's bypass-ladder rows for that control
class, and (b) run one wiki query AND one mcp__wigolo__search for the
specific tech-plus-control bypass. Results, or a genuine null, land in
coverage-depth.md. "No research tried" is not a claimable state.
Exit artifact + handoff
Appends into the shared core $RUN: probes/sqli-error.jsonl,
analysis/sqli-error-oracle.md, candidates.jsonl rows, pointer line
SQLI-ERROR-DONE. Consumer: triage. Findings leave ONLY through G1.
Distill: python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page techniques/web/sql-injection.md.
Stop conditions
All steps terminal; multi-token test passed on every claim; nothing written into skill dirs; no unchecked boxes above REVIEW; hunt-core stop conditions fire unchanged.
Attack surface
APPROACH: Hit login/search/sort/report params first; probe every quote context, take in-band (error/UNION) before blind (boolean/time), confirm in 1-2 manual requests then hand the dump to sqlmap (scoped, gentle, resume). AVOID: A generic 500, a WAF "SQL injection detected" string, an un-reproduced time delta, or a single-session login oracle is NOT confirmation - re-verify in a clean session, clear the cookie on a login oracle.
Cross-routing
- Load hunt-auth for auth-bypass outcomes of the injection.
- Load hunt-cloud when the DB is managed-cloud (different blast radius/escalation).
- Not this skill: NoSQL/GraphQL operator shapes (hunt-injection).