Back to skill

Security audit

Alibabacloud Waf Security Monitor

Security checks for vulnerabilities and agentic risk

Overview

The WAF inspection skill is mostly coherent, but it asks users or agents to run unverified CLI/plugin updates and leaves sensitive inspection results in a predictable temp file.

Review before installing. Use only with a least-privileged WAF read-only Alibaba Cloud identity, preinstall and verify the Aliyun CLI outside the agent session, avoid `curl | bash` and unpinned plugin updates, do not pass access-key secrets on the command line, and delete or protect the temporary WAF output log after use.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:22
Finding

Unverified Remote Installation Script Is Executed Directly by Bash

Content
View full analysis
= 3.3.3 required** > Run `aliyun version` to verify >= 3.3.3. If not installed or version too low, > run `curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash` to install/update, > or see [references/cli-installation-guide.md](references/cli-installation-guide.md) for installation instructions. ``` ### Technical Analysis The installation command downloads a mutable shell script and sends it directly to Bash. No version is pinned, and the Skill does not verify a cryptographic signature or checksum before execution. The effective code can therefore change after the Skill package has been reviewed. HTTPS protects the connection to the current endpoint but does not provide artifact reproducibility or protect against compromise of the hosting infrastructure, CDN, DNS path, certificate issuance process, or publisher account. The repository itself contains no copy of `setup.sh`, so its behavior cannot be established through this static audit. Installing a compatible CLI is related to the declared WAF inspection functionality, but direct execution of a mutable remote script is not the least-privileged installation method. A package manager or a separately downloaded, pinned, and cryptographically verified binary would provide the necessary functionality without granting arbitrary remote content immediate shell execution. ### Attack Path 1. An attacker compromises the remote installation endpoint, CDN, DNS route, or publisher account. 2. The attacker replaces `setup.sh` with a malicious shell payload. 3. A user or Agent follows the Skill's pre-check instructions. 4. `curl` retrieves the modified response and streams it directly into Bash. 5. Bash executes the payload without an opportunity for inspection or integrity verification. 6. Th ...[truncated 799 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Error
Location
SKILL.md:124
Finding

Mandatory Automatic Plugin Installation and Unpinned Updates Create Supply-Chain Risk

Content
View full analysis
/dev/null || true aliyun plugin update 2>/dev/null || true ``` The same behavior is mandated by the pre-check: ```markdown **Pre-check: Aliyun CLI plugin update required** > [MUST] run `aliyun configure set --auto-plugin-install true` to enable automatic plugin installation. > [MUST] run `aliyun plugin update` to ensure that any existing plugins are always up-to-date. ``` ### Technical Analysis The Skill changes the user's persistent CLI configuration to permit automatic plugin installation and then updates existing plugins without pinning versions, validating signatures, or presenting the changed components for review. This means the executable dependency set can change every time the Skill runs. It also potentially updates plugins unrelated to WAF inspection. Consequently, code outside the audited project may execute inside a cloud-authenticated environment. A WAF CLI plugin may be necessary for the declared functionality, but globally enabling automatic installation and updating all installed plugins exceeds the minimum necessary scope. Only the required WAF component should be installed, at an explicitly approved and verified version. The commands suppress stderr and ignore failure through `2>/dev/null || true`, reducing visibility into repository, integrity, or update errors. ### Attack Path 1. An attacker compromises a plugin repository, plugin publisher account, distribution channel, or a newly released plugin version. 2. The Skill enables automatic plugin installation in the user's CLI configuration. 3. The mandatory `aliyun plugin update` comm ...[truncated 996 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:115
Finding

Predictable Shared Temporary Log Persists Sensitive WAF Inspection Data

