Tip

Key guardrails to defend against rogue AI agents

AI agents go rogue for many reasons. Businesses must establish defense mechanisms and guardrails that counter the potential damage from an agent's rogue actions.

AI agents can improve decision-making and the execution of complex workflows, but they also introduce a new security risk: the possibility of an AI agent going rogue.

A rogue AI agent is an automated system that operates outside its intended controls, policies or defined scope. While rogue AI agents are not always malicious, they can cause harm, produce unintended consequences and commit unauthorized actions that negatively affect businesses.

Several incidents involving rogue AI agents have occurred in recent months. For example, OpenAI reported that models used during cybersecurity evaluations circumvented isolation controls, gained internet access and compromised parts of its research infrastructure and Hugging Face's systems. In another similar incident, Anthropic reported three incidents in which Claude, while participating in cybersecurity evaluations, obtained internet access because of a configuration error and subsequently gained unauthorized access to the systems of three organizations.

As businesses increasingly use agentic AI for tasks with limited human involvement, protection against rogue AI agents like these is more critical than ever. Businesses must develop guardrails that not only reduce the likelihood of one of their agents going rogue, but also protect against external rogue AI agents attempting to gain access to enterprise environments.

Why does an AI agent go rogue?  

In enterprise settings, a rogue AI agent can perform a range of destructive actions, such as deleting critical business records, exposing sensitive business information, attacking external systems, bypassing operational instructions, producing fake information and presenting it as legitimate.

AI agents go rogue and work unexpectedly for several key reasons.

Excessive autonomy

When an AI agent is granted authority to plan, execute and iterate on multi-step tasks with minimal human oversight, small errors compound into large failures without human notice.

Insufficient guardrails

AI agents can act unexpectedly when there are no enforceable constraints on what an AI agent can do, how it can do it and what consequences its actions can produce. Guardrails are technical controls integrated into an AI agent's work that prevent the AI agent from taking extreme or irreversible actions while working to achieve its goal or objective.

Overly broad permissions

AI agents are often granted more system access than their tasks require, which increases the blast radius of any mistake. Instead, agents should operate under the principle of least privilege -- using only the minimal permissions necessary to complete the task. For example, in late April 2026, a Cursor coding agent powered by Anthropic's Claude Opus 4.6 model went rogue after operating with overly broad permissions, deleting the production database and backups for PocketOS.

Inadequate monitoring

Inadequate monitoring refers to the absence of logging, alerting and real-time visibility into an AI agent's actions and interactions with other systems. Businesses that deploy AI agents without monitoring have no visibility and therefore discover problems only after they occur. Since AI agents operate at machine speed and can generate a vast amount of actions, traditional monitoring approaches are unable to provide sufficient context to understand AI agent activity.

Poorly defined human-oversight mechanisms

AI agents are increasingly permitted to make decisions and act without waiting for human approval. While this autonomy is considered the essence of AI agent work and suitable in many business cases, organizations must determine the appropriate human checkpoints to limit autonomy. Without human checkpoints, an agent might continue executing a series of actions even as its behavior drifts from the original objective.

For example, an AI agent tasked with investigating security alerts within an IT environment might be authorized to collect information, correlate events and recommend response actions. But allowing that agent to take response measures like deactivating user accounts, modifying firewall rules or deleting files without requesting human approval significantly increases the potential for incorrect decisions. A compromised AI agent could exploit its autonomy to shift from investigation to remediation and execute measures that could negatively impact business operations.

How to identify and curb rogue AI within internal systems

The first step businesses should take to combat rogue AI agents is to inventory all AI agents deployed within their IT environment to know where they are, what they can access and what actions they're authorized to execute.

Businesses should treat AI agents as systems operating within the enterprise IT environment and apply the same security principles used to protect other systems. This includes monitoring their activities, limiting their permissions, establishing what normal behavior looks like, requiring human approval for high-risk actions and having a mechanism in place to prevent an agent from behaving outside its defined scope.

Monitor agent behavior

Effective AI agent observability transforms the security process from reactive to proactive, enabling the detection and prevention of threats before they cause damage.

