Skip to main content
Menu
Advisories

Uncontrolled resource consumption from JSON Schema $ref expansion

GHSA-X8G6-W83H-P745Published Updated GitHub

Description

A small crafted JSON Schema in a chat request makes Envoy AI Gateway expand it into an exponentially larger structure, exhausting CPU and memory in the external processor that handles every request through the gateway. A body under 2 KB is enough to hang or OOM it.

Proof of concept

When a request is translated for a Vertex AI (Gemini) backend, jsonSchemaDereference (internal/translator/jsonschema_helper.go) resolves $refs while tracking only the ones live on the current path, so two sibling $refs to the same definition each re-expand it in full. A per-path depth cap bounds recursion but nothing caps the total node count, so a chain of definitions that each reference the one below it twice expands to about 2^N nodes. It is reached under default config for any Gemini model whose name does not contain 2.5 or 3.

On v1.1.0, a 15-level chain of this shape (a 1458-byte body) does not finish in 20 seconds, while an equal-size linear schema returns in about 4 ms, and each added level roughly quadruples the time.

Impact

Any client that can send a chat request to a Vertex-backed route can hang or OOM the shared external processor with a few kilobytes, denying service to every tenant behind it. The schema is expanded before any upstream call, so the cost is paid regardless of backend or credentials. Present in 1.1.0 and on main.

Affected versions

References

GitHub · theagentrouter/agent-router