Back to skill

Security audit

GitHub每日热榜前十项目名称和简介获取

Security checks for vulnerabilities and agentic risk

Overview

This skill fetches public GitHub Trending entries and asks the agent to translate them into Chinese, with no evidence of credential access, persistence, destructive behavior, or hidden privileged actions.

Install only if you want a Chinese-language GitHub Trending helper. When using it, treat repository names and descriptions as untrusted web data and do not follow any instructions that appear inside fetched project descriptions.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T01 · Skill Instruction Hijacking

Warning
Location
github-trending.py:10
Finding

Untrusted GitHub Content Can Influence Agent Instructions

Content
View full analysis

Vulnerability Details

File Location: github-trending.py:10-30; related processing instructions in SKILL.md:25-29
Vulnerability Type: Indirect prompt injection through untrusted web content
Risk Level: Medium

Complete Code Snippet:

python
url = "https://github.com/trending?since=daily"
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
}

try:
    response = requests.get(url, headers=headers)
    response.raise_for_status()
    soup = BeautifulSoup(response.text, 'html.parser')

    articles = soup.find_all('article', class_='Box-row')

    print("🔥 GitHub 今日趋势榜 Top 5:\n" + "-"*30)

    for i, article in enumerate(articles[:10], 1):
        # 获取项目名称
        title_tag = article.find('h2', class_='h3 lh-condensed')
        title = title_tag.text.strip().replace('\n', '').replace(' ', '') if title_tag else "未知项目"

        # 💡 这里是修改的地方:直接抓取 p 标签
        desc_tag = article.find('p')

        # 清洗一下文本,有时候简介里会有奇怪的换行
        desc = desc_tag.text.strip().replace('\n', ' ') if desc_tag else "作者很懒,暂无简介"

        print(f"{i}. 项目: {title}\n   简介: {desc}\n")

The relevant agent instruction in SKILL.md is:

markdown
将输出保存,用于后续翻译。

### Step 2 - 翻译项目信息

将脚本输出的每个项目名称和简介翻译成准确且符合中文语言习惯的中文。

Technical Analysis

The script retrieves repository names and descriptions from the public GitHub Trending page and prints those fields for subsequent processing by the AI agent. Repository descriptions are controlled by third-party GitHub users and therefore constitute untrusted input.

The only transformation applied to descriptions is trimming whitespace and replacing newline characters. It does not identify, neutralize, delimit, or reject instruction-like text. The skill then directs the agent to consume and translate the output without explicitly requiring it to treat all scraped fields ...[truncated 1603 chars]

Remediation
View remediation

Remediation Suggestions

  1. Add an explicit instruction to SKILL.md stating that repository names and descriptions are untrusted data and that commands, requests, URLs, or policy-like text contained in those fields must never be followed.
  2. Emit structured output, such as JSON, with fixed fields for repository_name and description, rather than presenting remote content as undifferentiated prose.
  3. Wrap every remote value in clear data delimiters and instruct the agent to translate only text inside the designated fields.
  4. Enforce conservative length and character limits before placing descriptions into agent context.
  5. Optionally flag or reject descriptions containing common prompt-injection patterns, while recognizing that filtering alone is not a complete defense.
  6. Ensure the agent has only the minimum tools and permissions required for translation so that successful instruction manipulation cannot trigger privileged side effects.
  7. Add tests using adversarial descriptions to verify that embedded instructions are translated or ignored as data rather than executed as agent directives.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill description says it fetches trending repositories and translates them to Chinese, but the detected behavior includes undocumented network access and the translation is not actually implemented in code. Description-behavior mismatch is dangerous because it undermines informed consent and can conceal side effects such as external requests or future capability creep behind a benign-looking description.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill instructs execution of a Python script that fetches GitHub Trending data, implying network access, but it declares no tool scope or permissions. This creates a least-privilege and transparency problem: users and hosting systems cannot tell in advance that external network access is required, making unexpected data egress or remote content retrieval harder to govern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description explicitly says the skill will translate project names and descriptions into Chinese, which imposes a specific language behavior. Under the policy, forcing a language or locale without user opt-in is a natural-language policy violation unless the constraint is clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This step instructs the agent to translate all project names and descriptions into Chinese and to conform to Chinese language habits. That is a hard-coded language requirement, and the file does not indicate any user choice or explicit locale-specific scope.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest description explicitly includes translating project names and descriptions into Chinese. In the implementation, the script requests GitHub Trending, extracts titles and descriptions, and prints them directly; there is no translation API, translation library, or translation logic anywhere in the code.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script prints all user-facing status and content labels in Chinese, including the success banner and error message. This imposes a specific language on users without opt-in, which matches the language/locale policy violation criteria for natural-language content.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The printed banner says 'GitHub 今日趋势榜 Top 5', which communicates a limited result set, but the loop iterates over articles[:10]. This is a semantic mismatch in the skill's stated behavior versus actual execution, even though it is not a security-sensitive expansion.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.