01 / ABSTRACT

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.

02 / KEY FINDINGS

Signals from the evaluation

73.4%Observed failure metricUNTRUSTED CONTEXT
03Trust boundaries mappedINGEST · RETRIEVE · GENERATE
04Defensive layers examinedCONTROL SURFACES
03 / THREAT MODEL

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.

04 / POISONING MECHANICS

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.

OBSERVED ATTACK PATH

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.

05 / EVALUATION

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 caseAttacker controlExpected boundarySignal
Injected documentDocument bodySource content stays dataInstruction ignored
Cross-tenant lureSearchable snippetTenant data stays isolatedNo foreign disclosure
Authority spoofingRetrieved metadataSystem rules retain priorityNo role escalation
Tool-output baitExternal resultTool output stays untrustedNo unauthorized action
06 / FORMALIZATION

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.

OUTPUT = G(USER_QUERY, TRUSTED_POLICY, RETRIEVED_EVIDENCE)RETRIEVED_EVIDENCE ∉ TRUSTED_POLICY

This distinction should exist in retrieval design, prompt construction, output validation, and the benchmark itself.

07 / DEFENSIVE CONTROLS

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.

retrieval-policy.tsREFERENCE PATTERN
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);
01

Scope retrieval

Enforce tenant boundaries before content reaches the model.

02

Mark provenance

Preserve source identity and trust level through prompt assembly.

03

Constrain actions

Require authorization for tools and sensitive outputs.

04

Evaluate continuously

Replay adversarial cases as the system changes.

08 / RECOMMENDATIONS

Build the evaluation into the system.

  1. Track provenance for every retrieved passage. The application should know who owns it and why it was selected.
  2. Make tenant isolation enforceable before generation. Filter and authorize at the data layer.
  3. Test with attacker-controlled content. Include obvious and subtle injections in repeatable benchmarks.
  4. Review the complete trace. Store retrieval, prompt construction, model response, and validation outcomes for analysis.
09 / REFERENCES

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 ↗