T09 · Insecure Skill Coding Practices
- Location
scripts/analyze_image.py:225- Finding
DashScope API Key Disclosure Through a Caller-Controlled Endpoint
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly a coherent Alibaba Qwen VL image-analysis helper, but its script can forward the user's DashScope API key and image data to an arbitrary caller-supplied endpoint.
Review before installing. Use only trusted request JSON, remove or restrict the base_url override, and avoid sending sensitive images, screenshots, documents, secrets, or regulated data unless you have approval for Alibaba Cloud processing. Pin dependencies for reproducible installs and rotate the DashScope key if this script has ever been run with untrusted input.
scripts/analyze_image.py:225DashScope API Key Disclosure Through a Caller-Controlled Endpoint
SKILL.md:30Unpinned Third-Party Dependency Installation
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def _load_env() -> None:
_load_dotenv(Path.cwd() / ".env")
repo_root = _find_repo_root(Path(__file__).resolve())
if repo_root:
_load_dotenv(repo_root / ".env")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def _load_env() -> None:
_load_dotenv(Path.cwd() / ".env")
repo_root = _find_repo_root(Path(__file__).resolve())
if repo_root:
_load_dotenv(repo_root / ".env")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
_load_dashscope_api_key_from_credentials()
if not os.environ.get("DASHSCOPE_API_KEY"):
print(
"Error: DASHSCOPE_API_KEY is not set. Configure it via env/.env or ~/.alibabacloud/credentials.",
file=sys.stderr,
)
print("Example .env:\n DASHSCOPE_API_KEY=your_key_here", file=sys.stderr)
The skill documentation implies capabilities involving environment variables, local file reads/writes, and outbound network access, but it declares no explicit tool scope or permission boundaries. This can cause an agent runtime to invoke the skill without clear least-privilege constraints, increasing the chance of unintended data access or exfiltration.
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.
mkdir -p output/aliyun-qwen-vl
python -m py_compile skills/ai/multimodal/aliyun-qwen-vl/scripts/analyze_image.py && echo "py_compile_ok" > output/aliyun-qwen-vl/validate.txt
The skill explicitly sends user prompts and images to Alibaba Cloud's DashScope API, but it does not clearly warn users that potentially sensitive local images and extracted content leave the local environment. For multimodal workflows, this creates a real privacy and compliance risk because screenshots, invoices, IDs, or other confidential data may be transmitted externally without informed consent.
This skill is designed around outbound API calls to a third-party endpoint, so external transmission is inherent to its function rather than a hidden behavior. However, it is still security-relevant because any supplied image, prompt text, and derived metadata may be transmitted off-system, which can expose sensitive information if not tightly controlled.
--print-response
## cURL (compatible mode)
```bash
curl -sS https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
The workflow text references checking whether an operation is read-only or mutating and executing a target operation, which is inconsistent with a vision-analysis skill that should only submit prompts and images to a remote model. This mismatch can mislead orchestration agents into granting broader authority or composing the skill into workflows with unnecessary side effects.
The documentation instructs users to send image URLs and accompanying text to third-party cloud endpoints but does not mention that image content, extracted text, or linked resources may contain sensitive data and will be transmitted off-system. In an image-understanding/OCR workflow, this omission can lead to unintentional disclosure of screenshots, documents, IDs, or internal URLs, making the skill context more sensitive than generic text-only API usage.
This code performs external network transmission of user-supplied prompts and image data to a remote endpoint, which is inherently sensitive for a multimodal analysis tool. The risk is amplified because the request body may contain raw local image contents embedded as base64 data URLs, and the base_url is request-configurable, enabling accidental or unsafe routing to non-default endpoints.
) -> requests.Response:
last_error: str | None = None
for attempt in range(max_retries + 1):
response = requests.post(url, headers=headers, json=payload, timeout=timeout_s)
if response.status_code < 400:
return response
The script sends prompts and image content, including local files converted to data URLs, to a third-party API service without any explicit consent gate, sensitivity warning, or data-classification check. In this skill context, users may analyze screenshots, OCR documents, charts, or other potentially sensitive images, so unintended disclosure of secrets, PII, or internal material to an external provider is a realistic risk.
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
if args.output:
output_path = Path(args.output)
output_path.parent.mkdir(parents=True, exist_ok=True)
output_path.write_text(json.dumps(result, ensure_ascii=True, indent=2), encoding="utf-8")
if args.print_response:
print(json.dumps(result, ensure_ascii=True))
No suspicious patterns detected.