Back to skill

Security audit

Alibabacloud Waf Rule Management

Security checks for vulnerabilities and agentic risk

Overview

This Alibaba Cloud WAF diagnostic skill is mostly purpose-aligned, but it needs review because its command/setup guidance can expose credentials and can turn untrusted diagnostic inputs into local shell execution.

Install only after review in a controlled environment. Use a dedicated least-privilege Alibaba Cloud RAM identity, avoid the non-interactive AccessKey command, verify CLI/plugin downloads, and do not let an agent paste untrusted host/path/query values directly into Bash commands; prefer manual review or a validated wrapper that passes arguments without shell interpolation.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
references/cli_commands.md:104
Finding

Shell Command Injection Through Unsanitized Diagnostic Parameters

Content
View full analysis
" \ --logstore "" \ --from "$FROM" \ --to "$TO" \ --query "host: and request_path: and status:" \ --line 10 \ --region \ --read-timeout 30 --connect-timeout 10 \ --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-rule-management/{{SESSION_ID}}" ``` ```bash aliyun sls get-logs-v2 \ --project "" \ --logstore "" \ --from "$FROM" \ --to "$TO" \ --query "host: and real_client_ip:" \ --line 10 \ --region \ --read-timeout 30 --connect-timeout 10 \ --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-rule-management/{{SESSION_ID}}" ``` The general command format also permits an unconstrained query string: ```bash aliyun sls get-logs-v2 \ --project "" \ --logstore "" \ --from "$FROM" \ --to "$TO" \ --query "" \ --line 10 \ --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-rule-management/{{SESSION_ID}}" ``` ### Technical Analysis The Skill instructs an agent with Bash access to interpolate user-supplied host names, paths, IP addresses, timestamps, regions, resources, and query expressions directly into shell command templates. Only trace IDs have explicit character restrictions. Equivalent shell-safe validation is not defined for the other parameters. Placing an untrusted value inside a double-quoted shell argument does not prevent shell evaluation. Command substitutions such as `$(command)` and backtick expressions are still executed by the shell. Embedded quotation marks can also terminate an argument and introduce additional shell operato ...[truncated 1850 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
references/profile_setup_guide.md:26
Finding

Unpinned and Unverified Executable Dependency Installation

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/profile_setup_guide.md:74
Finding

Long-Lived AccessKey Secret Exposed Through Command-Line Arguments

Content
View full analysis
\ --access-key-secret \ --region cn-hangzhou ``` The guide acknowledges the exposure but still presents the command as a supported configuration method: ```text Security Warning: Non-interactive commands will leave credential traces in shell history. It is recommended to use interactive configuration or clear shell history after use. ``` ### Technical Analysis The non-interactive setup command requires the user to place a long-lived AccessKey ID and AccessKey secret directly into command-line arguments. The secret can consequently be exposed through: - Shell history. - Terminal session logging. - Process listings or process-monitoring agents. - Audit logs and support bundles. - Clipboard history. - Command transcription in automation logs. Clearing shell history after execution is not a complete control. The secret may already have been copied into other logs, observed while the process was running, or captured by endpoint-monitoring software. This contradicts the Skill's broader prohibition against credential exposure and is particularly risky because the default credential chain is used by all subsequent diagnostic operations. ### Attack Path 1. A user replaces the placeholders with a real AccessKey ID and secret. 2. The shell records the complete command in history, or another local process observes its arguments. 3. A malicious local user, compromised process, logging system, or support-data recipient retrieves the secret. 4. The attacker authenticates to Alibaba Cloud with the exposed credential. 5. The attacker exercises all permissions assigned to that AccessKey until it expires, is rotated, or is revoked. ### Impact Assessment The immediate ...[truncated 477 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/rule_matcher.py:307
Finding

