Controller Denial of Service via Unbounded OAuth Metadata Response Buffering
Description
A namespace-scoped attacker with permission to create MCPRoute resources can trigger unbounded OAuth metadata response buffering in the shared Agent Router controller, causing memory exhaustion and controller termination.
In an isolated Kubernetes environment, a controlled 40 MiB metadata response repeatedly OOM-killed a controller with a 160 MiB memory limit. This also disrupted reconciliation of resources in an unrelated namespace for 43 seconds.
The issue allows a lower-privileged namespace user to affect the availability of a shared cluster-wide controller. Provisional severity: High.
Details
Vulnerability Description
Agent Router is vulnerable to controller-level Denial of Service due to unbounded HTTP response buffering during MCPRoute OAuth authorization-server metadata discovery.
A low-privileged Kubernetes principal with only create permission for MCPRoute resources in a single namespace can configure a metadata endpoint that returns an oversized JSON document.
The shared controller retrieves the response using io.ReadAll(resp.Body) without enforcing a maximum response size. The response is subsequently processed through json.Unmarshal.
Because arbitrary unknown JSON fields are accepted, an attacker-controlled metadata endpoint can return a large, syntactically valid JSON document containing oversized padding data.
Vulnerable Code
File: internal/controller/mcp_route_security_policy.go
Affected lines: 776–815 (audited commit)
The vulnerable operation is:
body, err := io.ReadAll(resp.Body)There is no response-size limit, bounded reader, or equivalent protection before the response is allocated in memory.
The relevant call chain is:
internal/controller/controller.go:231-241— MCPRoute reconciliation registration.internal/controller/mcp_route.go:63-83,162-165— security policy reconciliation.internal/controller/mcp_route_security_policy.go:719-727— metadata endpoint selection.internal/controller/mcp_route_security_policy.go:776-815— unbounded response reading and JSON processing.
Confirmed Security Impact
The vulnerability was reproduced against unmodified production reconciliation code in an isolated k3s environment.
The following results were observed:
- A 40 MiB metadata response caused the controller, configured with a 160 MiB memory limit, to be OOMKilled with exit code 137.
- The persisted malicious MCPRoute triggered three controller OOM restarts.
- A legitimate MCPRoute in an unrelated namespace remained unreconciled for 43 seconds.
- Both routes recovered after reducing the synthetic metadata response size to 1 MiB.
The attacker required only namespace-scoped MCPRoute creation permission, without permission to modify the controller, read Secrets, or access the affected namespace.
Affected Versions
The vulnerable response-reading pattern was verified in:
- v1.0.0
- v1.1.0
- v1.2.0
- Current main at commit
ca3e5166d9b6c491ea9acbcb9eaba2c6db1c4990
Recommended Remediation
Enforce a strict maximum OAuth metadata response size before buffering or parsing. The limit should apply regardless of whether Content-Length is supplied, and should be enforced for chunked responses as well.
Additional protections may include bounded concurrent metadata discovery, avoiding duplicate fetches during reconciliation, and appropriate retry limits.
Please keep this report confidential until a coordinated fix is available.
Proof of concept
Environment
- Product: Agent Router (formerly Envoy AI Gateway)
- Tested release: v1.2.0
- Audited main commit:
ca3e5166d9b6c491ea9acbcb9eaba2c6db1c4990 - Environment: Disposable local Kubernetes (k3s)
- Controller memory limit: 160 MiB
- Test endpoint: Controlled in-cluster HTTP service providing synthetic OAuth metadata
- Production reconciler: Unmodified
Step 1 — Configure Minimum Attacker Privileges
Create a namespace-scoped Kubernetes Role permitting only MCPRoute creation:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: mcproute-create-only
namespace: attacker-a
rules:
- apiGroups: ["aigateway.envoyproxy.io"]
resources: ["mcproutes"]
verbs: ["create"]The test identity was:
system:serviceaccount:attacker-a:one-shot-author
This identity did not have permission to access the controller, modify Pods, read Secrets, or create resources in the victim namespace.
Step 2 — Configure the Isolated Controller
The controller was configured with the following resource limits:
resources:
requests:
memory: 32Mi
cpu: 10m
limits:
memory: 160Mi
cpu: "1"An administrator preconfigured the required Gateway/backend resources and an isolated HTTP endpoint serving controlled, syntactically valid OAuth metadata.
The endpoint generated a 40 MiB JSON response with a large padding field.
Step 3 — Trigger Metadata Discovery
Configure the controlled metadata endpoint:
docker exec agent-router-round2-k3s kubectl set env \
deployment/large-metadata -n attacker-a RESPONSE_MIB=40Restart the disposable controller to obtain a clean baseline:
docker exec agent-router-round2-k3s kubectl rollout restart \
deployment/audit-controller -n agent-router-systemCreate the malicious MCPRoute using the restricted identity:
docker exec -i agent-router-round2-k3s kubectl create \
--as=system:serviceaccount:attacker-a:one-shot-author \
-f - < security-audit/round2/large_route.yamlStep 4 — Verify Cross-Namespace Impact
Create a separate, unrelated MCPRoute in namespace victim-b:
docker exec -i agent-router-round2-k3s kubectl create \
-f - < security-audit/round2/victim_route.yamlStep 5 — Observe Controller Failure
The controller reported:
ready=false
restarts=1
lastReason=OOMKilled
lastExit=137Both the malicious route and the unrelated victim route initially lacked reconciliation status.
The malicious object remained present after controller restart, causing repeated OOM failures.
Three OOM restarts were observed.
Step 6 — Validate Recovery
Reduce the synthetic endpoint response to 1 MiB:
docker exec agent-router-round2-k3s kubectl set env \
deployment/large-metadata -n attacker-a RESPONSE_MIB=1The controller subsequently recovered and both MCPRoute resources became Accepted.
The unrelated victim namespace experienced a 43-second reconciliation delay.
Observed Results
| Metadata response | Result |
|---|---|
| 8 MiB | Accepted |
| 16 MiB | Accepted |
| 24 MiB | Accepted |
| 32 MiB | Accepted |
| 40 MiB | OOMKilled, exit 137 |
Conclusion
A principal restricted to MCPRoute creation in one namespace can cause an oversized metadata response to exhaust the memory of the shared Agent Router controller, disrupting reconciliation of unrelated namespaces.
The issue was reproduced using isolated services and synthetic data. No production infrastructure was targeted.
Reproduction artifacts: security-audit/round2/harness/main.go, security-audit/round2/cluster_setup.yaml, security-audit/round2/large_route.yaml, and security-audit/round2/victim_route.yaml.
The complete setup and test evidence are documented in AGENT_ROUTER_ROUND2_VALIDATION.md.
Impact
Impact: Cross-Namespace Controller Denial of Service
This vulnerability allows a low-privileged, namespace-scoped attacker to cause a Denial of Service (DoS) against the shared Agent Router controller through uncontrolled memory consumption (CWE-400).
An attacker with only create permission for MCPRoute resources in one namespace can trigger the controller to retrieve and buffer an oversized OAuth metadata response, exhausting its available memory.
Confirmed security impact:
- Controller Availability: A single 40 MiB metadata response caused a controller with a 160 MiB memory limit to terminate with
OOMKilled(exit code 137). - Persistent Denial of Service: The malicious MCPRoute remained in Kubernetes after the controller restarted, resulting in three observed OOM restarts.
- Cross-Namespace Disruption: An unrelated MCPRoute in another namespace remained unreconciled for 43 seconds.
- Low Privilege Requirement: Exploitation required only namespace-scoped MCPRoute creation permission, without administrative access, Pod creation privileges, or access to other namespaces.
- Shared Control-Plane Impact: The failure affected a shared controller responsible for processing resources beyond the attacker's namespace.
Affected Users
Kubernetes deployments running Agent Router with a shared controller, where lower-privileged users can create MCPRoute resources and the controller can reach an attacker-controlled or compromised OAuth metadata endpoint.
Security Consequences
A namespace-restricted user can disrupt control-plane reconciliation for unrelated namespaces, potentially delaying route configuration and security-policy updates.
The demonstrated impact is limited to controller availability and reconciliation delays. Interruption of already-established Envoy data-plane traffic was not demonstrated.
Impact Classification: Availability — High
Suggested Severity: High (provisional CVSS v3.1: 7.7).