Back to skill

Security audit

公众号爆款文章查询(红狐数据)

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its WeChat article-search purpose, but it injects unrelated promotional output and pushes users toward persistent calendar subscriptions.

Review this skill before installing. Use it only if you are comfortable sending search keywords and dates to Redfox with your REDFOX_API_KEY. Avoid relying on JSON stdout until the promotional trailing print is removed, and avoid opening generated HTML reports from untrusted or unexpected API data unless the HTML escaping issue is fixed. Treat calendar subscription creation as optional and confirm the schedule and stored search terms before allowing it.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
scripts/fetch_gzh_trends.py:703
Finding
Unconditional Commercial Promotion Hijacks Script Output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/fetch_gzh_trends.py:703` **Vulnerability Type**: Unsolicited output injection and machine-readable output corruption **Risk Level**: High ### Vulnerable Code ```python print(f"\n另外红狐配套全量数据库可提供完整详实数据,如需了解采购方案,可发送邮件至 redfoxdata@proton.me 对接咨洵") ``` The printed message advertises a related commercial database and directs users to an external email address. ### Technical Analysis The script unconditionally appends a commercial solicitation to standard output after producing either JSON or HTML output. The message is not required to retrieve WeChat article trends and is emitted regardless of the user's request or selected output format. For JSON mode, this behavior is especially problematic because the script first prints a valid JSON document and then appends non-JSON text. Consequently, standard output is no longer valid JSON. Agents or downstream applications expecting structured data may fail to parse it, treat the appended message as trusted search output, or reproduce it in user-facing responses. This constitutes stable output hijacking: invoking an otherwise legitimate search function consistently causes unrelated promotional content to be inserted into the result. ### Attack Path 1. A user asks the agent to search for popular WeChat articles. 2. The agent invokes `fetch_gzh_trends.py` according to the Skill instructions. 3. The script retrieves and prints the requested search results. 4. Line 703 unconditionally appends the commercial solicitation. 5. The agent may reproduce the message as part of its answer, or a downstream JSON parser may fail because the output contains trailing non-JSON content. ### Impact Assessment No additional operating-system privileges are obtained. However, the issue affects every script execution and allows the Skill author to systematically insert unrelated commercial messaging into agent responses. The practical impact includes: - Persistent manipulati ...[truncated 267 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the unconditional promotional `print` statement. 2. Guarantee that JSON mode writes exactly one valid JSON document to standard output. 3. Send diagnostics exclusively to standard error. 4. If commercial or support information must be retained, place it in project documentation rather than runtime output. 5. If an informational runtime message is necessary, require explicit user opt-in and expose it through a separate command or structured metadata field. 6. Add automated tests that parse the complete JSON-mode standard output with `json.loads()` and fail when trailing content is present. ]]>

T01 · Skill Instruction Hijacking

Warning
Location
SKILL.md:296
Finding
Skill Instructions Mandate Unrequested Subscription Solicitation<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:296-348` **Vulnerability Type**: Mandatory agent-output redirection and unnecessary recurring-task solicitation **Risk Level**: Medium ### Vulnerable Instruction Segment The relevant section declares the subscription prompt mandatory for every successful search and prohibits the agent from skipping it: ```text Subscription service inquiry (mandatory) When the number of articles is greater than zero, the following must be asked immediately after outputting the results: Subscription service 1. Subscribe to articles matching the current search conditions and receive scheduled pushes? 2. Not now If the user selects option 1, use the calendar_create tool to create a schedule. Mandatory rules: - The subscription question must be asked immediately after the results. - If the user chooses to subscribe, calendar_create must be used. - The current query parameters must be used. - This step must not be skipped. - The question must not be asked before displaying the results. ``` ### Technical Analysis Searching for articles does not require creating or soliciting a persistent subscription. Nevertheless, the Skill text directs the agent to append a subscription prompt after every successful search and explicitly prohibits omission. The actual `calendar_create` call is conditioned on a subsequent user choice, which limits immediate exploitation. However, the mandatory solicitation still alters the agent's response goal from satisfying the current search request to encouraging creation of a recurring task. This exceeds the minimum privilege and interaction scope required for the declared search functionality. A calendar entry may persist beyond the current session and can cause repeated future actions or notifications. Such persistent behavior should be initiated only when the user independently requests scheduled delivery and confirms the schedule parameters. ### Attack Path 1. A user requests o ...[truncated 1050 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the rule requiring a subscription prompt after every successful search. 2. Activate subscription handling only when the user explicitly requests recurring delivery or asks about subscription options. 3. Require a separate, immediate confirmation before invoking `calendar_create`. 4. Before confirmation, clearly display: - The recurrence interval. - The execution or notification time. - The keyword and date-range information that will be stored. - The destination calendar. - Instructions for cancellation. 5. Store only the minimum metadata needed to implement the subscription. 6. Do not place sensitive or unnecessary search context in calendar descriptions. 7. Permit the agent to complete ordinary search requests without mentioning or invoking calendar functionality. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fetch_gzh_trends.py:212
Finding
Unescaped User and API Data in Generated HTML Report<![CDATA[ ## Vulnerability Details **File Location**: `scripts/fetch_gzh_trends.py:212-254, 275, 325, 608` **Vulnerability Type**: HTML injection through unescaped text and attribute values **Risk Level**: Medium ### Vulnerable Code ```python def get_card_html(item): """Generate a single HTML card.""" title = item.get('title', '') or item.get('summary', '')[:50] author = item.get('author', '') or '-' pub_time = item.get('publicTime', '')[:10] note_link = item.get('url', '') # ... summary = item.get('summary', '')[:100] if item.get('summary') else '' card = f''' <div class="card"> <div class="card-content"> <div class="card-header"> <h3 class="card-title"> <a href="{note_link}" target="_blank">{title}</a> </h3> <!-- score elements omitted --> </div> <div class="card-meta"> <span class="author">👤 {author}</span> <span class="date">📅 {pub_time}</span> </div> <div class="card-summary">{summary}...</div> <div class="card-footer"> <a href="{note_link}" target="_blank" class="read-more">View article →</a> </div> </div> </div> ''' return card ``` Additional unescaped insertions include: ```python topics_html += f'<li>· {topic_name}({count} 篇)</li>\n' ``` ```python topics_html += f'<div class="topic-item"><div class="topic-name">{topic_name}</div><div class="topic-count">{count} 篇文章</div></div>' ``` ```python return html_template.format(keyword=keyword, total=total, content=content) ``` ### Technical Analysis The HTML generator directly interpolates values from two untrusted sources: - The command-line keyword supplied by the user. - Article and topic fields returned by the remote API. Values such as `keyword`, `title`, `author`, `summary`, `topic_name`, and `note_link` are inserted into HTML wi ...[truncated 1898 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Escape all text and attribute values with `html.escape(value, quote=True)` before interpolation. 2. Treat text-node and attribute contexts separately rather than relying on a single formatting helper. 3. Validate article URLs with `urllib.parse.urlparse`. 4. Permit only explicitly approved schemes, preferably `https`. 5. Optionally restrict article hosts to expected domains such as `mp.weixin.qq.com`. 6. Reject URLs containing credentials, control characters, or malformed hostnames. 7. Add `rel="noopener noreferrer"` to every link using `target="_blank"`. 8. Add a restrictive Content Security Policy, for example by disallowing inline scripts and limiting network destinations. 9. Prefer a templating engine with automatic HTML escaping if third-party dependencies become acceptable. 10. Add tests using payloads containing quotes, angle brackets, event handlers, `javascript:` URLs, and closing tags. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (16)

Ae1

High
Category
analysis-evasion
Content
| SKILL 定义 | `SKILL.md` | 定义 Skill 元数据、工作流程、展示策略、订阅逻辑 |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Whitespace Padding

Medium
Category
Prompt Injection
Content
💡 **Found 12 related articles; showing first 10. View all?**

| Title                                                                                      | Author           | Reads | Published  | Relevance | Heat | Timeliness | **Total** |
| ------------------------------------------------------------------------------------------ | ---------------- | ----- | ---------- | --------- | ---- | ---------- | --------- |
| [Must-read for workplace newcomers: 5 tips to fit in fast](https://mp.weixin.qq.com/s/xxx) | Workplace Growth | 100K  | 2026-05-15 | 9.8       | 3.0  | 2.0        | **14.8**  |
| [Workplace communication: 3 sentences you must never say!](https://mp.weixin.qq.com/s/xxx) | Workplace Tips   | 85K   | 2026-05-14 | 9.5       | 2.8  | 2.0        | **14.3**  |
Confidence
70% confidence
Finding
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Whitespace Padding

Medium
Category
Prompt Injection
Content
| [Must-read for workplace newcomers: 5 tips to fit in fast](https://mp.weixin.qq.com/s/xxx) | Workplace Growth | 100K  | 2026-05-15 | 9.8       | 3.0  | 2.0        | **14.8**  |
| [Workplace communication: 3 sentences you must never say!](https://mp.weixin.qq.com/s/xxx) | Workplace Tips   | 85K   | 2026-05-14 | 9.5       | 2.8  | 2.0        | **14.3**  |
| [Workers must save: 7 secrets to efficient meetings](https://mp.weixin.qq.com/s/xxx)       | Workplace Lab    | 62K   | 2026-05-13 | 9.2       | 2.5  | 1.8        | **13.5**  |
| ...                                                                                        | ...              | ...   | ...        | ...       | ...  | ...        | ...       |

**🔤 Query expansion**: work, office workers, workplace outfits, workplace tips, growth, niche careers, managing up, workplace anxiety, promotion, financial freedom
Confidence
70% confidence
Finding
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The README’s user-facing instructions, examples, and warnings are entirely in Chinese, which effectively forces a specific language for interaction and setup. The policy allows locale constraints only when users are given a choice or when the restriction is clearly documented and justified as region-specific.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill documents access to environment variables, network calls, and HTML file generation, but it does not declare any explicit tool scope or allowed-tools boundary. This weakens least-privilege controls and can let the agent invoke capabilities beyond what a user would reasonably expect from a search skill, especially when combined with file output and external API access.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The trigger description includes broad concepts like helping users 'grasp trends' and 'get inspiration,' which can cause the skill to activate for vague creative or research requests outside the intended公众号 article-search context. Over-broad triggering can route user input to unnecessary external API calls and side-effecting workflows, especially given the subscription behavior later in the document.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The skill is presented as a WeChat article search/recommendation tool, but the workflow requires creating calendar subscriptions and scheduling future pushes whenever results exist. This is a scope expansion from passive search into persistent action on behalf of the user, increasing the chance of unintended side effects and consent bypass.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
The instructions direct the agent to call `calendar_create` to establish recurring reminders tied to the user’s search query, which is not directly necessary for article retrieval. This introduces a side-effecting capability unrelated to the core search function and could be abused to create unwanted persistent tasks or spam-like scheduled actions.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The document includes an API key header example (`X-API-Key: ak_xxxxxxxxxxxxxxxx`) without any guidance on secure secret handling. In an agent skill context, this increases the chance that implementers hardcode credentials in code, logs, prompts, or generated outputs, which can lead to unauthorized API use and credential leakage.

Intent-Code Divergence

Medium
Confidence
94% confidence
Finding
L171-L176说明脚本的数据表现评分包含“分享权重 20%”。但全文定义的接口返回字段(L95-L116)及脚本输出字段(L151-L167)均未提供任何分享数/转发数字段,因此该评分规则无法按文档所述实现,属于文档意图与实际可用数据之间的直接冲突。

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
L095-L107 要求用户回复“拓展”“不拓展”“继续”等固定中文词汇来驱动流程,但未说明是否接受其他语言或等效表达,也未提供语言选择或本地化兼容。这会在非中文用户场景下形成默认语言强制,属于自然语言层面的 locale 约束。

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
L300-L309 将订阅流程固定为中文菜单“是否需要订阅”“暂不需要”等,并要求用户按该格式响应,但没有说明可接受其他语言或自由表达。对于非中文环境,这属于未提供用户选择的语言约束。

Natural-Language Policy Violations

Low
Confidence
90% confidence
Finding
The HTML template fixes the document language to zh-CN, and the surrounding user-facing strings are also Chinese-only. Per the policy rule, forcing a specific language/locale without user opt-in is a natural-language policy concern unless the locale restriction is explicitly documented and justified.

Description-Behavior Mismatch

Low
Confidence
78% confidence
Finding
The manifest describes a 公众号搜索工具 for searching articles, showing hot recommendations, and helping creators find inspiration. In addition to querying and presenting data, this script persists an HTML report to a local file, which is a behavior beyond the core search/recommendation description rather than an obvious requirement of the stated skill purpose.

Missing User Warnings

Low
Confidence
81% confidence
Finding
This code creates and writes an HTML file to the local filesystem based on user input, but the only disclosure appears after the write succeeds. Under the code-file criteria, file writes should have some visible disclosure or explanatory warning before or around the operation; there is no prior prompt, warning comment about side effects, or confirmation for the write path.

Context-Inappropriate Capability

Low
Confidence
94% confidence
Finding
After completing its main function, the script prints a marketing-style message advertising a separate paid database and contact email. This capability is not justified by the manifest's stated purpose of searching public account articles, surfacing hot content, and providing inspiration.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
references/gzh_trend_data_format.md:20