Back to skill

Security audit

公众号阅读增长榜

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its stated purpose, but it automatically inspects shell startup files for an API key and displays remote Markdown verbatim, which users should review before installing.

Review this skill before installing. It sends your RedFox API key to redfox.hk for authentication, may automatically read common shell startup files if the key is not already in the environment, and may display API-provided links or Markdown exactly as received. Prefer using a dedicated environment variable or secret store and avoid granting broad home-directory file access.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/fetch_growth_rank.py:121
Finding

Unescaped Remote Data Rendered as Trusted Markdown

Content
View full analysis

Vulnerability Details

File Location: scripts/fetch_growth_rank.py, lines 121–124 and 196–210
Vulnerability Type: Markdown content and link injection
Risk Level: Medium

Vulnerable Code

python
def make_link(title: str, url: str) -> str:
    """生成Markdown链接"""
    t, u = safe_str(title), safe_str(url)
    return f'[{t}]({u})' if t != "-" and u != "-" else t
python
for rank_num, (acc, score) in enumerate(scored_data, 1):
    max_w = acc.get("maxWork") or {}
    user = safe_str(acc.get("userName"))

    lines.append(
        f"| {rank_num} | {user} | {make_link(max_w.get('title'), max_w.get('oriUrl'))} | "
        f"{format_count(max_w.get('watchCount'))} | {format_count(max_w.get('likeCount'))} | "
        f"{format_count(max_w.get('shareCount'))} | {safe_str(max_w.get('clicksCount'))} | "
        f"{safe_str(max_w.get('publicTime'))} | {score:.2f} |"
    )

Technical Analysis

The script obtains ranking and article fields from the remote RedFox API and inserts userName, maxWork.title, and maxWork.oriUrl directly into a Markdown table. The safe_str function only converts values to strings and does not escape Markdown metacharacters, table delimiters, line breaks, or control characters.

The make_link function also accepts the API-provided URL without parsing it or restricting its scheme. Consequently, crafted remote values can terminate the intended table cell or link syntax and introduce additional Markdown elements. This conflicts with the Skill instructions requiring the script's standard output to be displayed verbatim, because the Agent is explicitly instructed not to sanitize or reformat the generated output after execution.

Attack Path

  1. A remote ranking record contains a crafted account name, article title, or original-article URL.
  2. fetch_data retrieves the record from the configured RedFox API endpoint.
  3. render_table passes the remote t ...[truncated 1083 chars]
Remediation
View remediation

Remediation Suggestions

  1. Escape Markdown control characters in every API-derived text field, including backslashes, pipes, brackets, parentheses, carriage returns, and line feeds.
  2. Normalize each value to a single line before inserting it into the table.
  3. Parse oriUrl with a standard URL parser and allow only expected schemes, preferably https.
  4. Reject malformed URLs and render their titles as escaped plain text rather than clickable links.
  5. Consider restricting links to expected article hosts if that restriction is compatible with the service.
  6. Add tests covering table delimiters, nested links, image syntax, multiline values, control characters, and disallowed URL schemes.
  7. Revise the verbatim-output instruction so it applies only after remote fields have been validated and safely encoded by the script.
Vulnerability Patterns
  • 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
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
Findings (14)

Tainted flow: 'headers' from os.getenv (line 96, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/fetch_growth_rank.py (reported line 101)May include surrounding context.

python
"X-API-KEY": api_key
    }
    try:
        resp = requests.get(API_URL, params={"rankDate": rank_date, "source": source},
                            headers=headers, timeout=30)
        resp.raise_for_status()
        return resp.json()

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · scripts/fetch_growth_rank.py (reported line 89)May include surrounding context.

python
return api_key

    # 第三级:提示用户配置
    raise ValueError(
        "缺少 API Key,请按以下步骤配置:\n"
        "1. 访问 https://redfox.hk/login?source=clawhub 注册账号\n"
        "2. 登录后在个人中心获取 API Key(格式:ak_xxxxxxxx)\n"
        "3. 设置环境变量:export REDFOX_API_KEY=<你的apikey>\n"
        "   或永久配置:echo 'export REDFOX_API_KEY=<你的apikey>' >> ~/.bashrc && source ~/.bashrc"
    )


