---
id: AGT-044
title: "Detecting compromised or misbehaving agents"
url: https://patterns.trevonix.com/patterns/agt-044-detecting-compromised-or-misbehaving-agents
version: "1.0"
maturity: documented
collection: "Agent identity"
category: "Incident response"
last_reviewed: 2026-11-25
problems: ["Agent credential theft","Prompt injection and goal hijack","Data exfiltration by agents","Slow detection of automated misuse","Alert fatigue"]
standards: ["OpenID Shared Signals Framework 1.0","OpenID Continuous Access Evaluation Profile (CAEP) 1.0","OpenID RISC 1.0","MITRE ATLAS","OWASP Top 10 for Agentic Applications 2026 (ASI01, ASI03, ASI10)"]
recipes: {ping: documented, okta: documented, entra: documented, saviynt: documented, misc: documented}
license: CC BY 4.0
publisher: Trevonix
---

# Detecting compromised or misbehaving agents (AGT-044)

**Intent:** Notice quickly when an agent's identity is stolen, its credentials are used from somewhere unexpected, or its behaviour drifts from its purpose, by baselining each agent, collecting identity, gateway and runtime signals in one place, sharing risk between systems, and responding automatically in proportion to risk.

A stolen agent token or a hijacked agent looks legitimate in most logs. Baseline each agent's normal behaviour, combine identity provider risk, gateway, decision point and runtime signals, share risk events between systems, and respond in proportion: step down, require approval, or stop the agent.

## In short

- Give each agent a **baseline**: where it runs, which tools and APIs it calls, how often, how much data, at what times, for which people.
- Collect **identity, gateway, decision point and runtime signals** with the same agent ID and correlation ID, and **share risk events** between the identity provider, gateways and IGA with **Shared Signals (CAEP and RISC)**.
- Respond **in proportion and automatically**: reduce scope, require approval, revoke sessions, or stop the agent; then investigate with the attributable trail.

## Problem

Identity threat detection grew up around people: impossible travel, unfamiliar devices, password spraying. Agents break those signals. They have no devices, they run around the clock, they make thousands of calls, and a compromised agent uses its real credentials from its real runtime. When an attacker steals an agent's token, or a malicious document steers the agent into exfiltrating data, the requests are well formed, authenticated and authorised. Detection that only asks "was the token valid?" sees nothing wrong.

Agents also generate a lot of telemetry in many places: the identity provider, the agent platform, the MCP gateway, the decision point, the applications. Without a shared agent identifier and correlation ID, analysts cannot connect a suspicious tool call to the token, the person and the decision that allowed it, and response stays manual and slow.

## Use it when

- Agents run in production with access to sensitive data, money movement or administrative actions.
- Your SOC monitors people's identities and needs to cover agents too.
- You use several identity, gateway and governance products that each see part of the picture.

## Avoid it, or add more, when

- Agents are experimental and isolated from production data. Start with inventory and logging (AGT-012, AGT-025) and add detection when they reach production.

## Forces

- **Normal is unusual.** Agents' normal behaviour (bursts, night-time work, many calls) would trip human-oriented rules.
- **Authorised but wrong.** The most damaging misuse uses valid credentials and permitted actions.
- **Signal spread.** Each product sees one slice; correlation needs shared identifiers.
- **Speed against false positives.** Automatic stops protect quickly and can halt healthy agents.

## Solution

Build detection on three layers. **Credential misuse:** tokens used from outside the agent's runtime or network, unexpected clients, impossible token lifetimes, sign-ins from unfamiliar resources; identity providers now raise agent risk for some of these. **Behavioural drift:** compare each agent with its baseline and its declared purpose: new tools, new data classes, unusual volume, calls outside its task, denied requests rising, approvals being requested more often. **Content signals:** prompt-injection detections, data-loss alerts and unexpected outbound destinations from the runtime. Correlate everything in the SIEM by agent ID and correlation ID. Share risk across products with the Shared Signals Framework, so a gateway or IGA tool that detects a problem can tell the identity provider to revoke sessions, and the reverse. Automate proportionate responses through a playbook tied to the agent's risk tier.

