Delete, Replace, Repair and Port: Component Attribution in BARBICAN, a Layered Prompt Injection Gateway for MCPDeletion, Substitution, Repair and Transplant: Component Attribution in BARBICAN, a Layered Prompt-Injection Gateway for MCP
The authors apply deletion/substitution/repair/transplant interventions to their own MCP prompt-injection gateway BARBICAN, and state that repairing the arbiter raises AUC from 0.392 to 0.855 yet instead lowers system recall from 80.67% to 80.34%.
- Layered prompt injection defenses commonly use deletion-based ablation to attribute each layer's contribution, but the authors argue that under cascaded routing, deletion also changes the state of that layer's input and the subsequent rules, so the attribution numbers cannot be interpreted directly.
- The authors conduct 15+12 actual runs of interventions on their own MCP gateway BARBICAN: deletion, constant substitution, tokenizer repair, and transplantation of external classifiers, and propose reporting the class base rate of the routing band; they also audit the provenance of corpus labels and compare against 4 public detectors.
- The arbitration band is 96.82% malicious; after fixing the arbiter, AUC went from 0.392 to 0.855, yet system recall fell from 80.67% to 80.34%, and a constant "malicious" stub reached 80.77%; deletion versus replacement differs by a factor of 4.8; under distribution shift, ProtectAI v2 outperforms the gateway on both detection and false positives.
- The authors note: only one system and one corpus; the system is the authors' own; source code and corpus text are not yet public; the repair intervention is opportunistic; and operating-point effects were measured only at the 8 recorded points (Section 7).
- Threat model
- The paper does not propose an attack but analyzes a defense system: indirect prompt injection enters the model context via text returned by MCP tools; the victim system is the fail-closed gateway BARBICAN, located between the LLM client and the MCP servers, mediating tool calls.
- Evaluated models
- BARBICANDeBERTa-v3-smallintfloat/multilingual-e5-small
- Benchmarks
- BARBICAN 自有 25,000 条基准(20,519 条内部生成 + 4,481 条公开记录)InjecAgentLLMail-InjectBIPIAWildJailbreak独立检查集(3,003 条原始集合记录)
- Metrics
- RecallFPRF1MCCAUCMcNemar 精确检验决策改变数
The paper performs component attribution on BARBICAN, a layered prompt injection gateway for MCP, showing that when a single classifier within the layered defense fails completely, the end-to-end metrics barely move. Its arbitration stage received corrupted text throughout the evaluation due to a tokenizer configuration error; after the fix, that stage's AUC rose from 0.392 to 0.855, yet system recall instead fell from 80.67% to 80.34%, and a stub that always answers malicious reaches 80.77%. The reason is that 96.82% of the inputs sent by upstream routing were malicious, and the execution design lets conviction verdicts block while acquittal verdicts can only pass through one narrow branch; removing this component loses 673 detections, replacing its verdict with a constant changes only 12 to 140 of 25,000 decisions, and porting a ready-made classifier with AUC 0.916 changes only 16 of them. On this basis the authors argue that ablation numbers for routed stages must be interpreted together with the input class proportions, and that deletion experiments need replacement experiments as controls.
Paper analysis
What problem does this paper attempt to solve?
The authors test whether deletion-based ablation of a layered defense can truly attribute component contributions, and give a negative answer based on actual measurements with their own gateway.
Core problem: layered prompt-injection defenses use "delete a layer and rerun the benchmark" ablation to attribute that layer's contribution, and the authors argue that in cascaded routing systems this convention does not measure the component itself.
- Setting and importance: MCP has language models routinely call external tools, and text returned by tools enters the context and "looks like instructions," which the model cannot reliably distinguish; defenses therefore converge on layered structures (rules→semantics→neural arbitration→fail-closed default), each layer has latency or inference cost, and it must be stated which layer is "worth its cost" (Section 1).
- Shortcomings of existing methods: The authors point out that deletion-based ablation in a cascade removes the component together with its dedicated routing predicate, score interval, and fallback rule when there is no response, and the reported drop is the joint contribution of the three; the interpretability and statistics literature has long concluded that zero ablation overestimates component importance, yet the security field still follows the deletion convention (Sections 1, 2.1).
- Core observation: Routing means expensive stages receive not random samples but the residual that upstream stages cannot decide, and BARBICAN's arbitration band is 96.82% malicious; at this base rate a constant strategy of "always judge malicious" is strong, and component quality can hardly manifest as a change in end-to-end metrics (Section 4.2).
- What the paper proposes: Four interventions (deletion, substitution, repair, transplant) on the authors' own fail-closed gateway BARBICAN, totaling 15+12 actual runs, and reporting requirements: for any stage that receives routed traffic, ablation numbers must be reported together with the class base rate of its band, and deletion experiments must be paired with substitution experiments (Sections 4, 6.3).
- Threat model (the attacks the analyzed system defends against, not attacks by this paper):
- Attacker goal: inject instructions into the model via untrusted text such as retrieved documents, code comments, and error messages.
- Attack path: indirect prompt injection, with text entering the model context via MCP tool returns.
- Victim system: the inline, fail-closed gateway BARBICAN between the LLM client and MCP servers.
- The paper sets no assumptions about the attacker's knowledge or capabilities; this paper proposes no new attack.
What related research exists?
Related work falls into four groups: layered MCP defenses, ablation and variable importance, cascaded system performance analysis, and safety evaluation effectiveness.
Layered defenses and their ablation convention
- ShieldMCP [3] intercepts at the tool layer and combines structural analysis with semantic intent verification; a tool-poisoning threat-modeling study [4] likewise recommends a multi-layer arrangement; BARBICAN belongs to this family.
- Spotlight-Guard [17] states that "component ablation isolates each layer's contribution," PromptGuard [18] quantifies the "individual and combined contributions" of its regex and MiniBERT components, and the BIPIA companion defense study [19] measures each component's contribution to the overall defense—the paper names these three as representatives of the deletion convention and notes that none of them reports the class base rate of the traffic received by the ablated stage.
- The authors' own earlier work [21] (a three-layer MCP gateway) likewise reads differences between nested configurations as component contributions; the authors state that this paper is in part a correction of what that paper missed.
Deletion, intervention, and variable importance
- Mechanistic interpretability: Li and Janson [23] state that zero ablation, mean ablation, and resampling ablation systematically exaggerate the importance of transformer circuit components; Leavitt and Morcos [24] argue for measuring with interventions rather than correlations; activation patching and interchange intervention [25–28] provide formal tools for "replacing a component's output rather than deleting it."
- Statistics: Hooker et al. [33] argue that permuting or dropping covariates cannot measure their importance; leave-one-covariate-out [34] and conditional, Shapley-like alternatives [35–37] were developed because marginal removal is misleading under correlation. The authors state that bringing this distinction into layered security systems is one of this paper's contributions.
Decoupling of end-to-end performance from component quality
- Sculley et al. [61] describe entangled ML systems in which improving a single component may worsen the whole (ensemble setting); Saberian and Vasconcelos [62] formalize that optimizing local objectives stage by stage does not optimize the entire cascade.
- Axelsson's base-rate analysis [66] and Sommer–Paxson [67] point out the gap between detector output and operational interpretation; the authors state that this paper uses Axelsson's argument in reverse: routing raises the base rate seen by the arbitration stage, making its accuracy irrelevant.
Evaluation validity and single-system re-execution
- Arp et al. [38] enumerate recurring pitfalls in security ML (sampling bias, spurious correlations, selective data snooping); Pendlebury et al. [39] address spatiotemporal distribution shift in malware classification; [41–43] point out that defenses tuned on curated injection datasets degrade on unseen phrasings.
- The closest methodological precedents: large-scale re-evaluation of adversarial-example defenses [71–73] and Teuwen et al.'s [76] case study of a single alert-classification system (whose reported performance was mainly attributed to label imbalance in the input data); the authors state that the difference from [76] is that this paper re-examines its own system.
Baselines and benchmarks: the external baselines are four public detectors—Prompt Guard 2 (86M, 22M) [56], the ProtectAI DeBERTa-v3 prompt-injection classifier [57], and Llama Guard 3 (1B) [55]; LLM Guard 0.3.16 [50] and NeMo Guardrails 0.24.1 [45] are additionally run component by component on the check set. The benchmarks are BARBICAN's own 25,000-item corpus (including public records from InjecAgent, LLMail-Inject, BIPIA, and WildJailbreak) plus a 3,003-item independent check set. The authors state explicitly that these are external baselines rather than a comparison of complete defenses, and that no ranking of other gateways is made.
How does the paper address this problem?
Defines four interventions—deletion/substitution/repair/transplant—on a re-executable in-house gateway, and proposes an attribution norm of reporting the band base rate.
Overall approach: treat BARBICAN as an instrumentable measurement object, fix the corpus and machine, pin the code version, apply four different interventions to its arbitration stage, and use actual run results to distinguish "how much the component's answer is worth" from "what deletion changed," and propose accompanying reporting requirements. The methodological framework has no separate name; its core is the four operations plus the band base rate.
The four intervention operations (Section 4.1)
- Deletion: turn off the component, its traffic falls into residual handling, yielding P¬c; P − P¬c mixes the component, its routing predicate, the score interval, and the fallback rule, and is the operation behind conventional ablation tables.
- Substitution: the component is called as usual but its output is overwritten with a constant k, with routing and enforcement unchanged; P − P_{c←k} captures only the effect of the component's answer, and two extreme constants bracket that effect from both sides.
- Repair: fix a fault in the component's implementation (here a tokenizer configuration error), leaving everything else unchanged, exposing how closely system output tracks component quality; usable only when the component is actually broken and repairable.
- Transplant: replace the original component with an independently validated stronger component, with routing, thresholds, and enforcement unchanged, answering "whether the system responds to a known-good component."
Band base rate and upper bound (Section 4.2)
- Define the arbitration band B as the set of inputs reaching the arbiter, with p = |{x ∈ B : y(x) = malicious}| / |B| the malicious proportion within it.
- The authors derive: a constant stub that always judges malicious has precision p on B; a real classifier can only beat it by "letting through" inputs, and when p is close to 1 there are almost no benign inputs to let through, so no classifier of any accuracy can beat the stub.
- Relative to the constant stub, a single decision can gain at most the number of benign inputs in the band, (1−p)|B|, and requires that each negative decision is both correct and enforced as allow; in the control run this upper bound is 237 out of 25,000 decisions. The authors note that this upper bound limits only gains, not losses.
Run protocol (Section 4.3)
- Corpus: each run pushes all 25,000 prompts (12,500 malicious / 12,500 benign) through the live pipeline, with SHA-256 verified before the run; no offline replay, because the intervened components are upstream of the policy stage.
- Configurations: 15 configurations (Table 2), each triggered by an added environment variable; with no variables, the recorded confusion matrix must be reproduced exactly, serving as a control proving the instrumentation is inert. 11 no-repair runs are on one code state, and 4 repair runs on a second state.
- Tracing: each run writes a 51-field trace per prompt (per-stage scores, decisions, thresholds, results of each degradation condition, final enforcement state); in the control and repair runs the arbiter additionally performs a bypass scoring outside the decision path.
- Validation: a validation script written before the runs audits trace integrity, whether the control falls on the recorded matrix, whether results were copied from the control, and computes exact McNemar statistics against the control.
Second series, external baselines, and transplant protocol (Section 4.4)
- Second series: 12 runs on the second code state—three controls, decision pinned to "malicious," post-allow escalation disabled, and 7 semantic thresholds (0.30–0.42) combined with the allow-hint switch; the first run must reproduce the first-series control sample by sample before continuing.
- Lineage grouping: MinHash LSH (128 permutations, 32 bands, word 5-grams, Jaccard ≥ 0.8 confirmation) groups near-duplicate prompts into 21,807 groups; all splits are at the group level, and intervals are percentile bootstrap over resampled groups (B = 1,000).
- Operating-point rule: all detectors (including BARBICAN) select points by the same rule—highest recall subject to FPR not exceeding 5% on the selection data; two mechanisms: 4/5 lineage-group selection, 1/5 scoring (repeated 5 times), or selection only on the synthetic subset and scoring only on the public records.
- Transplant runs: on the second platform, Prompt Guard 2 (86M) is placed in the arbitration stage, the semantic stage, or both, and ProtectAI v2 in both; classifier scores are precomputed, thresholds are taken from the synthetic subset; in the semantic stage scores are piecewise-linearly mapped so that their threshold corresponds to the control's semantic threshold of 0.42, with everything downstream unchanged.
Success determination and statistics
- The binary metric counts block as positive and allow and allow_limited as negative (the gateway's own mapping); Table 5 additionally reports the convention with allow_limited counted as block.
- Intervals are Wilson 95%; paired comparisons against the control use the exact McNemar test; the authors note that both treat the 25,000 items as independent, and near-duplicates make intervals and p-values optimistic but do not affect counts.
What experiments did the paper conduct?
15+12 actual-run interventions plus transplantation, corpus audit and external comparison: fixing the arbiter instead lowers recall; deletion and replacement differ by 4.8×.
Experimental setup
- System under test: BARBICAN (a fail-closed MCP gateway, built by the authors' team, pseudonymized), whose arbiter is a quantized DeBERTa-v3-small (INT8 ONNX, 141.9M parameters in total); the review model of the authors' earlier gateway [21] is Llama 3 (Section 5.14).
- External baselines: Prompt Guard 2 (86M, 22M), ProtectAI deberta-v3-base-prompt-injection-v2, Llama Guard 3 (1B), all with pinned model versions; LLM Guard 0.3.16 and NeMo Guardrails 0.24.1 are additionally run component by component on the check set (library default configuration).
- Benchmarks: BARBICAN's own 25,000 items (20,519 internally generated + 4,481 from InjecAgent/LLMail-Inject/BIPIA/WildJailbreak); an independent check set of 3,003 items (203 benign LLMail emails, 400 BIPI original contexts each with one clean and one attack-inserted version, and 500 items for each of the four WildJailbreak categories).
- Metrics: Recall, FPR, F1, MCC, AUC, number of decision changes relative to the control; paired comparisons use the exact McNemar test, and intervals are Wilson 95% or group-level bootstrap.
- Repetitions and platforms: the first series has 15 runs (Apple silicon/macOS arm64, Python 3.13), the second series 12 (control repeated 3 times); the independent re-execution is on an x86-64 Windows machine. The paper does not report an attack-assist model (this study has no attacker).
Main results
According to Table 3 (25,000 items, control Base: TP 10,084, FP 520, FN 2,416):
Swipe horizontally to read the table
Run Operation Recall % FPR % Relative to control b/c Base Control 80.67 4.16 — Sub-Pos Decision pinned to "malicious" 80.77 4.16 0/12 Sub-Neg Decision pinned to "benign" 79.55 4.16 140/0 Rem-Arb Delete arbiter (band let through) 75.29 4.15 673/1 Rem-Cal Disable calibration stage 74.15 3.69 815/59 Rem-Resc Disable rescue policy branch 73.18 4.02 937/18 Repair Repair tokenizer 80.34 4.16 48/7 - The authors point out: deletion reports 673 lost detections, whereas constant substitution moves only 12 or 140 decisions, the two sets do not overlap, the upper bound on the effect of the arbiter's own decisions is 152 decisions (0.61%), and the 4.8× difference comes from deletion changing the disposition state of the band rather than from a measurement artifact.
- Repair raises the arbiter's AUC from 0.392 to 0.855, yet system recall falls from 80.67% to 80.34% (a net loss of 41 detections), and the constant "malicious" stub (80.77%) is higher than both; on the four public corpora the change in recall from repair is 0.00 percentage points.
- Mechanism (Table 4): of the 7,453 items in the band, 96.82% are malicious (30.11% outside the band); the constant stub's precision is 96.82%, higher than the 96.33% of the broken classifier's positive decisions; negative decisions are almost all wrong (93.3%) and can only be released via the narrow allow_limited branch, and the degradation gate passes 0 times in both the control and repair runs.
Attribution of detection sources (Section 5.5)
- What was measured→results: deletion/substitution runs are used to attribute the 10,084 true positives to components (Table 6)—rescue policy branch +937 TP (precision 98.1%), calibration threshold rule +815 (93.2%), review-state fail-closed transition +673 (99.9%), similarity memory +258 (precision 55.6%), arbiter decisions ≤152 decisions.
- Authors' interpretation: the largest contributor, the rescue branch, is a hand-written policy rule, four of which trigger only on synthetic samples (100.0%) and never on the public corpora, with the mechanism being matching the format strings of generator output; the authors state that these branches "are in effect identifying which generator wrote the text," and that on inspection they were fitted on another corpus with 0% text overlap with the evaluation set.
- The undocumented seven-signal fusion score is the single most discriminative quantity in the whole system (AUC 0.925; semantic layer 0.695, rule layer 0.595, arbiter 0.392/0.855 after repair).
Corpus labels and external comparison (Sections 5.9, 5.10)
- Label audit: the 1,000 "benign" records of WildJailbreak are actually of the plain type (containing 495 harmful requests), and the label encodes prompt form rather than harm; the 981 BIPIA items are generated HTML with attack strings embedded (median 51,694 characters), a format the original benchmark does not contain; the 1,000 LLMail-Inject items each carry a result-record line from the original challenge. After removing these appended lines and rerunning, LLMail recall goes from 92.70% to 92.50% (2 decisions), and BIPIA recall remains 99.59%.
- Shortcut baseline: under group-level cross-validation, the first word of the prompt alone correctly classifies 96.7% of the corpus (AUC 0.995), and the first 64 characters 99.2%; the authors state that the corpus labels can be recovered from the opening words.
- External comparison (Table 10): in-distribution, BARBICAN leads with 81.3% recall / 4.4% FPR; under distribution shift (selection on the synthetic set, scoring on public records), ProtectAI v2 has 80.5% recall / 1.9% FPR, while BARBICAN has 65.8% / 14.9%, which the authors describe as being surpassed on both axes simultaneously; the only public source on which BARBICAN remains ahead is LLMail-Inject (92.7%).
Transplant experiments (Section 5.12, Table 12, second platform)
- Arbitration stage: Prompt Guard 2 has AUC 0.916 on the band (the gateway's own classifier 0.368) and changes only 16 of the 25,000 decisions; it judges 202 benign inputs in the band as benign, but none are released, and the 4 that are released are all attacks.
- Semantic stage: the same classifier changes 1,015 decisions, raising recall to 81.31% and lowering FPR to 3.69%; the authors describe the difference as positional—the semantic stage determines routing, and its scores can reach the decision.
- Both stages together: Prompt Guard 2 lowers corpus recall to 75.94%; on the check set the gateway detects 41.9% of attacks, below the 78.2% achieved by the classifier used independently. The authors state that the pipeline costs the classifier on at least one axis.
Other ablations and analyses
- Second series (Table 8): the three control repetitions are identical sample by sample; disabling post-allow escalation loses 1,146 detections (recall falls to 71.50%), more than deleting any named layer; semantic thresholds between 0.34 and 0.42 change no decisions.
- Enforcement-mapping sensitivity (Table 5): with allow_limited counted as block, the arbiter's deletion/substitution/repair/transplant change no decisions except the 12 allow-hint releases.
- Independent check set (Table 11): BARBICAN's true-benign FPR is 18.0%, attack recall 31.2%, AUC 0.547; the three injection classifiers are better on both axes (e.g., ProtectAI v2 at 6.5% / 46.3%).
- Earlier gateway (Section 5.14): of the 1,628 items in the band where the review model was consulted, 92.94% are malicious, and the constant decision differs from the review model by only 136 decisions (McNemar p = 0.80).
- Second-platform re-execution (Section 5.15): the confusion matrix is reproduced exactly on x86-64, with only 2/25,000 decisions differing; the arbiter's INT8 output differs by more than 0.01 in probability on 2,433/7,452 items, with 166 decision flips, but this yields only 2 decision changes.
- LLM Guard / NeMo Guardrails (Table 13): neither routes, so deletion attribution is technically valid, but the largest independent contributions come from components that read document format (e.g., NeMo's length-perplexity heuristic flags 116/118 BIPIA attacks and 0 benign items in the sample).
What are some points that can be further explored?
The authors list limitations such as a single system and single corpus, self-built self-evaluation, and source code withheld from public release, and propose validation on a routing system built by others.
Limitations noted by the authors and future directions
- Scope: The study is based on one system and one corpus; the base-rate argument is general, but its instantiation here is a single measurement, and whether the arbitration bands of other layered defenses are similarly concentrated is an unanswered empirical question; this paper answers it only for one other system (the authors' earlier gateway) (Section 7, Scope).
- Self-built, self-evaluated: The system was built by the authors' team, and the authors chose which interventions to run and which findings to report; the authors state that testing on an independent routing system built by others is the most direct way to test the generality of the argument, and they have not yet done so (Section 7, One system).
- Enforcement mapping convention: The deletion–substitution difference is measured with allow_limited counted as allow; if counted as block, the arbiter's interventions change no decisions except the 12 allow-hint releases—the conclusion that "component quality does not reach the output" still holds, but the magnitude of the difference does not (Section 7, Enforcement mapping).
- Verification rather than re-execution: The release package can rebuild all result tables from the traces, but the source code and corpus text belong to an in-progress thesis and are withheld from public release for now, so readers cannot re-execute the runs, recompute external detector scores, or repeat the corpus audit; the authors plan to release the source code after the thesis defense (Section 7 and Data and Code Availability).
- Repair interventions are opportunistic: They require that the component is actually broken and that the breakage is actually repairable, and both conditions happen to hold at the same time, so repair is a diagnostic means after discovering a fault rather than a routine step (Section 7).
- Other explicitly stated items: Operating-point effects were measured only at the 8 points actually run rather than by continuous search; post-allow escalation was only subjected to deletion and constant/random substitution, and different escalation rules were not transplanted; residual nondeterminism exists for 1/25,000 prompts; during one run the similarity memory file was written concurrently (decisions were unaffected); peak memory measurements captured process-level noise and are therefore not reported; the direction of the coupling between the rescue branch and the generator format cannot be determined (Section 7, individual items).
Scope of experimental coverage
- The system under test is one BARBICAN gateway (two code states), plus the published record of the authors' earlier gateway and two non-routing defenses, LLM Guard and NeMo Guardrails (library default configuration, Section 5.13).
- The external baselines are 4 public detectors (Prompt Guard 2 86M/22M, ProtectAI v2, Llama Guard 3 1B); the authors explicitly state that these are baselines rather than competitors and do not rank complete systems (Section 4.5).
- The corpus is a 25,000-item in-house benchmark (82% synthetic) plus a 3,003-item independent check set; the first series had 15 runs, the second series 12, and the second-platform control re-execution 1, with the control repeated 3 times and identical sample by sample (Tables 2, 8).
- The paper does not report wall-clock cost per run or information beyond the query budget and the number of repetitions; memory data are not reported due to measurement noise (Section 7).
- The paper states that no competitor gateway was rebuilt, no testing was done on a routing system built by others, and no transplantation of post-allow escalation was done (Sections 4.5, 7).
Summarize the main content of the paper
Intervention measurements on the authors' own MCP gateway: deletion-based ablation attributed the contributions of routing and execution rules to the component.
An empirical analysis of the evaluation methodology for layered prompt injection defenses: the authors re-execute their own fail-closed gateway BARBICAN to test whether the convention of "delete a layer and attribute the metric drop to that layer" holds.
- Problem: a stage in the cascade is defined by its routing rules and execution policy, and deleting it removes these along with it; the authors argue that such ablation numbers are uninterpretable without the stage's input distribution.
- Method: fix 25,000 corpus items and the machine, pin the code version, run 15+12 actual runs, apply four interventions to the arbitration stage—deletion, constant replacement, tokenizer fix, external classifier transplantation—and propose a requirement to report band-class base rates.
- Key result one: 96.82% of the arbitration band is malicious; the fix raises the arbiter's AUC from 0.392 to 0.855, yet system recall drops from 80.67% to 80.34%, and a constant "malicious" stub reaches 80.77% (Table 3, 4).
- Key result two: deleting the arbiter loses 673 detections, while constant replacement moves only 12 or 140 decisions, a 4.8× difference; the authors say the difference comes from deletion changing the band's disposition state (Table 3, 5).
- Key result three: a classifier with AUC 0.916 transplanted into the arbitration stage changes only 16/25,000 decisions, whereas placing it in the semantic stage changes 1,015; the authors say stage contribution is determined by position before quality (Table 12).
- Incidental findings: detections mainly come from an undocumented fusion stage, hand-written rescue branches and fail-closed conversion; the labels or text of three public sets in the benchmark were altered when entering the corpus; under distribution shift, ProtectAI v2 outperforms the gateway on both detection and false positives (Table 6, 10).
- Authors' conclusion: for any stage that receives routing traffic, ablation numbers must be reported together with its band base rate, and deletion experiments must be paired with replacement experiments; the authors expect this reporting requirement to apply beyond this gateway, but measured it only on this gateway and its earlier gateway.