T09 · Insecure Skill Coding Practices
- Location
scripts/generate_image.sh:115- Finding
JSON Injection Through Unescaped Image Generation Parameters
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a straightforward Zhipu image-generation helper, with expected third-party API use and some input-validation/privacy documentation caveats.
Install only if you intend to use Zhipu AI for image generation. Avoid putting secrets, private personal data, or proprietary content in prompts, keep the ZHIPU_API_KEY scoped and monitored for billing, and be aware that unusual quotes or JSON-like text in prompts may cause malformed or unintended API requests until the script is hardened.
scripts/generate_image.sh:115JSON Injection Through Unescaped Image Generation Parameters
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
SKILL_DIR="$(dirname "$SCRIPT_DIR")"
# Load ZHIPU_API_KEY from .env file if exists (secure: only read the specific variable)
ENV_FILE="$SKILL_DIR/.env"
if [ -f "$ENV_FILE" ]; then
# Secure read: only extract ZHIPU_API_KEY, ignore other content
API_KEY_FROM_ENV=$(grep -E '^ZHIPU_API_KEY=' "$ENV_FILE" 2>/dev/null | head -1 | cut -d'=' -f2- | tr -d '"' | tr -d "'")
The skill declares shell-capable behavior by instructing users to run a local script, but it does not define any explicit tool scope such as permissions or allowed-tools. This increases the chance of over-broad execution in an agent environment and makes it harder to constrain what the skill may invoke.
The activation description is broad enough to trigger on common image-related requests, which can cause the agent to invoke this skill in situations where the user did not clearly consent to using an external image-generation provider. Over-broad routing raises privacy and safety risk because user prompts may be sent off-platform unexpectedly.
The documentation does not warn that prompts and related content are transmitted to Zhipu's external API service. Users may unknowingly send sensitive, proprietary, or personal information to a third party, creating privacy and compliance exposure.
The script sends user-supplied prompt content and the bearer API credential to an external third-party endpoint. This is expected for an API client, but it is still a real data-transmission boundary: sensitive prompts or misuse of the key could expose user data to the provider or enable unauthorized billing if the environment is compromised.
echo "Size: $SIZE"
echo "Watermark: $WATERMARK"
RESPONSE=$(curl -s -X POST "$API_URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "{
Most of the user-facing documentation is in Chinese, while the policy requires avoiding forced language constraints unless the user is given a choice or the locale restriction is justified. The file mentions support for Chinese/English prompts, but it does not offer bilingual documentation or state that Chinese-only documentation is intentional and limited to a specific audience.
The manifest describes a text-to-image generation skill, but the implementation also reads a local .env file to obtain credentials. While this is a common convenience pattern, it is still a local file access capability not mentioned in the stated purpose and not strictly inherent to image generation itself.
No suspicious patterns detected.