Blog / A10:2021 Server-Side Request Forgery
A10:2021 · Server-Side Request Forgery

Your publish URL is an env var, and so are the secrets

The build reads its package publish target from an environment variable with no checks. Change that variable and the publishing credentials go with it.

env var setspublish URLno scheme or hostcheckbuildauthenticates…credentials sentto attacker hostATTACKER INPUTIMPACTinternal service reached
Attack path · env var sets publish URL → no scheme or host check → build authenticates to it → credentials sent to attacker host

The build reads its package publish target from an environment variable with no checks. Change that variable and the publishing credentials go with it.

What goes wrong

The build picks its package publishing endpoint from an environment variable and uses it directly. No scheme validation, and no check that the address is the registry you actually publish to. Whoever can set that variable sets the destination.

The destination is where the damage lives. Publishing authenticates, so the configured username and secret get sent to whatever host the variable named. Redirect it to an attacker-controlled server and the build hands over its publishing credentials while it believes it is doing a normal release.

Build environments feel trusted, which is why this hurts. A malicious change to CI config, or a compromised dependency pulled into the build, can rewrite an environment variable, and the credentials follow the URL.

The pattern

Vulnerable
publishTo(env.PUBLISH_URL) {  // no validation
  credentials {
    username env.PUBLISH_USER
    password env.PUBLISH_SECRET
  }
}
Hardened
def target = env.PUBLISH_URL
assert isExpectedRegistry(target)  // pinned host, https only
publishTo(target) {
  credentials {
    username env.PUBLISH_USER
    password env.PUBLISH_SECRET
  }
}
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

Credentials go wherever the URL points, and if the URL is a variable, someone can point it. Treat your release pipeline as an attack surface, because it holds secrets with real reach and it runs code from more sources than you track. Pin the publish endpoint to a known host, or at minimum assert its scheme and origin before any credential is attached.

Check your own code