Back to skill

Security audit

alibabacloud-cfw-internet-firewall-protect

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly coherent for Alibaba Cloud Firewall administration, but it can disable broad firewall protections without a script-enforced confirmation gate for scoped disable operations.

Install only if you are comfortable giving an agent Alibaba Cloud Firewall write authority. Review scoped disable requests carefully, prefer explicit IP lists or tightly combined filters, and avoid using broad filters such as only --ip-version, only a region, or only a resource type unless that is truly intended. Install or upgrade Aliyun CLI through a trusted package path when possible, and use least-privilege or temporary cloud credentials.

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
scripts/fw-switch.sh:374
Finding

Scoped firewall disable operations lack a script-enforced confirmation gate

Content
View full analysis

Vulnerability Details

File Location: scripts/fw-switch.sh:374-476
Vulnerability Type: Missing confirmation control for a security-sensitive cloud operation
Risk Level: Medium

Technical Analysis

The enable and disable subcommands share the cmd_enable_disable implementation. Although the function requires at least one scope dimension, the disable path does not accept or enforce a --yes confirmation parameter before calling the authenticated PutDisableFwSwitch API.

Relevant argument parsing and scope validation:

bash
local IPS="" REGIONS="" RESOURCE_TYPES="" IP_VERSION="" MEMBER_UID="" DRY_RUN=false

while [[ $# -gt 0 ]]; do
  case "$1" in
    --ips) IPS="$2"; shift 2 ;;
    --regions) REGIONS="$2"; shift 2 ;;
    --resource-types) RESOURCE_TYPES="$2"; shift 2 ;;
    --ip-version) IP_VERSION="$2"; shift 2 ;;
    --member-uid) MEMBER_UID="$2"; shift 2 ;;
    --dry-run) DRY_RUN=true; shift ;;
    --help|-h)
      local action_cap="$(printf '%s' "${ACTION:0:1}" | tr '[:lower:]' '[:upper:]')${ACTION:1}"
      show_help "fw-switch.sh ${ACTION}" \
        "${action_cap} firewall protection for specified assets" \
        "fw-switch.sh ${ACTION} [options]" \
        "  --ips <ip1,ip2,...>              Comma-separated IP list
  --regions <r1,r2,...>            Comma-separated region list
  --resource-types <t1,t2,...>     Comma-separated resource types
  --ip-version <4|6>               IP version filter
  --member-uid <uid>               Member account UID
  --dry-run                        Preview CLI command
  --help, -h                       Show this help

  At least one of --ips, --regions, --resource-types, --ip-version is required.
  Parameters can be combined for compound filtering."
      ;;
    *) log_error "Unknown option: $1"; exit 1 ;;
  esac
done

if [[ -z "$IPS" && -z "$REGIONS" && -z "$RESOURCE_TYPES" && -z "$IP_VERSION" ]]; then
  log_error "At least one of --ips, --regions, --resource-types, --ip-version is requir
...[truncated 3375 chars]
Remediation
View remediation

Remediation Suggestions

  1. Add a --yes parameter to the scoped disable command and reject execution when it is absent:

    bash
    local YES=false
    
    case "$1" in
      --yes) YES=true; shift ;;
      # existing options...
    esac
    
    if [[ "$ACTION" == "disable" && "$DRY_RUN" != "true" && "$YES" != "true" ]]; then
      log_error "Disabling firewall protection requires --yes to confirm."
      output_error "NotConfirmed" "Operation requires --yes flag to confirm"
      exit 1
    fi
    
  2. Perform the confirmation check after local validation and dry-run handling but before require_attribution and call_cfw_api, ensuring that no write API is contacted first.

  3. For stronger protection, bind confirmation to the exact previewed operation. Generate a confirmation token containing or cryptographically covering:

    • The Alibaba Cloud account or member UID.
    • The action (disable).
    • The normalized IP, region, resource-type, and IP-version filters.
    • The previewed asset count.
    • A short expiration time.
  4. Require the execution phase to present the matching token. Reject changes when the account, action, or scope differs from the preview.

  5. Apply an additional explicit broad-scope warning or stronger approval requirement when the request uses only --ip-version, only a region, or only a resource type.

  6. Add automated tests confirming that:

    • Scoped disable without confirmation performs no API call.
    • --dry-run remains non-destructive.
    • A confirmed command cannot widen or alter the previewed scope.
    • enable-all and disable-all retain their existing confirmation behavior.
Vulnerability Patterns
  • 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
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (36)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
it needs the session-id too. Passing it as `SKILL_SESSION_ID={session-id} bash scripts/validate-cli.sh --check-permission` keeps every call from the very first

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
it needs the session-id too. Passing it as `SKILL_SESSION_ID={session-id} bash scripts/validate-cli.sh --check-permission` keeps every call from the very first

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
it needs the session-id too. Passing it as `SKILL_SESSION_ID={session-id} bash scripts/validate-cli.sh --check-permission` keeps every call from the very first

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
it needs the session-id too. Passing it as `SKILL_SESSION_ID={session-id} bash scripts/validate-cli.sh --check-permission` keeps every call from the very first

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
it needs the session-id too. Passing it as `SKILL_SESSION_ID={session-id} bash scripts/validate-cli.sh --check-permission` keeps every call from the very first

Self-Modification

High
Category
Rogue Agent
Confidence
95% confidence
Finding

The skill recommends installing or upgrading software by piping a remotely fetched script directly into bash. That pattern creates a supply-chain execution risk: if the remote endpoint, transport, or distribution pipeline is compromised, arbitrary code runs immediately in the agent environment, potentially with elevated privileges.

Content

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

md
# First install, or major upgrade
/bin/bash -c "$(curl -fsSL --connect-timeout 10 --max-time 120 https://aliyuncli.alicdn.com/setup.sh)"

# Routine self-update (supported from CLI 3.3.5)
aliyun upgrade --yes

# Alternative on macOS

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
erride and will error with `unchecked version`. The `call_cfw_api` function in `common.sh` is designed accordingly and does not include `--version`.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

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
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

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
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SKILL_SESSION_ID={session-id} bash scripts/fw-switch.sh query --region cn-hangzhou

Lp1

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'file_write' 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.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
89% confidence
Finding

The skill explicitly instructs the agent to proceed in non-interactive mode without an additional user confirmation round-trip, including for destructive firewall changes. In this context, the skill can disable or broadly alter network protections, so autonomous execution raises the risk of unintended security-impacting changes if the user's scope is ambiguous or the preview is miscomputed.

Content

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

md
Auto-protection is configured at the account's default scope and takes **no region parameter** — there is no per-region variant to confirm with the user. If the user asks to limit auto-protection to one region, tell them the API does not support a readable region-scoped config, and offer `fw-switch.sh enable --regions <region>` for the existing assets in that region instead.

`fw-switch.sh query` (read-only, so no confirmation gate applies):

| Parameter | Required | Description | Default when omitted |
|---|---|---|---|

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
97% confidence
Finding

The documentation includes examples that pass Access Key IDs and secrets directly as command-line arguments. On many systems, command-line arguments can be exposed through shell history, process listings, audit logs, or CI job output, which can leak long-lived cloud credentials and enable account compromise.

Content

No source excerpt is available for this finding.