Traditional endpoint and application monitoring programs might not provide sufficient visibility into AI agent activity. To achieve full visibility over AI agent interactions, security teams should monitor the following:

  • API interactions. Agents commonly communicate with internal and external APIs to perform their tasks. Monitoring should inspect every API call to detect unusual patterns that deviate from normal behavior.
  • Database access. To execute their assigned tasks, AI agents might need to read/write to databases. Security monitoring should track which tables agents access and the types of queries used to fetch information from them. An agent querying tables containing sensitive information outside its normal operational scope should be treated as a potential security risk.
  • Cloud service usage. Some agents interact with cloud services for various reasons, like creating new compute instances, accessing storage buckets or modifying IAM roles. Monitoring should track all AI agent interactions with cloud resources. An agent accessing resources it has never accessed before or attempting to modify security rules when it's not supposed to should trigger immediate preventive action.
  • File system activity. AI agents might need to read, write and modify files across network drives and local storage. Security teams should track AI agent file access patterns and identify any unusual read/write operations. If an AI agent attempts an unusual activity relative to its scope, such as accessing files in a directory that has not been accessed before or updating system configuration files, these actions are red flags that should be investigated.

Apply least privilege access

A common practice among developers is to grant AI agents broad administrative privileges because it is easier and expedites deployment, or because the organization does not yet know the exact scope of the AI agent's work. AI agents should be granted only the permissions required to perform their assigned tasks.

Establish AI agent behavioral baselines

Businesses should establish a baseline of normal agent behavior and compare it with current behavior to identify any abnormal activity. An AI agent's behavioral baseline is a profile of its expected operational behavior. It answers the following questions:

  • Systems the agent typically accesses.
  • Number of API calls the agent makes each hour.
  • Type of data the agent typically accesses and modifies.
  • Sequence of actions the agent commonly executes.
  • Time when the agent normally operates and when it remains idle.
  • Typical error rate of agent work.

After establishing the behavioral baseline of an AI agent, any major deviation turns into a warning signal that requires investigation.

Require human approval for critical actions

The core feature of AI agents is their ability to make decisions, execute tasks and adapt to new information autonomously without requiring human approval. Although not every agent action requires human approval, autonomy can be a double-edged sword. It provides numerous business benefits by simplifying and accelerating workflows, but also introduces serious risks when agents make mistakes or act outside their defined scope.

Clearly define what actions require human judgment. The following agent actions should proceed without human approval:

  • Reading public data.
  • Querying non-sensitive database tables.
  • Creating reports and summaries.
  • Performing routine tasks such as calculation or analysis.

These actions are low-risk and amenable to automation because they are reversible, don't harm the business if executed incorrectly and are limited in scope.

Human approval should be required for the following agent actions:

  • Changing system configuration files.
  • Modifying production databases.
  • Accessing, exporting, modifying and deleting highly sensitive data, financial information and intellectual property.
  • Creating administrative user accounts.
  • Executing financial transactions.
  • Deploying applications.

These actions are high-risk because they are irreversible and can have a catastrophic impact on business continuity and reputation if executed incorrectly.

Maintain an immediate kill switch

Businesses should establish a ready mechanism to suspend or terminate the AI agent's work if malicious behavior is detected. A kill switch is a technical emergency mechanism that can immediately cease AI agent operations. It's not a single button but a series of coordinated technical controls that, when executed, halt the AI agent's ability to act. For example, to prevent a rogue agent from continuing to execute unauthorized actions, the kill switch should be able to revoke credentials; terminate all agent active sessions, processes and connections; isolate agent compute resources from other production systems; prevent the agent from submitting new actions; and prevent the agent from accessing tools and integrations with other systems it uses to perform its tasks.

Controls for defending against rogue AI

Click here for a checklist of all eleven controls for defending against internal and external rogue AI agents.

How to defend against external rogue agents

Many recent rogue AI incidents show that agents can escape their testing environments, connect to the internet and attack external systems. As a result, businesses are not only focusing on controlling AI agents operating within their IT environment but also preparing defenses against rogue AI agents originating from external sources. 