Content
View full analysis
&1) echo "$HEARTBEAT_CN" > /tmp/waf_skill_output.log HEARTBEAT_INTL=$(aliyun waf-openapi describe-instance \ --region ap-southeast-1 --user-agent "$ALIBABA_CLOUD_USER_AGENT" 2>&1) echo "$HEARTBEAT_INTL" >> /tmp/waf_skill_output.log ``` Subsequent responses are appended to the same fixed path: ```bash echo "$RESULT" >> /tmp/waf_skill_output.log ``` The verifier also defaults to that predictable path: ```python LOG_PATH = sys.argv[1] if len(sys.argv) > 1 else '/tmp/waf_skill_output.log' try: raw = open(LOG_PATH).read() ``` The cleanup section states: ```markdown ## Cleanup > No explicit cleanup required. All operations are read-only and no resources are provisioned. ``` ### Technical Analysis The workflow aggregates Alibaba Cloud WAF API responses into a fixed filename under the shared `/tmp` directory. It does not create a private temporary directory, set a restrictive `umask`, use exclusive file creation, reject symbolic links, validate file ownership, or remove the file after report generation. Although the cloud API operations are read-only, their responses can contain sensitive operational information, including WAF instance identifiers, protected domains, certificate metadata, cloud resource identifiers, URLs, traffic data, alarms, attack events, and blacklisted IP addresses. Read-only cloud behavior does not eliminate the need to protect locally persisted output. On a multi-user system, permissions depend on the process umask. A predictable path may also permit a l ...[truncated 1626 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/cli-installation-guide.md:101
Finding

Credential Setup Guide Encourages Secrets in Command-Line Arguments

Content
View full analysis
\ --access-key-secret \ --region cn-hangzhou ``` All `aliyun configure` commands support non-interactive flags, which is the recommended approach -- it works in scripts, CI/CD pipelines, and agent-driven automation without hanging on stdin prompts. ``` The guide also provides literal argument-based examples: ```bash aliyun configure set \ --mode AK \ --access-key-id LTAI5tXXXXXXXX \ --access-key-secret 8dXXXXXXXXXXXXXXXXXXXXXXXX \ --region cn-hangzhou ``` ### Technical Analysis Passing an access-key secret as a command-line argument may expose it through shell history, process inspection, terminal capture, CI/CD logs, command auditing, or an Agent conversation transcript. Recommending this approach for scripts and Agent-driven automation increases the chance that real credentials will be recorded in durable logs. This guidance conflicts with the stronger rules in `SKILL.md:53-56`, which prohibit asking for access keys in conversation and prohibit use of `aliyun configure set` with literal credential values during the session. The examples use placeholders rather than real committed credentials, so no hardcoded live secret was identified in the repository. The vulnerability is the unsafe credential-handling pattern presented to users. ### Attack Path 1. A user follows the installation guide and substitutes a real access-key ID and secret into the command. 2. The shell records the command in history ...[truncated 975 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents a comprehensive WAF inspection and monitoring skill covering many security and operational checks. The supplied code does only one specific task: compare cloud resource regions against a supplied WAF region and emit mismatch findings. That is at best a small subset of asset consistency checking and not representative of the broad declared functionality. Because the code’s primary purpose is materially narrower and different, and it adds a specific region-mismatch detection behavior not clearly declared, this is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
99% confidence
Finding

Piping a remotely fetched script directly to bash is a classic arbitrary code execution and supply-chain risk. In this context, the danger is heightened because the skill is supposed to perform security monitoring, yet it instructs execution of external code before inspection, which could compromise the host, credentials, or subsequent analysis results.

Content

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

md
**Pre-check: Aliyun CLI >= 3.3.3 required**
> Run `aliyun version` to verify >= 3.3.3. If not installed or version too low,
> run `curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash` to install/update,
> or see [references/cli-installation-guide.md](references/cli-installation-guide.md) for installation instructions.

