Blog / A03:2021 Injection
A03:2021 · Injection

Untrusted config that your deployment templates evaluate as code

A packaged deployment template ran user-supplied annotations through a helper that evaluates expressions. Feed it an expression and it can read secrets elsewhere in the release or query the cluster.

operator or usersets…value passed to arendering helperhelper evaluatesit as a templateinjectedexpression…secrets orcluster…ATTACKER INPUTIMPACTcode path executes
Attack path · operator or user sets an annotation → value passed to a rendering helper → helper evaluates it as a template → injected expression runs in context → secrets or cluster data disclosed

A packaged deployment template ran user-supplied annotations through a helper that evaluates expressions. Feed it an expression and it can read secrets elsewhere in the release or query the cluster.

What goes wrong

Annotations are supposed to be inert metadata, strings you attach to a deployed object. In this chart they get routed through a helper that renders template expressions. The moment untrusted input reaches that helper, the annotation stops being data and becomes an expression the renderer will execute.

Template expressions here run with the surrounding rendering context, and that context reaches more than the current field. It can read other values defined in the release, secrets among them, and in some setups it can look up live objects in the cluster. Someone who controls the annotation writes an expression that copies a secret into a rendered field, or enumerates resources the rendering identity is allowed to see. The reach is the whole release, not the one annotation they touched.

Keep template evaluation off anything a caller can set. Values that come from users or downstream overrides should be emitted as literal strings. If operator-authored values genuinely need templating, keep that path separate from the caller-controlled one.

The pattern

Vulnerable
# helper re-renders whatever it receives
define "render":
    return evalTemplate(value, context)   # runs the input

metadata:
  annotations:
    render(userValues.annotations)   # user-controlled
Hardened
# emit caller-supplied values as literal strings
metadata:
  annotations:
    for key, val in userValues.annotations:
        emit(key + ": " + quote(val))   # never evalTemplate
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

Charts rarely stay in one team's hands. Yours might be installed by a platform team, then handed to an app team that supplies its own values, and any of them can reach a field that gets re-rendered. Server-side template evaluation on untrusted input is remote code execution's quieter cousin, and it earns the same suspicion.

Check your own code