Can prompt injection attacks reach the generator? A study of attack survival in real RAG scenariosCan It Reach the Generator? Investigating the Survival of Prompt-Injection Attacks in Realistic RAG Settings
The authors state that they retested seven GEO prompt injection attacks under a real three-stage RAG pipeline (retrieval→reranking→generation); gradient attacks have Sg@3 below 2%, and only LLM-driven attacks remain effective.
The attacker selects a target product document in the corpus and replaces its content with an adversarial edit so that it enters the generator's top-3 recommendations. Knowledge is divided by attack family: instruction override requires no model access; LLM-driven requires black-box access; gradient attacks assume full white-box access (including model weights), optimized against Qwen3-8B. The victim system is a retriever→LLM reranker→LLM generator three-stage RAG recommendation pipeline.
- Existing GEO prompt injection research reports high success rates under a frozen context protocol, but assumes the attacked document necessarily reaches the generator, bypassing retrieval and reranking; the authors argue this overestimates the attack threat in real RAG recommendation systems.
- Build a three-stage pipeline on Amazon ESCI: retrieval (BM25/dense)→Qwen3-8B listwise reranking→Qwen3-8B generation; define three stage-wise metrics Sr@10, Eρ@5, Sg@3; compare FC and E2E for seven attacks; and evaluate four prompt injection guardrails.
- Under E2E, retrieval filters out about 20% of attack documents on average; gradient attacks have Sg@3 below 2%, IOA drops to about 14.7%, and only CORE-review/CORE-reason remain above 46%; the authors state that PG-FT fine-tuned on 104 queries detects all attacks with 97.3% F1.
- Limitations listed by the authors: single pipeline configuration, only the ESCI product search domain, products represented only by title and bullet points, and the reranker and generator using only the single Qwen3-8B model family. The experiments cover 200 queries × 2 positions × 2 retrievers, for a total of 800 attack targets.
- Evaluated models
- Qwen3-8BBM25BAAI/bge-large-en-v1.5Llama-Guard-4-12BQwen3Guard-Gen-8BPrompt-Guard-2-86MPG-FT
- Benchmarks
- Amazon ESCI (Task 1, US locale)
- Metrics
- Sr @10Eρ @5Sg @3∆nDCG@5AvgRankF1FDR
Yu Yin and other researchers re-evaluated seven generative engine optimization (GEO) prompt injection attacks in a three-stage real RAG pipeline consisting of a retriever, an LLM reranker, and an LLM generator, and found that existing evaluation protocols markedly overestimate attack effectiveness. Prior GEO studies reported a strongest attack success rate of about 80%, but assumed that the attacked document bypasses retrieval and reranking and is fed directly into the generator; in the real pipeline, gradient-based and instruction-override attacks mostly fail before reaching the generator, and only LLM-driven prompt injection remains end-to-end effective. The analysis also shows that such attacks are easy to detect: a lightweight prompt injection defense fine-tuned on a small-scale attack dataset detects all attacks. Code and data are available at https://github.com/ielab/geo_injection_rag_survival。
Paper analysis
What problem does this paper attempt to solve?
The authors question that GEO attack evaluations bypass retrieval and reranking, and re-estimate the real threat of seven attacks under an end-to-end RAG pipeline.
Core question: The high success rates (about 80%) of existing GEO prompt injection attacks were obtained under a protocol that assumes the attacked document necessarily reaches the generator; whether these attacks can "survive" to the generation stage in a real RAG pipeline is not yet clear.
- Scenario and importance: In RAG recommendation systems (such as Amazon Rufus), the LLM directly determines the information users see; the authors state that existing GEO research reports attack success rates above 50% (strongest about 80%), raising concerns about the commercial and security risks of RAG recommendations.
- Shortcomings of existing evaluations: The authors point out that prior GEO research shares a frozen context (FC) protocol—evaluating on a fixed candidate set, which (i) ignores retrieval: assumes the attacked document is always retrieved; (ii) ignores reranking: yet LLM rerankers are already a standard component of deployed RAG. Adversarial edits change document content, which may itself change whether the document can be retrieved and ranked highly.
- Core observation: For an attack to succeed end-to-end, it must pass three gates in sequence: survival through retrieval, exposure through reranking, and success at generation; the FC protocol reports only the last gate, which the authors argue overestimates attack effectiveness.
- Paper contributions: Systematically retest seven attacks from six methods on a retriever→LLM reranker→LLM generator three-stage pipeline, define staged survival metrics, and evaluate off-the-shelf and fine-tuned prompt injection guardrails; the authors state that gradient and instruction-override attacks mostly fail before reaching the generator, and only LLM-driven attacks are effective end-to-end.
- Threat model:
- Goal: Make the target product title appear in the generator's top-3 recommendations (Sg@3).
- Knowledge: Varies by attack family—instruction override (IOA) requires no model access; LLM-driven attacks (CORE, TAP) require black-box access; gradient attacks (RAF, SRP, STS) assume full white-box access (including model weights), optimized against Qwen3-8B.
- Capability: The attacker selects one target document in the corpus and replaces its content with an adversarial edit (d̃⋆ = d⋆ ⊕ δ).
- Victim system: A three-stage RAG recommendation pipeline on Amazon ESCI product search (sparse or dense retrieval, Qwen3-8B listwise reranking, Qwen3-8B generator).
What related research exists?
Related work falls into three categories: GEO injection attacks and RAG/ranking research; this paper does not propose new attacks but re-evaluates their evaluation protocol.
GEO and prompt injection attacks (systems under retest)
- Instruction override attack (IOA): Qian et al. (2025), Yin et al. (2026)—no model access required; fixed instructions are injected into documents to make the model instead carry out the attacker's intent; the paper states it is consistently effective on ranking tasks; this paper adopts the DCH/SD variants of Qian et al.
- LLM-driven prompt optimization: Pfrommer et al. (2024) (TAP), Jin et al. (2026) (CORE-review/CORE-reason)—only black-box access is required; an auxiliary LLM iteratively refines the injected prompt based on the target system's outputs.
- Gradient token optimization: Kumar and Lakkaraju (2024) (STS), Tang et al. (2025) (SRP), Xing et al. (2025) (RAF)—assume full white-box access; gradient signals are used to optimize adversarial tokens that increase the visibility of the target product.
RAG and LLM ranking
- RAG systems: Gao et al. (2023), Yu et al. (2024), Zuccon et al. (2025)—the application of LLMs in document ranking, question answering, and RAG cores; the context-size saturation finding of Yu et al. (2024) is used to set k=5.
- LLM rerankers: this paper adopts the RankGPT listwise strategy of Sun et al. (2023); the cascaded reranking practice of Ma et al. (2024) is used to set n=10.
- Position bias: the long-context lost-in-the-middle tendency of Tang et al. (2024) and Liu et al. (2024), and the first-position bias in recommendation of Hou et al. (2024) and Jiang et al. (2025)—this paper states that biases in the two directions coexist in the same pipeline.
Baselines and benchmarks: the attack baselines are the seven attack variants above (IOA, CORE-review, CORE-reason, TAP, RAF, SRP, STS, Table 1); on the defense side, three off-the-shelf guardrails are compared: Llama-Guard-4-12B, Qwen3Guard-Gen-8B, Prompt-Guard-2-86M; the benchmark is the Amazon ESCI product search corpus (Task 1, US locale).
Positioning of this paper: the authors state that the difference from prior work is not proposing new attacks but the evaluation protocol—prior protocols freeze the candidate set and test only the generation stage (Table 2), whereas this paper adds retrieval and reranking back level by level, performs end-to-end survival evaluation, and argues that end-to-end evaluation should become the default setting for GEO research.
How does the paper address this problem?
Build a three-stage RAG pipeline and use three staged metrics to compare the survival rates of seven attacks under the frozen-context and end-to-end protocols.
Overall approach: add back the retrieval and reranking omitted in the earlier GEO evaluation, level by level, and re-test the attack end-to-end on the retriever → LLM reranker → LLM generator pipeline, using staged metrics to locate at which stage the attack fails.
Problem formalization and three-stage metrics
- The attacker replaces the target document d⋆ with d̃⋆ = d⋆ ⊕ δ, obtaining the attacked corpus C̃; end-to-end success requires satisfying three metrics in sequence.
- Retrieval survival Sr(δ) = 1[d̃⋆ ∈ C̃q^(n)]: the attacked document enters the retrieval top-n (Sr@10 in the experiments).
- Reranking exposure Eρ(δ) = 1[d̃⋆ ∈ M̃q^(k)]: the reranker places it into the generator's top-k input (Eρ@5).
- Generation success Sg(δ) = 𝟙[title(d⋆) ⊆ ã]: the target product title appears in the generated response (Sg@3, top-3 recommendations); satisfying Sg=1 implies Eρ=1 implies Sr=1.
Pipeline configuration (§4.2, Appendix A)
- Retriever: BM25 (sparse) and BAAI/bge-large-en-v1.5 (dense) are each evaluated independently; queries with at least 40 annotated products are retained, with retrieval depth 40.
- Reranker and generator: share the Qwen3-8B backbone; reranking uses the listwise RankGPT strategy (best effectiveness/efficiency trade-off on ESCI in preliminary experiments, Table 6), n=10; the generator takes top-5 (k=5) and outputs m=3 product recommendations.
- Attack positions: attack the documents at rank 10 (the last one the reranker sees) and rank 6 (the first one discarded after reranking) among the unattacked reranking top-n.
Evaluation protocol (§4.3, Appendix B)
- Baseline: run the full pipeline on the unattacked corpus to determine the attack target positions and the no-attack baseline.
- Frozen Context (FC): replicate the earlier protocol—take the baseline's top-k candidates, replace d⋆ with d̃⋆, and leave the rest unchanged.
- End-to-End (E2E): write d̃⋆ back into the corpus, re-index, and run the full pipeline; see Algorithm 1 in Appendix B.
Attack and defense settings
- Seven attacks (Table 1): IOA (DCH suffix); CORE-review/CORE-reason (max_iter=5, generator/synthesizer/optimizer all Qwen3-8B); TAP (depth=5, branching=3); RAF (600 steps, length 30); SRP (1000 iterations, length 30); STS (1000 iterations, 30 tokens, reduced from 2000 to 1000 due to compute). White-box attacks optimize directly against Qwen3-8B, which the authors state makes the white-box setting most favorable to the attack.
- Guardrail evaluation (§5.4, Appendix J): three off-the-shelf guardrails plus PG-FT (fine-tuned on Prompt-Guard-2-86M as the base); 345 queries split 30/20/50 into train/dev/test (104 training queries), reporting F1 and FDR under two class ratios, balanced (1:1) and pipeline (about 1:9).
- Position bias probe (§5.5, Appendix E): for the same attacked document, perform a position swap between rank 6 and rank 10 (the other 8 unchanged), feeding the same top-10 context to the reranker (Eρ@3) and directly to the generator (Sg@3), to isolate each stage's position preference.
What experiments did the paper conduct?
Comparison of seven attacks under FC and E2E: gradient attacks have Sg@3 below 2%, only LLM-driven attacks remain above 40%; the fine-tuned guardrail reaches F1 of 96.9%.
Experimental setup
- Models/components under test: Qwen3-8B serves as both the reranker and generator backbone (and is also the optimization target of the white-box gradient attacks); retrievers are BM25 and BAAI/bge-large-en-v1.5; the guardrail experiments evaluate Llama-Guard-4-12B, Qwen3Guard-Gen-8B, Prompt-Guard-2-86M, and the fine-tuned version PG-FT.
- Dataset: Amazon ESCI (Task 1, US locale); 1,294 queries with ≥40 labeled products are retained, and 200 queries per retriever are sampled stratified by ESCI label (55 shared by both retrievers).
- Attack scale: each attack is applied to all 800 targets (200 queries × 2 positions × 2 retrievers).
- Metrics: Sr@10 (retrieval survival), Eρ@5 (reranking exposure), Sg@3 (generation success, target title entering top-3 recommendations), supplemented by ∆nDCG@5 and AvgRank.
- Determination method: Sg@3 is determined by whether the target product title appears in the generated response (string containment); guardrail detection reports F1 and FDR; retriever comparison uses Wilcoxon and McNemar tests (Appendix K).
- Inference settings: vLLM temperature 0.0, seed=42; gradient attacks use HuggingFace generate() with do_sample=False (Appendix F).
Main results
FC vs E2E when attacking the rank 10 document (per Table 4, units %):
Swipe horizontally to read the table
Attack Retriever Sr@10 FC→E2E Eρ@5 FC→E2E Sg@3 FC→E2E IOA BM25 100.0→50.5 65.0→15.5 41.0→12.0 IOA Dense 100.0→68.0 73.5→25.5 46.0→17.5 CORE-review BM25 100.0→89.5 63.0→61.0 51.5→46.5 CORE-reason Dense 100.0→98.5 65.0→72.5 54.5→59.0 TAP BM25 100.0→89.5 59.5→40.5 57.0→39.5 SRP BM25 100.0→74.0 4.0→3.0 2.0→1.0 RAF Dense 100.0→75.5 6.5→4.0 2.0→1.5 STS BM25 100.0→66.5 5.0→1.0 2.0→0.5 (CORE-review under Dense has Sg@3 58.5→47.0, CORE-reason under BM25 44.5→48.0, TAP under Dense 56.5→41.0; the three gradient attacks have E2E Sg@3 ≤2.5 under both retrievers.)
- Authors' interpretation: under E2E only LLM-driven attacks remain effective—cross-retriever averages are about 53.5% for CORE-reason, about 46.7% for CORE-review, and about 40.2% for TAP; gradient attacks, optimized against the generator target rather than the reranker, are further downweighted at reranking, with Sg@3 below 2%.
- Exception: CORE-reason is the only attack higher under E2E than under FC (about +4% across retrievers); the authors state that its few-shot template makes the output contain the user query multiple times, and the retriever rewards this lexical-semantic overlap; its retrieval survival drops the least (5.2%, Table 3).
- Overall magnitude: the authors state that effective attack methods drop by 13.8% on average under E2E versus FC; IOA falls from the strongest attack at the reranker under FC to about 14.7% E2E Sg@3.
Stage-by-stage breakdown: what reranking and retrieval each contribute (§5.1, §5.2)
- Two-way effect of reranking (Figure 2, retrieval frozen): compared with No Reranker, all seven attacks improve in AvgRank; IOA/CORE/TAP improve in average Sg@3 by +25.5%, while gradient attacks improve by only +4.5%; however, top-5 truncation (Rerank10·Gen5 vs Rerank10·Gen10) reduces average Sg@3 by 4.6%, with TAP dropping the most (∆=−17.0%); the authors state the net effect is reranking gain +16.5% offset by truncation −4.6%.
- Retrieval as implicit filtering (Table 3, rank 10): under E2E, Sr@10 drops on average to 79.9% (FC is always 100%), and AvgRank worsens by 1.95 positions on average; attacking rank 6 is milder (88.5%, 1.23 positions). IOA drops the most (average Sr@10=59.3%), LLM-driven attacks survive best (CORE-reason 94.8%, CORE-review 92.3%, TAP 88.3%), and gradient attacks lose about a quarter (STS 71.3%, SRP/RAF 76.8%).
- Retriever choice is largely irrelevant: paired tests on the 55 shared queries show that retriever choice has negligible effect on attack success; the only consistent exception is CORE-reason (Wilcoxon p=0.016 at rank 6, p=0.008 at rank 10), where dense retrieval makes it about 2.2 positions higher and raises Eρ@5 by about 20 percentage points (Appendix K).
Guardrail detection (§5.4, Table 5)
- Off-the-shelf guardrails do not generalize: under the balanced setting, Prompt Guard detects only IOA (F1 95.6%) and STS (80.6%), with F1 of 0.0–0.5 for TAP, CORE-review, and CORE-reason; Llama Guard has F1 of 11.3%–25.7% except for STS (73.8%); Qwen Guard reaches 42.3% only for TAP. The authors note that the most effective attacks under E2E, CORE-review and CORE-reason, pass through all off-the-shelf guardrails.
- The fine-tuned guardrail detects all attacks: PG-FT is fine-tuned on 104 training queries and achieves average F1 96.9% under balanced (90.4%–98.6% per attack) and 81.2% under pipeline (about 1:9); the authors state that the rise in FDR to about 29.2% under pipeline is due to class imbalance rather than false positives on clean content.
- Authors' interpretation: surviving attacks expose a consistent pattern (schema) that a lightweight fine-tuned guardrail can detect, which the authors consider further narrows the GEO threat.
Position bias and other analyses
- Opposite stage position preferences (Figure 3, Table 7): in the position swap experiment, all attacks have ∆Eρ@3>0 and ∆Sg@3<0—the reranker prefers attacks placed later in the input, while the generator prefers earlier; the authors state that the two biases coexist within the same pipeline, and position swap can serve as a stage-preference probe requiring no white-box access.
Other ablations and analyses
- Rank 6 attacks (Appendix H, Table 11): E2E Sg@3 is generally higher than at rank 10, e.g., CORE-reason reaches 75.5% under Dense and CORE-review 67.5%.
- Breakdown by ESCI label (Appendix I, Figure 5): the two CORE attacks have the highest ∆nDCG@5 on all labels; under effective attacks, S-label targets have the highest ∆nDCG@5; TAP is clearly lower on the I label; gradient attacks have ∆nDCG@5 below 1% on all labels.
- IOA advantage at position 6 (Appendix I): IOA has higher ∆nDCG@5 at position 6 than at position 10, which the authors attribute to 15.3% more retrieval survival at position 6.
- Retriever statistical tests (Appendix K, Table 12): among the 14 (attack×position) cells, only CORE-reason is significant at both positions; the Stouffer combined test gives p=0.003, and the authors state that the overall tendency is almost entirely contributed by CORE-reason.
What are some points that can be further explored?
The authors list four limitations: pipeline scope, domain, product representation, and single model family; the experiments cover 800 attack targets and four guardrails.
Limitations and future directions noted by the authors
- Pipeline scope (Limitations): only the specific configuration retriever→LLM reranker→LLM generator is evaluated; real systems may also have query rewriting, personalized retrieval, dialogue memory, tool calls, post-generation moderation, and other components; the authors describe this setting as a "minimal realistic instance" rather than a complete deployment model.
- Evaluation domain (Limitations): all experiments are on the Amazon ESCI product search corpus; the authors note that corpora, ranking signals, and user intent in higher-risk domains such as healthcare and finance may change attack survival rates and impact, and validating attack effectiveness in these domains is left for future work.
- Product representation (Limitations): candidate products are represented only by title + bullet point; deployed systems also use signals that attackers find hard to forge, such as ratings, reviews, brand reputation, and historical sales; the authors state that the attack effectiveness numbers in this paper may therefore overestimate the real level in information-richer deployments.
- Single model family (Limitations): both the reranker and the generator are Qwen3-8B, which is also the optimization target of the white-box gradient attacks; the authors explain that cross-model comparison is infeasible under this setting—attack targets are seeded at fixed positions in each model's unattacked baseline ranking, and changing the LLM changes which products occupy those positions for each query, so the attack sets no longer match and ranking-based attack metrics are not directly comparable.
Scope of experimental coverage
- 800 attacked targets in total: 200 queries × 2 positions (rank 6, rank 10) × 2 retrievers (BM25, dense); main-text results are mainly for rank 10, with rank 6 in Appendices G/H.
- Attacks cover seven variants of six methods: IOA, CORE-review, CORE-reason, TAP, RAF, SRP, STS; the optimization target of the white-box attacks and the reranking/generation backbone are both Qwen3-8B.
- Defense evaluation includes three off-the-shelf guardrails (Llama-Guard-4-12B, Qwen3Guard-Gen-8B, Prompt-Guard-2-86M) and a fine-tuned version PG-FT; 345 queries are split 30/20/50, with 104 queries used for training, under two class ratios: balanced and pipeline (about 1:9).
- Statistical tests cover paired Wilcoxon/McNemar tests on the 55 queries shared by both retrievers (Appendix K); the paper does not report repeated sampling of generator outputs (inference temperature 0.0).
- The paper does not report evaluation against adaptive attacks (attacks specifically optimized against the fine-tuned guardrail); Appendix F reports approximate time cost of each attack on a single H100 (e.g., STS about 18 minutes/query, TAP and CORE about 4 hours).
Summarize the main content of the paper
End-to-end re-estimation shows the GEO injection attack threat was overestimated by prior protocols: gradient and instruction-override attacks mostly fail, and surviving attacks can be detected by a lightweight fine-tuned guardrail.
A study re-evaluating the evaluation protocol for GEO prompt injection attacks: the authors argue that the high success rates previously reported under the frozen context protocol (strongest about 80%) assume the attacked document necessarily reaches the generator, bypassing the retrieval and reranking gates where attacks are most likely to fail in real RAG systems.
- Method: Build a pipeline on Amazon ESCI of retrieval (BM25/dense)→Qwen3-8B listwise reranking (n=10)→Qwen3-8B generation (k=5, m=3), define three staged metrics Sr@10, Eρ@5, Sg@3, and run 800 targets for each of seven attacks under both FC and E2E protocols.
- Retrieval filtering: Under E2E, an average of 79.9% of attacked documents survive retrieval (rank 10, Table 3); IOA has the lowest survival rate (average 59.3%), and LLM-driven attacks survive best (88.3%–94.8%).
- End-to-end results (Table 4, rank 10): Gradient attacks (SRP, RAF, STS) all have Sg@3 below 2%; IOA drops to about 14.7%; only LLM-driven attacks remain effective—averaged across retrievers, CORE-reason about 53.5%, CORE-review about 46.7%, TAP about 40.2%; CORE-reason is the only attack whose E2E result exceeds its FC result (about +4%).
- Defense: None of the three off-the-shelf guardrails generalizes; under E2E the most effective CORE-review/CORE-reason pass through all off-the-shelf guardrails; PG-FT fine-tuned on 104 queries achieves an average F1 of 96.9% under balanced and 81.2% under pipeline, and the authors state it detects every attack.
- Other findings: The reranker and generator have opposite position preferences—the reranker prefers attacks later in the input, the generator prefers earlier (Figure 3); the authors accordingly summarize three properties of surviving attacks (query-aligned content, jointly effective across stages, robust to position bias).
- Authors' conclusion: The GEO threat landscape is narrower than previously reported, and the authors argue end-to-end evaluation should become the default protocol for future GEO research; limitations include a single pipeline configuration, a single product search domain, simplified product representation, and a single Qwen3-8B model family.