Back to skill

Security audit

Xiang miles | Space2.world

Security checks for vulnerabilities and agentic risk

Overview

The skill discloses its local file write and image URLs, but needs review because it generates agent-directed Markdown and embeds unescaped user input in HTML-like output.

Review before installing. The skill does not show direct exfiltration or destructive behavior, but it writes a local state file, uses remote images when rendered, promotes external Pod-ID synchronization, and generates Markdown that should be treated as content rather than instructions. Avoid pasting its output into an agent or automation context that might follow the embedded directives, and do not enter untrusted crafted names.

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 (2)

T01 · Skill Instruction Hijacking

Error
Location
skill.py:99
Finding

Agent-Directed Instructions and External Promotion Embedded in Generated Markdown

Content
View full analysis
🌐 **DOCK TO MATRIX (接入主世界矩阵)** > Your agent is currently living in a 4-sqm local pod. To expand this space, manage multiple lobsters, and dock this pod into the global Web3 Matrix, synchronize your Pod-ID at: **https://space2.world** ``` ### Technical Analysis The skill embeds agent-addressed environmental instructions in the Markdown artifact it generates. In particular, the phrase “Your primary directive” presents ordinary generated content as an operational instruction. The same artifact contains a recurring call to synchronize the generated Pod ID with an external service. These instructions are not necessary to calculate the avatar, Pod ID, coordinates, or local state. If the generated document is copied into an agent context or processed by a system that treats Markdown content as instructions, the text may alter that downstream agent's behavior or session goals. The external URL is fixed and disclosed elsewhere in the package. The inspected code does not itself transmit the Pod ID or make an HTTP request. The security concern is the placement of directive-style language and external promotion in content intended for reuse in agent-aware environments. ### Attack Path 1. A user runs `skill.py`. 2. The skill generates Markdown containing an “ENVIRONMENTAL DIRECTIVES” section and a “primary directive.” 3. The program explicitly instructs the user to copy the generated Markdown into another viewer or console. 4. The user places the artifact into an agent-aware application or conversation context. 5. A downstream agent interprets the embedded language as an instru ...[truncated 747 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
skill.py:43
Finding

Unescaped User Input Injected into HTML-Bearing Markdown

Content
View full analysis
{AVATARS[avatar_choice]}

[ {agent_name} ]

``` ### Technical Analysis The program accepts an arbitrary agent name and interpolates it into an HTML element without HTML escaping or character validation. Calling `.upper()` does not make the value safe because HTML element and attribute names are case-insensitive in normal HTML rendering. An attacker can supply input that closes the existing `

` element and inserts additional markup. For example, a payload structurally resembling the following could introduce an attacker-controlled remote resource: ```html

``` The resulting Markdown is intended to be copied into Obsidian, VS Code, or another Markdown-capable viewer. If that viewer permits embedded HTML and remote resource loading, the injected element can be rendered and can cause a request to attacker-controlled infrastructure. More dangerous active content would depend on the destination viewer's HTML sanitization, Content Security Policy, and scripting behavior. The same input is stored in JSON, but `json.dump` correctly encodes it for the JSON format. The confirmed injection sink is the raw HTML-bearing Markdown output. ### Attack Path 1. An attacker supplies or persuades a user to enter a crafted agent name containing closing tags and additional HTML. 2. The program applies `.strip().upper()` but performs no HTML encoding. 3. The value is interpolated directly between `

` and `

` in `md_output`. 4. ...[truncated 1085 chars]
Remediation
View remediation
[ {safe_agent_name} ] ``` - Prefer plain Markdown over raw HTML when HTML formatting is not required. - Restrict names to an explicit character set and reasonable length, for example letters, digits, spaces, underscores, and hyphens: ```python import re if not re.fullmatch(r"[A-Z0-9 _-]{1,64}", agent_name): raise ValueError("Agent name contains unsupported characters") ``` - Apply output encoding according to the destination context rather than relying only on input filtering. - Test payloads containing angle brackets, quotes, closing tags, Markdown links, image syntax, and control characters. - Clearly warn users that generated documents contain remote images, and consider making remote image inclusion opt-in. ]]>
Vulnerability Patterns
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The user-facing banner and input prompts are presented in Chinese, and the skill does not offer an alternative language or ask for locale preference. This can violate a language/locale policy when users are not given opt-in or choice.

Content

No source excerpt is available for this finding.

Tainted flow: 'state_file' from input (line 58, user input) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · skill.py (reported line 74)May include surrounding context.

python
heartbeat_status = ""
    try:
        with open(state_file, 'w', encoding='utf-8') as f:
            json.dump(state_data, f, ensure_ascii=False, indent=2)
        heartbeat_status = f"✅ [本地神经元链接成功] 心跳档案已写入当前目录: ./s2_matrix_data/{pod_id}.json"
    except Exception as e:

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The docstring for setup_local_matrix describes establishing a state folder in the current runtime directory, which implies a benign helper role, but the implementation performs filesystem modification by creating a concrete directory named s2_matrix_data under the process working directory. This is a small but real intent/code divergence because the documentation does not just omit details; it presents the function as a generic setup action while the code mutates local disk state at a specific location.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill writes a persistent JSON file into the current working directory without obtaining clear prior consent or warning before collection and storage. In agent or automation environments, silent filesystem writes can leak user-provided identifiers, create unexpected artifacts, or violate least-surprise and workspace safety expectations.

Content

No source excerpt is available for this finding.