T09 · Insecure Skill Coding Practices
- Location
scripts/wx_ocr_reply.py:12- Finding
Full-Screen Capture Stored in a Predictable Temporary File
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a WeChat automation helper, but it can send real messages and capture screen content with too little confirmation, validation, and privacy control.
Review this before installing because it can act through your live WeChat desktop session. Only use it for messages you explicitly requested, avoid sensitive screen content before running OCR, and prefer a version that confirms the recipient and exact message before sending, restores the clipboard, captures only a selected chat region, and deletes temporary screenshots.
scripts/wx_ocr_reply.py:12Full-Screen Capture Stored in a Predictable Temporary File
SKILL.md:138Unpinned Third-Party Dependency Installation
scripts/wx_send.py:19Messages Can Be Sent Without Verifying the Selected Recipient
The skill promises a dual-mode workflow including OCR-based auto-reply, but the shown core script only returns Ready when no message is provided and does not implement that capability. This mismatch can cause unsafe assumptions by users or upstream agents, leading them to rely on non-existent safeguards or workflows while still granting powerful automation permissions.
The skill promises a dual-mode workflow including OCR-based auto-reply, but the shown core script only returns Ready when no message is provided and does not implement that capability. This mismatch can cause unsafe assumptions by users or upstream agents, leading them to rely on non-existent safeguards or workflows while still granting powerful automation permissions.
The OCR auto-reply description omits key warnings that screenshots may capture unrelated on-screen sensitive information and that content may be transmitted to an external API. In the context of chat automation, this omission is especially risky because users may not realize personal messages, notifications, or other desktop data could be exposed.
The skill documents shell-executable automation (osascript, python3) but declares no explicit tool scope or permission boundary. In an agent environment, missing scope makes it easier for the skill to invoke local automation unexpectedly, including UI control and clipboard manipulation, without clear user consent or policy enforcement.
The manifest advertises built-in OCR auto-reply support, but the primary documented script does not do that. Security-sensitive capabilities must be accurately represented; otherwise, reviewers and users cannot correctly assess the data exposure and automation risks of the skill.
The trigger description is broad enough that normal conversational requests about WeChat could invoke an automation that controls the UI and sends messages. In this context, accidental triggering is dangerous because the skill can modify the clipboard and dispatch messages to real contacts with limited user visibility.
The skill lacks an explicit warning that it will overwrite the clipboard and automate message sending through UI control. Clipboard replacement and simulated keystrokes can leak or destroy user data, and they may send content to the wrong chat if focus changes or UI state differs from expectations.
The documentation extends the skill into an OpenAI-powered OCR auto-reply workflow that goes beyond simple message sending. Expanding a skill's scope in documentation without corresponding manifest clarity and security warnings can lead to unreviewed data flows and over-privileged deployment.
Introducing an external OpenAI API dependency for OCR auto-reply creates a potential exfiltration path for sensitive screen or chat content that is not necessary for the core task of sending a WeChat message. Because chat windows and screenshots may contain personal or confidential data, sending them to an external API materially increases privacy and compliance risk.
The top-level documentation says the script depends on OpenAI for generating replies, implying end-to-end OCR plus response generation. However, the code never imports or calls OpenAI and instead leaves reply generation as a TODO, which directly contradicts the documented behavior.
The script captures the full screen and OCRs its contents without any explicit consent flow, minimization, or warning. In the context of a WeChat auto-reply skill, this is especially sensitive because the screenshot may include unrelated chats, credentials, notifications, or other confidential material beyond the intended conversation, creating a real privacy-exposure risk.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def take_screenshot():
"""截图当前屏幕"""
screenshot_path = "/tmp/wechat_screenshot.png"
subprocess.run(["screencapture", "-x", screenshot_path])
return screenshot_path
def ocr_screenshot(image_path):
The script dynamically builds Python code as a string and executes it with python -c. Although it avoids a shell, image_path is interpolated directly into the generated code, so crafted input containing quotes/newlines could alter the executed Python source. In this file the current caller passes a fixed path, which reduces exploitability, but the pattern is still unsafe and brittle.
print("\\\\n".join(results))
'''
result = subprocess.run([sys.executable, "-c", py_script], capture_output=True, text=True)
return result.stdout
def main():
The manifest describes a mode that OCRs chat content and then automatically replies to the contact. In this file, the reply-generation and message-sending steps are explicitly left as TODOs and commented out, so the implemented behavior stops at displaying recognized text rather than completing the promised auto-reply flow.
This script automates WeChat UI actions and can send messages to a selected contact without any user-visible confirmation step before dispatch. It also overwrites the system clipboard with the contact name and message text, which can leak or destroy user clipboard contents and makes unintended or spoofed messaging easier if the skill is invoked with attacker-controlled input.
The manifest describes two modes: direct sending with provided content, and an OCR screenshot recognition mode that reads chat content and auto-replies when no message is supplied. This file implements only a simple two-argument send flow and exits when no message is provided, with no screenshot capture, OCR, or reply-generation logic.
The script automatically focuses WeChat, selects a contact, types arbitrary input, and sends it immediately without any confirmation or preview. In an agent setting, this can cause unintended or unauthorized outbound messages, including social engineering, data leakage, or messages sent to the wrong recipient if UI focus/search results are not as expected.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def send_wechat_message(contact_name, message):
"""发送微信消息"""
# 打开微信
subprocess.run(['open', '-a', 'WeChat'])
time.sleep(2)
# 打开搜索框 (Cmd+F)
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def send_wechat_message(contact_name, message):
"""发送微信消息"""
# 打开微信
subprocess.run(['open', '-a', 'WeChat'])
time.sleep(2)
# 打开搜索框 (Cmd+F)
The natural-language description is written only in Chinese ("发送微信消息给指定联系人"), which can indicate a language-specific constraint without any stated user choice or opt-in. The file provides no indication that the skill supports other languages or that the Chinese-only behavior is a justified locale-specific requirement.
The script automatically launches WeChat, focuses search, types a contact name, and sends keyboard input without a prominent disclosure or interactive confirmation. In this skill context, UI automation can cause unintended actions, target the wrong chat, or interfere with the user's active session, making the behavior riskier than ordinary local automation.