Back to skill

Security audit

Alibabacloud Waf Bot Management

Security checks for vulnerabilities and agentic risk

Overview

The skill has a legitimate WAF bot-management purpose, but it directs high-impact cloud firewall changes with weak confirmation, validation, and least-privilege safeguards.

Review before installing. Use scoped, short-lived RAM credentials; keep assessment on read-only access; require explicit confirmation for every create/modify/delete/clear/bind/enable action; start new rules in monitor/canary mode; validate all user-provided placeholders; and treat SDK and SLS outputs as sensitive user telemetry subject to privacy and access-control requirements.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:168
Finding

Shell Command Injection Through Unvalidated User-Controlled Placeholders

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:168-184, with additional affected command templates at SKILL.md:190-197 and SKILL.md:361-369
Vulnerability Type: Shell command injection
Risk Level: High

Vulnerable Code

bash
# Add trusted IPs to whitelist (can be executed multiple times)
aliyun waf-openapi add-address \
  --region {region} \
  --InstanceId {instance_id} \
  --AddressList '["{trusted_ip_1}","{trusted_ip_2}"]' \
  --AddressType "ipv4" \
  --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-bot-management"

Other affected templates include:

bash
aliyun waf-openapi create-defense-template \
  --region {region} \
  --InstanceId {instance_id} \
  --TemplateName "{scenario_name}_Bot_Protection" \
  --DefenseScene "antibot" \
  --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-bot-management"
bash
aliyun waf-openapi create-defense-rule \
  --region {region} \
  --InstanceId {instance_id} \
  --TemplateId {template_id} \
  --DefenseScene "antibot" \
  --RuleName "{new_rule_name}" \
  --RuleContent '{...}' \
  --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-bot-management"

Technical Analysis

The skill collects values such as regions, instance identifiers, scenario names, trusted IP addresses, and rule names, then interpolates them directly into command strings intended for shell execution. It does not define allowlist validation, escaping requirements, or an argument-array execution mechanism.

Shell quoting does not make these templates uniformly safe:

  • Values placed inside double quotes can still trigger shell expansion, including command substitution using $().
  • A single quote embedded in a trusted-IP value can terminate the single-quoted JSON argument and introduce additional shell syntax.
  • Fields such as {region}, {instance_id}, and {template_id} are not consistently quoted.
  • JSON is assem ...[truncated 1612 chars]
Remediation
View remediation

Remediation Suggestions

  1. Execute the CLI through a structured argument array without invoking a shell. Each placeholder must be passed as one discrete argument.
  2. Apply strict allowlist validation before command construction:
    • Validate regions against supported Alibaba Cloud region identifiers.
    • Validate instance, template, resource, and rule IDs against their documented formats.
    • Parse trusted addresses with an IPv4, IPv6, or CIDR library and reject all other input.
    • Restrict names to a conservative character set and length, such as ASCII letters, digits, underscores, and hyphens.
    • Restrict actions and statuses to explicit enumerations.
  3. Construct AddressList, ResourceList, and RuleContent with a JSON serializer rather than string concatenation.
  4. Reject control characters, command-substitution syntax, newlines, and unexpected quotes as defense in depth.
  5. Present the normalized command arguments and planned cloud mutations to the user before execution.
  6. Require explicit confirmation for every write operation, particularly address-book changes, resource binding, and template enablement.
  7. Add negative tests covering single quotes, double quotes, semicolons, newlines, $(), backticks, and malformed JSON.

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:125
Finding

Read-Only Failures Can Trigger a Request for Broad WAF Write Access

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:125-132
Vulnerability Type: Excessive cloud privileges and failure to enforce least privilege
Risk Level: Medium

Vulnerable Code

markdown
**Runtime Error Handling** (applies to all CLI calls):

When executing CLI commands in Step 1/3/4, handle errors as follows:

| Error Code | Meaning | Resolution |
|------------|---------|------------|
| command not found | CLI not installed | Pause the workflow. Direct the user to https://help.aliyun.com/zh/waf/web-application-firewall-3-0/developer-reference/cli-integration-example-v3 to install the CLI, or run `brew install aliyun-cli` (macOS) |
| InvalidAccessKeyId / Forbidden.RAM | Insufficient permissions | Pause the workflow. Ask the user to verify the RAM policy includes `AliyunWAFReadWriteAccess` |
| InvalidSecurityToken.Expired | STS Token expired | Ask the user to run `aliyun configure` to refresh credentials and retry |

The project itself documents a narrower option in references/ram-policies.md:7-23:

markdown
### Read-Only Access (Assessment Only)

For Step 1 (Current State Assessment) and Step 4 (Verification), attach the following system policy:

- **AliyunWAFReadOnlyAccess**: Grants read-only access to WAF resources, including instance queries, defense template queries, rule queries, and log status queries.

Technical Analysis

The error-handling rule explicitly applies to Steps 1, 3, and 4, but recommends AliyunWAFReadWriteAccess whenever a Forbidden.RAM response occurs. Steps 1 and 4 perform assessment and verification queries and ordinarily require only read access.

As a result, a permission failure during a read-only phase can cause the skill to ask the user to attach a policy that permits WAF mutation. The narrower policy documented in references/ram-policies.md is not enforced by the primary workflow.

