T06 · System Persistence
- Location
README.md:190- Finding
Persistent Unattended Publishing Through a Cron Job
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill matches its stated WeChat publishing purpose, but it can post publicly and reuse stored login cookies with weak safeguards.
Review carefully before installing. Use `--draft` first, avoid unattended cron publishing unless you fully control the machine and account, protect or delete `~/.wechat_mp/cookies.json` as a sensitive login session, and do not publish article files from untrusted sources until the HTML insertion is escaped or sanitized.
README.md:190Persistent Unattended Publishing Through a Cron Job
scripts/publish.py:23Reusable Authentication Cookies Stored Without Explicit Permission Hardening
scripts/publish.py:86Unescaped Article Content Injected into an Authenticated Page Through innerHTML
{line}
' ) else: html_parts.append( f'{line}
' ) return "\n".join(html_parts) ``` ```python html_content = build_html_content(content) # Clear the editor and inject HTML. page.evaluate("""(html) => { const ed = document.querySelector('.ProseMirror'); if (ed) { ed.innerHTML = html; ed.dispatchEvent(new Event('input', {bubbles:true})); } }""", html_content) ``` Comments and the docstring have been translated into English; the vulnerable data flow is unchanged. ### Technical Analysis The command-line argument and `--content-file` input are documented as plain text. However, each input line is interpolated directly into an HTML string without entity encoding or sanitization. The resulting string is then assigned to the editor's `innerHTML`. Characters such as `<`, `>`, `"`, and `&` therefore retain HTML semantics. A crafted input can terminate the intended paragraph structure and inject arbitrary elements or attributes. Depending on the target page's Content Security Policy and browser behavior, active constr ...[truncated 1796 chars]scripts/requirements.txt:1Unbounded Playwright Dependency Without Integrity Pinning
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).
A: 删除 Cookie 文件后重新登录:
rm ~/.wechat_mp/cookies.json
python3 publish.py --login
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).
- **保存位置**:`~/.wechat_mp/cookies.json`
- **有效期**:通常 30 天左右
- **过期处理**:自动跳转登录,用微信重新扫码
- **清除**:`rm ~/.wechat_mp/cookies.json` 后重新 `--login`
## 故障排查
The README states that login cookies are automatically saved to ~/.wechat_mp/cookies.json but does not warn that these cookies are sensitive session credentials. If another local user, backup system, or malware accesses that file, an attacker may be able to reuse the session to control the associated WeChat public account.
The README explicitly instructs users to publish articles directly and later recommends batch and scheduled publishing, but it does not clearly warn that omitting --draft will cause an immediate public post. In an automation skill that targets a real publishing platform, lack of an irreversible-action warning materially increases the risk of accidental publication, reputational harm, and unintended disclosure.
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.
编辑 crontab:
crontab -e
添加定时任务(每天下午 3 点发布):
The skill automates drafting or directly publishing content to a public WeChat official account, but the description does not prominently warn users that running it can cause immediate public-facing actions. In an automation context, omission of this warning increases the risk of accidental publication, reputational harm, and unintended disclosure if the user invokes the skill with real account credentials.
The documentation states that authentication cookies are saved and reused from ~/.wechat_mp/cookies.json, but it does not provide a clear security warning about the sensitivity of that file. Persistent session cookies can allow account takeover by any local user, malware, backup system, or process that gains read access to the file.
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
**Q: 第一次运行总是要登录?**
A: 首次登录后 Cookie 会保存到 `~/.wechat_mp/cookies.json`,后续会自动使用。如果还是提示登录,检查:
- Cookie 文件是否存在:`ls -l ~/.wechat_mp/cookies.json`
- 文件是否可读:`cat ~/.wechat_mp/cookies.json`
- 尝试重新登录:`python3 publish.py --login`
The documentation promotes direct publication and cookie reuse for a real account-impacting workflow without clearly warning that persisted session cookies are sensitive credentials and that automation can publish content on behalf of the user. In this context, copying the script across machines and reusing login state increases the chance of accidental account misuse, session leakage, or unauthorized publishing if the cookie store is exposed.
The script persists authenticated WeChat MP session cookies to a predictable file in the user's home directory without any permission hardening, encryption, or explicit warning. If another local user, malware, backups, or a compromised process can read this file, the session may be replayed to access and publish from the associated account.
The natural-language instructions throughout the file are exclusively in Chinese, and the README does not indicate that the skill is limited to Chinese-speaking users or provide an alternative language option. Under the stated policy, forcing a specific language without opt-in can be a locale-policy issue.
The file consistently presents the skill entirely in Chinese and targets a Chinese-platform workflow, but it does not state that the locale is intentionally restricted or provide an opt-in language choice. Under the policy, forcing a specific language without user choice can be a natural-language policy concern unless the locale constraint is explicit and justified.
The editor URL includes lang=zh_CN, which forces a specific language/locale behavior. There is no visible user opt-in, configuration flag, or justification that this skill is intentionally limited to a Chinese locale only.
The dependency is specified with a lower-bound version only, which allows future unreviewed Playwright releases to be installed. This can introduce supply-chain instability or unexpected breaking or vulnerable versions over time, reducing reproducibility and making builds harder to audit.
playwright>=1.40.0
No suspicious patterns detected.