← Back to blog
Blog Detail

Exposed LLM Gateways: Testing Whether the Config API Leaks Upstream Provider Keys

Amazon's MadPot telemetry shows agentic campaigns harvesting keys from exposed AI gateways. Test whether yours returns a usable upstream provider key, then prove it at the provider.

Trusteed Team
Trusteed Editorial
Written On
Nov 15, 2026
Category
API Security
Read Time
8 min read
  • LLM Gateway Security
  • API Security
  • Credential Theft
  • Attack Surface Testing
  • ARTEX
  • Trusteed
Exposed LLM Gateways: Testing Whether the Config API Leaks Upstream Provider Keys

Exposed LLM Gateways: Testing Whether the Config API Leaks Upstream Provider Keys

TL;DR

Between October 3 and November 5, 2026, Amazon's MadPot decoy network captured requests from AI agents built on ARTEX, an open-source agentic pentest framework, and those requests carried the agents' own campaign memory. The recorded method is unglamorous: find internet-exposed AI gateways and app builders, read the upstream provider keys they store, validate the keys, and pool them for reuse. The testable hypothesis for your estate is narrower than "are we exposed to agentic attackers": does your gateway's config or admin API return a usable upstream credential to a caller who should not have it? You prove it by comparing responses from a low-privilege account and an admin account on the same endpoint, then presenting the extracted key to the provider's identity endpoint and recording what it reaches. A login page banner is not proof; a provider-side identity response containing your account ID is.

What this is

An LLM gateway (also called an LLM proxy or AI gateway) sits between your applications and one or more model providers. It holds the upstream provider keys, brokers model calls, and exposes a management API for channels, providers, users, and tokens.

Key harvesting is the practice of reading those stored upstream keys from an exposed management interface and then using them directly at the provider, bypassing your gateway, your rate limits, and your logging.

The distinction that decides the finding:

  • Gateway token — the credential your application or user presents to the proxy. Revocable in the gateway. Low value alone.
  • Upstream key — the credential the proxy presents to OpenAI, Anthropic, Bedrock, Vertex, or an aggregator. Revocable only at the provider.

Most of this article is about the second one, because that is what the agent records describe collecting and grading.

Why it matters

If an exposed gateway returns upstream keys, the blast radius is not the gateway. It is every provider account that gateway aggregates — which is precisely why the campaign favored aggregation points over single-purpose apps: one weak management interface can expose many downstream accounts.

The failure modes that make it worse than a normal exposure:

  • Revocation gap. Disabling the gateway user, rotating the gateway's master key, or deleting the channel does not necessarily invalidate the upstream key. It stays live at the provider.
  • Silent spend. Inference billed to your provider account but never recorded in your gateway's request logs is invisible to gateway-side dashboards.
  • Self-funding operations. Amazon describes a campaign where stolen keys paid for the inference that powered further credential hunting. The economics mean an unrotated key does not just cost money — it funds follow-on discovery.
  • Scope beyond inference. The agent records describe validating identities through provider token and identity services, enumerating storage, assessing permission scope, and going after managed model services, secrets stores, and application identities.
  • The 30-day grading rule. Operators instructed agents to treat credentials exposed publicly for more than 30 days as low-value inventory. Exposure age changes an attacker's prioritization; it does not change whether the key works.

How it works

The campaign pattern has four stages, and each one is a place to test.

1. Locate. Amazon reports that MadPot presented popular LLM-compatible chat-completions interfaces on various ports, and agents sent prompts to them as if they were inference backends. Real gateways are found the same way agents find them: by their own paths, UI assets, and version banners. Amazon's post names LLM gateways and proxy platforms including One API, New API, Veloera, Sub2API, and LiteLLM, and AI application builders including Dify, FastGPT, Langflow, and RAGFlow.

2. Extract. The management API returns channel or provider records. The web UI often masks the key field; the API behind it often does not. Endpoints worth checking include the status, channel/provider list, token list, and model list routes, plus the OpenAI-compatible /v1/models.

3. Validate. The key is only a finding if it authenticates. Validation endpoints are read-only and provider-specific: an OpenAI-compatible /v1/models call, AWS sts:GetCallerIdentity, or an OAuth tokeninfo lookup.

4. Pool. Keys are stored in shared state and reused across agents. From a defender's view, that means a single leaked key can appear from many source IPs over time.

