Secure single-server AI harness
← Scenario write-up

Security demo · model escalation

One -m flag spends the key in the open — behind the catalog it dies before credentials

The same agent image, run twice. In a plain container the wrong-model pick is honored end to end and nothing refuses or records it. Behind the boundary, the catalog lists exactly the approved models: the same pick gets 404 before credentials, forged headers are stripped, and the direct path dies at connect().

secure-single-server · OpenShell sandbox · docs/examples/model-escalation

plain container · no boundary sandbox · execution boundary -m gpt-6-sol + key ✕ model: gpt-6-sol 404 before credentials ✕ direct · skips gateway EACCES at connect() agentkey in env stand-in provider3 requests · canary attached no refusal · no audit agentsame image Praxis gatewaycatalog listsgpt-4.1-mini only api.openai.comthe real provider
Fig. 1Side A honors the flag end to end — a real provider would bill and tell no one. Side B's only model path is the gateway: the catalog answers 404 before credential injection, and the direct provider path dies at connect().

The move

Same credential, same endpoint — only the model field changes

Spending a found key on a different provider is key theft. Spending it on a stronger model at the legitimate provider is model escalation: same credential, same endpoint, one field. The September 2026 benchmark made the move famous — the model outsourced part of its task to stronger models and outscored itself.

one field {"model": "gpt-4.1-mini"}budget · approved {"model": "gpt-6-sol"}premium · never approved
Fig. 2The escalation move is one field in the request body. A boundary that validates paths, credentials, and quotas but not this field does not stop it — that was the gap the API-key-theft demo recorded, and the catalog is the fix that shipped.

No boundary

The client's config owns the model list — and it is honored

Side A runs the agent image as a plain container: a provider key in the environment, unrestricted network, a stand-in provider on the host playing the real provider's role. The client-side model list is the user's own config file — the user who owns the config owns the list.

the stand-in provider's own request log

the agent ran its bash tool, wrote the proof file, and confirmed completion on gpt-6-sol
stand-in provider records: 3 completion request(s) for gpt-6-sol, canary credential attached to each

The choice was honored verbatim, the key traveled with every request, and nothing refused or logged a violation. A real provider would bill for this and tell no one.

The mechanism

The model field is a lookup key, not a command

Behind the boundary, every path to a model runs through the Praxis gateway. Its unified model catalog answers /v1/models from the administrator's configuration, and the request's model field is checked against it before credentials are injected.

sendslooks upforwardsagentgatewaybody pre-readcatalogapproved modelsprovider
  1. Body pre-read: caller copies of the routing header X-Gateway-Model are stripped — the body's model decides.
  2. Catalog lookup: the model field is matched against the administrator's approved set.
  3. Not in the catalog: static 404 Unknown model — before credentials, before the upstream.
  4. In the catalog: the real credential is injected and the request is forwarded.
Fig. 3The catalog check runs first: an unknown model never reaches credential injection, so no client-side change can reach the routable set.

The fallbacks

The same pick, three ways — all refused

Side B tries the escalation three ways: in the request body, forged into the routing header, and by skipping the gateway entirely.

404

wrong model in the body

✕ agentgpt-6-sol gatewaycatalog 404 Unknown model
stripped

forged routing header

✕ agentfake header gatewaystrips it body decides → 404
EACCES

skip the gateway

✕ agentdirect provider:443 EACCES at connect()
Fig. 4Three fallbacks, three refusals: the catalog answers the body's model with 404, the header never survives pre-read, and the direct path is the key-theft vector one layer down — it dies the same way.

The sanctioned flow

The approved model answers

The demo's sanctioned pick is a budget model — the budget-versus-premium tiering an administrator would actually configure. Through the catalog it works exactly as intended:

side B, through the catalog

the approved model answered: I am the GPT-4.1-mini language model.

Side B makes exactly one real completion request — the sanctioned model, a few tokens. The wrong-model requests are refused before credentials, and no key ever exists inside the sandbox to transmit.

The evidence

The refusal is the gateway's own answer, not the client's

models in the catalog1gpt-4.1-mini
wrong-model requests that reached a provider0refused before credentials
provider credentials inside the sandbox0placeholder only

As the user experiences it, opencode wraps the refusal in a generic UnknownError — it cannot attribute the refusal. The raw request from the sandbox's sanctioned runtime shows whose answer it is:

the raw request, at the wall of the gateway

HTTP 404
Unknown model

the direct provider path

connect error: EACCES

the audit record

[1792602895.804] [sandbox] [OCSF ] [ocsf] NET:OPEN [MED] DENIED /usr/bin/node-26(0) -> api.openai.com:443 [reason:transparent_tcp_policy_denied]

Every other failure happens inside the client or inside an allowed connection; the audit record holds the one network denial side B produces.

What this demo does not claim

The catalog decides which — not how much

scope
  • The catalog is per-gateway. Every sandbox behind one gateway shares the routable set; per-agent tiers are a deployment pattern, not something this demo demonstrates.
  • The client contract constrains the catalog. The deployed client path sends the legacy max_tokens parameter, which current premium families reject; the sanctioned model must be one the qualified client can actually call.
  • Quota and audit are the spend controls. The catalog decides which models are routable; rolling-day token limits and per-request access logs decide and record how much.

What to remember

Agents may use only the models the administrator approved

  1. The model field is a catalog lookup key, not a command. The gateway refuses unknown models with a static 404 before credential injection.
  2. The refusal happens where the credential lives. No provider key exists inside the sandbox, so there is nothing to spend on any model.
  3. Headers do not route. Caller copies of X-Gateway-Model are stripped during body pre-read; the body's model decides.

Sources

docs/examples/model-escalation/README.md — the scenario

openshell/scripts/model-misuse-demo.sh — runs both sides in one sandbox, destroyed on exit

openshell/scripts/model-misuse-catalog.json — the shipped single-model catalog

scripts/common/unified_config.py — the unified model catalog

Sibling examples in the same incident family: API key theft, document exfiltration. The side-A provider is a host-side stand-in; the planted key is a synthetic canary.