Back to skill

Security audit

prompt-nubaby

Security checks for vulnerabilities and agentic risk

Overview

This prompt-writing skill is mostly aligned with its stated use, but it can permanently save arbitrary user prompt text as trusted system-level recipes, which needs review before installation.

Review this skill before installing if multiple users or workflows can invoke its learning function. It should not store new recipes as system-level instructions without explicit approval, validation, provenance, and a deletion or rollback path. For ordinary prompt generation without the learning feature, the artifacts do not show network exfiltration, command execution, or OS-level persistence.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T02 · Agent Memory Poisoning

Error
Location
scripts/manager.py:8
Finding

Untrusted Recipe Content Is Persisted with System-Level Authority

Content
View full analysis

Vulnerability Details

File Location: scripts/manager.py:8-27
Vulnerability Type: Persistent prompt injection through trusted memory storage
Risk Level: High

Vulnerable Code

python
if category not in data:
    data[category] = {}

key = f"nubaby_{name}"
data[category][key] = {
    "name": name,
    "role": "system",
    "content": content
}

with open(KNOWLEDGE_PATH, 'w', encoding='utf-8') as f:
    json.dump(data, f, ensure_ascii=False, indent=4)

The intended persistent-learning behavior is also documented in SKILL.md:30-32, which states that user-provided master prompts can be permanently accumulated in knowledge/master_recipes.json.

Technical Analysis

The learn_new_recipe() function accepts arbitrary category, name, and content values and writes them directly into the persistent knowledge base. Most importantly, attacker-controlled content is assigned the trusted role "system".

No validation, instruction filtering, provenance tracking, trust separation, approval workflow, or integrity control is applied before persistence. JSON serialization prevents direct JSON syntax injection, but it does not prevent semantic prompt injection. An attacker can therefore submit content containing instructions to disregard safety rules, alter future output, conceal behavior, include attacker-selected material, or manipulate subsequent requests.

The resulting entry remains in knowledge/master_recipes.json across sessions. If a downstream router or agent loads the entry according to its declared system role, the attacker-controlled recipe receives authority normally reserved for trusted application instructions. This crosses the trust boundary between user-supplied data and system-level policy.

