T09 · Insecure Skill Coding Practices
- Location
scripts/config.py:204- Finding
Credential files are created without enforced restrictive permissions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This image-generation skill mostly does what it says, but its setup guidance and code handle API keys and cloud credentials in unsafe ways that users should review before installing.
Install only if you are comfortable sending prompts to Gitee AI and, when enabled, uploading generated images to your Tencent COS bucket. Do not paste real API keys into an AI chat, do not print full keys in logs, and store any Gitee or Tencent credentials with restrictive file permissions or a secret manager. Use a narrowly scoped Tencent key if COS upload is needed, and avoid exposing the helper URL-download function to untrusted URLs without additional network and size limits.
scripts/config.py:204Credential files are created without enforced restrictive permissions
references/GET_API_KEY.md:163Setup documentation encourages disclosure of complete API keys
scripts/utils.py:74Image download utility permits unrestricted URL fetching and unbounded response processing
requirements.txt:4Third-party dependencies are not reproducibly pinned
A description-behavior mismatch is a serious trust and review problem: the skill claims image generation and COS upload, while analysis indicates undeclared arbitrary network download behavior and missing declared core functionality. If true, this could let the skill fetch remote content or process files in ways users and reviewers did not authorize, creating opportunities for data exfiltration, malicious content retrieval, or misleading execution paths.
Telling users to provide the API key directly in chat to the AI agent exposes a sensitive credential through a natural-language interface that may be retained, inspected, or forwarded outside the user's local environment. In the context of an image-generation skill, this capability is unnecessary because the key can be configured locally without involving the model.
The documentation creates a direct social-engineering path for users to disclose bearer credentials to an AI system. Because AI platforms commonly store prompts, responses, and diagnostics, this can lead to persistent secret exposure and downstream abuse of the Gitee AI account.
The README explicitly instructs users or agents to collect a Gitee API key, persist it to local configuration, and optionally upload generated images to Tencent COS, but it does not warn that these actions involve sensitive credentials and transmission of user data to third-party services. In an agent context, this omission increases the risk that secrets are solicited or stored insecurely and that users are not meaningfully informed before content is sent to external providers.
The skill documentation describes capabilities that use environment variables, local file reads/writes, and network access, but it does not declare any tool scope or permission boundaries. In an agent setting, missing explicit permissions increases the chance that the skill is granted broader access than users expect, enabling unintended secret access, file modification, or outbound requests.
The skill advertises cloud upload and local saving but does not clearly warn that prompts, generated images, and related metadata may be transmitted to external providers and stored remotely. Users may unknowingly send sensitive prompts or content to third parties, creating privacy, compliance, and data retention risks.
The configuration guidance instructs users to place API keys and cloud credentials in files and environment variables without explicit secret-handling safeguards. This increases the risk of credential leakage through checked-in config files, permissive file permissions, logs, screenshots, or agent misuse of environment access.
The document warns users not to disclose API keys, then immediately shows a realistic full-length example key and later encourages sharing a key with an AI agent. Even if the example key is not live, this normalizes unsafe handling of secrets and weakens the document's security posture by teaching users that plaintext exposure is acceptable.
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.
# Linux/macOS
mkdir -p ~/.openclaw/skills/free-image-gen
# Windows (PowerShell)
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.openclaw\skills\free-image-gen"
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.
# Linux/macOS
mkdir -p ~/.openclaw/skills/free-image-gen
# Windows (PowerShell)
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.openclaw\skills\free-image-gen"
The document explicitly instructs users to send their Gitee API key to an AI agent in natural language. That creates an unnecessary credential disclosure path through chat logs, model providers, telemetry, or prompt-history storage, which is especially risky because an API key is a bearer secret that can be reused by whoever obtains it.
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 ~/.openclaw/skills/free-image-gen
# 创建配置文件
cat > ~/.openclaw/skills/free-image-gen/config.json << 'EOF'
The module documentation and all user-facing interactive text are written exclusively in Chinese, and the skill provides no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.
The code interactively collects API keys and optional COS secrets, then writes them in plaintext JSON to a predictable path under the user's home directory without warning the user about local secret storage, file permissions, or the sensitivity of those credentials. In an agent/tooling context, this increases the chance that other local users, processes, backups, or accidental file disclosure expose long-lived credentials that can be abused for API usage or cloud storage access.
Data is uploaded to cloud storage (S3 / GCS / Azure Blob). This may be a legitimate backup or exfiltration to an external bucket. Manual review is recommended.
if key is None:
key = local_path.split('/')[-1].split('\\')[-1]
response = self.client.upload_file(
Bucket=self.bucket,
LocalFilePath=local_path,
Key=key,
This code performs a network upload of a local file to a remote cloud storage service, which can transmit user or system data off the machine. Although the function name and docstring describe uploading, there is no confirmation prompt, user-facing log/print, or explicit warning about this data transfer in the code shown.
The manifest describes a tool for generating images and supporting local save or Tencent COS upload. This module also exposes a delete capability that removes objects from remote cloud storage, which is not mentioned or obviously required by that stated purpose. Deleting remote content is a materially different capability from generating or uploading images.
The delete method performs a destructive remote operation by deleting an object from COS, but it provides no confirmation prompt or advance user disclosure before doing so. A failure message is printed only after the operation errors, which does not warn the user about the irreversible action beforehand.
When upload_to_cos is enabled, the skill uploads the generated local file to Tencent COS, transmitting user-derived content to a cloud service. The parameter name suggests upload behavior, but this file does not include a clear warning, confirmation, or user-facing disclosure about external cloud transfer.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"Authorization": f"Bearer {self.api_key}"
}
response = requests.post(url, json=payload, headers=headers, timeout=60)
if response.status_code != 200:
raise Exception(f"API 调用失败 ({response.status_code}): {response.text}")
This Python file performs a network request to Gitee AI using the user-provided prompt, which may contain sensitive user data. Although the docstrings describe image generation, there is no confirmation prompt, print/log disclosure, or explicit warning in this file that prompt content will be sent to an external service.
User-facing natural-language strings, including the module description, CLI description, and argument help text, are entirely in Chinese. This imposes a specific language/locale on users without offering any language choice or documenting a justified region-specific constraint.
All user-facing instructions are provided only in Chinese, and the document does not indicate that this is an optional locale or a region-specific requirement. Under the stated policy, forcing a single language without user opt-in can be a natural-language policy concern.
The entire skill documentation is written in Chinese and does not indicate that other languages are supported or that the language choice is optional. Under the stated policy, forcing a specific language without user opt-in is a natural-language locale violation unless clearly justified as region-specific.
This requirements file includes natural-language comments entirely in Chinese, such as the header and dependency section labels. Because the file provides no indication that language choice is optional or justified for a region-specific skill, it may violate a language/locale policy requiring user opt-in or neutrality.