Regular Expression Denial of Service in the Rule-Matching Engine

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
Findings (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The code is clearly related to WAF diagnostics, so the domain is aligned. However, the declared description emphasizes a read-only assistant that queries WAF logs through Alibaba Cloud SLS tooling and provides text-only console guidance for users. This code chunk instead performs analytical processing on already-supplied JSON inputs (rule-json/log-json or files), with no Alibaba Cloud API/CLI/SLS access at all. Its primary function is a rule-condition matching and diagnosis engine, not a log-querying assistant. Additionally, the output is structured JSON, not exclusively human-readable guidance. These are material description-versus-behavior differences, even though the code remains within the same WAF troubleshooting area.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**See complete setup guide**: [references/cli_guide.md](references/cli_guide.md) Section 1

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**See complete setup guide**: [references/cli_guide.md](references/cli_guide.md) Section 1

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · references/security_rules.md (reported line 18)May include surrounding context.

md
### 2. NO Script Generation

- ❌ NEVER generate configuration scripts (bash, python, etc.)
- ❌ NEVER output rule JSON examples
- ❌ NEVER write executable CLI commands for configuration
- ❌ NEVER save files to outputs directory or any location

Lp1

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'network' capability that is not listed in its permissions. This may indicate deceptive intent or missing permission declarations.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill forbids script generation and file saves, but later requires rule.json and log.json to run the diagnosis engine. In agent environments, this contradiction can lead to hidden file creation despite an asserted 'text-only' safety model, undermining operator expectations and potentially writing sensitive log or rule data to disk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file requires all diagnosis reports to start with a fixed English disclaimer, which imposes a specific language on user-facing output. The policy allows locale constraints only when users are given a choice or when the constraint is clearly documented and justified; neither is present here.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill claims to be a read-only, text-only diagnostic assistant, yet instructs execution of local commands such as python3, openssl, plugin installation, and a diagnosis script. This expands the trust boundary from cloud read-only queries to arbitrary local execution, which can affect the host environment and creates room for unsafe subprocess use in an agent context.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

At L138-L140, the documentation says Alibaba Cloud CLI is the only required tool and that no plugins are needed. Later, L404-L405 explicitly state that aliyun sls get-logs-v2 requires the SLS plugin and even instruct installation, which directly contradicts the earlier claim.

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 · SKILL.md (reported line 266)May include surrounding context.

md
### 2. Rule Configuration Guidance (Pure Text Guidance Mode)

> ⚠️ **CRITICAL: TEXT-ONLY guidance. NEVER generate scripts, save files, execute write APIs, or ask for IDs to "help configure".**

#### 2.0 Absolute Prohibitions (Critical - Zero Tolerance)

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% 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 · SKILL.md (reported line 314)May include surrounding context.

md
When handling user configuration requests, follow these priorities:

1. **Auto-extract**: Prioritize extracting known parameters from current conversation context
2. **Already have required info**: Use directly, **do not ask user again**
3. **Insufficient info**: Only ask when key information is truly unknown

#### 2.2 Generate Configuration Guidance Plan

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill metadata says outputs should be human-readable console guidance, but this reference instructs the agent to read the file before executing live Alibaba Cloud CLI commands. That expands the capability from read-only assistance into operational cloud API use, increasing the risk of unintended data access, environment interaction, and boundary violations if the agent follows the document literally.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This section instructs writing files under /tmp and invoking a local Python script, which is inconsistent with a text-only diagnostic skill. Introducing local filesystem writes and script execution creates unnecessary execution and tampering surface, and can lead to unsafe handling of untrusted log/rule data or unauthorized local actions in the agent environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Line L098 states 'If user does not specify version, ALWAYS default to WAF 3.0.' This is a natural-language policy issue because it forces a default behavior rather than prompting for clarification or documenting a justified constraint, which can mis-handle users working with WAF 2.0 contexts.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The checklist tells the operator to guide users to run aliyun configure, which moves beyond the skill's stated read-only diagnostic role into credential setup. Even though it also warns not to run aliyun configure get, instructing credential configuration can unnecessarily expand handling of secrets and encourage broader CLI access than needed for a text-only assistant.

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/profile_setup_guide.md (reported line 30)May include surrounding context.

bash
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz
tar -xzf aliyun-cli-linux-latest-amd64.tgz
mkdir -p ~/.local/bin && mv aliyun ~/.local/bin/
export PATH="$HOME/.local/bin:$PATH"  # Add to ~/.bashrc or ~/.zshrc for persistence
aliyun version

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% 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/profile_setup_guide.md (reported line 31)May include surrounding context.

wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz tar -xzf aliyun-cli-linux-latest-amd64.tgz mkdir -p ~/.local/bin && mv aliyun ~/.local/bin/ export PATH="$HOME/.local/bin:$PATH" # Add to ~/.bashrc or ~/.zshrc for persistence aliyun version

text

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/profile_setup_guide.md (reported line 152)May include surrounding context.

}

text

> 🔒 **Security Tip**: Ensure this file has correct permissions: `chmod 600 ~/.aliyun/config.json`

---

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/profile_setup_guide.md (reported line 215)May include surrounding context.

md
## Security Best Practices

1. **Use RAM users instead of primary account**: Create a dedicated RAM user and grant minimum permissions
2. **Rotate keys regularly**: Recommend changing AccessKey every 90 days
3. **Use temporary credentials**: For CI/CD or temporary access, use STS Token
4. **Protect configuration files**: `chmod 600 ~/.aliyun/config.json`

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/profile_setup_guide.md (reported line 218)May include surrounding context.

md
1. **Use RAM users instead of primary account**: Create a dedicated RAM user and grant minimum permissions
2. **Rotate keys regularly**: Recommend changing AccessKey every 90 days
3. **Use temporary credentials**: For CI/CD or temporary access, use STS Token
4. **Protect configuration files**: `chmod 600 ~/.aliyun/config.json`
5. **Do NOT commit credentials to code repositories**: Add config.json to .gitignore

---

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/security_rules.md (reported line 9)May include surrounding context.

md
## ❌ Forbidden Actions (Zero Tolerance)

### 1. NO Write Operations

- ❌ NEVER call Create*/Update*/Delete* APIs
- ❌ NEVER modify WAF rules, templates, or protection objects

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
71% confidence
Finding

The skill instructs running local commands such as installation, CLI configuration, identity lookup, and plugin installation, and notes reliance on AccessKey credentials. Although the document contains read-only cautions, this section does not clearly warn that these steps execute on the user's machine and use cloud credentials/account context.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The documentation directs use of aliyun sts get-caller-identity and instance inspection to derive account and billing metadata. While not inherently secret-exfiltrating, it reaches beyond the stated narrow purpose of WAF diagnosis and collects additional cloud account context that may be unnecessary under a least-privilege, text-only skill model.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

Line L070 instructs users to enter en for the default language as a fixed requirement. Under the policy, locale or language should not be forced unless the user is given an opt-in choice or the constraint is clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

This code opens files specified by the CLI arguments --rule-file and --log-file, which is a file access operation on potentially sensitive local data. Although the behavior is functional for the tool, there is no user-facing disclosure beyond generic argument help that the script will read the provided local files and process their contents.

Content

No source excerpt is available for this finding.