Back to skill

Security audit

Skill Sms Rpg Instruction

Security checks for vulnerabilities and agentic risk

Overview

This is a Chinese text-adventure skill with local save-file management that is mostly disclosed and purpose-aligned, with a limited caution around bundled test scripts that can overwrite/delete slot 1 if run manually.

Install only if you are comfortable with the skill creating, reading, updating, and deleting local game saves under ./sms-rpg-saves/. Avoid running the bundled test_save_system.py scripts in a directory that contains real saves, or back up save_001.json first.

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
test_save_system.py:13
Finding

Test Scripts Overwrite and Delete Production Save Data

Content
View full analysis

Vulnerability Details

File Location: test_save_system.py:13, 118-120, 217-218, 232-233
Vulnerability Type: Test/production data-path collision causing destructive file operations
Risk Level: Medium

Vulnerable Code

python
# Test directory
SAVE_DIR = "./sms-rpg-saves"
python
filepath = os.path.join(SAVE_DIR, f"save_{slot:03d}.json")
with open(filepath, 'w', encoding='utf-8') as f:
    json.dump(save_data, f, ensure_ascii=False, indent=2)
python
# Create test save
create_test_save(1)
python
# Clean up test save
delete_save(1)

The duplicate script at scripts/test_save_system.py contains the same vulnerable logic at the same line numbers.

Technical Analysis

The test script uses ./sms-rpg-saves, which is also the production save directory specified by the Skill. When executed from the project directory, create_test_save(1) opens save_001.json in write mode. Python's open(..., 'w') truncates an existing file before writing the test fixture, without checking whether it contains user data.

At the end of execution, delete_save(1) removes that same file. The test therefore lacks isolation from production data and performs destructive operations on a predictable production path. Both copies of the script independently expose this behavior.

Attack Path

  1. A user has a legitimate game save at ./sms-rpg-saves/save_001.json.
  2. The user, an automated test runner, or an Agent invokes either bundled test script from the project directory.
  3. create_test_save(1) opens the legitimate save with write mode and replaces it with fixture data.
  4. The script performs its update test against the replacement data.
  5. Cleanup calls delete_save(1).
  6. The slot-1 save is permanently removed unless an external backup exists.

No elevated privileges, network access, or attacker-supplied input are required.

Impact Assessment

The vulnerability permits destruction of data writable by the process running th ...[truncated 374 chars]

Remediation
View remediation

Remediation Suggestions

  1. Isolate every test run with a temporary directory:
python
import tempfile
from pathlib import Path

def run_tests():
    with tempfile.TemporaryDirectory(prefix="sms-rpg-test-") as temp_dir:
        save_dir = Path(temp_dir)
        # Pass save_dir explicitly to all save functions.
  1. Refactor save functions to accept a directory argument rather than relying on a production-path global:
python
def create_test_save(save_dir, slot=1):
    filepath = save_dir / f"save_{slot:03d}.json"
  1. Never use ./sms-rpg-saves as the default test target. If a persistent test directory is required, use an unmistakably separate path such as ./.test-data/sms-rpg-saves.

  2. Add a safety check that refuses to run destructive tests when the resolved test directory equals the production save directory.

  3. Avoid unconditional overwrite. Create test fixtures with exclusive creation mode ('x') or unique generated filenames.

  4. Restrict cleanup to a temporary directory created and owned by the current test run. Do not delete predictable production filenames.

  5. Apply the same correction to scripts/test_save_system.py, or remove the duplicate script to prevent the vulnerable implementation from remaining callable.

  6. Add a regression test that places a sentinel file in the production save directory, runs the test suite against an isolated directory, and verifies that the sentinel remains unchanged.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

This duplicate mismatch finding is substantively valid for the same reason: the skill is framed as story generation but embeds operational logic for modifying persisted state and handling save files. Hidden or under-disclosed side effects are dangerous because they can trigger file creation, overwrite, or deletion under an innocuous-looking activation path.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

This duplicate mismatch finding is substantively valid for the same reason: the skill is framed as story generation but embeds operational logic for modifying persisted state and handling save files. Hidden or under-disclosed side effects are dangerous because they can trigger file creation, overwrite, or deletion under an innocuous-looking activation path.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs the agent to read, write, enumerate, and delete local save files, but it does not declare any explicit tool scope or permission boundaries. That creates an authorization ambiguity where filesystem-capable execution could occur without least-privilege constraints, increasing the chance of unintended file access or destructive operations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The activation description is broad enough to match ordinary conversation such as starting a game, continuing, or sending an action, which can cause accidental invocation. In this skill, accidental invocation is more concerning because activation can lead to local file enumeration, save loading, overwriting, or deletion logic rather than harmless text generation alone.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file presents the skill description and all interaction patterns exclusively in Chinese and frames the behavior as the default operation, with no opt-in or language selection mechanism. This can violate language/locale policy when the skill effectively forces a specific language on users without choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents the skill specification entirely in Chinese, including headings, rules, examples, and workflow descriptions, with no indication that users may choose another language. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This YAML file’s natural-language content is entirely in Chinese, with no indication that language selection is configurable or that the skill is limited to a Chinese-speaking or region-specific context. Under the policy rule, forcing a specific language without user opt-in is a locale/language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This manifest file is entirely authored in Chinese, including all titles, descriptions, milestones, and user-facing content, with no indication that the skill supports other languages or that Chinese is an explicit user-selected locale. Under the policy for natural-language violations, forcing a specific language without user opt-in is a reportable locale-policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This Python file contains user-facing natural-language descriptions entirely in Chinese, including the module docstring that identifies the script and its purpose. Under the language/locale policy, forcing a specific language without opt-in or justification can be a policy violation, and no alternative language choice or region-specific rationale is provided here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This YAML file contains all user-facing titles, descriptions, consequences, and options in Chinese, but does not indicate that the skill is region-specific or provide any language choice. That can violate a language/locale policy when users are not explicitly opted into Chinese content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This YAML template uses Chinese titles, descriptions, and comments throughout, which imposes a specific language/locale on consumers of the skill. The file does not document that Chinese is optional, configurable, or limited to a region-specific use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language strings and comments that force a specific language experience for users, including the module description and runtime output. Under the policy, a fixed language without user opt-in or a documented justification is a locale-policy violation.

Content

No source excerpt is available for this finding.