![Diagram. Left: four signal sources for one agent: the identity provider (agent risk, sign-ins), the MCP or API gateway (tools called, volumes, denied calls), the decision point (denials, approvals requested), and the agent runtime (prompt-injection detections, outbound destinations, data-loss alerts](https://patterns.trevonix.com/img/AGT-044/agt-044-solution.png)

*Signals from identity, gateway, decision point and runtime meet in the SIEM; shared signals and playbooks respond in proportion.*

*Signals to collect*

| Signal | Source | Example detection |
| --- | --- | --- |
| Agent risk raised | Identity provider | Sign-in to an unfamiliar resource, confirmed compromise by an admin |
| Token used from outside the runtime | Identity provider, gateway | Source network or client not in the agent's baseline |
| New tool or data class | Gateway, decision point | First call to a finance tool by a support agent |
| Volume spike | Gateway | Ten times the usual record reads in an hour |
| Denials rising | Decision point | Repeated attempts at disallowed actions |
| Approval pattern change | Approval service | Many approval requests, or approvals at odd hours |
| Content signals | Agent runtime, DLP | Prompt-injection detector fires; personal data in outbound calls |
| Unexpected destination | Network egress | Calls to a domain no task needs |

*Response ladder*

| Level | Trigger (examples) | Automatic response |
| --- | --- | --- |
| 1 Watch | Minor drift, single anomaly | Raise alert, increase logging |
| 2 Reduce | Drift on a sensitive tool or data class | Narrow scope or move agent to read-only |
| 3 Confirm | High-value action during an anomaly | Require human approval for every consequential action |
| 4 Contain | Credential misuse or confirmed injection | Revoke sessions and tokens, block at gateways |
| 5 Stop | Confirmed compromise or tier 4 agent at level 4 | Kill switch across platforms (AGT-016) |

How it works

1. **Baseline each agent:** runtime, networks, clients, tools, data classes, volumes and hours, from its first weeks in production and its declared purpose.
2. **Use one agent ID and a correlation ID** across identity provider, gateway, decision point, runtime and applications (AGT-025).
3. **Turn on vendor agent risk features** and forward their events to the SIEM.
4. **Write detections** for the signals above, tuned per risk tier; start in alert-only mode.
5. **Connect products with Shared Signals:** gateways and IGA publish risk events; the identity provider and gateways subscribe and act (revoke sessions, block).
6. **Automate the response ladder** in SOAR or native policies, with human confirmation for levels 4 and 5 on low-tier agents.
7. **Rehearse:** run a stolen-token and a prompt-injection exercise each quarter and measure time to contain.

> **Watch the denials:** The best early-warning signal is often the decision point: an agent that suddenly hits many denials is either broken or being steered. Alert on denial rates per agent before building anything more complex.

## Design rules

1. **Every agent has a baseline and a declared purpose to compare against.**
2. **One agent ID and correlation ID across all telemetry.**
3. **Detect misuse of valid access, not only invalid access.**
4. **Share risk between products; do not wait for a person to copy alerts.**
5. **Respond in proportion to risk tier, automatically where safe.**
6. **Rehearse and measure time to contain.**

## Anti-patterns

| Anti-pattern | What goes wrong |
| --- | --- |
| Reusing human ITDR rules for agents | Constant false positives, then alerts are muted |
| Logs without agent IDs or correlation IDs | Analysts cannot connect a tool call to a token and a person |
| Detection without automated response | Agents act at machine speed; people respond hours later |
| Stopping every agent on any anomaly | Business stops trusting the controls and asks for exceptions |
| No baseline update after legitimate changes | New features look like attacks |

## Benefits

- Faster detection of stolen agent credentials and hijacked agents.
- Proportionate, automatic containment.
- Investigations that join identity, gateway, decision and runtime evidence.
- Risk shared across products instead of trapped in one.

## Costs and risks

- SIEM ingestion and detection engineering for agent telemetry.
- Baseline upkeep as agents change.
- Shared Signals support varies by product.
- Tuning time to keep false positives low.

## Recipes

### Ping Identity

*Maturity: Documented; last verified 2026-11.*

Gateway, decision and session signals to the SIEM; automated revocation.

Configure

1. Send PingGateway MCP audit events, PingOne Authorize decisions and Advanced Identity Cloud or PingOne audit logs to the SIEM with the agent ID.
2. Use PingOne Protect to detect computer-using agents and risky sessions in your own apps.
3. Automate responses in DaVinci or journeys and revoke agent sessions and tokens through the platform APIs.

### Okta

*Maturity: Documented; last verified 2026-11.*

Posture findings, shared signals and automated containment.

Configure

1. Use ISPM to assess agent posture (owners, over-privileged connections, stale credentials) and Identity Threat Protection to receive and act on shared signals from security partners.
2. Stream System Log events for AI agents, resource connections and Agent Gateway to the SIEM.
3. Automate containment with Okta Workflows: deactivate a resource connection, deactivate the agent, or block it at the Agent Gateway.

### Microsoft Entra

*Maturity: Documented; last verified 2026-11.*

Agent risk detections, blocking high-risk agents and SIEM correlation. Written from Microsoft documentation.

Configure

1. In **ID Protection > Risky Agents**, review agent risk; detections include unfamiliar resource access and admin-confirmed compromise, and administrators can confirm compromise or dismiss risk.
2. Apply the Conditional Access template that blocks high-risk agent identities.
3. Stream sign-in, audit and risk logs to Microsoft Sentinel or your SIEM and correlate with gateway and runtime logs by agent object ID.

Gotchas

- ID Protection for agents needs Microsoft Entra ID P2, and Microsoft has said it will require an Agent 365 licence.
- For agents acting on behalf of a user, some risk is evaluated on the user rather than the agent identity; check both.

### Saviynt

*Maturity: Documented; last verified 2026-11.*

Partner risk signals and drift from declared intent; delete switch for containment.

Zuma Insights ingests external risk signals from security partners (CrowdStrike, Zscaler, Wiz and Cyera were named) and Saviynt describes continuous detection of behavioural drift from declared intent. Feed those findings into the response ladder and use the delete switch for level 5.

### SIEM, SOAR and Shared Signals

*Maturity: Documented; last verified 2026-11.*

Correlation, automation and standard risk events between products.

Use the SIEM and SOAR you already run for people. Implement Shared Signals transmitters and receivers where your products support them (CAEP session-revoked and credential-change events, RISC account events) so risk moves between products without manual steps.

## Verification tests

| Test | Expected result |
| --- | --- |
| Use a copied agent token from an unknown network | Detected; sessions revoked at level 4 |
| Make a support agent call a finance tool | Alert; scope reduced |
| Plant a prompt injection that triggers exfiltration attempts | Runtime detection plus egress alert; agent contained |
| Gateway publishes a risk event | Identity provider revokes the agent's sessions |
| Quarterly exercise | Time to contain within the target for the tier |

## Maturity and verification

**Documented.** Written from vendor documentation and the OpenID Shared Signals specifications, which became final in September 2025. Agent-specific risk detections in identity providers were new in 2026, with a short list of detections so far; most behavioural detection still has to be built in the SIEM.

## Frequently asked questions

**Does the identity provider detect compromised agents for us?**

Partly. Identity providers now raise risk for some agent events, such as sign-ins to unfamiliar resources, and let administrators confirm compromise. Behavioural drift across tools and data still needs gateway and runtime telemetry correlated in a SIEM.

**What about agents acting on behalf of users?**

Watch the agent's own identity and the delegation chain. Risk detections for agents acting on behalf of a person may be attributed to the person in some products, so check both risk views during an investigation.

## References

- [Microsoft Learn: ID Protection for agents](https://learn.microsoft.com/en-us/entra/id-protection/concept-risky-agents)
- [OpenID Foundation: Shared Signals Framework, CAEP and RISC become Final Specifications](https://openid.net/press-release-openid-foundation-finalizes-global-standards-for-real-time-identity-security/)
- [Saviynt: Delivering intelligence to the AI identity control plane](https://saviynt.com/blog/identity-security-for-ai-agent-access-gateway-identity-management-posture-management)
- [MITRE ATLAS](https://atlas.mitre.org/)
- [OWASP: Top 10 for Agentic Applications 2026](https://genai.owasp.org/2025/12/09/owasp-top-10-for-agentic-applications-the-benchmark-for-agentic-security-in-the-age-of-autonomous-ai/)

---

Source: https://patterns.trevonix.com/patterns/agt-044-detecting-compromised-or-misbehaving-agents. © Trevonix. Licensed CC BY 4.0. Provided as is, without warranty; see https://patterns.trevonix.com/about#disclaimer.
