Back to skill

Security audit

AWS云架构师

Security checks for vulnerabilities and agentic risk

Overview

This AWS helper is not overtly malicious, but it asks for broad AWS CLI/Bash authority and has underspecified automation, credential-context, and caching practices that should be reviewed before use.

Install only if you are comfortable letting the agent run AWS CLI commands through your local AWS profiles. Use a least-privilege read-only profile by default, require explicit confirmation for any write or cleanup action, redact account/resource identifiers before sharing outputs, and avoid the documented /tmp cache or callback/export flows unless you have reviewed where the data goes.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:120
Finding

Predictable Plaintext Temporary File Used for AWS Resource Inventory

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 120-121
Vulnerability Type: Unsafe temporary-file handling and plaintext storage of cloud resource metadata
Risk Level: Medium

Complete Code Snippet:

bash
aws ec2 describe-instances > /tmp/ec2-instances.json   # Cache resource list
cat /tmp/ec2-instances.json | jq '.Reservations[*].Instances[*].InstanceId'  # Read subsequent data from cache

Technical Analysis

The skill instructs the agent to write the full response from aws ec2 describe-instances to a fixed, predictable path under the shared /tmp directory. It does not require secure file creation, restrictive permissions, ownership validation, atomic writes, or cleanup.

On a multi-user system, another local user may monitor or pre-create this path. If the path is a symbolic link, shell redirection follows it and truncates or overwrites the linked file when the agent has permission to write to the target. If the generated cache has permissive permissions, other users may read AWS instance metadata. The full AWS response can contain substantially more infrastructure information than the instance IDs selected by the later jq command.

Attack Path

  1. A local attacker anticipates that the skill will use /tmp/ec2-instances.json.
  2. The attacker either monitors that predictable path or creates it as a symbolic link to another file writable by the agent.
  3. The agent executes the documented aws ec2 describe-instances command using its configured AWS identity.
  4. Shell redirection follows the existing path and writes the full EC2 inventory to it.
  5. The attacker reads the resulting cloud metadata or causes an unintended writable target file to be truncated and replaced.
  6. Because no cleanup is specified, cached infrastructure information may remain available after the task.

Exploitation requires local access to the same host and sufficient filesystem access to interact with t ...[truncated 763 chars]

Remediation
View remediation

Remediation Suggestions

  • Avoid caching the response unless repeated processing genuinely requires it.

  • Request only the necessary fields from AWS rather than storing the full response:

    bash
    aws ec2 describe-instances \
      --query 'Reservations[*].Instances[*].InstanceId' \
      --output json
    
  • If caching is required, create a private temporary directory and enforce owner-only permissions:

    bash
    umask 077
    cache_dir="$(mktemp -d)" || exit 1
    trap 'rm -rf -- "$cache_dir"' EXIT
    cache_file="$cache_dir/ec2-instances.json"
    
    aws ec2 describe-instances \
      --query 'Reservations[*].Instances[*].InstanceId' \
      --output json > "$cache_file"
    
  • Do not use a fixed filename in a shared temporary directory.

  • Validate file ownership and type before reuse, and reject symbolic links.

  • Use atomic creation or replacement where cached data must persist.

  • Delete temporary cloud inventory immediately after use.

  • Document the cache's lifetime and invalidate it after infrastructure changes.

Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (10)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 41)May include surrounding context.

md
**输出**: 返回成本优化工作流的响应数据,含执行状态与操作日志.
- 通过`input_params`参数调用,支持创建/查询/导出
### 4. 智能上下文检测
区域与配置文件优先级链(用户指定→AWS_PROFILE/AWS_REGION环境变量→~/.aws/config默认→询问用户),自动检测无需手动指定

**处理**: 解析智能上下文检测的输入参数,完成核心逻辑,输出标准化响应数据.
**输出**: 返回智能上下文检测的响应数据,含执行状态与操作日志.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 189)May include surrounding context.

md
**输出**: 返回成本优化工作流的响应数据,含执行状态与操作日志.
- 通过`input_params`参数调用,支持创建/查询/导出
### 4. 智能上下文检测
区域与配置文件优先级链(用户指定→AWS_PROFILE/AWS_REGION环境变量→~/.aws/config默认→询问用户),自动检测无需手动指定

**处理**: 解析智能上下文检测的输入参数,完成核心逻辑,输出标准化响应数据.
**输出**: 返回智能上下文检测的响应数据,含执行状态与操作日志.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document claims a hard 'zero key exposure' policy, but elsewhere instructs users to configure API keys and establish API connections, creating conflicting guidance around secret handling. Such contradictions increase the chance that operators or downstream agents will request, inspect, log, or mishandle credentials under the guise of setup or troubleshooting.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
86% confidence
Finding

The skill instructs displaying environment-derived profile and region context and running aws configure list, which can expose credential source paths, active profile names, account context, and other sensitive configuration metadata in chat or logs. In a tool with Bash execution and logging, this materially increases the risk of credential discovery and operational reconnaissance.

Content

Scanner excerpt · SKILL.md (reported line 90)May include surrounding context.

在此执行相关操作

echo "操作完成"

bash
# 优先级:用户指定 > 环境变量 > ~/.aws/config 默认 > 询问用户
echo "Profile: ${AWS_PROFILE:-未设置}, Region: ${AWS_REGION:-未设置}"
aws configure list

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

An overly broad activation description allows the skill to trigger in loosely related scenarios, increasing the chance it will run AWS CLI, inspect environment configuration, or perform resource operations when not truly needed. In a skill with Bash, Read, Write, and Edit capabilities, weak trigger boundaries materially raise misuse risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description explicitly states '支持中文交互' as part of the skill behavior, and the display name is also localized, but there is no indication that users may choose another language or opt in to Chinese-only behavior. This can violate language/locale policy when a skill imposes a specific language without user choice or documented justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill encourages AWS queries and logging but does not clearly warn that outputs may contain sensitive metadata such as account IDs, bucket names, IAM usernames, ARNs, network topology, and security posture details. In an audit-oriented skill, this omission can lead to unnecessary disclosure in chat transcripts, logs, or exported artifacts.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The limitations section states the skill depends on a local AWS CLI environment and 'does not provide cloud execution capability,' with destructive actions requiring explicit confirmation and not being fully automated. A later section promotes CI/CD integration and automated resource creation/cleanup, which conflicts with those stated operational limits and suggests a higher level of unattended automation than the earlier constraints allow.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill is presented as an AWS cloud-architect/audit tool, but later expands into generic file processing, API integration, and arbitrary command execution capabilities. This scope creep weakens user expectations and safety boundaries, making it easier for the skill to be invoked for unintended high-risk operations beyond AWS auditing.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The line only states '触发条件(trigger)与激活方式' without actually listing the trigger conditions or activation mechanism. An empty or placeholder trigger section leaves users and orchestrators unclear on when this skill should or should not run.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.