T09 · Insecure Skill Coding Practices
- Location
scripts/qq_hw.py:575- Finding
PowerShell Command Injection Through Unescaped File Paths
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly does what it claims, but it needs careful review because it uses authenticated QQ browser state, asks to run browser automation outside the sandbox, and contains unsafe download and PowerShell handling.
Install only in an isolated workspace or disposable account, with a dedicated QQ browser profile and explicit recipient approval for any email or WeChat sending. Avoid unattended use until dependencies are pinned, sandbox guidance is narrowed, bkn handling is documented, URL/image validation is added, and the PowerShell path injection issue is fixed.
scripts/qq_hw.py:575PowerShell Command Injection Through Unescaped File Paths
scripts/qq_hw.py:368Unrestricted URL Retrieval and Unbounded Image Decompression
SKILL.md:29Browser Automation Is Required to Run Without Sandbox Isolation
SKILL.md:123Runtime Installation of Unpinned Third-Party Packages
scripts/count_pages.ps1:4Predictable Temporary Homework Copy Is Left on Disk
Most of the declared functionality is accurately represented by the code: it retrieves QQ group homework, gathers details including image URLs, builds DOCX files, can convert to PDF, supports multi-group and subject filtering, has text-only and multi-page options, and includes a substantial doctor/self-check flow suitable for scheduled automation. However, the description explicitly says the skill can send the result to a specified email or WeChat, and positions that as a use case. In the supplied code chunk, there is no email-sending logic, no WeChat messaging/sharing logic, and no corresponding CLI subcommand. That is a material overstatement of capability, so this should be flagged as a description-behavior mismatch.
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Referenced artifact was not completely inspected
python scripts/qq_hw.py day <日期> --refresh
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
sys.stdout.flush()
# 用子进程而不是 os.execve:Windows 上 exec 的进程替换语义不可靠(输出会丢、产物可能不落盘),
# subprocess 透传 stdout 与退出码,行为可预期。QQHW_REEXEC 防递归。
env = dict(os.environ, QQHW_REEXEC="1")
try:
r = subprocess.run([cand, os.path.abspath(__file__)] + sys.argv[1:], env=env)
sys.exit(r.returncode)
The skill instructs use of shell commands, file reads/writes, browser/network access, and email/WeChat delivery, but declares no explicit tool scope or permission boundaries. In a skill that handles login state, local files, scheduled automation, and outbound sending, missing scope declarations increases the chance of over-privileged execution and accidental or unauthorized data access/exfiltration.
The description says the skill should be used when the user asks to 'organize, export, or send QQ group homework' and lists generic triggers such as '作业整理'、'作业文档' and '发作业给XX'. These phrases are common and underspecified, with no exclusion conditions or negative examples, increasing the risk of unintended invocation for unrelated homework or document-sending requests.
The skill explicitly supports unattended export and sending of QQ group homework, including images, to email or WeChat, but does not present a prominent privacy warning at the top-level description. Because homework content may include student information, teacher names, class/group identifiers, and attachments, silent or background transmission raises meaningful privacy and data-handling risk.
The documentation explicitly instructs operators to recover a real authentication-derived bkn token from browser network resources and cache it, but provides no security guidance on handling session-linked secrets, consent boundaries, storage protections, or misuse risks. In the context of a headless homework-export automation skill that accesses private QQ group content and attachments, this enables credential/session abuse and unauthorized data extraction if logs, cache files, or automation hosts are compromised.
The file title and the operational guidance throughout the document are written entirely in Chinese, and multiple instructions assume Chinese-language interaction and content handling. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified, which is not documented here.
No suspicious patterns detected.