---
title: How do you detect an AI agent trying to expand its own permissions?
url: https://opencontroller.lyzr.com/blog/detect-ai-agents-trying-to-expand-their-own-permissions
published: 2026-11-17
updated: 2026-11-17
author: Lyzr
---

# How do you detect an AI agent trying to expand its own permissions?

**Watch for four signals tied to the agent's own identity: identity and policy write calls in your cloud logs, requests for broader OAuth scopes, edits to the agent's own configuration or permission files, and creation of new credentials. Any one of these from an agent that has no business doing it should raise a high-severity alert. The stronger control is preventive: an agent identity should never hold the rights to change itself.**

An agent does not need to be "malicious" to escalate. A coding agent blocked by a permission error may try to fix the error. A prompt injection may instruct an agent to add an MCP server or create an access key. In both cases the behaviour looks like what security teams already hunt for in human attackers. MITRE ATT&CK catalogues it as T1098, Account Manipulation, including T1098.001 (Additional Cloud Credentials) and T1098.003 (Additional Cloud Roles).

## Which signals show an agent expanding its access?

| Signal | Where to see it | Examples |
|---|---|---|
| Cloud IAM writes | AWS CloudTrail, Azure Activity Log, Google Cloud Audit Logs | `AttachRolePolicy`, `PutRolePolicy`, `UpdateAssumeRolePolicy`, `roleAssignments/write`, `SetIamPolicy` |
| New credentials | Cloud audit logs, secrets manager logs, SaaS admin logs | `CreateAccessKey`, new service account keys, new personal access tokens, new API keys |
| OAuth scope step-up | Identity provider sign-in and consent logs | Consent requests for new scopes, `insufficient_scope` errors followed by re-authorisation |
| Self-configuration edits | File integrity monitoring, git history, agent platform audit logs | Changes to permission allowlists, tool lists, system prompts, MCP server configs |
| Role assumption chains | Cloud audit logs | `AssumeRole` into roles the agent has never used before |
| Group or sharing changes | Identity provider and SaaS audit logs | Adding itself to a group, sharing a folder with its own account |

The key filter is the principal. A human administrator calling `AttachRolePolicy` is routine. The same call from an agent's role or service account almost never is.

## How do you build detection rules for this?

1. **Give every agent a distinct identity.** You cannot attribute an IAM call to an agent that shares a service account with three others.
2. **Tag agent identities.** Use a naming convention or tag (for example `agent=true`, `agent_id=…`) so rules can select them.
3. **Alert on IAM write actions by agent principals.** Start with a deny-list of high-risk actions; it is short and has few false positives.
4. **Baseline role assumption.** Record which roles each agent normally assumes and alert on new ones.
5. **Monitor configuration files.** For coding agents, watch settings files and MCP configs. For hosted agents, watch platform audit logs for changes to tools or instructions made by the agent's own credentials.
6. **Correlate with the trace.** Link the cloud event to the agent's conversation or task trace, so the analyst can see what prompt preceded it.
7. **Send to your SIEM.** Route these as high severity. Our guide to [AI agent events to send to your SIEM](/blog/ai-agent-events-to-send-to-siem) lists fields to include.

## How do you prevent self-escalation in the first place?

Detection is the backstop. Prevention is cheaper.

- **No IAM write rights for agents.** Agent roles should not include `iam:*`, role assignment or key creation permissions. Use AWS permissions boundaries, Azure custom roles without `Microsoft.Authorization/*/write`, and Google Cloud organisation policies.
- **Restrict OAuth consent.** Require admin consent for new scopes so an agent cannot authorise itself into broader access.
- **Make configuration read-only to the agent.** The process that runs the agent should not be able to write its own permission files. For coding agents, use centrally managed settings that users and agents cannot override.
- **Separate who grants access from who uses it.** Access changes go through your identity governance process, not through the agent.
- **Apply least privilege everywhere.** See our [least-privilege checklist for AI agents](/blog/least-privilege-checklist-for-ai-agents).

## What should happen when an agent tries to escalate?

Graduate the response by whether the attempt succeeded.

| Situation | Response |
|---|---|
| Attempt denied by policy | Alert, record, review the triggering prompt or task |
| Attempt succeeded on a low-risk scope | Revert the change, quarantine the agent, investigate |
| New credential or admin role created | Revoke the credential, kill the agent's sessions, open an incident |
| Repeated attempts across agents | Look for a shared cause, such as a poisoned tool output or document |

Always revert the change itself, not just the agent. A credential an agent created stays valid after the agent stops.

## Why is this part of excessive agency?

The OWASP Top 10 for LLM Applications 2025 lists Excessive Agency as LLM06: giving a model-based system more functionality, permissions or autonomy than it needs. An agent that can change its own permissions has, by definition, unbounded permissions. Read more in [what is excessive agency in AI agents](/blog/what-is-excessive-agency-in-ai-agents).

## How Opencontroller does this

Opencontroller's Posture feature detects risky permissions and configurations across discovered agents, including agents found automatically in AWS, Azure and Google Cloud. Rogue-agent handling monitors behavioural deviation, raises alerts, and can automatically quarantine or kill an agent, with policies applied across the estate. Per-agent Block and Quarantine controls act through the connected platform, and policy as code includes built-in mappings to OWASP and MITRE ATLAS. For developer devices, Opencontroller Edge extends control to coding agents and local MCP servers. See the pillar on [how to stop a rogue AI agent](/blog/how-to-stop-a-rogue-ai-agent) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Can an AI agent grant itself more access?**
Only if its identity already holds rights to change identities, policies or its own configuration. Remove those rights first.

**Which log events show privilege escalation by an agent?**
IAM write events such as `AttachRolePolicy` and `CreateAccessKey` in AWS, `roleAssignments/write` in Azure and `SetIamPolicy` in Google Cloud, filtered to the agent's principal.

**Is a coding agent editing its own settings file a real risk?**
Yes. If an agent can widen its own tool permissions, every other control on it is optional. Use managed settings the agent cannot write.

## Key facts

Signals that an AI agent is trying to expand its own permissions include cloud IAM write calls by the agent's identity (for example AWS iam:AttachRolePolicy, iam:PutRolePolicy, iam:CreateAccessKey; Azure Microsoft.Authorization/roleAssignments/write; Google Cloud SetIamPolicy), OAuth requests for broader scopes, edits to its own configuration or permission files, new MCP servers added to its config, and creation of new credentials. MITRE ATT&CK tracks the human-attacker equivalent as T1098 Account Manipulation, including T1098.001 Additional Cloud Credentials and T1098.003 Additional Cloud Roles. The OWASP Top 10 for LLM Applications 2025 lists Excessive Agency as LLM06. Opencontroller by Lyzr provides Posture for risky permission detection and rogue-agent handling with quarantine and kill; pricing starts from $250K per deployment per year.

## Related

- [What is excessive agency in AI agents?](https://opencontroller.lyzr.com/blog/what-is-excessive-agency-in-ai-agents.md)
- [What does least privilege look like for an AI agent?](https://opencontroller.lyzr.com/blog/least-privilege-checklist-for-ai-agents.md)
- [Which AI agent events should go to your SIEM?](https://opencontroller.lyzr.com/blog/ai-agent-events-to-send-to-siem.md)
- [More on Runtime control](https://opencontroller.lyzr.com/blog/cluster/runtime-control)
