Back to skill

Security audit

Skill 3d Preview

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a 3D preview skill, but it has unsafe file-writing behavior and inconsistent documentation that users should review before installing.

Install only if you are comfortable with a rough preview utility that writes files and generates HTML. Use trusted scene names only, avoid opening exported HTML in sensitive contexts unless remote cdnjs loading is acceptable, and prefer a fixed version that validates scene names and size limits.

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

T05 · Unauthorized Access and Privilege Escalation

Error
Location
preview_3d.py:12
Finding

Path Traversal Through Unvalidated Scene Names

Content
View full analysis

Vulnerability Details

File Location: preview_3d.py, lines 12, 17, 27, 49, 52, and 69
Vulnerability Type: Path traversal and unauthorized filesystem access
Risk Level: High

Vulnerable Code

python
with open(os.path.join(DIR, f"{args.name}.json"), 'w') as f:
    json.dump(scene, f, ensure_ascii=False, indent=2)
python
path = os.path.join(DIR, f"{args.scene}.json")
if not os.path.exists(path):
    return
with open(path) as f:
    scene = json.load(f)
python
output = os.path.join(DIR, f"{args.scene}_preview.html")
with open(output, 'w', encoding='utf-8') as f:
    f.write(html)

Technical Analysis

Scene names supplied through args.name and args.scene are directly interpolated into filesystem paths. os.path.join() does not prevent path traversal and does not verify that the resulting path remains under the intended scenes directory.

A value containing parent-directory components, such as ../../target, produces a path equivalent to:

text
scenes/../../target.json

The operating system resolves these components before opening the file. Consequently, the create_scene, add_object, render_ascii, and export_threejs operations can access paths outside the designated scene-storage directory.

The .json and _preview.html suffixes constrain the exact filenames that can be targeted, but they do not provide directory containment. The add_object and export operations can also read attacker-selected JSON files when those files exist and contain the expected structure.

Attack Path

  1. The attacker invokes create_scene with a traversal-based scene name, for example:
    text
    ../../target
    
  2. The application constructs:
    text
    <project>/scenes/../../target.json
    
  3. Filesystem path normalization resolves this outside the scenes directory.
  4. The process creates or overwrites target.json ...[truncated 1166 chars]
Remediation
View remediation

Remediation Suggestions

  • Restrict scene identifiers to a conservative allowlist, such as ASCII letters, digits, underscores, and hyphens:
    python
    import re
    
    if not re.fullmatch(r"[A-Za-z0-9_-]+", scene_name):
        raise ValueError("Invalid scene name")
    
  • Resolve and validate every path before opening it:
    python
    from pathlib import Path
    
    SCENE_DIR = (Path(__file__).resolve().parent / "scenes").resolve()
    
    def scene_path(name: str, suffix: str = ".json") -> Path:
        if not re.fullmatch(r"[A-Za-z0-9_-]+", name):
            raise ValueError("Invalid scene name")
    
        candidate = (SCENE_DIR / f"{name}{suffix}").resolve()
        if candidate.parent != SCENE_DIR:
            raise ValueError("Path escapes the scene directory")
        return candidate
    
  • Use the validated helper consistently for creation, loading, modification, rendering, and HTML export.
  • Reject absolute paths, path separators, parent-directory components, null bytes, and platform-specific alternate separators.
  • Avoid silently overwriting existing files. Use exclusive creation mode where appropriate or require explicit overwrite authorization.
  • Run the Skill under a least-privileged account with write access limited to the designated scene directory.
  • Add tests covering ../, absolute paths, repeated separators, encoded traversal forms, and Windows-style separators.

T09 · Insecure Skill Coding Practices

Warning
Location
preview_3d.py:10
Finding

Denial of Service Through Unbounded Scene Dimensions

Content
View full analysis

Vulnerability Details

File Location: preview_3d.py, lines 10 and 30–33
Vulnerability Type: Uncontrolled memory allocation and output generation
Risk Level: Medium

Vulnerable Code

python
scene = {
    "name": args.name,
    "size": [
        float(args.width),
        float(args.depth),
        float(args.height)
    ],
    "objects": [],
    "lights": [],
    "created": ""
}
python
w, d = int(scene["size"][0]), int(scene["size"][1])
grid = [['·'] * (w * 2) for _ in range(d)]

Technical Analysis

Scene dimensions are converted to floating-point values without validating that they are finite, positive, and within safe operational limits. During ASCII rendering, the width and depth are converted to integers and used directly to allocate a two-dimensional grid.

Memory consumption grows approximately in proportion to 2 × width × depth, with additional substantial overhead from Python lists and references. Extremely large dimensions can therefore trigger excessive memory allocation, CPU usage, and terminal output.

The renderer also prints each generated row. Even where memory remains available, a large grid can block the process for an extended period or overwhelm logs, API output limits, terminals, and downstream consumers.

