/

CVE-2026-11393

Severity:

CRITICAL RISK

(9.0)

Code Injection (CWE-94) in AgentCore CLI Collaboration Flow

CVE-2026-11393

Awaiting Analysis

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution under AWS IAM role and local user context

Severity:

CRITICAL RISK

(9.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

AgentCore CLI before v0.14.2 improperly neutralizes triple-quote characters when generating Python code from collaboration instructions.

An authenticated attacker can craft a malicious collaborationInstruction so that, when another user imports the agent, arbitrary code runs under the agent's IAM execution role in AWS and on that user's local environment.

Affected context

This vulnerability appears in workflows where AgentCore CLI is used to import or collaborate on Bedrock Agents that contain shared collaboration instructions.

The issue arises when the CLI generates Python source code that embeds these instructions without safely handling triple-quote characters, allowing attacker-supplied content to escape the intended string literal.

It primarily affects authenticated users operating in the same AWS account where one party can define or modify collaborationInstruction content that another party later imports with AgentCore CLI.

Exploit preconditions

  • Attack surface: Agent import and collaboration flows in AgentCore CLI that process Bedrock Agent collaborator instructions.
  • Required access: Authenticated ability to create or modify an agent (or collaborator) with a crafted collaborationInstruction in a shared AWS account or environment.
  • Trigger point: A separate user uses a vulnerable version of AgentCore CLI to import or process the attacker-controlled agent, causing code generation and execution.
  • Why exploitation is possible: The code generation logic fails to correctly escape or sanitize triple-quote characters, allowing attacker input to terminate a string literal and inject arbitrary Python statements into the generated source file.

Why this happens

The core issue is unsafe code generation that directly embeds attacker-controlled text into Python source files without robust quoting or escaping.

When triple-quote characters in collaborationInstruction are not neutralized, the generated Python code can break out of the intended string context and introduce new, executable statements.

This design aligns with CWE-94: Improper Control of Generation of Code (Code Injection), where dynamically constructed code incorporates untrusted input as executable syntax rather than treating it as inert data.

Potential impact

  • Execution of arbitrary Python code during agent import or runtime initialization.
  • Actions performed under the imported agent's IAM execution role, including potential access to AWS services, data, and infrastructure reachable by that role.
  • Execution of arbitrary code on the local machine running AgentCore CLI, within the permissions of the importing user.
  • Lateral movement within the AWS account by abusing shared agent collaboration channels.
  • Data exfiltration, modification of agent logic, or insertion of backdoors into generated artifacts.

General mitigation guidance

Mitigation generally focuses on hardening code generation and treating all remote or collaborative content as untrusted input:

  • Encapsulate untrusted text in data structures rather than interpolating it directly into executable code; prefer configuration or templates interpreted as data, not as Python source.
  • When dynamic code generation is unavoidable, apply strict escaping and encoding routines that safely handle quotes, newlines, and special characters before embedding input into strings.
  • Introduce explicit validation and allowlists on collaborationInstruction content, limiting it to expected formats or schemas and rejecting syntactically suspicious constructs.
  • Run generated or imported code under least-privilege IAM roles and local OS accounts so that unexpected execution has reduced blast radius.
  • Separate code-generation responsibilities from execution, for example requiring manual review or signing of generated code before it can run in sensitive runtime environments.

How teams detect issues like this

Effective detection typically combines static analysis, code review, and runtime monitoring:

  • Use static analysis or linters to flag patterns where user-controlled or remote text is concatenated into Python source files, especially inside triple-quoted strings or eval/exec-like constructs.
  • During security-focused code review, look for code-generation utilities that handle collaboration or configuration text and verify that they apply consistent escaping and validation.
  • Define policy checks in CI/CD pipelines that disallow direct interpolation of untrusted input into code templates, or require security approval for such changes.
  • Monitor runtime environments (both local and in AWS) for anomalous behavior triggered during agent import, such as unexpected outbound network calls or unusual IAM API usage patterns after new agents are imported.
  • Employ automated review tools that can scan both source repositories and generated artifacts for injection-prone code-generation patterns.

Sources

SourceLink
aws.amazon.comaws.amazon.com/security/security-bulletins/2026-040-aws/
github.comgithub.com/aws/agentcore-cli/releases/tag/v0.14.2
github.comgithub.com/aws/agentcore-cli/security/advisories/GHSA-m4x6-gwgp-4pm7
npmjs.comnpmjs.com/package/@aws/agentcore/v/0.14.2
npmjs.comnpmjs.com/package/@aws/agentcore/v/1.0.0-preview.9

Frequently asked

questions

Exploitation is scoped to environments where multiple authenticated users share agents or collaborators and at least one user runs a vulnerable AgentCore CLI. The attacker must be able to control collaborationInstruction content that another user later processes.

The attacker needs authenticated access sufficient to create, modify, or upload an agent or collaborator definition with malicious instructions in the same AWS account or shared environment where another user will import the agent using a vulnerable CLI.

The safest pattern is to stop injecting untrusted input directly into generated code. Treat collaboration content as data, enforce strict validation, and ensure all embedded text is robustly escaped so it can never alter the surrounding syntax of the generated Python file.

Design code-generation systems around clear trust boundaries: assume all remote or collaborative content is hostile, validate it against strict schemas, encode or escape it before embedding, and subject any dynamic code paths to dedicated security review and automated static analysis focused on injection risks.

Find out what's already
exploitable in your codebase.