An LLM relay is an intermediary service that forwards prompts and responses between a client and upstream model providers. In malicious cases, the relay can inspect, modify, or exfiltrate content in transit, turning a convenience layer into a trust boundary that attackers control.
What an LLM relay does
An LLM relay sits between a client and one or more upstream model providers, forwarding prompts, responses, and sometimes routing metadata. In a well-run design it is a convenience and control layer; in a hostile one it becomes a man-in-the-middle point where content can be observed, altered, delayed, or selectively dropped before it reaches the model or the user.
The relay pattern matters because it changes the trust boundary. The client may believe it is talking to a provider, but the relay can become the effective operator of transport, logging, policy enforcement, and sometimes identity or billing decisions. That is why relay security is not just about connectivity, it is about who can see the conversation and what authority that intermediary has over the flow.
Why LLM relays are used
Teams use relays to standardise access across multiple model providers, hide provider-specific details, add observability, enforce policy, and centralise rate limiting or cost controls. In that role, the relay can simplify application code and create a single operational choke point for governance, logging, and safety checks.
The same centralisation also makes the relay attractive to attackers. If a relay handles many applications, it may see sensitive prompts, proprietary outputs, embedded secrets, or user data from multiple workflows. A compromise of the relay can therefore expose more than one model integration, and a malicious relay can quietly siphon content without affecting the visible user experience.
Trust boundaries, data handling, and failure modes
The key security question is whether the relay is trusted only to transport data or also to inspect, transform, store, or decide about it. The more functions it performs, the larger the blast radius if it is misconfigured, compromised, or operated by an untrusted party. That risk is especially acute when prompts contain credentials, API keys, personal data, or confidential business context.
A relay can fail by over-logging, forwarding to the wrong backend, reusing session context across tenants, or silently modifying system instructions and tool directives. It can also become a durable exfiltration path if it archives requests and responses in plaintext, forwards them to analytics systems, or injects its own policy layer without clear separation from the application’s trust model.
For identity and access design, the relay is also where authorization assumptions can break. If the relay can act on behalf of multiple callers, its own privileges, service credentials, and routing logic must be tightly scoped and auditable, because the relay may be the practical control point that governs which requests reach which model, and under whose authority. See AI Infrastructure Workload Identity Guide for the identity controls that protect the systems behind AI platforms, and LLM Provider API Key Security and LLMjacking Guide for how provider credentials are abused when that control plane is weak.
How to recognise a compromised or untrusted relay
Indicators are usually behavioural rather than visual. Unexpected prompt mutations, unexplained latency, duplicated requests, missing responses, changed system instructions, unusual egress destinations, or logs containing more content than the application should retain are all signals that the relay may be doing more than transport. If the relay is operated by a third party, version drift or undocumented policy changes are also warning signs.
Post-incident review should assume that any data passing through the relay may have been exposed. That means investigating what prompts, responses, secrets, and conversation history were traversed, what was logged, which downstream providers were contacted, and whether any service tokens or API keys used by the relay itself need rotation. When the relay is part of a broader AI platform, review its provenance and surrounding dependencies alongside the application path, as illustrated by AI Supply Chain Security and AI-BOM Guide and Enterprise AI Copilot Security Guide.
When the relay becomes the attack path
Attackers value relays because they can concentrate trust, visibility, and credentials in one place. A malicious relay can capture prompts, tamper with instructions, downgrade guardrails, or redirect traffic to shadow infrastructure while preserving the appearance of normal operation. If the relay also brokers access tokens or provider keys, compromise can quickly expand from data theft into model abuse and lateral movement.
The risk is not limited to obvious theft. A relay can be used to selectively poison context, alter outputs, or create inconsistent model behaviour that is hard to attribute. That makes the relay both a confidentiality risk and an integrity risk, especially in environments where users assume the intermediary is neutral when it is actually an execution point with meaningful control over model interaction.
Risk and Threat Considerations
An LLM relay creates a concentrated trust boundary, so compromise or abuse of that layer can expose prompts, outputs, secrets, and routing decisions across many downstream AI workflows. The danger is highest when the relay has broad logging, shared tenancy, or access to provider credentials and conversation history.
Failure mechanism: The relay inspects, modifies, stores, or forwards content outside the caller’s trust assumptions, then uses its position to exfiltrate data or alter model behaviour without an obvious user-visible failure.
Impact: Sensitive content can leak, model outputs can be manipulated, and one compromised intermediary can affect many applications at once, turning a convenience layer into a high-value control and surveillance point.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-53 Rev 5 provides the primary governance reference for this term.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | IA-9 — Service Identification and Authentication | LLM relays broker service-to-service AI access and trust. |
| AC-6 — Least Privilege | Relays often hold broad routing and data-access powers. | |
| AU-2 — Event Logging | Relays need auditability for prompt handling and routing decisions. | |
| Recommendation — Constrain relay-to-provider authentication to scoped service credentials and verify each backend connection. Minimise relay permissions so it can only forward approved traffic and nothing more. Log relay access, routing, and policy actions with enough detail to investigate misuse. | ||
Practitioner Guidance
Why practitioners should care: Treat the relay as part of the security boundary, not as a transparent plumbing component. Its permissions, logging, retention, and routing rules should be owned like any other high-trust service that can observe sensitive business content.
Common misunderstanding: Teams often assume that because the relay only “forwards” requests, it cannot materially change the risk profile. In practice, forwarding plus inspection, transformation, analytics, or token brokerage is enough to create a powerful trust dependency.
Practitioner takeaway: Define exactly what the relay is allowed to see, store, modify, and route, then verify that those powers match the minimum trust needed for the application.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org