This does not independently bypass Alibaba Cloud authorization ...[truncated 1279 chars]

Remediation
View remediation

Remediation Suggestions

  1. Map every workflow phase and API call to its exact required RAM action.
  2. For Steps 1 and 4, request only AliyunWAFReadOnlyAccess or, preferably, the documented custom policy containing the necessary Describe* actions.
  3. Request write permissions only when the user explicitly chooses configuration or tuning operations in Steps 3 or 5.
  4. Prefer the custom policy in references/ram-policies.md over AliyunWAFReadWriteAccess, and constrain resources where Alibaba Cloud supports resource-level authorization.
  5. Change error handling so that Forbidden.RAM identifies the specific failed API action and recommends only that missing permission.
  6. Require explicit administrator confirmation before any privilege expansion and explain which subsequent mutations the new policy permits.
  7. Use separate short-lived identities or STS sessions for assessment and mutation phases, then revoke or expire write access immediately after configuration.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:199
Finding

Production Blocking Rules Can Be Enabled Before Mandatory Canary Validation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:199-253
Vulnerability Type: Unsafe production configuration workflow
Risk Level: Medium

Vulnerable Code

bash
# Example: Create crawler client detection rule (action = block)
aliyun waf-openapi create-defense-rule \
  --region {region} \
  --InstanceId {instance_id} \
  --TemplateId {template_id} \
  --DefenseScene "antibot" \
  --RuleName "Crawler_Client_Block" \
  --RuleContent '{"bot_labels":["malicious_crawler_python","malicious_crawler_java"],"action":"block"}' \
  --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-bot-management"
bash
aliyun waf-openapi modify-template-resources \
  --region {region} \
  --InstanceId {instance_id} \
  --TemplateId {template_id} \
  --ResourceMode "bind" \
  --ResourceList '["{resource_id_1}","{resource_id_2}"]' \
  --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-bot-management"
bash
aliyun waf-openapi modify-defense-template-status \
  --region {region} \
  --InstanceId {instance_id} \
  --TemplateId {template_id} \
  --Status "enabled" \
  --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-bot-management"

Canary deployment is described only after the enablement step:

markdown
**Canary Deployment Recommendation**: For initial configuration, set all disposition actions to `monitor` (observe only, no blocking). Run for a period and review hit data. After confirming no false positives, switch to the formal disposition actions.

Technical Analysis

The executable workflow creates a rule with a blocking action, binds the template to protected resources, and enables it. The safer monitor-first process appears afterward as a recommendation rather than a prerequisite enforced by the workflow.

A literal execution of Step 3 can therefore activate blocking controls against production traffic before false-positive analysis. This is ...[truncated 1689 chars]

Remediation
View remediation

Remediation Suggestions

  1. Make monitor the mandatory initial action for every newly created rule, regardless of its eventual target action.
  2. Separate the workflow into explicit stages:
    • Create disabled or monitor-only rules.
    • Verify the generated rule content.
    • Bind only to a non-production or narrowly scoped canary resource.
    • Observe for the scenario-specific minimum period.
    • Obtain explicit user approval.
    • Promote one rule at a time to captcha, then to block where justified.
  3. Require a preflight summary listing affected domains, resource IDs, templates, labels, actions, and expected user impact before binding or enablement.
  4. Snapshot the existing template, rule, binding, and status configuration before mutation.
  5. Implement automated rollback that disables the template first and then restores or deletes all resources created during the session.
  6. Treat incomplete execution as a failed transaction and clearly mark all surviving mutations.
  7. Add post-change health checks and automatically revert if error rates, block rates, or legitimate-traffic failures exceed approved thresholds.
  8. Require separate confirmation for production endpoints, especially login, payment, ordering, and public API resources.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (5)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documented clear-address operation can wipe an entire whitelist/blacklist address book, which could immediately remove trusted or blocked IP controls and materially weaken protections. In the context of an automation assistant for WAF bot management, omission of an explicit warning increases the chance that an agent or operator invokes it casually, causing broad security-impacting misconfiguration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown reference lists destructive operations such as delete-defense-template as routine cleanup actions, but it does not include any warning that these calls can remove active configuration or affect protection coverage. Under the markdown-file criteria, descriptions should disclose behaviors that may affect user data or system integrity.

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/scene-academic.md (reported line 36)May include surrounding context.

md
| Rule Type | Recommended Action | Reason |
|-----------|-------------------|--------|
| IDC / request sequence / threat intelligence | captcha (slider) | Normal users can pass verification |
| AI crawlers / spoofed spiders / known malicious tools | block (block) | Clearly malicious, no verification opportunity given |

### Recommended Rules to Enable

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide instructs operators to deploy an App SDK that collects extensive device and behavioral environment data, but it provides no warning to disclose this collection to end users or to align deployment with privacy notice, consent, and data-minimization requirements. In a production security product context, this omission can lead to non-compliant surveillance-style collection, legal/privacy exposure, and unsafe deployment practices even if the underlying anti-bot purpose is legitimate.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file instructs users to run investigative queries over fields such as real_client_ip, account, umid, user_agent, and province, which can reveal sensitive user or device information. The usage section explains prerequisites and substitutions but does not warn readers that the queries may surface personal or sensitive operational data and should be handled appropriately.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.