Trust breaks at the retrieval boundary.
Retrieval-augmented generation lets a model use external context to answer a question. In a multi-tenant system, that same context can carry instructions from a lower-trust source. We examine where those instructions enter, how they are promoted into authority, and what an evaluation must measure to reveal the failure.
The study focuses on tenant-scoped documents, shared retrieval infrastructure, and downstream responses. It treats retrieved text as adversarial input and follows its path through ranking, prompt construction, generation, and output review.
Signals from the evaluation
Where the attacker enters
The attacker controls material that a legitimate user may retrieve: a document, record, snippet, or tool response. The attacker does not need to control the user request. Their goal is to make the assistant treat source content as an instruction and cross a tenant or policy boundary.
The most consequential transition occurs when the application places retrieved text near a trusted instruction without a clear boundary. The model then receives both in a single context window.
A document can carry more than data.
Context poisoning embeds behavioral instructions inside content that should only be used as evidence. Those instructions may mimic system language, invent a conversation history, or ask the model to disclose information from another tenant.
Untrusted text enters the index → a legitimate query retrieves it → prompt assembly removes the source boundary → generation follows the injected instruction.
Why latent injections are hard to spot
An obvious “ignore previous instructions” string is easy to recognize. A latent injection can look like a citation, configuration note, or procedural hint. It may only activate for a narrow user query or when several retrieved passages appear together.
Measure the boundary, not just the answer.
A useful benchmark records whether the malicious passage was retrieved, where it appeared in the assembled prompt, and which instruction the model followed. Answer quality alone cannot show whether the trust boundary held.
| Test case | Attacker control | Expected boundary | Signal |
|---|---|---|---|
| Injected document | Document body | Source content stays data | Instruction ignored |
| Cross-tenant lure | Searchable snippet | Tenant data stays isolated | No foreign disclosure |
| Authority spoofing | Retrieved metadata | System rules retain priority | No role escalation |
| Tool-output bait | External result | Tool output stays untrusted | No unauthorized action |
Separate evidence from authority.
We can describe the desired boundary as a constraint on generation: retrieved context may inform factual content, but it cannot update the assistant’s instruction set or expand the tenant scope.
This distinction should exist in retrieval design, prompt construction, output validation, and the benchmark itself.
Controls must be layered.
Source isolation, explicit delimiters, tenant-aware retrieval, and output checks address different failure points. A single instruction that says “ignore malicious content” cannot substitute for a constrained data path.
const context = await retrieve({
query: userQuery,
tenantId: session.tenantId,
allowedSources: policy.allowedSources,
});
const prompt = composePrompt({
instructions: trustedPolicy,
evidence: markAsUntrusted(context),
});
return validateOutput(await model.generate(prompt), policy);Scope retrieval
Enforce tenant boundaries before content reaches the model.
Mark provenance
Preserve source identity and trust level through prompt assembly.
Constrain actions
Require authorization for tools and sensitive outputs.
Evaluate continuously
Replay adversarial cases as the system changes.
Build the evaluation into the system.
- Track provenance for every retrieved passage. The application should know who owns it and why it was selected.
- Make tenant isolation enforceable before generation. Filter and authorize at the data layer.
- Test with attacker-controlled content. Include obvious and subtle injections in repeatable benchmarks.
- Review the complete trace. Store retrieval, prompt construction, model response, and validation outcomes for analysis.
Further reading
This research note is part of the GloomByte Labs AI security program. Related publications and implementation artifacts will be linked from the papers index as they become available.
Browse publications ↗