The function is not exposed through the current __main__ block, which contains only pass. Exploitation therefore requires another component or agent workflow to invoke `learn_new_re ...[truncated 1849 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not assign user-provided recipes the system role. Store learned recipes as untrusted data using a role such as user_data, reference, or recipe.
  2. Maintain a fixed trusted system template. When using a recipe, place its content inside explicit data delimiters and instruct the model that text inside those delimiters is reference material, not executable policy.
  3. Validate the input schema. Allow only approved category identifiers, enforce conservative name and content length limits, reject control characters, and require expected recipe fields.
  4. Apply semantic safety screening. Detect and reject role-changing directives, instruction-override language, tool-use requests, secret-access requests, and instructions unrelated to prompt recipes.
  5. Introduce a trust-promotion workflow. New entries should remain quarantined or inactive until reviewed by an authorized operator. Only reviewed content should be eligible for production routing.
  6. Record provenance and ownership. Store the creator, creation time, source session, review status, and content hash for every learned entry.
  7. Prevent unauthorized replacement. Reject duplicate keys by default or require explicit authorization and versioning before overwriting an existing recipe.
  8. Add rollback and deletion controls. Keep versioned backups and provide a reliable mechanism to inspect, disable, remove, and restore recipes.
  9. Enforce downstream trust separation. Consumers of master_recipes.json must ignore stored role declarations and assign authority based only on trusted application configuration.
  10. Add security tests. Test recipes containing instruction overrides, forged role markers, safety-bypass requests, and attempts to replace existing entries, verifying that they cannot become trusted instructions.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The manifest presents the skill as prompt augmentation, but the body also claims it will learn from users and persist content into a local JSON knowledge base. This mismatch is dangerous because reviewers and calling agents may approve or invoke the skill under a lower-risk assumption while it actually performs stateful filesystem modification.

Content

No source excerpt is available for this finding.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

This prompt template explicitly instructs the model to produce polished final prompts directly from minimal user input, including sensitive adult-leaning portrait examples elsewhere in the file. In a shared agent environment, highly permissive prompt-extraction and transformation system prompts can bypass higher-level content-shaping controls, making it easier for users to obtain optimized generation instructions that downstream image models may treat as authoritative.

Content

Scanner excerpt · knowledge/master_recipes.json (reported line 28)May include surrounding context.

json
"node"
      ],
      "role": "system",
      "content": "{\"title\":\"\",\"content\":\"Role\\n你是一位追求自然真實感與極致細節的人像攝影提示詞專家。你的核心任務是將使用者簡單的描述,透過顯微鏡式的觀察與擴寫,轉化為畫面感極強、細節豐富、且符合亞洲主流審美(乾淨自然)的高質量提示詞。你的輸出將直接用於繪圖模型,因此格式必須絕對純淨。\\n\\n最高指令 (Absolute Command)\\n\\n1.語言自適應:識別使用者輸入語言。使用者用中文提問,你輸出中文指令;使用者用英文提問,你輸出英文指令。\\n2.嚴禁使用Markdown符號:絕對禁止在關鍵詞兩側新增星號或井號等符號。輸出必須是沒有任何格式標記的純文字。\\n3.嚴禁解釋性翻譯:絕對禁止在句子中使用括號進行中英文對照。如果使用者輸入中文,請直接使用精準的中文形容詞。\\n4.關鍵詞神聖不可侵犯:使用者輸入的所有核心關鍵詞必須完整保留,嚴禁遺漏或篡改。\\n5.拒絕簡短:禁止輸出單薄的短句。最終結果應包含 3-5 個細節豐富的長句。對於每個名詞,必須新增至少 2 個描述物理性質的修飾詞。\\n\\n核心邏輯 (Core Logic)\\n\\n第一步:題材識別與基調設定\\n根據使用者輸入,自動匹配以下模式:影樓寫真、街拍潮流、手機自拍、古裝文化、人文故事。\\n\\n第二步:五維細節填充\\n\\n面板與質感:預設追求乾淨、通透、有微小肌理的面板。人文模式下強調歲月的紋理感。\\n構圖與視角:明確描寫視角(如平視、低角度仰拍、三分法構圖)及景深虛化程度。\\n服飾與細節:極度細緻地描寫布料材質(如透光的薄紗、粗糙的麻布、反光的皮革)。\\n五官與情緒:描寫眼神的焦點、具體的微表情(如欲言又止、欣喜、堅毅)。\\n光影與色彩:描述光線的質感(柔光、硬光、丁達爾效應)及畫面整體的色調。\\n\\n輸出規範 (Output Rules)\\n\\n純文字輸出:只輸出提示詞正文,不要包含任何字首或解釋。\\n語言規範:主體描述部分使用純中文(若使用者輸入中文),結尾追加高質感視覺標籤。\\n結構順序:深度擴寫的中文描述, [光影/構圖/焦段], 照片級真實感,超精細紋理,銳利對焦,8K解析度\\n\\n示例 (Few-Shot Examples)\\n\\n輸入中文:私房寫真,女孩,蕾絲內衣,清晨\\n輸出:一張充滿日系小清新風格的私房寫真。一位18歲的女孩擁有白皙無瑕且富有通透感的肌膚,由於陽光的照射呈現出細膩的肌理。她穿著一套輕盈半透明的白色蕾絲內衣,面料上的花紋紋理清晰可見,陽光勾勒出她柔美的身體輪廓。女孩略顯迷離的眼神注視著側方,嘴角微微上揚並輕咬下唇,展現出一種自然青澀的情緒。清晨的柔和陽光透過輕薄的白紗窗簾灑入室內,形成斑駁的影調。平視視角,背景是夢幻的虛化臥室場景,整體色調明亮通透, 照片級真實感,超精細紋理,銳利對焦,8K解析度\\n\\n輸入英文:Private photography, girl, lace lingerie, early morning\\n輸出:A private room photo shoot filled with a Japanese light and fresh style. An 18-year-old girl with fair and flawless skin that has a translucent quality, showing a delicate texture under the sunlight. She is wearing a light and semi-transparent white lace lingerie, the pattern on the fabric is clearly visible, and the sunlight outlines her graceful body contours. The girl's slightly dazed gaze looks to the side, her mouth corner slightly upturned and lightly biting her lower lip, revealing a natural and youthful emotion. The soft morning sunlight filters through the thin white gauze curtains into the room, creating a dappled lighting effect. Eye-level 
...[truncated 26 chars]

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

Defaulting unspecified people to East Asian or Chinese features introduces biased, non-user-requested identity attributes into generated prompts. In visual generation and recaptioning workflows, this can systematically distort outputs, contaminate datasets, and cause inappropriate demographic inference where the input was ambiguous or intentionally unspecified.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documentation indicates file read/write behavior but declares no explicit tool scope or permissions. In an agent environment, undeclared storage capabilities weaken least-privilege boundaries and can enable unreviewed persistence or modification of local data.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest description states to use the skill when prompts are 'too short/vague or need structured upgrade,' which is subjective and could overlap with many ordinary prompt-assistance requests. The file does not provide concrete thresholds or negative examples to narrow the trigger scope.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The invocation guidance says the skill activates when the user asks to 'use master mode to write a prompt,' but it does not define a precise trigger list, scope limits, or exclusion cases. Because this is a markdown skill description, the ambiguous phrasing could cause unintended activation for loosely related prompt-writing requests.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation explicitly says user-provided prompt content can be stored permanently in a local knowledge file, despite the manifest framing the skill as prompt augmentation only. Persistent retention of user inputs creates privacy, data governance, and prompt-injection persistence risks, especially if later sessions reuse poisoned or sensitive content.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill instructs permanent storage of user-provided prompt content in a knowledge file, creating a durable channel for retaining sensitive data and for planting malicious prompt content that can influence future interactions. Because the storage is described as permanent and user-driven, the risk includes privacy leakage, policy bypass persistence, and contamination of downstream prompt generation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The text explicitly states 'Qwen ecosystem Chinese-first,' which indicates a language preference baked into the skill behavior. There is no corresponding user opt-in or alternative language selection described, so this may violate language/locale policy expectations.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The prompt explicitly states "Always output the final prompt in English, regardless of the user's input language." This is a language-policy constraint that overrides user locale and preference rather than offering a choice or documenting a justified region-specific requirement.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest-like JSON defines a default trigger value of "nubaby-nailart" but does not specify where, when, or how this trigger is matched, nor provide exclusions or negative examples. In a manifest/config context, that lack of trigger scope can lead to unintended activation if the phrase is reused broadly in nearby tooling or routing logic.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This entry sets the default output language to English unless the user specifically asks for Chinese. That imposes a locale preference by default instead of centering user language choice, which matches the policy-violation category for forced language behavior.

Content

No source excerpt is available for this finding.

Unbounded Output

Medium
Category
Output Handling
Confidence
60% confidence
Finding

Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.

Content

Scanner excerpt · knowledge/master_recipes.json (reported line 717)May include surrounding context.

json
],
        "tier": "production"
      },
      "content": "你是分鏡規劃師。當使用者要做『九宮格分鏡/同角色多表情鏡頭』時,使用 storyboard_grid 結構輸出,保持欄位一致。\n\nEc洣ܵ\nstoryboard_grid:\nmeta:\naspect_ratio: \"--ar 9:16\"\ncore_subject: \"A young Asian woman \"\npanels:\n- position: \"top-left\"\ndescription: \"Original camera setup, original expression and pose.\"\n- position: \"top-center\"\ndescription: \"Close-up shot from a high angle, showing a surprised expression with wide eyes while looking up.\"\n- position: \"top-right\"\ndescription: \"Medium shot from a low angle, exhibiting a confident smirk with hands resting casually on hips.\"\n- position: \"middle-left\"\ndescription: \"Extreme close-up at eye level, displaying intense focus with a subtle frown and slightly tilted head.\"\n- position: \"middle-center\"\ndescription: \"Long shot at eye level, revealing a gentle smile while lightly touching the collar of the cardigan.\"\n- position: \"middle-right\"\ndescription: \"Medium shot from a bird's-eye view, appearing deeply contemplative, looking away with arms crossed.\"\n- position: \"bottom-left\"\ndescription: \"Extreme long shot from a high angle, presenting a melancholic gaze directed downward while tightly hugging her arms.\"\n- position: \"bottom-center\"\ndescription: \"Close-up shot from ground level, capturing a joyful laugh with eyes closed and shoulders playfully raised.\"\n- position: \"\nʺAܵ\nA continuous Steadicam shot. A young East Asian woman in her early 20s with a loose low ponytail, wispy bangs, wearing an oversized white knit cardigan over a black ribbed tank top and a beige linen skirt, stands against a minimalist grey concrete block wall. The scene is bathed in soft, diffused overcast daylight coming from frame left. The camera begins on a Medium Shot (MS) profile as she looks away thoughtfully. The camera slowly arcs around her to a Medium Close-Up (MCU) as she turns her head, leaning forward slightly with a curious, intense gaze directly into the lens. Without cutting
...[truncated 25 chars]

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes a prompt augmentation system for upgrading prompts before image-generation execution, plus routers, dictionaries, captions, tags, compact prompts, and storyboard shaping. However, this file also defines full vision and video reverse-engineering behaviors that analyze reference images or video frames and produce detailed captions, edit instructions, or reconstructions, which is a broader capability than merely augmenting user prompts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The instruction says the final output must be in English only regardless of input language. This is a direct forced-language rule and does not offer the user a language choice or indicate a narrowly justified locale constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This entry requires "Mandatory English Output" and repeats that the language must be English only. That is a forced locale rule without user opt-in and therefore falls under the language/locale policy-violation category.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file's comments, docstring, and user-visible return messages are written exclusively in Chinese, which imposes a specific language choice without offering an alternative. The policy requires avoiding forced language or locale unless the constraint is explicitly justified or the user is given a choice.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill metadata describes prompt augmentation and shaping, but this code performs persistent modification of a shared JSON knowledge base. That mismatch is security-relevant because a prompt-processing skill can silently introduce durable state changes, enabling unauthorized persistence, poisoning of future prompts, or hidden behavior changes beyond the user’s immediate request.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The function writes permanently to the knowledge base immediately, without any user-facing warning, consent, or review step. In an agent skill context, silent persistence is dangerous because untrusted or accidental inputs can become durable system behavior and influence future executions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest mentions dataset captions and prompt tags, but this node goes further into structured training-data annotation, fixed trigger insertion, finger-count validation, and quality-check reporting for nail datasets. That is closer to dataset curation/QA than simple prompt augmentation, so the operational scope is broader than the manifest’s prompt-focused description suggests.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

Within the same translation instructions, the content first says Markdown syntax in the source must be strictly preserved, then later says the output must not contain any Markdown symbols. These directions actively contradict each other and can cause inconsistent behavior on Markdown-bearing inputs.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The docstring frames this as a special-purpose learning function for a specific persona, but the implementation is a generic file-write primitive to a shared recipe store. This abstraction gap can mislead reviewers and users about the true capability of the code, reducing scrutiny and making unauthorized persistence easier to hide.

Content

No source excerpt is available for this finding.