Back to skill

Security audit

Content System Wechat Formatter

Security checks for vulnerabilities and agentic risk

Overview

This WeChat HTML formatter has a coherent purpose, but its runtime imports executable code from a hard-coded personal folder outside the reviewed package.

Review this skill before installing. It appears intended for legitimate WeChat article formatting, but the runtime should be changed to package or pin the renderer instead of loading it from /Users/Abigale/.codex/skills/wechat-article-workflow/scripts. Also confirm generated output filenames to avoid overwriting existing ready HTML files.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T07 · Tool Hijacking and Spoofing

Error
Location
runtime.py:9
Finding
Hard-Coded External Module Path Enables Python Import Hijacking<![CDATA[ ## Vulnerability Details **File Location**: `runtime.py`, lines 9–22 **Vulnerability Type**: Untrusted external module loading through Python search-path manipulation **Risk Level**: High ### Vulnerable Code ```python SKILL_SCRIPTS = Path("/Users/Abigale/.codex/skills/wechat-article-workflow/scripts").resolve() DEFAULT_THEME_NAME = "elegant-gold" DEFAULT_TEMPLATE_NAME = "default" if str(SKILL_SCRIPTS) not in sys.path: sys.path.insert(0, str(SKILL_SCRIPTS)) from wechat_html_renderer import ( # noqa: E402 apply_template, available_template_catalog, available_themes, load_theme, markdown_to_wechat_html, render_standalone_document, theme_to_dict, ) ``` ### Technical Analysis The runtime prepends a hard-coded, user-specific directory to `sys.path` and then imports `wechat_html_renderer` from the resulting search path. The imported module is not included in the audited project, version-pinned, or subject to any integrity check. Python executes a module's top-level code during import. Because the external directory is inserted at index zero, a `wechat_html_renderer.py` file placed there takes precedence over modules available through ordinary package paths. An attacker who can create or modify files in that directory could therefore cause arbitrary Python code to execute when the skill is loaded. This is classified as tool hijacking because the skill explicitly redirects a legitimate-looking renderer import to an externally controlled local location. The hard-coded path also makes the skill non-portable and creates inconsistent behavior between audited source code and deployed execution environments. ### Attack Path 1. The attacker obtains write access to `/Users/Abigale/.codex/skills/wechat-article-workflow/scripts`, or causes a crafted directory and module to exist at that path in the target environment. 2. The attacker creates or replaces `wechat_html_renderer.py` with a malicious module that exposes the expecte ...[truncated 1380 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the hard-coded absolute path and the `sys.path.insert(0, ...)` mutation. 2. Package `wechat_html_renderer` inside the reviewed skill or a normal Python package and use an explicit package-relative import. 3. Declare the renderer as a pinned dependency with hashes and install it only from an approved package source. 4. Ensure the renderer source is included in security reviews so deployed behavior matches the audited artifact. 5. If external module loading is operationally unavoidable: - Obtain the path from trusted administrator-controlled configuration rather than user content. - Resolve and validate the path against an explicit allowlist. - Require restrictive directory ownership and permissions. - Reject symbolic links and unexpected file ownership where applicable. - Verify the module against an approved cryptographic digest before loading it. - Avoid placing the directory ahead of trusted package locations. 6. Run the formatter under a least-privileged account with filesystem, process, network, environment-variable, and credential access restricted to what formatting requires. 7. Add deployment tests that fail if the renderer resolves outside the expected installed package location. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The manifest description says to use the skill when Codex needs `公众号排版预览`, which imposes a Chinese-language/localized framing in the activation description. The file does not offer any user language choice or explicitly justify this locale-specific wording as a documented regional constraint.

Missing User Warnings

Low
Confidence
91% confidence
Finding
This markdown file documents a file-writing behavior by specifying that the skill will write output to `content-production/ready/<slug>-wechat.html`. Under the markdown-specific warning rule, behaviors that affect user data or the filesystem should be disclosed with a clear warning, but the description provides no caution about overwriting existing files or creating artifacts in the workspace.

Static analysis

No suspicious patterns detected.