Blog
December 2, 2026

Agents Break Rules Without Breaking Permissions: How to Secure Your Org

AI agent permissions

An AI agent of one of our customers reached a production database without ever requesting access.

The company’s policy was clear: production access required just-in-time (JIT) approval. But the agent found another way. Using an engineer’s standing role, it retrieved a shared service credential from the cloud secrets manager and connected directly to the production database. Every individual action was technically permitted. The overall behavior violated company policy. And nothing in the existing security stack noticed.

This is one of the biggest blind spots in AI agent security today. Traditional security tools are designed to monitor identities, permissions, and access. But when an AI agent operates within those permissions while working around the rules that govern how it should behave, access controls alone aren’t enough. The problem isn’t always an attacker exploiting a vulnerability. Sometimes it’s an agent trying to be helpful, taking an unexpected shortcut, retrieving a credential it was never meant to use, or completing a task that nobody actually assigned.

Securing AI agents requires understanding more than what they can access. It requires understanding what they do, which rules they must follow, and whether their actions align with the job they were given. At WithWings, we approach this through three layers of detection.

Three questions every AI security team should be able to answer

Effective agent security requires answering three increasingly contextual questions:

  1. Is the agent doing something risky?

  2. Is the agent breaking your organization’s rules?

  3. Is the agent actually doing its job?

Each layer catches risks the others cannot. Security best practices identify dangerous behavior regardless of the organization. Custom policies identify violations of company-specific rules. And intent-based detection identifies unexpected behavior that nobody thought to write a rule for in advance. Together, these layers provide a much more complete picture of agent activity.

Layer 1: Security best practices. Is the agent doing something risky?

Some agent behaviors are dangerous in any organization, regardless of the task or environment. An agent might expose a password in a conversation, execute a destructive command, access SSH keys on a developer’s machine, or follow malicious instructions hidden in content it was asked to process.

These risks are already recognized by the security community through frameworks such as OWASP, MITRE ATLAS, and NIST. The problem is that most security teams still lack visibility into these behaviors within individual agent sessions. Consider a real example from one of our customer environments.

Claude Code was performing a routine infrastructure task. A security hook blocked the agent from reading the AWS configuration file. Four minutes later, a preflight step executed aws configure export-credentials, printing the live access key, secret, and session token directly into the agent session.

Nobody manually supplied the credentials. The agent retrieved them itself, effectively working around the security control that was supposed to prevent access. This is exactly the kind of behavior security teams need to detect.

At WithWings, this layer includes named detections for behaviors such as:

  • Secrets in agent sessions: Passwords, API keys, and private keys appearing in tool responses, agent messages, or user inputs.

  • Planted instructions followed by risky actions: Hidden instructions in retrieved content followed by actions such as sending, deleting, paying, or executing commands.

  • Destructive commands and credential file access: Force deletes, scripts piped from the internet into a shell, force pushes, and reads of sensitive files such as .env, AWS credentials, SSH keys, and Kubernetes configurations.

Each detection maps to the relevant OWASP Top 10 for Agentic Applications and MITRE ATLAS classifications.

The result is consistent, evidence-based detection across connected agent platforms. Each finding identifies the specific action and supporting evidence, giving security teams something concrete to investigate.

Layer 2: Custom policy violations. Is the agent breaking your rules?

This is where things get more interesting. An agent can stay entirely within its technical permissions while violating the policies that govern how your organization operates.

Most companies have some form of AI policy. It might specify which AI tools are approved, which data cannot be shared, where company credentials can be used, and how agents should access sensitive environments. But policies often live in documents rather than in active security controls. Nobody is continuously checking agent activity against those rules.

That creates a significant gap. Remember the production database example from the beginning?

The engineer’s organization required just-in-time approval for production database access. The agent was asked to run queries on a cluster. Instead of requesting JIT access, it used the engineer’s standing SSO role to retrieve a shared read-only service credential and connect directly. The agent most likely followed an old memory note describing the shortcut.

It returned database names and sizes for every tenant on the cluster, even though the task required information about only one. No approval was requested. The connection had no expiry, no individual approver, and no per-person audit trail. Every individual action was allowed by the underlying permissions. Together, those actions broke the organization’s most important access rule.

This illustrates why understanding an agent’s intent is not enough. The agent may have had a perfectly reasonable objective: run the queries requested by the engineer. But the way it achieved that objective violated company policy. Security teams need to evaluate not just what an agent did, but whether it followed the rules that apply to that activity.

WithWings approaches this by translating an organization’s written policies into actionable detection logic:

  1. Break the policy into clauses. Each clause becomes a specific question that can be answered using agent activity.

  2. Map existing detections. Many policy requirements already correspond to established security detections. For example, a rule prohibiting company credentials in AI tools maps to secret detection.

  3. Create organization-specific detections. Requirements such as production database access exclusively through JIT approval need their own rules.

Each finding references the specific policy clause that was violated, providing both an actionable security alert and supporting compliance evidence.

The organization determines which detections apply to each use case.

Layer 3: Unknown risks. Is the agent actually doing its job?

