Back to skill

Security audit

alibabacloud-cdn-refresh-preload

Security checks for vulnerabilities and agentic risk

Overview

This diagnostic skill needs review because its advertised read-only safeguards allow unintended file access, file writes, and potentially leaking local data.

Prefer a corrected version before using production credentials or running alongside sensitive files. Any evaluation should use an isolated environment without unrelated secrets and narrowly scoped CDN credentials. The skill uses the currently configured CLI account; supplying a UID does not switch accounts. Fixes should safely handle response headers, restrict probe options and destinations, and verify HTTPS by default.

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

Error
Location
scripts/cdn_probe.py
Finding

Untrusted response headers can inject curl arguments and disclose local files

Content
View full analysis

Impact

Disclosure of readable, header-compatible local files, potentially including credential-bearing configuration lines, to the attacker's endpoint.

Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (18)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The advertised read-only probe boundary is undermined by options that access local files or write output, including curl header-file loading and write-out output redirection. An attacker who influences a probe command could expose local data or modify files with the agent's privileges; routing every probe through this wrapper increases reliance on its incomplete validation.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/cdn_probe.py (reported line 14)May include surrounding context.

python
chaining, substitution) are never available to the input.
  2. Raw-input pre-check: any input containing shell metacharacters
     (; | & $ ` > < newline) is rejected before parsing.
  3. Binary whitelist: only curl / dig / openssl may be executed; every
     other binary is refused with a clear error and a fix hint.
  4. curl is restricted to read-only GET/HEAD requests: body/upload/output
     flags (-d/--data*, -F/--form*, -T/--upload-file, -o/--output, -O, -J,

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/cdn_probe.py (reported line 60)May include surrounding context.

python
# Shell metacharacters that must never appear in a probe command.
FORBIDDEN_CHARS = set(";|&$`><\n\r")

# curl flags that perform writes (request body, upload, local file output)
# or can smuggle arbitrary options (-K reads a config file).
CURL_WRITE_FLAGS = {
    "-d", "--data", "--data-raw", "--data-binary", "--data-urlencode",

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/cdn_probe.py (reported line 60)May include surrounding context.

python
# Shell metacharacters that must never appear in a probe command.
FORBIDDEN_CHARS = set(";|&$`><\n\r")

# curl flags that perform writes (request body, upload, local file output)
# or can smuggle arbitrary options (-K reads a config file).
CURL_WRITE_FLAGS = {
    "-d", "--data", "--data-raw", "--data-binary", "--data-urlencode",

The supposedly read-only curl options permit local file writes through --write-out.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The validator accepts arbitrary -w/--write-out values, including %output{filename} on supporting curl versions. This permits file creation or overwrite with attacker-influenced formatting output despite the stated prohibition on local writes.

Content

No source excerpt is available for this finding.

The --url=value path permits arbitrary local file reads unrelated to CDN diagnostics.

High
Category
Excessive Agency
Confidence
100% confidence
Finding

The --url=value branch checks the option name but never validates the value's scheme, unlike the separate --url value branch. Consequently, curl can read file:/// paths and return their contents through captured stdout, exposing files accessible to the agent.

Content

No source excerpt is available for this finding.

The read-only OpenSSL validator permits TLS key-log file creation.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The OpenSSL validator blocks only a small set of write flags and therefore accepts s_client -keylogfile with an arbitrary writable path. This breaks the read-only boundary by creating or appending to local files and can persist TLS session secrets.

Content

No source excerpt is available for this finding.

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, network, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

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 31)May include surrounding context.

md
no direct HTTP signing). No external Python SDK dependencies.
2. **Alibaba Cloud credentials** — Credentials are resolved automatically by the aliyun CLI default credential chain (environment or ~/.aliyun/config.json). Do not read, print, or pass AK/SK/STS tokens explicitly.
3. **Target inputs**: URL (the resource to diagnose) and UID (the Alibaba Cloud account UID). UID can be omitted — it defaults to the caller account derived via `aliyun sts get-caller-identity`. Auto-fill first, ask second: never ask the user for UID or role name when they can be derived.

   **Auto-fill declaration requirement**: Whenever any parameter is auto-filled (UID, domain, URL, or role name), the Agent MUST explicitly declare this in the response or report metadata. For example: "UID auto-derived via sts:GetCallerIdentity: 1772241626973633" or "Domain auto-discovered via DescribeUserDomains: tofirae.com" or "URL auto-extracted from refresh task records: https://tofirae.com/1.png". This declaration is manda

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 46)May include surrounding context.

