Back to skill

Security audit

MTG Wiki (English)

Security checks for vulnerabilities and agentic risk

Overview

This MTG helper is mostly purpose-aligned, but it tells users to clone a mutable external GitHub repository and run an unverified Python indexing script that is not included in the reviewed package.

Install only if you are comfortable with the external repository dependency. Before running the indexing command, inspect the cloned code, pin it to a trusted commit, and run it in a low-privilege environment without sensitive credentials. Treat API lookups as sending your card or rules query text to third-party services.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • 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)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:153
Finding

Execution of Unpinned Code Retrieved from a Mutable Remote Repository

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:153-159; mirrored in SKILL-cn.md:153-159
Vulnerability Type: Remote payload retrieval and execution
Risk Level: High

Vulnerable Code

SKILL.md:

bash
git clone https://github.com/RaymondYHH/mtg-skill.git
cd mtg-skill/magic-skill
text
After installing, run `python3 raw/tools/mtg_wiki/build_indices.py` to build local indices.

SKILL-cn.md contains the equivalent commands:

bash
git clone https://github.com/RaymondYHH/mtg-skill.git
cd mtg-skill/magic-skill
text
安装后运行 `python3 raw/tools/mtg_wiki/build_indices.py` 构建本地索引。

Technical Analysis

The Skill directs users to clone the current default branch of an external GitHub repository and then execute build_indices.py from the downloaded content. The repository is not pinned to a reviewed commit hash or signed release, and the instructions do not require signature or checksum verification.

Consequently, the effective executable payload can change after this Skill has been reviewed. The referenced Python script and its imported modules are not included in the audited artifact, which contains only SKILL.md and SKILL-cn.md; their behavior therefore cannot be statically verified as part of this audit.

This is a remote payload retrieval and execution weakness rather than evidence that the current remote repository is malicious. The security issue arises because mutable, externally controlled code is trusted and executed without integrity validation.

Attack Path

  1. An attacker compromises the repository owner, a maintainer account, or another mechanism capable of modifying the repository's default branch.
  2. The attacker modifies raw/tools/mtg_wiki/build_indices.py or a Python module imported by that script.
  3. A user follows the Skill instructions and clones the repository without selecting a known, reviewed revision.
  4. The user runs `python3 ...[truncated 989 chars]
Remediation
View remediation

Remediation Suggestions

  1. Include all required scripts and data-processing code directly in the published Skill so that the complete executable implementation can be reviewed with the package.
  2. If remote retrieval is unavoidable, pin the repository to a specific reviewed commit hash rather than cloning and executing the mutable default branch.
  3. Publish cryptographic checksums or signed release artifacts and verify them before any downloaded file is executed.
  4. Review the pinned build_indices.py file and all local modules it imports, because pinning only the top-level command is insufficient if dependencies remain mutable.
  5. Use a detached checkout of the approved commit and reject execution if the checked-out revision or file hashes differ from expected values.
  6. Run the indexing process in a sandbox or container with minimal filesystem access, no unnecessary credentials, restricted network access, and no administrative privileges.
  7. Keep the English and Chinese instructions synchronized so that both variants enforce the same integrity-verification and least-privilege controls.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

L003 将触发条件定义为“当用户询问万智牌相关内容(牌名、规则概念、赛制、策略、背景设定)”即可触发,覆盖面非常广,但没有给出更具体的触发短语、上下文限制或不触发示例。这样的描述容易在一般闲聊、背景讨论或轻度提及万智牌时也触发该技能。

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
87% confidence
Finding

The skill instructs use of external APIs (mtgch and Scryfall), which creates outbound data transmission to third-party services. Even if the content is game-related, user queries may still contain private context, and sending them to external endpoints can leak prompts, usage patterns, or sensitive text embedded in requests; the local/offline database option reduces but does not eliminate the risk because network use is explicitly prioritized.

Content

Scanner excerpt · SKILL-cn.md (reported line 99)May include surrounding context.

md
API 优先级:
1. mtgch API(`https://mtgch.com/api/v1/`)— 中文优先
2. Scryfall API(`https://api.scryfall.com/`)— 英文为主
3. 本地 37k Oracle 数据库 — 离线精确匹配

## 层系统速查 (CR 613)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger description is broad enough that ordinary mentions of MTG topics, card names, formats, or lore could activate the skill in contexts where the user did not explicitly request it. This can cause unintended routing, context hijacking, or over-collection of user prompts by the skill, though the content here is domain-focused rather than overtly malicious.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Triggering on any card-name mention is ambiguous because many card names are common words or phrases, and users may reference them without intending to invoke this skill. That increases the risk of accidental activation and response interference, especially in mixed-topic conversations.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
82% confidence
Finding

The skill explicitly prioritizes external APIs, which can transmit user-supplied card names, rules queries, or translated text to third-party services. While this is consistent with the skill's function, it creates a real data egress path and privacy risk if users submit sensitive or proprietary content in their queries.

Content

Scanner excerpt · SKILL.md (reported line 99)May include surrounding context.

md
API priority:
1. mtgch API (`https://mtgch.com/api/v1/`) — Chinese first, bilingual
2. Scryfall API (`https://api.scryfall.com/`) — English primary
3. Local 37k Oracle DB — offline exact match

## Layer System Quick Reference (CR 613)