Skip to the page
Tecyfy

What is a non-human identity? Keys, service accounts and AI agents

A non-human identity is any account, key or token that a program uses to prove who it is: a service account, an API key, a CI deploy token, an AI agent's credentials. Why they now outnumber people, the 6 ways they go wrong in OWASP's list, and the fixes, with a check you can run on your own.

Tecyfy · Published · 7 min read

A ring of many identical machine keys with one gold house key among them under the words API KEY, showing machine identities outnumbering people

A non-human identity is any account, key or token that a program uses to prove who it is: a service account that runs a nightly job, an API key in an app's settings, the token a build pipeline uses to deploy, the credentials an AI agent uses to read tickets and call tools. It gets permissions like a person's account does, but no person signs in with it, and nobody is asked for a second factor.

Security people shorten it to NHI, and it has become a category of its own because there are so many of them. In CyberArk's 2025 survey of more than 1,200 security leaders, machine identities outnumbered people 82 to 1, and half said a compromised machine identity had led to an incident in the past year. It is a vendor's survey, but the shape is familiar to anyone who has counted the keys in a cloud account.

What counts as a non-human identity

If a program holds it and uses it to get in somewhere, it counts:

  • Service accounts: the cloud or database accounts that jobs and services run as, such as the account a warehouse load uses every night.
  • API keys and tokens: a key for a model API, a payment provider or a CRM, usually a long string in a config file or an environment variable.
  • CI/CD credentials: what the build pipeline uses to push images and deploy to the cloud.
  • OAuthOAuthThe standard way to let one app act for you at another service without giving it your password; the app gets a limited, revocable access token instead. MCP servers use it to let AI agents sign in. grants to integrations: the token a SaaS tool keeps after someone clicked "Allow" years ago.
  • Certificates and SSH keys: how servers and devices prove who they are to each other.
  • AI agents: an AgentAgentA model that uses tools in a loop, deciding each next step from what the last one returned, until the task is done. calls tools and APIs with credentials, so it is a non-human identity. So is the MCPModel Context ProtocolAn open standard for connecting AI applications to tools and data. A system offered once as an MCP server works in any application that speaks MCP. server that holds the keys to your email or database on its behalf.

The difference from a person's account is not the permissions. It is everything around them. A person has a manager, leaves the company on a known date, signs in with a phone in hand and gets locked out after a few wrong tries. A key has none of that. Whoever holds the string is the program.

Why machine identities go wrong

They are made in a hurry, by the person who needed something to work that afternoon, and then nobody owns them. The usual life of a key goes like this. A developer creates it with broad access to get past a permissions error, pastes it into a .env file, copies it to staging and production because it works, and moves on to another team. 3 years later the key still works, still has the broad access, and sits in the git history of a repository that has been forked twice.

OWASP collected these patterns into the Non-Human Identities Top 10 in 2025. 6 of the 10 are about the identity itself and can be checked from what you know about it:

RiskWhat it looks likeThe fix
NHI1 Improper offboardingKeys for ended projects, departed staff or old vendors still workAn owner and a review date for each; remove what has not been used
NHI2 Secret leakageKeys in source code, config files, logs or chatA secrets manager, repository scanning, rotate anything ever committed
NHI5 OverprivilegedAdmin rights for a job that reads one bucketOnly the actions and resources the job uses
NHI7 Long-lived secretsKeys with no expiry, or one years awayShort-lived tokens issued for each run
NHI8 and NHI9 Isolation and reuseOne key for test and production, or for several appsOne identity per app per environment
NHI10 Human usePeople sign in with the service account to fix things by handPeople use their own accounts; the logs then say who did it

The other 4 depend on the tools around the identity: third-party extensions and SaaS that hold your credentials (NHI3), weak or outdated sign-in methods (NHI4) and badly configured cloud deployment, such as static keys in a pipeline or OIDC trust with loose conditions (NHI6).

Pick a typical identity and mark what is true of it:

Try itWhich OWASP risks does this machine identity carry?
Identity
What is true of it
Machine identity3

deploy-bot

Deploys from the build pipeline to the cloud account

Expires
Never
Access
Broad
Owner
A named person
Used by
Shared
Signs in
Machines only
Stored in
Secrets manager
  1. NHI7

    Long-lived secret

    A key that never expires works for whoever copies it, for as long as nobody notices.

    Open
  2. NHI5

    Overprivileged identity

    Whatever takes it over can do everything it is allowed to, not only its job.

    Open
  3. NHI1

    Improper offboarding

    Give each identity an owner and a review date; remove what has not been used in 90 days.

    Closed
  4. NHI8 / NHI9

    Shared across environments or apps

    A leak from a test box or a small app opens production and every other app that shares it.

    Open
  5. NHI10

    Human use of a machine identity

    People sign in as themselves; the identity is for the program only.

    Closed
  6. NHI2

    Secret leakage

    Keep it in a secrets manager, scan repositories, and rotate any key that was ever committed.

    Closed