Verify caller identity and derive the caller UID (auto-cached)

--uid is informational only (recorded in the report for traceability); credentials always come from the CLI default credential chain

--role-name defaults to cseesadiagnosticrole if omitted; do not ask the user for it

cd $SKILL_DIR && python3 scripts/sts_token.py --json

text

Probe instructions weaken transport security without warning the user.

Medium
Category
Output Handling
Confidence
98% confidence
Finding

The probe examples disable certificate verification with curl -k, and the instructions also recommend an HTTP fallback without explaining the loss of authentication and confidentiality. A network attacker could forge cache headers and diagnosis evidence, while plaintext requests may expose sensitive URL paths or query parameters.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/cdn_probe.py (reported line 323)May include surrounding context.

python
def local_exec(argv, timeout=60):
    """Execute a validated argv list locally (argv list, never a shell)."""
    try:
        result = subprocess.run(
            argv, shell=False, capture_output=True, text=True, timeout=timeout,
        )
        return {

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/cdn_refresh_preload.py (reported line 139)May include surrounding context.

python
result: Optional[Dict[str, Any]] = None
    for attempt in (1, 2):
        try:
            proc = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
        except subprocess.TimeoutExpired:
            raise RuntimeError('CliError: aliyun CLI request timed out after 30s')
        except FileNotFoundError:

Tainted flow: 'cmd' from os.environ.get (line 125, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/cdn_refresh_preload.py (reported line 139)May include surrounding context.

python
result: Optional[Dict[str, Any]] = None
    for attempt in (1, 2):
        try:
            proc = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
        except subprocess.TimeoutExpired:
            raise RuntimeError('CliError: aliyun CLI request timed out after 30s')
        except FileNotFoundError:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
93% confidence
Finding

Although the argument-list subprocess prevents shell injection, curl receives a URL without an HTTP/HTTPS scheme restriction and bypasses the designated probe validator. Because task matching ignores scheme and port, a completed matching directory task can authorize probing a different protocol or port, potentially enabling unintended service interactions or internal-network requests through --resolve.

Content

Scanner excerpt · scripts/cdn_refresh_preload.py (reported line 457)May include surrounding context.

python
self._log(f'  Command: {curl_command}')

        try:
            proc = subprocess.run(cmd, capture_output=True, text=True, timeout=15)
        except subprocess.TimeoutExpired:
            return {'ok': False, 'curl_command': curl_command, 'resolve': resolve_used,
                    'error': 'curl request timeout (>15s)'}

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/sts_token.py (reported line 120)May include surrounding context.

python
try:
        # stdin=DEVNULL: never hang on interactive CLI prompts (e.g. plugin
        # auto-install questions); fail fast with a timeout/error instead.
        proc = subprocess.run(cmd, capture_output=True, text=True, timeout=60,
                              stdin=subprocess.DEVNULL)
    except subprocess.TimeoutExpired:
        print("Error: get-caller-identity timed out after 60s. Retry or check network.", file=sys.stderr)

Tainted flow: 'cmd' from os.environ.get (line 110, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/sts_token.py (reported line 120)May include surrounding context.

python
try:
        # stdin=DEVNULL: never hang on interactive CLI prompts (e.g. plugin
        # auto-install questions); fail fast with a timeout/error instead.
        proc = subprocess.run(cmd, capture_output=True, text=True, timeout=60,
                              stdin=subprocess.DEVNULL)
    except subprocess.TimeoutExpired:
        print("Error: get-caller-identity timed out after 60s. Retry or check network.", file=sys.stderr)

The script directly loads the CLI credential configuration despite claiming never to read secrets.

Low
Category
Excessive Agency
Confidence
96% confidence
Finding

The module documentation at L008-L010 says authentication is handled exclusively by the CLI and the script never reads secrets. However, L087-L090 opens and fully deserializes ~/.aliyun/config.json, which can contain stored access keys and security tokens, bringing those secrets into the Python process even though only the region is needed.

Content

No source excerpt is available for this finding.