Fueled by several NHI-related breaches, NHI security companies (SlashID included) are everywhere these days - but, what are the core issues, and what’s causing them?
In this blog post, we seek to map out the problem and draw some lessons from application security, endpoint, and other areas of security to reason about the problem.
Attack patterns against NHI
The MITRE ATT&CK framework is very useful for mapping attack patterns against NHIs:
Several of the techniques discussed here apply to NHIs - in particular, limiting this to Initial Access
and Credential Access
:
- Trusted relationships
- Credentials from password stores
- Exploitation for Credential Access
- Steal application access token
- Steal or Forge Authentication Certificates
- Steal Web Session Cookies
- Unsecured Credentials
In practice, looking at historical data we see adversaries perform the following techniques to gain access via NHIs:
- OAuth social engineering (notable adversary: APT28/GRU)
- Stolen, lost, or forged credentials (notable adversary: APT29/SVR)
- An important sub-category of (2) is Kerberos/Active Directory-related token forging or stealing (notable adversary: Turla/FSB)
- Exploitation of federation trust relationships (notable adversary: Scattered Spider)
In this article we are not going to focus on OAuth social engineering and the exploitation of federation trust relationships for two reasons:
- OAuth social engineering is a broader problem that applies to user accounts as well. Similarly, federated trusts relationships broadly apply to user identities. We are going to cover both in separate posts
- While both techniques are dangerous, stolen, forged and lost credentials represent the bulk of real-world intrusions by a significant margin
What is unique about NHIs?
With a taxonomy of attacks under our belt, we can reason about the unique challenges associated with NHIs. At a high level, we see 5:
- You can’t enforce Multi-Factor Authentication (MFA)
- Their credentials can’t be rotated easily
- Lifecycle management is lacking: it is hard to know who has access to them, and how and when they should be de-provisioned. Further, there’s no source of truth/” known good” for them
- There are too many of them and their usage is not self-explanatory
- They are often over-privileged
The result is that, as an industry, we face the following:
- Attackers target NHIs because they can log into a system and move laterally much more easily
- If there is a breach or suspected breach, the time to remediate is extremely long
- It’s hard to stay compliant
- Because NHIs are so often overprivileged, privilege escalation and lateral movement are much easier to achieve
Analyzing the problem
In summary, we are facing two core issues.
One is that NHIs make for perfect candidates for credential-based attacks, and the second is that governance of these identities is too hard due to sprawl and lack of granular visibility.
When we talk about governance in this context we mean both lifecycle management as well as entitlement management.
Dissecting the problem further leads us to several questions.
Are NHI issues a misnomer? Are they credential issues?
While not all NHI issues are credentials-related, without credentials, we could be way less concerned about the remaining NHI attack vectors.
Specifically, without credentials, NHIs would be a significantly less popular attack vector because there would be a lot fewer ways to impersonate an NHI - in particular, phishing, endpoint/workload breach, and trusted relationships exploitation.
As we can see from past breaches the bulk of identity attacks are credential-related, just a few examples:
- The recently branded UnOAuthorized attack against Microsoft apps involves credentials attached to service principals and then misusing these credentials for persistence and privilege escalation
- The AWS credential leak campaign reported by Palo Alto Unit 42 is another example of NHI credentials abused
- One of the most infamous attack vectors for AWS historically were Server-Side Request Forgery (SSRF) attacks to steal EC2 metadata credentials.
So yes, many NHI concerns are credential concerns in disguise.
While it’s not feasible to get rid of credentials altogether, short-lived credentials can greatly reduce risk and increase the ability to generate high signal detections.
Would workload-bound credentials solve the problem?
As we have discovered, one of the central issues with NHIs is that they are privileged, and impersonating one by stealing credentials is relatively easy.
Workload-bound credentials would significantly reduce the number of attacks you could carry via an NHI. If you can safely attest a device or a workload and protect its identity we would make the value of an NHI limited in that it could only be misused while maintaining persistence on the workload using it.
However, as we’ve seen in application security, even the most locked-down applications still get compromised. Locking down credentials increases the complexity of the attack but by no means solves the problem entirely.
When it comes to governance, are lifecycle management and over-privileged identities a solvable problem?
In a perfect world access issuance would be significantly down-scoped to just the number of permissions necessary for that NHI to perform its role. A good parallel to think about is sandboxing applications on desktops.
Sandboxing has been incredibly useful in reducing the odds of privilege escalation once an attacker has compromised the application. However, it is also incredibly difficult to apply in real life.
Most applications are still far from being sandboxed and it took Chrome several years and an inordinate amount of engineering effort.
If the parallel holds we can then conclude that achieving perfect least privilege won’t be feasible and we’ll have to accept a trade-off, however, it is equally true that the current state of NHI privilege management is similar to applications before sandboxing was widely used.
Is this an identity, engineering, or SOC issue?
We believe the answer is all of the above and a unified approach decreases the odds of a successful breach.
The ideal solution
The NHI problem is not fundamentally new - in fact, as an industry, we’ve had many similar challenges in the past and, as usual in security, a layered approach is the right way to think about it. In particular:
- Short-lived credentials
- Device/workload-bound identities
- Down-scoped privileges for each identity
- Governance around provisioning, de-provisioning, and federated trust
- A detection and response framework to stop the remaining potential breaches
It is key to remember that even if 1-4 are in place, the fundamental threat still exists and is unavoidable. When we think about it:
- Breaching a workload or a user will still happen and it will likely still result in the loss of key material later leveraged for lateral movement
- Phishing via OAuth apps and federation can be abused to pivot from a user account to an NHI
So it’s clear that the three pillars to solve this problem are engineering, governance, and detection and response.
How close are we to that?
While there are several standards out there and, to some degree, practical implementations of device-bound tokens and ephemeral credentials, in practice, several problems emerge:
- Most applications don’t support ephemeral credentials or even multiple credentials per tenant/account. As a result, credential rotation and revocation are risky and could result in downtime. Furthermore, several applications require a user to login through the UI to generate a new set of credentials making automation harder
- Workload/device attestation is feasible but not trivial to solve at scale
- Least privilege, as we discussed, is hard to achieve. For instance, AWS has 15,561 API methods and 17,181 permissions
- Sometimes NHIs are used outside of workloads so attestation is not an option to begin with
- Lastly a number of attack paths are not easily addressable and have never been historically, e.g.: phishing and exploitation of application vulnerabilities
So what can we practically do today?
Even though we can’t easily get to the ideal solution, several practical improvements are feasible today:
- Use a vaulting solution to reduce the risk of credential sprawl
- Adopt a secret scanner to reduce the risk of accidental credential leaks
- Tokenize credentials/adopt a secret-less posture. The basic premise is to minimize the surface-touching key material to make it easier to perform rotation, reduce the odds of needing to rotate credentials in the first place and generate an audit trail on usage
- Implement and enforce conditional access for NHIs
- Unify observability and inventory of the various NHIs present across your environments
- Detect and automatically respond - put a strong detection and response framework in place to reduce the risk of a lost or stolen credential or a compromised identity. According to CrowdStrike, attackers break out in approximately 30 minutes - it’s important to react automatically to reduce the blast radius of the incident.
How can SlashID help?
SlashID can help in three ways:
- You can adopt our platform to observe, detect, and automatically respond to NHI breaches. You can read more about our approach here based on the Palo Alto Unit 42 report of the latest AWS credential theft campaign
- You can adopt our Gate module to implement credential tokenization and conditional access for NHIs. This is an overview of how we approach tokenization
- Provide visibility over trust relationships, privileges, and remediation capabilities to help solve the governance issue
Conclusion
We hope this blog post helped frame the issues surrounding NHIs and some of the approaches to solving them.
Ultimately the perfect solution requires a significant engineering effort from both vendors and consumers of a service, making it hard to achieve in the real world in the short term.
Until then, we believe that security teams should put in place a credential minimization strategy and a detection and response framework.
Reach out to us to let us know how you are approaching the problem or to schedule a free Identity Security Assessment!