Repository navigation
Description
Summary
SpiffeIDFromPod (agent/internal/xds/proxy/listener.go) takes the aether.io/spiffe-id pod annotation verbatim, with no validation:
func SpiffeIDFromPod(cniPod *cniv1.CNIPod, trustDomain string) string {
if id, ok := cniPod.GetAnnotations()[xdsconst.AnnotationSpiffeID]; ok && id != "" {
return id
}
return fmt.Sprintf("spiffe://%s/ns/%s/sa/%s", trustDomain, cniPod.GetNamespace(), cniPod.GetServiceAccount())
}Annotations arrive straight from the pod object via the CNI ADD path (agent/internal/cni/server/pod.go), so any principal who can create a pod can choose the mesh identity that pod's inbound listener presents — a different service account, a different namespace, or a different trust domain entirely. Nothing checks the value against the pod's own namespace/ServiceAccount, and nothing logs the override.
Why this matters
Mesh authorization is built on the peer's presented SPIFFE ID:
- clients pin the expected SAN per upstream (
agent/internal/xds/cache/mtls.goderivesspiffe://<td>/ns/<ns>/sa/<sa>from the registry service name); - inbound RBAC /
EndpointPolicyand the XFCC-based authz path key off the caller identity (proposal 027, feat(authz): RBAC local authorization with audit mode #476/fix(authz): INBOUND filters bring their own chain entry into the union #477).
An attacker who can create a pod in any mesh-managed namespace can therefore have it present the identity of a privileged service and satisfy those checks. That is a full authorization bypass, not a spoofed label — the whole point of per-pod SVIDs is that identity is not self-asserted.
It also converts Kubernetes' weakest common permission (create a pod in my own namespace) into cross-namespace impersonation, which is exactly the boundary the trust-domain design is supposed to hold.
Note the actual SVID material still comes from SPIRE, which issues based on the pod's real workload attestation — so this is about which identity the listener is configured to present/validate as, and the blast radius depends on how the SDS name resolves for an overridden ID. That interaction needs to be traced as part of the fix; it may fail closed (no matching SVID) in some configurations and open in others. Either way the annotation should not be trusted.
Proposed fix
Prefer removal. If the escape hatch has a real use case, validate it:
- reject any value whose trust domain is not the mesh trust domain;
- reject any value whose
/ns/<ns>/sa/<sa>does not match the pod's own namespace and ServiceAccount (i.e. the annotation may only ever restate the derived value, which makes it useless — hence "prefer removal"); - if a legitimate cross-identity case exists, gate it behind a cluster-scoped policy object an ordinary namespace user cannot create, not a pod annotation.
Whatever is chosen, log at WARN when the annotation is present and emit a metric so the override is never silent.
Related
Found during the #638 design exploration (2026-09-02) while auditing identity derivation. Independent of #638's own mechanism. See also the fail-open path noted there: agent/internal/xds/proxy/transportsocket.go silently drops SAN pinning when sanURIs is empty, which is the other place identity enforcement can disappear without a signal.
Adjacent, same area: agent/internal/xds/proxy/egress.go applies pod-supplied endpoint.aether.io/* metadata after the built-in namespace/pod/ip keys, so a pod can overwrite them. Reorder so built-ins win, before anything is built on those fields.
Activity
fix(security): stop trusting the aether.io/spiffe-id pod annotation a…
fix(security): stop trusting the aether.io/spiffe-id pod annotation a…