def fetch_data(rank_date: str, source: str) -> dict:
    """调用API获取榜单数据"""
    api_key = get_api_key()
    headers = {
        "Content-Type": "application/json",
        "X-API-KEY": api_key
    }
    try:
        resp = requests.get(API_URL, params={"rankDate": rank_date, "source": source},
                            headers=headers, timeout=30)
        resp.raise_for_status()
        return resp.json()
    except Exception as e:
        raise Exception(f"API调用失败: {e}")


def safe_s

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README uses very broad natural-language invocation phrases such as generic requests for rankings and analysis, which can overlap with ordinary user conversation and unintentionally trigger the skill. In an agent environment, overly generic triggers can cause accidental tool activation, unexpected external API calls, and unintended disclosure of fetched third-party content or metadata.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill documentation instructs use of capabilities that access environment variables, local files, and the network, but it does not declare any explicit tool scope or permission boundaries. That creates an authorization and transparency gap: a host agent may grant broader access than users expect, and the skill can read local shell config files that may contain unrelated secrets in addition to the API key.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The spec explicitly instructs the skill to read shell startup files such as ~/.bashrc and ~/.zshrc to extract an API key. Those files often contain unrelated secrets, tokens, aliases, and personal configuration data, so granting the skill permission to inspect them exceeds what is necessary for a ranking-viewing feature and creates a clear local secret-access risk. In this context, the skill’s purpose is simply fetching a leaderboard, which makes the fallback especially unjustified and more suspicious.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The markdown describes reading sensitive shell configuration files for API key recovery without any clear user warning, consent flow, or disclosure that local credential sources will be accessed. Even if intended only to find one variable, this pattern normalizes silent inspection of sensitive local files and can expose additional secrets or private data if implemented broadly or incorrectly.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
71% confidence
Finding

The entire workflow is written as a hard requirement for Chinese-language interaction and output formatting, but it does not state that the skill is intentionally limited to Chinese users or provide any user opt-in for language choice. Under the policy, forcing a specific language without user choice can be a natural-language policy violation unless clearly documented and justified.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger examples include very broad, everyday phrases such as '公众号增长榜', which can match casual user language and cause the skill to activate when the user did not clearly intend this specific workflow. In an agent setting, over-broad activation can lead to unintended tool/script execution and irrelevant data retrieval, especially because the workflow then mandates immediate script use.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The workflow explicitly states that unclear requests should default to querying yesterday's ranking, which bypasses user confirmation and executes on ambiguous input. This increases the chance of unintended invocation and unnecessary external/script activity, a common safety issue in agent skills.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script scans shell startup files such as .bashrc and .zshrc to extract REDFOX_API_KEY automatically, which exceeds the minimum access needed for a ranking lookup tool. Reading shell profile files exposes unrelated user configuration and secrets and creates a privacy/security boundary violation if this skill runs in a broader agent environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill silently reads credential material from user shell profiles without clear user-facing notice, which can surprise users and bypass informed consent. In an agent-skill context, undisclosed access to local config files is especially sensitive because users expect a data-fetching skill, not host configuration inspection.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation gives conflicting statements about API key sourcing: one part says the key is read only from environment variables, while another says the script will also inspect shell startup files. This inconsistency can mislead users about what local files may be accessed, weakening informed consent and potentially exposing additional secrets if shell config files contain tokens, aliases, or other credentials.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

A natural-language policy issue exists when a skill effectively forces a specific language or locale without user opt-in. This API specification provides all instructions, examples, and operational notes only in Chinese and does not indicate any alternative language option or justified locale restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The script description and all user-facing messages are written in Chinese, which imposes a specific language on users without offering any opt-in or alternative locale. Under the stated policy, forcing a specific language without user choice is a natural-language policy concern.

Content

No source excerpt is available for this finding.