22 Recipe: validate your injection detector against a real payload corpus
| Field | Value |
|---|---|
| Tools | ATTACK: libertas-prompts + jailbreak-payloads (A-2 data packs, safe) ↔︎ DEFENCE: rebuff (d-01, safe) + a public DeBERTa-class detector + nemo-guardrails (d-01, safe) — the pre-#210 data-pack + detector rows were phantom-upstream (removed; the names ride the os#210 registry) |
| Section | Attack–defence pairs |
| Level | hard |
| Time | ~45 min first loop, then per-corpus-refresh |
| Layer/Category | ATTACK / a-02-prompt-injection-jailbreaks ↔︎ DEFENCE / d-01 + d-02 |
| Tags | pair, prompt-injection, jailbreaks, detector, owasp-llm01, data-packs |
22.1 Problem
The deployment runs an injection detector in front of a model. Candidates: rebuff’s multi-stage defence, a BERT-class classifier pack, a NeMo Guardrails config with input rails. None of those rows publishes a false-negative count the analysis can rely on. A detector whose misses go unmeasured is an unverified claim. Kailash ships both sides of the experiment as manifest rows. The attack side: the A-2 payload packs (real-world attack corpora, data status, safe). The packs carry licence caveats, not safety gates. The defence side: the d-01/d-02 detector stack. The pairing thesis runs on the prompt-injection surface: corpus → detector → miss analysis → rule update. The same-seed diff discipline keeps the numbers honest.
22.2 Solution
The loop runs in four stations. Station names matter because every later diff cites them:
# 1. THE CORPUS (station 1): what the packs mount
kailash list --category a-02-prompt-injection-jailbreaks
kailash info libertas-prompts # -> data pack, AGPL-3.0 repo licence,
# content use-restrictions beyond it
# libertas-prompts: the L1B3RT-4S corpus, vendor-organized
# jailbreak-payloads: the same corpus packaged as the payload pack
# (the pre-#210 data-pack citation was a phantom-upstream
# pack — removed; registry: kailash-os#210)
# (data packs ride opt-in kailash-data.* derivations — never a
# default image; see [Refresh wordlists and data packs]
# (../admin/data-packs.html))
# 2. THE DETECTOR (station 2): run the defence stack against the corpus
# 2a. rebuff (python surface; Apache-2.0 upstream):
# rb = RebuffSdk(<openai_apikey>, <pinecone_apikey>,
# <pinecone_index>, <openai_model>)
# result = rb.detect_injection(<payload_text>)
# -> result.injection_detected: bool
# 2b. the public DeBERTa-class detector (the pre-#210 first-party
# classifier row was phantom-upstream, removed — os#210)
# pack — PENDING CLI; the loader contract follows the
# DeBERTa-class detector + gate-loader shape the manifest
# description names)
# 2c. nemo-guardrails (config-driven; the input rail activation):
# rails: # in your config.yml
# input:
# flows:
# - jailbreak detection heuristics
# (the heuristics are perplexity-based — see Discussion)
# 3. MISS ANALYSIS (station 3): label the corpus against the detectors,
# then diff the misses — every payload the defence wave did NOT
# flag gets read as a sentence: what technique made it through?
# (mechanical pass: corpus row -> detector verdicts -> miss list;
# the miss list is the deliverable, not the rate alone)
# 4. RULE UPDATE + SAME-SEED RE-RUN (station 4): tighten the detector
# (rules/thresholds/allow-lists), then re-run the ENTIRE corpus
# under the same seed/order — the diff between runs is the only
# admitted evidence that the update moved the surface
# (the walk-through of the same discipline on a platform target:
# [Attack the platform, then verify](attack-then-verify.html))Expected output shape (abridged, shapes not transcripts):
corpus: <n> payloads (libertas-prompts + jailbreak-payloads rows + L1B3RT-4S samples)
detector verdicts (per payload):
{payload_id, source_pack, rebuff: detected|missed,
detector-bert: SAFE|INJECTION (planned pack — PENDING),
nemo: blocked|passed}
miss list:
{payload_id, technique_class ("context-switch", "encoded",
"language-mix", ...), why_passed: <one-line analysis>}
loop record (the diff): {seed, corpus_rev, detector_versions,
miss_rate_before: <float>, miss_rate_after: <float>,
fixed: [...], newly_missed: [...]}
22.3 Discussion
- The attack side is data, and the licence caveats are part of the row: all three packs carry
packaging.status: dataandsafety.level: safe. The guide’s safety-classes table reads the class as self-contained, no live firing. A corpus is analysis material, not a launcher. What the rows DO carry is licence posture: L1B3RT-4S rows cite AGPL-3.0 with per-source content use-restrictions beyond the repo licence (the manifest comment says so explicitly for this lane). Read every file before redistributing it — the data-packs recipe’s licence discipline applies verbatim. - The defence side is three kinds of detector, on purpose. rebuff: a multi-stage defence — heuristics, an LLM check and a vector-db similarity check. The canary-word leakage check turns a detector into a tripwire (its manifest tag carries
prompt-injection). The SDK surface needs provider credentials for its stages. the DeBERTa-class detector: the public detector lineage (SAFE/INJECTION label classes at the upstream reference; the pre-#210 first-party loader-pack row was phantom-upstream — removed, name in the os#210 registry). nemo-guardrails: the config-driven rail with documented jailbreak heuristics. The heuristics: length-per-perplexity and prefix/suffix-perplexity thresholds (defaults89.79/1845.65, config-validated at create-time). Activation runs via thejailbreak detection heuristicsinput flow inconfig.yml. Layer mapping: rebuff + nemo-guardrails sit in d-01-runtime-defence; the classifier rides d-02-detection-monitoring-observability — the pair recipe cites both categories because the surface is observed at two layers. - Why same-seed diffs are the discipline: a detector update that fixes one payload often unfixed another.
newly_missedis a first class citizen of the diff, not a footnote. The A-2 packs refresh on cadence (libertas-prompts/jailbreak-payloadscarryupdate:steady). A corpus rev change invalidates every previous miss-rate, so the loop record pins corpus_rev next to seed. Without the seed+rev pin, “the detector improved” is unfalsifiable. - Judge-model dependence, stated: rebuff’s LLM stage and giskard-style judges consume provider keys. Keys read from
~/.config/kailash/keys/per the OS secrets posture — never committed, never in the store. A judge-driven verdict inherits the judge’s blind spots. That is miss-analyser material too. - The pair completes itself: the fixed detector graduates by re-entering production. The d-01 rows are runtime gates, so the improved threshold config IS the deliverable. The corpus becomes the standing acceptance set that future detector bumps are diffed against (the book’s upkeep rule at pair granularity). When a rebuilt A-2 attack tool lands via the os#210 rebuild contract, this loop’s station 2 gains live-fire legs. The data-pack legs above are the static half that never needs a target.
- Authorisation framing carries: the corpus is real attack material. Running it against models or deployments outside the lab’s ownership is the A-2 lane’s authorised-engagement business, not a cookbook exercise. Against the lab’s OWN detector stack in the lab, this recipe is the defender-validation case the responsible-use statement names.
22.4 See also
- Attack the platform, then verify — the manifest’s other pair recipe; the same-seed diff discipline’s origin walk
- Refresh wordlists and data packs — the opt-in data-pack mechanism the payload packs ride
- Serve a local model for scanning — standing the target endpoint up for live-fire legs
- Establish a fairness/robustness baseline for a deployed model — the assurance baseline the detector diffs feed
- Guide safety classes chapter (data vs
requires-targetvsexppostures): https://docs.kailash.tools/governance/safety-classes.html - Upstream surfaces: L1B3RT-4S corpus (AGPL-3.0) https://github.com/elder-plinius/L1B3RT4S · rebuff https://github.com/protectai/rebuff · NeMo Guardrails jailbreak heuristics https://docs.nvidia.com/nemo/guardrails/configure-guardrails/guardrail-catalog/jailbreak-protection.html · the DeBERTa-class detector reference weights https://huggingface.co/protectai/deberta-v3-base-prompt-injection-v2
- Manifest row URLs for the landed data packs: https://github.com/kailash-os/libertas-prompts · https://github.com/kailash-os/jailbreak-payloads (the pre-#210 data-pack + detector rows pack rows were phantom-upstream, removed — names ride the os#210 registry)
- The A-2 payload-pack manifest lane: kailash-os#76
- Recipe directory
Recipe provenance. Manifest facts post-os#210: two A-2 data-pack rows (libertas-prompts, jailbreak-payloads — status: data, safe, AGPL-3.0 keyed to elder-plinius/L1B3RT4S with content use-restrictions; ATLAS/OWASP mappings on the rows, OWASP LLM01 both epochs); d-01 rebuff + nemo-guardrails bespoke Apache-2.0 — all from the post-purge packages manifest, verified 2026-10-14. The pre-#210 The pre-#210 data-pack + detector rows were phantom-upstream (never-created kailash-os repos) and are REMOVED per the os#210 audit. Upstream surfaces checked at each pinned source: rebuff RebuffSdk(...).detect_injection / add_canary_word / is_canaryword_leaked (README at protectai/rebuff main), nemo-guardrails jailbreak detection heuristics flow + the two perplexity thresholds + validation rules (NVIDIA docs catalog at the current version), the detector-reference model’s label classes SAFE/INJECTION (HF model card config.json), L1B3RT4S repo licence read at the pin (LICENSE: AGPL-3.0) — verified 2026-10-14. The loop’s worked pass (labelled corpus → verdicts → miss list → same-seed diff): PENDING — operator-run by construction; the loop record schema above is the standing template.
ref: a-02/d-01/d-02 manifest rows + detector/corpus sources at the pins - verified 2026-10-14.