T09 · Insecure Skill Coding Practices
- Location
SKILL.md:215- Finding
Arbitrary Python Code Execution Through Unquoted Heredoc Expansion
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does what it claims, but its voice-message scripts include unsafe runtime package installation, weak credential-file handling, and an input-handling flaw that can execute arbitrary local code.
Review before installing. Use this only with non-sensitive message content, create the Feishu config file with private permissions, avoid the Edge TTS script until the heredoc injection flaw is fixed, and install dependencies explicitly in an isolated environment with pinned versions instead of letting the script run pip automatically.
SKILL.md:215Arbitrary Python Code Execution Through Unquoted Heredoc Expansion
SKILL.md:179Unpinned Third-Party Package Is Installed Automatically at Runtime
SKILL.md:84Predictable Shared Temporary Files Permit Symlink and Race Attacks
SKILL.md:31Credential Configuration File Is Created Without Enforced Restrictive Permissions
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).
fi
rm -f /tmp/voice.wav /tmp/voice.opus 2>/dev/null echo "🧹 清理临时文件完成"
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
# Debian/Ubuntu
sudo apt update && sudo apt install -y jq ffmpeg python3 python3-pip
# CentOS/RHEL
sudo yum install -y jq ffmpeg python3 python3-pip
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# ===================== 核心逻辑 =====================
# 获取令牌
echo "🔑 获取飞书访问令牌..."
TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d "{\"app_id\":\"$APP_ID\",\"app_secret\":\"$APP_SECRET\"}" \
| jq -r '.tenant_access_token // empty')
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# ===================== 核心逻辑 =====================
# 获取令牌
echo "🔑 获取飞书访问令牌..."
TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d "{\"app_id\":\"$APP_ID\",\"app_secret\":\"$APP_SECRET\"}" \
| jq -r '.tenant_access_token // empty')
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# 发送消息
echo "📨 发送语音消息..."
SEND_RESPONSE=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"receive_id\":\"$CHAT_ID\",\"msg_type\":\"audio\",\"content\":\"{\\\"file_key\\\":\\\"$FILE_KEY\\\"}\"}")
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# 发送消息
echo "📨 发送语音消息..."
SEND_RESPONSE=$(curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"receive_id\":\"$CHAT_ID\",\"msg_type\":\"audio\",\"content\":\"{\\\"file_key\\\":\\\"$FILE_KEY\\\"}\"}")
The skill omits a clear privacy disclosure even though it sends user-supplied text and generated audio to Feishu, and the Edge TTS variant also sends text to an external TTS provider. Users may unknowingly transmit sensitive or regulated content to third parties, creating privacy, compliance, and data-handling risks.
The optimization table states that any failure scenario ensures temporary files are cleaned. In the basic send_voice.sh flow, failures after generating /tmp/voice.wav and /tmp/voice.opus but before the final cleanup—such as upload failure at L95-L98 or send failure at L111-L114—exit without deleting those files, so the documentation materially overstates the script's behavior.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
# Debian/Ubuntu
sudo apt update && sudo apt install -y jq ffmpeg python3 python3-pip
# CentOS/RHEL
sudo yum install -y jq ffmpeg python3 python3-pip
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sudo apt update && sudo apt install -y jq ffmpeg python3 python3-pip
# CentOS/RHEL
sudo yum install -y jq ffmpeg python3 python3-pip
# macOS
brew install jq ffmpeg python3
The file sets default_voice to zh-CN-XiaoxiaoNeural, uses Chinese default text, and all examples are oriented around Chinese speech output. Because no language choice or explicit justification for a China-specific locale constraint is documented, this appears to impose a locale preference without user opt-in.
The documentation describes dependency handling as checking for dependencies and prompting the user to install them. However, send_voice_edge.sh goes further by automatically running 'pip3 install edge-tts --quiet' at L179-L181, which is a side effect not reflected by the stated behavior and changes the host environment.