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

One config line decides where your release secrets go

A publish block trusts an environment variable for its destination. The auth block right below it fires for any host that variable names.

variable namesthe registryauth blockattaches secretsno origin checksecrets sent tochosen hostATTACKER INPUTIMPACTinternal service reached
Attack path · variable names the registry → auth block attaches secrets → no origin check → secrets sent to chosen host

A publish block trusts an environment variable for its destination. The auth block right below it fires for any host that variable names.

What goes wrong

Look at the publish block and the credentials sit a few lines under the destination. The destination is an environment variable, used raw. The credentials are unconditional. Nothing checks that the two belong together, so the secret authenticates to whatever the variable resolved to.

That gap is the whole bug. Point the variable at an attacker-run server and the release step logs in to it, sending the username and secret across. It reads as a normal publish in the logs, because from the build's point of view it is one. The only thing that changed was an address nobody validated.

Rated high because the payoff is publishing credentials, which are often reusable and let an attacker push tampered artifacts under your name. The prerequisite, influence over a build variable, is met more often than teams like to admit.

The pattern

Vulnerable
repository {
  url = System.getenv('REPO_URL')  // trusted blindly
  credentials {
    username = System.getenv('REPO_USER')
    password = System.getenv('REPO_SECRET')
  }
}
Hardened
def repo = System.getenv('REPO_URL')
require(repo == EXPECTED_REPO_URL) { 'unexpected publish target' }
repository {
  url = repo
  credentials {
    username = System.getenv('REPO_USER')
    password = System.getenv('REPO_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

A credentialed request to an unvalidated destination is credential exfiltration waiting for a trigger. This keeps happening because the destination and the auth are written as separate concerns, so nobody asks whether the secret should follow the URL wherever it goes. Bind the two. If the target is not the registry you expect, do not send the secret.

Check your own code