Businesses can take the following measures to defend against external rogue AI agents.

Monitor external connections

Preventing external rogue AI agents requires monitoring external connections to organizational resources. Security teams should monitor incoming API requests, authentication attempts, network connections and any access to public-facing applications.

Traditional security monitoring is designed to detect human-based attacks and known malware signatures, but AI agents behave differently. For example, automated agents can generate requests at a much higher rate and with greater consistency than a human operator. When multiple agent instances operate concurrently, agents can adapt their behavior in response to others, making it difficult to predict their attack patterns.

Security teams should monitor the following indicators:

  • External API requests. A sudden spike from a particular source or IP address might indicate an automated attack. Requests to endpoint devices that are rarely accessed or to servers hosting sensitive information are a red flag.
  • Authentication attempts. AI agents try to gain unauthorized access to protected resources using techniques such as brute-force attacks, credential stuffing or exploitation of weak authentication mechanisms.
  • Network connections. Receiving connections from IP addresses that have no business relationship with the organization is a red flag and could indicate an automated or AI-powered attack.
  • Public-facing applications. Web applications and portals are major targets for rogue AI agents. Security monitoring should watch for requests that try to manipulate input validation, such as using SQL injection and command injection attacks. 

Strengthen API security

APIs are considered the most widely exploited attack surface in enterprise environments since they enable external systems and applications to interact with internal applications, databases and services. Businesses must ensure all APIs that expose protected resources or privileged functionality use strong authentication and authorization controls so only legitimate systems and users can interact with the API.

Although authentication verifies identity, authorization decides what actions that identity can perform. It's necessary to have authorization controls in place, so even if an external agent has been successfully authenticated to access the internal environment, it can only access permitted functions and data.

Apply zero-trust principles

Organizations must not automatically trust an AI agent simply because it has successfully authenticated. Every request should be evaluated using contextual information, such as the following:

  • Identity of the system making the request.
  • Type of resources accessed.
  • Type of action performed.

This approach reduces the negative effect of a rogue AI agent that obtains valid credentials. For example, if a rogue external AI agent compromises one account, that account should not grant it access to other systems or sensitive resources.

Limit external permissions

When using external systems such as third-party applications, partner integrations and service accounts, grant only the minimum permission required to perform their tasks. Businesses must not grant broad access rights simply because it's more convenient or such access could be useful in the future.

External systems provide a direct pathway into IT environments. If a rogue AI agent compromises an external system or acquires its credentials, it will inherit all the external system's permissions, bypassing an organization's internal security controls.

Protect sensitive data

If a rogue AI agent gains access to a company's IT environment, it might try to identify and collect sensitive information. Protect sensitive data using the following approaches:

  • Discover and classify sensitive data. The first step should be to identify and classify all sensitive data across the IT environment, such as personally identifiable information, financial records and intellectual property.
  • Apply granular access. After classifying the data, apply the principle of least privilege to AI agents, so they can access only the data required to perform their assigned tasks, thereby preventing broad data exposure.
  • Protect data when it's being used and in transit. Protection can be achieved through a variety of methods, such as encrypting data stored in databases and files, replacing sensitive data with non-sensitive tokens and dynamically altering or hiding sensitive parts of data when agents view it.

Review third-party AI integrations

An external AI agent can use a legitimate third-party integration to gain access to internal systems. As businesses increasingly work to connect AI services to their applications, these integrations can create new ways to access enterprise systems.

To reduce this risk, companies must identify which AI services have access to their IT systems to determine the data those services can access and the actions they're authorized to perform. Third-party AI integrations should be regularly reviewed, and any additional permissions should be reduced when they're no longer required.  

Detecting and stopping every external AI agent is not always feasible. Instead, businesses should ensure that if a rogue agent were able to gain access to their environment, its ability to access systems, move among resources and cause damage is restricted.

Nihad A. Hassan is an independent cybersecurity consultant, digital forensics and cyber OSINT expert, online blogger and author with more than 15 years of experience in information security research. He has authored six books and numerous articles on information security. Nihad is highly involved in security training, education and motivation.

Dig Deeper on AI Ethics & Governance