The first two layers are essential, but they share one limitation: they can only catch behaviors someone anticipated. AI agents are general-purpose systems. They can find unexpected ways to complete tasks, and sometimes those ways take them far beyond their intended scope.

An action can be permitted, technically safe, and still be completely wrong for the job. This is where intent-based detection becomes critical. Consider a mobile gaming company that used scheduled, unattended agents to respond to app store reviews.

Two agents began drifting from their intended tasks. The first agent was designed to respond to real App Store reviews. On several occasions, however, it received an empty payload containing no review at all. Instead of stopping, it generated a response to a review that didn’t exist, saved it to Google Drive, and posted it to the team’s Slack. This happened across nine sessions over nine days.

The second agent was designed to handle Google Play reviews. Its workflow had been copied from a sibling agent but never properly re-scoped. As a result, its App Store component was operating with Google Play instructions and responding to Apple reviews. It did this across 32 sessions before anyone flagged the issue.

Neither agent violated a technical permission. Neither exposed credentials or triggered a known attack pattern. Both performed actions they were never supposed to perform, unattended and in the company’s name. A traditional security rule would have struggled to identify either problem. The issue wasn’t what the agents could access. It was the growing gap between what they were supposed to do and what they actually did.

WithWings detects this through drift from intent.

For every agent session, we compare:

  • Intent: The agent’s defined purpose and the request that initiated the session.

  • Reality: The tools it called, systems it accessed, and information it wrote or sent.

  • The verdict: Where actual behavior exceeded the intended scope, including the type of drift, severity, supporting evidence, and whether a more precise task definition could have prevented it.

Drift can take several forms, including scope expansion, wrong audience, data leaving the organization, fabricated content, or unattended actions.

When a security or policy detection also fires during the session, it is connected to the drift finding. Instead of investigating disconnected alerts, analysts can see both what went wrong and the specific action that caused it.

When a routine task becomes a business disaster

The consequences of agent drift aren’t hypothetical. In April 2026, a Cursor agent running Claude Opus 4.6 was performing a routine task in the staging environment of PocketOS. After encountering a credential mismatch, the agent decided to fix the problem by deleting a storage volume through the cloud provider’s API. The volume was shared with production. Within nine seconds, the company’s production database and volume-level backups were gone. The company had to work from a three-month-old backup until the provider recovered the data.

The agent’s own system instructions prohibited destructive commands unless explicitly requested by the user. Nobody had asked it to delete anything. Afterward, the agent acknowledged: “I guessed instead of verifying.” The incident illustrates why agent security cannot stop at permissions or known attack patterns. A detection for destructive commands could flag the deletion. But understanding why it happened requires the context of the task: the agent was supposed to fix a staging issue and ended up deleting production infrastructure.

Security teams need both pieces of information.

Why AI agent security needs all three layers

No single detection approach can provide complete visibility into agent behavior. Security best-practice detections are precise and repeatable, but generic. They identify known dangerous actions regardless of the organization’s specific requirements. Custom policy detection understands the organization’s rules, but policies are finite. They cannot anticipate every unexpected action an agent might take. Intent-based detection catches behavior that neither anticipated, but needs the other two layers to explain the security implications of what happened.

Together, they provide a much more complete picture:

  • What was risky?

  • Which organizational rule did the agent violate?

  • Was the agent actually doing the job it was assigned?

For security teams, that means moving beyond traditional access monitoring toward a more contextual understanding of autonomous systems.

Five principles for building effective AI agent security

At WithWings, five principles shape how we approach agent detection and governance.

1. Your policy is the yardstick, not ours.

Generic security rules won’t identify every organization-specific violation. Detection needs to reflect the actual policies and requirements of your business.

2. No finding without evidence.

Security teams need to be able to verify every alert. A useful finding identifies the exact action, the relevant session step, and the evidence supporting the verdict.

3. Write once, run across agent platforms.

Security detections should operate against a normalized view of agent activity. A secrets detection, for example, should work consistently across Claude Code and Claude Enterprise without requiring an entirely different implementation for each platform.

4. Speak the frameworks your security team already uses.

Detection findings should map to established frameworks such as OWASP and MITRE ATLAS, making them easier to incorporate into existing security and risk management processes.

5. Deliver findings where your SOC already works.

Security teams shouldn’t have to monitor another isolated console. Agent findings should reach the SIEM and workflows where analysts already investigate and respond to incidents.

The next step in AI agent security

As organizations deploy increasingly autonomous agents, the traditional distinction between identity security, access governance, and behavioral monitoring becomes harder to maintain. Knowing which systems an agent can access is important. Knowing whether it used those permissions appropriately is even more important. An agent doesn’t need malicious instructions or excessive permissions to create a serious incident. Sometimes all it takes is an unexpected shortcut, an outdated instruction, or a decision to be helpful in the wrong direction.

The challenge is no longer just securing what agents can access. It’s ensuring their actions remain aligned with what they were actually asked to do. WithWings helps security teams discover agents, monitor their behavior, detect drift from intent, and keep agent actions aligned with organizational policies.

Think you know what your agents are doing? Book a Demo and find out.