Back to skill

Security audit

Alibaba Cloud AI Text Qwen Generation

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent Alibaba Qwen text-generation helper, with expected third-party API use and local request-file generation, but users should treat prompts, outputs, API keys, and helper output paths carefully.

Before installing, confirm Alibaba Cloud Model Studio is an approved destination for your prompts and outputs, use a least-privilege DashScope API key, avoid sending secrets or regulated data, and keep generated request/response files in a controlled output directory. Consider pinning the DashScope package version and avoid passing untrusted values to the helper's `--output` option.

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 (2)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:45
Finding
Unpinned DashScope Dependency Creates a Mutable Supply-Chain Risk<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 45-49 **Vulnerability Type**: Unpinned third-party dependency **Risk Level**: Medium ### Vulnerable Code ```bash python3 -m venv .venv . .venv/bin/activate python -m pip install dashscope ``` ### Technical Analysis The installation command retrieves the currently available `dashscope` package without specifying an audited version or verifying an integrity hash. Consequently, the installed code can change after the Skill has been reviewed. Use of the official package name is consistent with the Skill's declared Alibaba Cloud functionality, and installation occurs inside a virtual environment. However, a virtual environment isolates Python packages rather than operating-system permissions: package build or installation processes still run with the invoking user's privileges. This is a supply-chain weakness rather than evidence that the current `dashscope` package is malicious. ### Attack Path 1. An attacker compromises the package publisher, package repository, release workflow, or another part of the dependency distribution chain. 2. The attacker publishes a malicious or compromised version under the expected package name. 3. A user follows the Skill instructions and runs `python -m pip install dashscope`. 4. Pip resolves the mutable latest version rather than a previously audited release. 5. Malicious build logic may execute during installation, or installed package logic may execute when the SDK is subsequently imported or invoked. ### Impact Assessment Execution would occur with the privileges of the user running pip. Depending on those privileges and the malicious package behavior, the affected scope could include files accessible to that user, environment variables, credentials available to the process, and outbound network access. The command does not itself provide administrative privilege escalation, and the virtual environment limits package placement but not the permissi ...[truncated 36 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin `dashscope` to a reviewed, exact version instead of installing the latest release: ```bash python -m pip install "dashscope==<reviewed-version>" ``` 2. Maintain a locked requirements file containing cryptographic hashes: ```bash python -m pip install --require-hashes -r requirements.lock ``` 3. Configure the expected official package index explicitly and avoid untrusted extra indexes. 4. Review transitive dependencies and regenerate the lock file only through a controlled dependency-update process. 5. Run dependency installation and use under a minimally privileged account in an isolated environment. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/prepare_generation_request.py:20
Finding
User-Controlled Output Path Allows Overwriting Arbitrary Writable Files<![CDATA[ ## Vulnerability Details **File Location**: `scripts/prepare_generation_request.py`, lines 20-39 **Vulnerability Type**: Unrestricted file-write destination **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument("--output", default="output/aliyun-qwen-generation/requests/request.json") args = parser.parse_args() payload = { "model": args.model, "messages": [ {"role": "system", "content": args.system}, {"role": "user", "content": args.prompt}, ], "stream": args.stream, } if args.temperature is not None: payload["temperature"] = args.temperature if args.top_p is not None: payload["top_p"] = args.top_p if args.max_tokens is not None: payload["max_tokens"] = args.max_tokens output = Path(args.output) output.parent.mkdir(parents=True, exist_ok=True) output.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8") ``` ### Technical Analysis The `--output` argument accepts an unrestricted filesystem path. The script neither confines the resolved destination to the documented output directory nor rejects absolute paths, parent-directory traversal, or symbolic-link targets. `Path.write_text()` opens an existing target for replacement, so a caller can overwrite any file writable by the executing user. The preceding `mkdir()` call can also create attacker-selected directory trees where permissions allow. Exploitation requires control over the script arguments or successful influence over an Agent that constructs those arguments. The issue does not bypass operating-system filesystem permissions and does not independently provide privilege escalation. ### Attack Path 1. An attacker or untrusted task controls or influences the value passed to `--output`. 2. The attacker supplies an absolute path, traversal path, or path resolving through a symbolic link to a sensitive writable target. 3. The script creates missing parent directories where permitted. 4. `write_text()` repl ...[truncated 811 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Constrain all output to a fixed, approved base directory. 2. Resolve both the base directory and requested destination, then verify that the destination remains beneath the base: ```python base = Path("output/aliyun-qwen-generation/requests").resolve() requested = (base / args.output).resolve() if requested != base and base not in requested.parents: parser.error("--output must remain under the approved requests directory") ``` 3. Reject absolute paths and path components equal to `..`. 4. Avoid following symbolic links when creating or opening the destination. 5. Use exclusive creation where overwriting is unnecessary, or require an explicit `--overwrite` option before replacing an existing file. 6. Run the helper with minimum filesystem privileges and do not derive `--output` from untrusted prompt content. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill documents file-writing and outbound network behavior but does not declare any explicit tool scope or permissions boundary. This can cause an agent or operator to invoke the skill with broader capabilities than expected, weakening least-privilege controls and making unintended data egress or filesystem writes harder to govern.

Session Persistence

Medium
Category
Rogue Agent
Content
## Validation

```bash
mkdir -p output/aliyun-qwen-generation
python -m py_compile skills/ai/text/aliyun-qwen-generation/scripts/prepare_generation_request.py && echo "py_compile_ok" > output/aliyun-qwen-generation/validate.txt
```
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.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill instructs users to persist prompt templates, normalized requests, and response summaries to disk, but these artifacts may contain secrets, personal data, internal prompts, or proprietary model outputs. Storing them by default without warnings, redaction guidance, or retention limits increases the risk of local data exposure and later unintended reuse.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The quick-start example sends user-supplied prompt content to a third-party remote endpoint using an API key, but it does not warn that request contents leave the local environment. In practice, operators may paste confidential or regulated data into the example without understanding the privacy, residency, or provider-handling implications.

External Transmission

Medium
Category
Data Exfiltration
Content
## Quick start (OpenAI-compatible endpoint)

```bash
curl -sS https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
Confidence
95% confidence
Finding
This example performs intentional external transmission to the Alibaba Cloud Model Studio endpoint, including prompt content and an authorization bearer token. While expected for a provider integration skill, it still represents a real data egress path and becomes dangerous if users submit sensitive data or run the command in environments without approved outbound access.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
This markdown file contains user-facing natural-language content exclusively in Chinese, and there is no indication that the skill is region-specific or that users can opt into this locale. Under the language/locale policy rule, forcing a specific language without opt-in can be a policy concern.

Static analysis

No suspicious patterns detected.