Blog / A02:2021 Cryptographic Failures
A02:2021 · Cryptographic Failures

Config decides where your auth token goes

The telemetry URL was assembled from runtime config with no allowed-origin check and no forced HTTPS, and every request carried a bearer token. Point it anywhere you like.

config suppliesthe host and paththe URL is builtwith no…a bearer token isattachedthe request goesout over…the token landson an…ATTACKER INPUTIMPACTinternal service reached
Attack path · config supplies the host and path → the URL is built with no origin allowlist → a bearer token is attached → the request goes out over whatever scheme config chose → the token lands on an attacker host or in cleartext

The telemetry URL was assembled from runtime config with no allowed-origin check and no forced HTTPS, and every request carried a bearer token. Point it anywhere you like.

What goes wrong

Two mistakes stacked on top of each other. The destination URL is built straight from config values with no check that the origin is one you actually trust, so anyone who can influence config redirects the request. That could be a compromised settings server, a tampered config file, or a machine-in-the-middle on the config fetch itself. And the scheme isn't pinned, so nothing stops the request going out over plain HTTP.

Now add the third fact: the same request attaches a bearer token. A redirected request delivers that token to an attacker's endpoint. A downgraded request leaks it to every hop on the wire. A bearer token is a password in a header. You would not POST a password to a URL you never validated, and that is exactly what this does on every telemetry flush.

The pattern

Vulnerable
void sendTelemetry(Event e) {
  String url = config.host + config.path + "/events";
  var req = post(url).body(e);
  req.header("Authorization", "Bearer " + config.token);
  send(req);   // host and scheme both come from config
}
Hardened
void sendTelemetry(Event e) {
  URI url = URI.create(config.host + config.path + "/events");
  require("https".equals(url.getScheme()));
  require(ALLOWED_HOSTS.contains(url.getHost()));
  var req = post(url).body(e)
      .header("Authorization", "Bearer " + token);
  send(req);
}
How the pipeline adjudicated itHELD
ABCDEFGH

Grounding and reachability were confirmed. The exploit-path gate would not conclude without the calling code, so the finding was held and an evidence request was raised instead of being reported as fact.

Ed25519 · per-tenant signing key · gate ledger A–H · verify offline against the published payload hash

Why it matters to you

Config is an input like any other. If an attacker can nudge it, an unvalidated destination plus an attached credential is a clean way to exfiltrate that credential, and then everything the credential unlocks. You don't need a memory bug or an injection. You need one setting.

The rule is simple. A credential only goes to a destination you validated on this call, over a transport you pinned. Anything less is trusting your config store with your auth tokens.

Check your own code