3 of 6 risks open on deploy-bot. Next fix: use short-lived tokens: an IAM role, workload identity or OIDC in CI, valid for one job.

Risks from the OWASP Non-Human Identities Top 10 (2025). NHI3 (third-party tools) and NHI4 (weak sign-in methods) depend on the tool, not on the identity, so they are not shown.

Short-lived beats rotated

Rotating a key every 90 days narrows the window. Not having a key closes it. The large clouds and CI systems now let a workload prove who it is and get a token that expires on its own, so there is nothing long-lived to steal.

  • On AWS, a workload on a service such as EC2 or Lambda runs as an IAM role and gets that role's temporary credentials, a workload runs as a role, a service account or a managed identity attached to it, and gets temporary credentials. AWS's own IAM guidance asks for exactly that: workloads use temporary credentials through IAM roles, and long-term access keys only where nothing else works.
  • In GitHub Actions, OpenID Connect replaces the cloud key stored as a repository secret. The workflow asks the cloud for a token that is valid for that one job and then expires. The cloud side decides which repository, branch or environment may ask, and that condition is the part to get right: OWASP's NHI6 is about trust that accepts any repository's token.
  • For a third-party API that only offers keys, keep the key in a secrets manager, give it the narrowest scope the API allows, and set a rotation date on the calendar with an owner's name beside it.

AI agents are the identities that read instructions

Every risk above applies to an AI agent, with one more on top. A deploy key does what its script says. An agent decides what to do next from the text it reads, and that text can come from an email, a web page or a ticket written by an attacker. With prompt injectionPrompt InjectionAn attack that hides instructions in text a model reads, such as a web page, an email or a file, so the model follows the attacker instead of you., the attacker borrows the agent's identity without stealing its key. Our prompt injection examples show how that happens through ordinary documents.

So the identity is the boundary that still holds when the model is fooled:

  • Give each agent its own identity, not a developer's personal token and not the shared service account. Then you can scope it, see what it did in the logs, and switch it off alone.
  • Scope it to the task. A support agent that reads tickets does not need to delete them, and one that drafts replies does not need to send them.
  • Act as the user where the tool allows it. The MCP security guidance forbids a server from passing on tokens that were not issued for it, so a token meant for another service cannot be passed through it; the same guidance asks servers to start with a minimal set of scopes and add more only when a privileged action first needs them.
  • Put a person in front of what cannot be undone. Payments, deletions and messages to customers wait for a click. How to add human approval to an AI agent shows where to put the gate, and coding agents have the same idea in their permission rules.

Where to start this week

You do not need a new product to make a first pass. Most clouds and code hosts already have the data.

  1. List what exists. Export the service accounts, access keys and OAuth apps from your cloud console and code host. Add the API keys from your secrets manager and .env files.
  2. Sort by last used. AWS's IAM guidance asks you to review and remove unused users, roles and credentials, and the IAM console shows when each was last used. Anything unused for 90 days is a candidate to disable, then remove a few weeks later if nothing breaks.
  3. Write an owner beside each one. An identity nobody will claim gets disabled first.
  4. Move pipelines to OIDC. Each deploy key you replace with a short-lived token is one fewer secret to leak.
  5. Scan repositories for secrets, including history, and rotate every key you find, even if the repository is private.

Do the first 3 steps for your AI agents and MCP servers too. They are the newest identities in most companies, made fastest, and the least likely to be on anyone's list.

Questions

What is a non-human identity?
A non-human identity (NHI) is any identity that a program, not a person, uses to prove who it is and get access: a cloud service account, an API key, an OAuth token, a CI/CD deploy credential, a certificate, or the credentials an AI agent uses to call tools. It has permissions like a user account, but no person signs in with it and no one is prompted for a second factor.
What are examples of non-human identities?
Service accounts that run scheduled jobs, API keys in an application's configuration, the token a CI pipeline uses to deploy to the cloud, OAuth tokens a SaaS integration holds, TLS certificates, bot accounts, and the keys an AI agent or MCP server uses to reach email, tickets, databases or code.
Why are non-human identities a security risk?
Because they are many, rarely reviewed and often powerful. Keys are copied into code and config files, given broad access to save time, shared between environments, and left working after the project or vendor is gone. A stolen key works without a password prompt or a second factor, so whoever has it is the program.
What is the OWASP Non-Human Identities Top 10?
A list of the 10 main risks of machine identities, published by OWASP in 2025: improper offboarding, secret leakage, vulnerable third-party NHIs, insecure authentication, overprivileged NHIs, insecure cloud deployment configurations, long-lived secrets, poor environment isolation, NHI reuse, and human use of NHIs.
Is an AI agent a non-human identity?
Yes. An agent calls APIs and tools with credentials, so it is a non-human identity, and a riskier one than most, because what it does next is decided by a model reading text that an attacker may have written. Give each agent its own identity with only the access its task needs, short-lived tokens, and a person's approval for actions that cannot be undone.