Description

An LLM-based system is often granted a degree of agency by its developer - the ability to call functions or interface with other systems via extensions (sometimes referred to as tools, skills or plugins by different vendors) to undertake actions in response to a prompt. The decision over which extension to invoke may also be delegated to an LLM 'agent' to dynamically determine based on input prompt or LLM output. Agent-based systems will typically make repeated calls to an LLM using output from previous invocations to ground and direct subsequent invocations.

Excessive Agency is the vulnerability that enables damaging actions to be performed in response to unexpected, ambiguous or manipulated outputs from an LLM, regardless of what is causing the LLM to malfunction. Common triggers include: hallucination/confabulation caused by poorly-engineered benign prompts, or just a poorly-performing model; and direct/indirect prompt injection from a malicious user, an earlier invocation of a malicious/compromised extension, or (in multi-agent/collaborative systems) a malicious/compromised peer agent.

The root cause of Excessive Agency is typically one or more of: excessive functionality; excessive permissions; excessive autonomy. Excessive Agency can lead to a broad range of impacts across the confidentiality, integrity and availability spectrum, and is dependent on which systems an LLM-based app is able to interact with.

Note: Excessive Agency differs from Insecure Output Handling which is concerned with insufficient scrutiny of LLM outputs.

Common Examples of Risks

  • Excessive Functionality An LLM agent has access to extensions which include functions that are not needed for the intended operation of the system. For example, a developer needs to grant an LLM agent the ability to read documents from a repository, but the 3rd-party extension they choose to use also includes the ability to modify and delete documents.
  • Excessive Functionality An extension may have been trialled during a development phase and dropped in favor of a better alternative, but the original plugin remains available to the LLM agent.
  • Excessive Functionality An LLM plugin with open-ended functionality fails to properly filter the input instructions for commands outside what's necessary for the intended operation of the application. E.g., an extension to run one specific shell command fails to properly prevent other shell commands from being executed.
  • Excessive Permissions An LLM extension has permissions on downstream systems that are not needed for the intended operation of the application. E.g., an extension intended to read data connects to a database server using an identity that not only has SELECT permissions, but also UPDATE, INSERT and DELETE permissions.
  • Excessive Permissions An LLM extension that is designed to perform operations in the context of an individual user accesses downstream systems with a generic high-privileged identity. E.g., an extension to read the current user's document store connects to the document repository with a privileged account that has access to files belonging to all users.
  • Excessive Autonomy An LLM-based application or extension fails to independently verify and approve high-impact actions. E.g., an extension that allows a user's documents to be deleted performs deletions without any confirmation from the user.

Prevention and Mitigation Strategies

Example Attack Scenarios

  1. #01Scenario

    An LLM-based personal assistant app is granted access to an individual's mailbox via an extension in order to summarise the content of incoming emails. To achieve this functionality, the extension requires the ability to read messages, however the plugin that the system developer has chosen to use also contains functions for sending messages. Additionally, the app is vulnerable to an indirect prompt injection attack, whereby a maliciously-crafted incoming email tricks the LLM into commanding the agent to scan the user's inbox for sensitive information and forward it to the attacker's email address.

  2. DefenseThis could be avoided by: eliminating excessive functionality by using an extension that only implements mail-reading capabilities; eliminating excessive permissions by authenticating to the user's email service via an OAuth session with a read-only scope; and/or eliminating excessive autonomy by requiring the user to manually review and hit 'send' on every mail drafted by the LLM extension. Alternatively, the damage caused could be reduced by implementing rate limiting on the mail-sending interface.

Reference Links

  1. Slack AI data exfil from private channels: PromptArmorpromptarmor.substack.com
  2. Rogue Agents: Stop AI From Misusing Your APIs: Twiliotwilio.com
  3. Embrace the Red: Confused Deputy Problem: Embrace The Redembracethered.com
  4. NeMo-Guardrails: Interface guidelines: NVIDIA Githubgithub.com
  5. Simon Willison: Dual LLM Pattern: Simon Willisonsimonwillison.net