**Pre-check: Aliyun CLI plugin update required**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
flag" errors, `--biz-region-id` does not route correctly). See [API Reference](references/api-reference.md).

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
flag" errors, `--biz-region-id` does not route correctly). See [API Reference](references/api-reference.md).

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> Use python3 for JSON extraction (not grep/sed/awk/bash string ops). See [Defense Templates Guide](references/defense-templates.md).

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> Use python3 for JSON extraction (not grep/sed/awk/bash string ops). See [Defense Templates Guide](references/defense-templates.md).

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| CLI Commands | [references/related-commands.md](references/related-commands.md) |

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The trigger list includes phrases like "traffic anomaly" and "certificate check," which are generic enough to appear in ordinary troubleshooting conversations outside the intended Alibaba Cloud WAF context. Although the surrounding description is WAF-specific, the trigger line itself does not clearly constrain activation scope or provide exclusions, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill directs the agent to install or update the Aliyun CLI as part of normal execution, which exceeds the minimum needed for a read-oriented WAF inspection task and introduces supply-chain risk. Automatically changing the local toolchain can execute unreviewed code and alter the environment in ways unrelated to the user's immediate request.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill claims operations are read-only, but it modifies local CLI configuration by enabling auto plugin installation and updating plugins. This weakens trust boundaries because a supposedly passive inspection skill is permitted to change execution behavior and fetch code dynamically from external sources.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Declaring that no resources are changed while still altering local plugin/configuration state is a security-significant documentation mismatch. Users and orchestration systems may grant this skill broader trust because it is presented as non-mutating, even though it performs persistent local changes that can affect future commands.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/acceptance-criteria.md (reported line 45)May include surrounding context.

md
CORRECT: Use `${BOT_TEMPLATE_ID:-0}` fallback when template not found (ensures call reaches server)
INCORRECT: Using template-id from `waf_group` scene (this is "Web Core Protection" but NOT supported by the API)
INCORRECT: Using template-id from `cc` / `custom_acl` / `ip_blacklist` scenes
INCORRECT: Picking first template without checking DefenseScene field
INCORRECT: Using grep to extract template-id (breaks on different JSON formatting)

## 7. describe-defense-rule-statistics (UNCONDITIONAL, bot_manager ONLY)

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/defense-templates.md (reported line 73)May include surrounding context.

md
CORRECT: Use `${BOT_TEMPLATE_ID:-0}` fallback when template not found (ensures call reaches server)
INCORRECT: Using template-id from `waf_group` scene (this is "Web Core Protection" but NOT supported by the API)
INCORRECT: Using template-id from `cc` / `custom_acl` / `ip_blacklist` scenes
INCORRECT: Picking first template without checking DefenseScene field
INCORRECT: Using grep to extract template-id (breaks on different JSON formatting)

## 7. describe-defense-rule-statistics (UNCONDITIONAL, bot_manager ONLY)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 30)May include surrounding context.

md
tar -xzf aliyun-cli-macosx-latest-amd64.tgz

# Move to PATH
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 45)May include surrounding context.

md
tar -xzf aliyun-cli-macosx-latest-amd64.tgz

# Move to PATH
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 58)May include surrounding context.

md
tar -xzf aliyun-cli-macosx-latest-amd64.tgz

# Move to PATH
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 71)May include surrounding context.

Extract and install

tar -xzf aliyun-cli-linux-latest-arm64.tgz sudo mv aliyun /usr/local/bin/

text

### Windows

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The guide includes non-interactive commands with access key ID and secret passed directly on the command line and shows them stored in the local CLI config file. In practice, command-line arguments can be captured in shell history, process listings, CI logs, and screenshots, and the examples normalize insecure handling of long-lived credentials in a security-monitoring skill context.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 118)May include surrounding context.

md
1. Log in to Aliyun Console: https://ram.console.aliyun.com/
2. Navigate to: AccessKey Management
3. Create a new AccessKey pair
4. Save the secret immediately -- it's only shown once

### Configuration Modes

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The troubleshooting section recommends aliyun configure get and debug logging without warning that these commands may reveal configuration details, account identifiers, endpoints, authentication failures, and potentially sensitive credential-related material in terminal output or logs. In an agent or CI environment, such output is especially likely to be persisted or forwarded to centralized logging systems.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 369)May include surrounding context.

7. Secure Config File

bash
chmod 600 ~/.aliyun/config.json

Troubleshooting

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The document requires use of the literal regions cn-hangzhou and ap-southeast-1, which imposes a fixed locale/region behavior in natural-language instructions. The file does not indicate that this is user-selectable or explain that the skill is intentionally limited to those regions for a justified region-specific purpose.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.