They should use both, but for different failure modes. Host hardening limits what the attacker can do locally, while workload identity limits what the attacker can reach east-west. If only one is present, the containment model remains incomplete.
Why This Matters for Security Teams
RCE containment fails when organisations assume one control can cover both local execution and network reach. Host hardening is designed to reduce what an attacker can do on the compromised machine: restrict binaries, lock down OS features, remove write paths, and reduce privilege. workload identity addresses a different problem: proving what the workload is allowed to talk to east-west, even after a process is abused. The two controls are complementary, not interchangeable.
This matters because modern compromise paths often move from code execution to credential theft, service impersonation, or lateral movement in minutes. NHI Management Group has shown that machine identity failures are frequently slow to detect, with an average time to detect a compromised machine identity of 214 days in the Critical Gaps in Machine Identity Management report. That gap is long enough for an attacker to pivot well beyond the original host. In practice, many security teams discover the missing half of containment only after a service account, API key, or workload token has already been abused.
Current guidance suggests treating RCE as both an endpoint problem and an identity problem. The network path matters as much as the process boundary, which is why the SPIFFE workload identity specification is increasingly used to bind access to the workload rather than the machine alone.
How It Works in Practice
Effective containment starts by assuming the host will be compromised and then limiting blast radius in two directions. Host hardening narrows local execution options. That includes removing unnecessary packages, enforcing least privilege on service accounts, applying application allowlisting where practical, disabling dangerous admin paths, and using OS-level controls such as seccomp, AppArmor, SELinux, or container isolation. These measures do not prevent all RCE, but they can make post-exploitation actions significantly harder.
Workload identity then constrains east-west movement. Instead of granting a process broad network trust because it runs on a particular server, the system issues cryptographic identity to the workload itself. In a SPIFFE-based model, the workload presents a short-lived identity document that downstream services verify before accepting requests. That shifts authorisation from “this host is trusted” to “this workload, in this context, may call this service.” For NHI governance, that distinction is critical. The Ultimate Guide to NHIs notes that NHIs frequently carry excessive privilege, which means an RCE on one service can quickly become a trust chain problem if identity is static or overbroad.
- Use host hardening to reduce local privilege escalation and tampering opportunities.
- Use workload identity to authenticate service-to-service calls with short-lived cryptographic proof.
- Prefer ephemeral secrets and automatic rotation over embedded long-lived credentials.
- Enforce policy at request time, not only at deployment time, so the decision follows the workload.
- Log both local security events and identity assertions to support containment validation.
For implementation patterns, the Guide to SPIFFE and SPIRE is useful because it frames workload identity as a runtime trust primitive rather than a static configuration artifact. These controls tend to break down in legacy flat networks where services depend on shared accounts, long-lived tokens, and broad trust zones because identity cannot be enforced at the call boundary.
Common Variations and Edge Cases
Tighter containment often increases operational overhead, requiring organisations to balance reduced blast radius against deployment complexity and service reliability. That tradeoff is real, especially in mixed environments where some systems can support modern workload identity and others still depend on legacy authentication.
There is no universal standard for this yet, but current guidance suggests a layered model. On bare metal and traditional VMs, host hardening may carry more weight because workload identity integration can be uneven. In Kubernetes and service mesh environments, workload identity usually becomes the stronger east-west control because pod IPs and node boundaries are too weak to define trust. In container platforms, a compromised container may still be contained by the node if the kernel, runtime, and filesystem are hardened properly, but that does not stop an attacker from abusing any static secrets already mounted into the workload.
Edge cases also matter when the attacker can execute code but not install tooling. Host controls may stop persistence, yet if the process already holds a valid token, workload identity is the only control that can narrow where that token works. Conversely, identity alone cannot stop local file theft, memory scraping, or abuse of privileged binaries. That is why the question is not which control wins, but which control fails first in a given architecture. Where legacy service accounts are reused across environments, both layers are required and neither can be considered complete on its own.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | A01 | RCE on an AI agent maps to abuse of autonomous execution and tool access. |
| CSA MAESTRO | IDM | MAESTRO emphasizes workload identity and runtime trust for agentic systems. |
| NIST AI RMF | AI RMF supports risk-based controls for autonomous and unpredictable systems. |
Constrain agent tool access and runtime authority so code execution does not become unrestricted action.
Related resources from NHI Mgmt Group
- What breaks when organisations use one Azure identity pattern for every workload?
- Should organisations use just-in-time access for AI-enabled developer workflows?
- Should organisations treat workflow engines like privileged identity infrastructure?
- When should organisations prioritise Zero Standing Privilege for non-human identities?