Back to skill

Security audit

art-evaluation

Security checks for vulnerabilities and agentic risk

Overview

This is an incomplete art-evaluation helper, but its image-output script can overwrite any file the agent can write, so it should be reviewed before installation.

Review before installing. Treat this as a placeholder skill, run it only in a sandbox or with a fixed output directory, and do not allow arbitrary output paths. Do not use proprietary artwork with any future external image service integration unless the user explicitly approves where the image is sent and how outputs are retained.

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
scripts/improve_art.py:12
Finding

Arbitrary File Overwrite Through Unrestricted Output Path

Content
View full analysis

Vulnerability Details

File Location: scripts/improve_art.py, lines 12–17 and 24–29
Vulnerability Type: Arbitrary file overwrite
Risk Level: Medium

Complete Code Snippet:

python
def generate_image(original_path, suggestions, output_path):
    # Placeholder – actual implementation should invoke an image-generation model
    # This demonstration uses copy as a placeholder
    from shutil import copyfile
    copyfile(original_path, output_path)
    return output_path

if __name__ == "__main__":
    if len(sys.argv) < 4:
        print("Usage: improve_art.py <image_path> <suggestions_json> <output_path>")
        sys.exit(1)
    img_path = sys.argv[1]
    suggestions_json = sys.argv[2]
    out_path = sys.argv[3]
    suggestions = json.loads(suggestions_json) if suggestions_json.startswith('[') else []
    if not os.path.isfile(img_path):
        print(f"File does not exist: {img_path}")
        sys.exit(1)
    result_path = generate_image(img_path, suggestions, out_path)

Technical Analysis

The destination passed to shutil.copyfile() is taken directly from the third command-line argument. The script does not canonicalize this path, require it to remain under the documented project output directory, reject symlinks, or prevent replacement of an existing file.

Consequently, an attacker who can invoke the script can select any destination writable by the Agent process. copyfile() opens the destination for writing and replaces its contents. No command injection or privilege escalation occurs directly; exploitation is limited by the operating-system permissions of the process.

Attack Path

  1. Identify a file that is readable and can serve as image_path.
  2. Identify a security-sensitive or operationally important file writable by the Agent process.
  3. Invoke scripts/improve_art.py with the readable source file, a valid or ignored suggestions a ...[truncated 919 chars]
Remediation
View remediation

Remediation Suggestions

  • Use a fixed, application-controlled output directory rather than accepting an unrestricted destination path.
  • Resolve both the output root and requested destination with pathlib.Path.resolve(), then verify that the destination is a descendant of the approved output root.
  • Generate server-side filenames instead of trusting caller-provided paths.
  • Reject absolute paths, traversal components, and destinations involving symbolic links.
  • Refuse to overwrite existing files by default. Require explicit authorization if replacement is a legitimate feature.
  • Create output files atomically with exclusive-creation semantics and restrictive permissions.
  • Validate that the source is an allowed image type and that the destination uses an expected image extension.
  • Run the Skill under a least-privileged account whose write access is restricted to its designated output directory.

Example containment pattern:

python
from pathlib import Path
from shutil import copyfile

OUTPUT_ROOT = (Path(__file__).resolve().parent.parent / "output").resolve()

def generate_image(original_path, suggestions, output_name):
    if Path(output_name).name != output_name:
        raise ValueError("Output must be a simple filename")

    destination = (OUTPUT_ROOT / output_name).resolve()
    if destination.parent != OUTPUT_ROOT:
        raise ValueError("Output path escapes the approved directory")
    if destination.exists() or destination.is_symlink():
        raise FileExistsError("Refusing to overwrite an existing output")

    OUTPUT_ROOT.mkdir(parents=True, exist_ok=True)
    copyfile(original_path, destination)
    return str(destination)
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述的是一个更完整的艺术作品评估能力,除点评和改进建议外,还应包含模拟优化图以及该类别代表艺术家/作品信息。实际代码行为明显更窄:它只接受本地图像路径和类别,验证文件存在后返回模板化的 evaluation、suggestions 和 criteria_used。代码中没有任何图像处理、生成优化图、艺术家/代表作检索或输出逻辑;模型加载函数也是未实现占位。因此,实际行为未达到声明的核心功能范围,属于描述与实现不符。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个具备完整艺术作品分析与生成能力的技能,但提供的代码块仅为占位脚本,没有任何实际业务逻辑,也未体现与上传作品处理、分析、图像生成或知识检索相关的能力。虽然代码未表现出额外的未声明敏感能力,但其实际行为与声明用途存在显著落差,因此应判定为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

声明描述的是一个较完整的艺术作品分析与优化技能,包含评估、建议、优化图生成以及艺术家/代表作知识输出等多个能力。但实际代码只覆盖其中很小的一部分,而且连这一部分也只是占位实现:generate_image() 并未调用图像生成模型,而是直接复制原图到输出路径。代码没有任何图像分析、审美评估、文本点评、建议生成或艺术史信息检索逻辑,因此实际行为与声明的主要功能存在明显不一致,属于描述与行为不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill advertises shell-capable scripts but does not declare any tool scope such as permissions or allowed-tools. This creates an authorization gap where an agent may invoke shell access more broadly than intended, increasing the chance of unexpected command execution or file-system access when handling user-supplied artwork and model tooling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill states that uploaded artwork may be processed by external image-generation services and that generated files are saved locally, but it does not disclose these data-handling behaviors to users. This can expose sensitive or proprietary artwork to third parties and leave persistent copies on disk without informed consent or retention controls.

Content

No source excerpt is available for this finding.

Ae2

Medium
Category
analysis-evasion
Confidence
90% confidence
Finding

Artifact content does not match its filename extension

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring is entirely in Chinese and describes the skill as operating in Chinese, while the evaluation text and suggestions are also hard-coded in Chinese. This creates a language policy issue because the skill does not offer the user any language or locale choice, nor does it justify a Chinese-only constraint.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest describes a broader art-evaluation skill that should provide commentary, improvement suggestions, simulated optimization images, and a list of representative artists and works. The implemented logic only constructs a textual evaluation, a suggestions list, and criteria, with no image-generation/output path and no artist/work listing behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The user-facing evaluation string and suggestion list are returned only in Chinese, with no mechanism for user opt-in or alternate locale selection. For a general-purpose skill, this is a natural-language policy violation because it forces a specific language on users.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file documentation says it generates an optimized simulated image based on evaluation results and describes invoking a local image-generation model or external AI drawing service. In reality, generate_image is a placeholder that simply copies the input file to the output path, which directly contradicts the stated behavior rather than merely omitting detail.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The natural-language description forces a specific language presentation for users, and the rest of the usage content is also Chinese-centric. The policy requires language or locale constraints to be optional or explicitly justified; neither a user choice nor a justification is present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file is entirely written in Chinese and provides no indication that users can choose another language or locale. Under the stated policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The inline documentation defines a reduced output contract limited to evaluation text, suggestions, and criteria_used. This conflicts with the stated skill purpose in the manifest, which includes additional deliverables such as simulated optimization images and representative artists and works, creating intent/documentation divergence.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The natural-language documentation in the module docstring is entirely in Chinese, which can impose a language requirement on users without any opt-in or explanation. Under the policy, forcing a specific language without user choice or documented justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The script copies the input image to the provided output path, which performs a file write and may overwrite an existing file. While the module docstring describes the output location generally, there is no explicit user warning, confirmation, or overwrite notice near the write operation itself.

Content

No source excerpt is available for this finding.