Skip to content

bug: Forgeable headers let callers pick the ext_proc chain, switch off IBAC/SPARC, or choose the JWT audience #1562

Closed

Description

@huang195

Problem

Three checks trust a header that the caller (an external client or the agent itself) can set. Each lets a request skip a plugin chain or plugin. Line numbers are at ab5f01f26.

1. ext_proc picks the inbound or outbound chain from a header the client can forge

core/listener/extproc/server.go:197-215 chooses the pipeline from x-authbridge-direction. getHeader (:1324-1334) returns the first entry, and any value other than inbound means outbound.

  • Inbound: the Envoy Lua filter in rossoctl (charts/rossoctl/templates/authbridge-template-configmaps.yaml:169; same in agent-namespace-resources.yaml:244-246) uses headers():add, which appends after the client's entry. An external caller who sends x-authbridge-direction: outbound runs handleOutbound. jwt-validation never runs, and the request reaches the agent unauthenticated.
  • Outbound: the outbound listener never strips the header. An agent that sends x-authbridge-direction: inbound gets the inbound chain, so outbound OPA, IBAC and token exchange are skipped.

Fix:

  • In the Envoy config: use headers():replace on inbound, and remove the header on the outbound listener.
  • In cortex: reject a request that carries more than one direction entry.

Not yet tested against a live Envoy. The claim that Envoy passes duplicate headers to ext_proc in insertion order is from reading the config.

2. An agent can turn off IBAC (and SPARC) by setting a header itself

core/plugins/ibac/plugin.go:341-343 returns Continue, with no skip recorded, when the request has X-IBAC-Judge: 1. sparc/plugin.go:262 does the same with its sentinel. Outbound pctx.Headers is the agent's own request, and nothing strips these headers.

IBAC's stated threat is a prompt-injected agent (docs/ibac-plugin.md:17-29). A tool that lets the model set headers sends POST exfil-server with X-IBAC-Judge: 1 and is never judged.

The guard protects against a loop that cannot happen: the judge uses its own http.Client that bypasses the listener (judge.go:48-55).

Fix: delete the header check in both plugins.

3. jwt-validation audience_mode: per-host takes the audience from the caller's Host header

core/plugins/jwtvalidation/plugin.go:261-263, 390-395 sets the expected aud to routing.ServiceNameFromHost(pctx.Host). On the reverse-proxy inbound listener, pctx.Host is r.Host (reverseproxy/server.go:343).

  • Case: a caller with a token minted for billing sends it to agent foo with Host: billing. It passes, and the Director then forwards the request to foo. This is the confused-deputy case that jwks.go:63 says the audience check exists to stop.
  • On ext_proc, inbound Host is deliberately empty (extproc/server.go:263-271). Per-host mode adds no default audience (plugin.go:133), so every inbound request gets a 503 (auth.go:330-336).
  • The two tests (plugin_test.go:43, 191) only check Configure and Ready.

Fix: derive the audience from the listener's backend or original destination, or refuse per-host mode on inbound in validate().

Found by a code audit of main at ab5f01f.

Assisted-By: Claude (Anthropic AI) [email protected]

Activity

  1. added
    bug
    Identity
    on Oct 29, 2026
  2. self-assigned this
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Identitybug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions