Back to skill

Security audit

sn-image-imitate

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for image style imitation, but it sends user image and prompt data to external AI services and lacks clear bounds and cleanup for generated work files.

Review before installing. Use this skill only with images and prompts you are comfortable sending to the configured SN or third-party AI providers, keep retry counts small, and verify that sn-image-base is trusted. Prefer an updated version that uses private temporary directories, cleans intermediate artifacts, and enforces hard limits on retries and thresholds.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:125
Finding

Predictable Temporary Directory Enables Symlink Attacks and Sensitive Artifact Exposure

Content
View full analysis
/ as TEMP_DIR 3. Resolve and normalize REFERENCE_IMAGE 4. Persist user request: echo "$TARGET_CONTENT" > "$TEMP_DIR/target-content.txt" ``` The workflow subsequently writes additional artifacts to the same directory: ```bash echo "$SHORT_CAPTION" > "$TEMP_DIR/reference-short-caption.txt" echo "$LONG_CAPTION" > "$TEMP_DIR/reference-long-caption.txt" echo "$LAYOUT_BLUEPRINT_JSON" > "$TEMP_DIR/layout-blueprint.json" ``` ```bash echo "$NEW_LONG_CAPTION" > "$TEMP_DIR/new-long-caption.txt" ``` ```bash --save-path "$TEMP_DIR/attempt_.png" ``` ### Technical Analysis The task identifier is based only on a timestamp with one-second precision. Such a value is predictable and can also collide when multiple tasks start during the same second. The workflow does not require: - Atomic creation of a unique temporary directory. - Restrictive directory and file permissions. - Verification that the directory is owned by the current process or user. - Rejection of pre-existing files or symbolic links. - No-follow semantics when opening output files. - Cleanup of intermediate artifacts after task completion. Shell output redirection follows symbolic links. In a shared local environment, another user or compromised process may predict and pre-create the workspace or individual output paths. When the worker writes an artifact, the write may consequently target a different file accessible to the worker account. The stored artifacts may include the user's target content, all text extracted from the reference image, the layout blueprint, the rewritten generation prompt, and generated images. If default filesystem permissi ...[truncated 1613 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:101
Finding

Unbounded User-Controlled Retry Count Can Cause Resource Exhaustion and Excessive API Charges

Content
View full analysis
.png" \ --output-format json ``` When `max_attempts > 1`, each attempt can also invoke a VLM review: ```bash python "$SN_IMAGE_BASE/scripts/sn_agent_runner.py" sn-image-recognize \ --system-prompt-path "$SKILL_DIR/prompts/layout_review.md" \ --user-prompt "Reference is image[0], candidate is image[1]. Layout blueprint JSON:\n$LAYOUT_BLUEPRINT_JSON\n\nEvaluate layout similarity and return JSON only." \ --images "$REFERENCE_IMAGE" "$TEMP_DIR/attempt_.png" \ --output-format json ``` ### Technical Analysis `max_attempts` is accepted from the caller, but the documented validation does not enforce that it is an integer within a safe minimum and maximum range. The value controls a loop in which each iteration may perform both image generation and visual-model review. Although the loop can terminate early when a candidate passes review, an attacker can select parameters or content likely to fail the threshold. A very large retry count may ...[truncated 1636 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (10)

YARA rule 'agent_skill_prompt_injection_hidden_instructions': Prompt injection or hidden instructions embedded in AI agent skill text [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

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

md
and API keys** section in [`sn-image-generate_en.md`](../../docs/sn-image-generate_en.md) for more configurations.

## API Configuration

All API calls in this skill are executed through the `sn_agent_runner.py` of the `sn-image-base` skill,
please refer to the `sn-image-base` skill ([README.md](../sn-image-base/README.md)) for more details.

- **VLM call**: `sn-image-recognize` (Step 1 & 3)
- **LLM call**: `sn-text-optimize` (Step 2)
- **Image generation call**: `sn-image-generate` (Step 3)

**When encountering `MissingApiKeyError` or needing explicit model control**: pass model and auth params explicitly via CLI arguments. See `$SN_IMAGE_BASE/references/api_spec.md`.

**`$SN_IMAGE_BASE` path explanation**: `$SN_IMAGE_BASE` is the installation directory of the `sn-image-base` skill (`SKILL.md` exists). The agent can locate this path by skill name `sn-image-base`.

## Architecture: Main Agent + Worker Agent

This skill uses a two-tier agent architecture:

- **Main Agent**: receives us

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
: `$SN_IMAGE_BASE` is the installation directory of the `sn-image-base` skill (`SKILL.md` exists). The agent can locate this path by skill name `sn-image-base`.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

md
## References

- `prompts/image_annotate.md` - Image annotation + layout blueprint system prompt (Step 1, required)
- `prompts/caption_rewrite.md` - Caption rewrite system prompt with layout-lock constraints (Step 2, required)
- `prompts/layout_review.md` - Candidate-vs-reference layout/style review prompt (Step 3, required)
- `../sn-image-base/SKILL.md` - Base tool behavior and parameter defaults

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The README describes a pipeline that sends the reference image, extracted captions, rewritten prompts, and generated outputs to external VLM/LLM/image-generation services, but it does not warn users that their images and prompts may leave the local environment. This creates a real privacy and data-governance risk because users may provide sensitive images or proprietary content without understanding that third-party processing occurs.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · README.md (reported line 17)May include surrounding context.

md
### sn-image-imitate(Tier 1)

图像风格模仿场景技能,构建于 `sn-image-base` 之上。完整行为见 [`skills/sn-image-imitate/SKILL.md`](../sn-image-imitate/SKILL.md)。

给定一张参考图像和目标内容描述,该技能会:

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · README_CN.md (reported line 17)May include surrounding context.

md
### sn-image-imitate(Tier 1)

图像风格模仿场景技能,构建于 `sn-image-base` 之上。完整行为见 [`skills/sn-image-imitate/SKILL.md`](../sn-image-imitate/SKILL.md)。

给定一张参考图像和目标内容描述,该技能会:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README states that the skill accepts a local path or URL for a reference image and uses VLM/image-generation APIs, but it does not clearly warn that the image and derived captions/layout metadata may be transmitted to external providers. This creates a real privacy and data-handling risk because users may supply sensitive local images assuming processing is local, especially in an agent workflow that abstracts away backend calls.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly sends the reference image and user-provided target content to external vision, language, and image-generation services, but the description does not warn users that their data leaves the local environment. This creates a real privacy and compliance risk because users may provide sensitive images, proprietary visuals, or confidential prompts without informed consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This instruction imposes a language-selection policy based solely on detected image text rather than allowing the user to choose the output language. The rule prohibits forcing a specific language or locale without user opt-in, and the same requirement is repeated later in the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This line reiterates the requirement to determine a primary language from visible text and use it for the response, defaulting to English otherwise. That is a natural-language policy constraint on output language without giving the user a choice, which falls under the language/locale policy violations category.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.prompt_injection_instructions

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
SKILL.md:176