Because scene files are ordinary JSON files, this condition may be reached either through the normal create_scene command or through a crafted scene file made available to the renderer.

Attack Path

  1. The attacker creates a scene using extremely large width and depth values, or supplies a crafted scene JSON file containing such values.
  2. The application accepts and stores the dimensions without enforcing limits.
  3. The attacker invokes render_ascii for that scene.
  4. The renderer calculates w and d from the untrusted values.
  5. The list comprehension attempts to allocate a grid with approximately 2 × w × d cells.
  6. The ...[truncated 961 chars]
Remediation
View remediation

Remediation Suggestions

  • Validate all dimensions before storing or rendering them.
  • Reject non-finite values such as positive infinity, negative infinity, and not-a-number values.
  • Require dimensions to be positive and enforce explicit maximum values.
  • Limit the total number of grid cells rather than checking each dimension alone:
    python
    import math
    
    MAX_WIDTH = 500
    MAX_DEPTH = 500
    MAX_GRID_CELLS = 250_000
    
    def validate_dimensions(width, depth, height):
        values = (width, depth, height)
        if not all(math.isfinite(value) for value in values):
            raise ValueError("Dimensions must be finite")
        if not all(value > 0 for value in values):
            raise ValueError("Dimensions must be positive")
        if width > MAX_WIDTH or depth > MAX_DEPTH:
            raise ValueError("Scene dimensions exceed allowed limits")
        if int(width) * 2 * int(depth) > MAX_GRID_CELLS:
            raise ValueError("Rendered grid would exceed the cell limit")
    
  • Revalidate dimensions when reading scene JSON rather than trusting previously stored files.
  • Impose maximum object counts and object dimensions to prevent related processing abuse.
  • Consider streaming rows instead of retaining the entire grid where functionality permits.
  • Apply process-level memory, execution-time, and output-size limits as defense-in-depth measures.
  • Return controlled validation errors instead of allowing allocation failures to terminate the process.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill is advertised as a 3D preview tool with ASCII rendering and Three.js export, but the documented behavior is only a generic connect/dispatch stub with none of the claimed functionality. This kind of description-behavior mismatch is dangerous because it can conceal unrelated actions, mislead reviewers, and cause the skill to be invoked in contexts where users believe it is low-risk visualization code.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding

The skill declares no explicit tool scope or permissions while static analysis indicates file-write capability. Even if the current markdown only shows metadata and an example, undocumented write access expands the attack surface and prevents callers from understanding or constraining what the skill may modify.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file applies to SQP-1, and the documented scenarios and invocation are very generic: phrases like '日常业务流程', '自动化任务', and an example using action="connect" do not clearly define when this skill should or should not be used. The lack of specific trigger constraints, explicit supported actions, or negative examples could cause unintended invocation in broad everyday contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The description is written entirely in Chinese and gives no indication that other languages are supported or that the locale is intentionally restricted. This can violate language or locale policy when the skill is presented in environments where users have not opted into that language.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger phrases are extremely broad (3D, 3d) and have no contextual constraints, so the skill may activate for many unrelated user requests that merely mention 3D. Over-broad invocation increases the chance of unintended routing, prompt interception, or unreviewed behavior being applied outside the intended use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The tool's description, help text, status messages, and inline labels are consistently hard-coded in Chinese, which imposes a specific language on all users. There is no opt-in, locale selection, or documentation indicating that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The HTML export hard-codes a CDN-hosted Three.js script, causing a locally generated preview file to load active code from the network at open time. This creates a supply-chain and privacy risk because the preview depends on third-party availability and integrity, and users may unknowingly execute remotely served JavaScript when viewing what appears to be a local artifact.

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 states that this skill provides 3D effect preview capabilities, specifically ASCII rendering and Three.js export. However, the execute path only supports a trivial connect action and otherwise returns a generic success message, with no code related to 3D processing, preview generation, ASCII rendering, or export.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language content of the skill description and headings is written entirely in Chinese, with no indication that language choice is optional or user-selectable. Per the policy, forcing a specific language or locale without opt-in can be a natural-language policy violation unless clearly justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest and overview consistently describe the skill as providing 3D preview functionality via ASCII rendering and Three.js export. However, the only code example calls execute(action="connect"), which implies connection-oriented behavior unrelated to 3D rendering or export and therefore contradicts the documented intent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The export function writes an HTML file that silently embeds a remote script and reports only a success message, so a user may open the file expecting a purely local preview without realizing network access and third-party code execution will occur. In this skill context, that makes the behavior more dangerous because the feature is described as a preview/export utility, not as a web-connected application.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The class docstring identifies this as the "skill_3d_preview" skill, and the execute method is documented as performing the main function. In practice, execute() only returns a static success response and does not invoke scene creation, ASCII rendering, or Three.js export, which contradicts the documented intent of the wrapper API.

Content

No source excerpt is available for this finding.