On versions: this is a class-level deployment pattern, not a single CVE. This post does not assert affected versions for any named project. Check the release notes and advisories for the products you actually run, and read the Amazon Security Blog post for the deployments the campaign referenced.

Detection and response

Dark insight card comparing an exposed LLM gateway's access log (one IP probing /v1/config/status, /v1/config/channel, /v1/config/token with 401, 401, 200) against a provider-side identity response returning the victim's account ID, with two supporting facts: provider logs are recorded out-of-band, and a spend-versus-request-count divergence shows usage bypassed the proxy.

Telemetry that catches this, in order of signal strength:

  • Provider-side audit logs. New key usage from an IP you do not own, sts:GetCallerIdentity from an unfamiliar principal, or a model-list call with no subsequent inference from the same key. This is the strongest evidence because the attacker cannot write to it from your network.
  • Gateway access logs. Sequential unauthenticated GETs against status, channel, token, and model routes from one source, followed by a 200 where earlier requests returned 401.
  • Spend-to-log ratio. Token consumption at the provider that has no matching request count in the gateway. Divergence means usage bypassed the proxy.
  • Egress from the gateway host to provider endpoints or regions it does not normally serve.
  • Canary keys. Plant a synthetic key in a channel configuration. Any use of it is unauthorized by definition, and it fires on extraction rather than on abuse.
  • A decoy inference endpoint. Because agentic frameworks retain conversation history, requests to a fake chat-completions interface can carry system prompts, tool history, and knowledge-graph state. Treat that content as attacker-authored and unverified — it tells you intent, not outcomes.

What a defender checks first: which gateways and AI app builders answer from the public internet, and whether their key-bearing endpoints require authentication at all.

What to do

  1. Inventory the surface. List every LLM gateway and AI app builder reachable from outside, with product, version, and whether self-registration is enabled. Write the list down before you test.
  2. Request the config endpoints without credentials. Record status code and body for the status, channel, token, and model routes. A 200 with provider metadata is the finding's opening line; a 401 is a data point, not an all-clear.
  3. Run the two-account comparison. Create a low-privilege account and an admin account in the same deployment. Request the same key-bearing endpoint as each. Diff status code and body. A key prefix in the low-privilege response is a broken function-level authorization finding.
  4. Validate read-only at the provider. Present the extracted key to /v1/models, sts:GetCallerIdentity, or tokeninfo. Capture the raw response.
  5. Enumerate scope, then stop. List models, list storage, read permission scope. Do not write, delete, or invoke billable inference beyond a single minimal call if your authorization permits it.
  6. Rotate at the provider, not only in the gateway. Then re-run step 4 with the old key and capture the rejection. That before-and-after pair is the remediation proof.
  7. Attach evidence to the finding. Full request and response with the secret redacted to a short prefix plus last four characters, the provider identity response, UTC timestamps, and the revocation pair. A second researcher should be able to reproduce every step from that package.
  8. Re-test after rotation. Confirm no other channel, user token, or backup configuration still holds a live copy.

FAQ

Is this the same as asking whether an AI agent's reported findings are real? No. That question is about verifying what an agent claims it did. This one is about your deployment: whether a config endpoint returns a credential that authenticates. The first needs corroboration; the second you can test yourself in an afternoon.

The UI masks the key. Is it still a finding? Yes, if the API returns it. Masking is usually a client-side rendering choice. Request the endpoint directly with the same session and compare.

We use a hosted gateway. Does any of this apply? The mechanism shifts from stored provider keys to member and role boundaries, but the test is the same: two accounts, one endpoint, diff the responses. Look at member management and key-creation routes.

What if the key only lists models and nothing else? You have proven possession of a valid credential and its scope. Report exactly that scope. Inflating a read-only key into "full account takeover" is how findings get dismissed.

Does rotating the gateway master key fix it? Only if the upstream keys rotate too. The gateway secret protects the proxy; the provider key is a separate credential with a separate revocation path.

Where this fits in a program

Exposure work earns its keep at the evidence stage. Inventory tells you where the gateway is; validation tells you whether the key inside it still authenticates. Trusteed's attack surface inventory and API surface testing give a researcher the endpoints to test, and its SOC gate keeps an unvalidated scanner hit out of the analyst queue until exploitability context backs it. The finding stays yours — it just becomes checkable by someone else.

Sources

Join Our Newsletter

Trusteed keeps you informed: emerging risks, platform updates, and practical guides for faster defense.