Back to skill

Security audit

ai-drama-prompt-factory

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real short-drama prompt workflow, but its bundled document tools can broadly index and read local files without enough containment.

Install only if you will use it on trusted story/project folders. Do not point its indexing tools at a home directory, repository root with secrets, or untrusted downloaded index JSON; regenerate indexes from approved source text and review outputs before sharing them externally.

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/doc_fetch.py:193
Finding

Arbitrary Local File Read Through Untrusted Index Paths

Content
View full analysis
Dict[str, Any]: """Load the index file.""" with open(index_path, 'r', encoding='utf-8') as f: return json.load(f) ``` ```python def fetch_lines(filepath: str, start: int, end: int) -> str: """Retrieve a specified range of lines from a file.""" try: with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: lines = f.readlines() ``` ```python filepath = file_info['filepath'] print(f'📄 File: {file_info["filename"]}') print(f'📍 Path: {filepath}') print(f'📝 Total lines: {file_info.get("total_lines", "?")}') print('=' * 60) # List sections if args.list: print(list_sections(file_info)) return 0 # Retrieve a section if args.section: section = find_section_in_file(file_info, args.section) if not section: print(f'❌ Section not found: {args.section}') print(list_sections(file_info)) return 1 print(f'📑 Section: {section.get("title")}') print(f'📍 Location: lines {section.get("start_line")}-{section.get("end_line")}') print('-' * 60) print(fetch_section(filepath, section, args.context)) return 0 # Retrieve a line range if args.lines: start, end = parse_line_range(args.lines) print(f'📍 Line range: {start}-{end}') print('-' * 60) print(fetch_lines(filepath, start, end)) return 0 # Retrieve all content if args.all: print(f'📄 Full content, up to {args.max_lines} lines:') print('-' * 60) print(fetch_all(filepath, args.max_lines)) return 0 ``` From `scripts/doc_search. ...[truncated 3699 chars]
Remediation
View remediation
Path: trusted_root = Path(root).resolve(strict=True) candidate = Path(indexed_path) if candidate.is_absolute(): raise ValueError("Absolute paths are not permitted in index entries") resolved = (trusted_root / candidate).resolve(strict=True) if not resolved.is_relative_to(trusted_root): raise ValueError("Indexed path escapes the trusted document root") if not resolved.is_file(): raise ValueError("Indexed path is not a regular file") return resolved ``` 3. **Store relative paths in generated indexes** - Modify `doc_indexer.py` so index entries contain paths relative to the indexed root rather than absolute paths. - Resolve those relative paths only after applying the containment check. 4. **Handle symbolic links explicitly** - Either reject symbolic links entirely or resolve them and verify that their final targets remain under the trusted root. 5. **Validate index structure** - Enforce a schema that constrains required properties and types. - Reject unknown or malformed entries. - Apply reasonable limits to the number of files, section ranges, and path lengths. 6. **Avoid trusting externally supplied indexes** - Regenerate an index from a user-approved source directory where practical. - If indexes must be reusable across trust bounda ...[truncated 615 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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 (26)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description promises an end-to-end AI short-drama production/prompt-generation pipeline for adapting novels or creating original shorts. The supplied code does none of that. It is a standalone CLI utility for reading a document index JSON, locating files and sections, and printing specific lines, sections, or truncated file contents from local files. There are no features related to story planning, character/scene/prop prompt creation, storyboard generation, video/audio prompt assembly, novel adaptation logic, diagnostics, or API JSON output beyond loading an index file. This is a clear primary-purpose mismatch, and the code also exposes undeclared file-content access capabilities unrelated to the declared skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description describes an end-to-end creative pipeline for generating AI short-drama prompt packages from novels or story ideas. The supplied code does nothing related to story adaptation, script generation, scene/character prompt creation, video/audio prompt assembly, or staged short-drama production workflows. Instead, it is a generic document indexing utility: it reads files/directories, parses markdown/python/json/text/html/code structures, extracts keywords, gathers metadata such as size, modification time, and MD5 hash, and saves the results as JSON. This is a materially different primary purpose and includes filesystem indexing capabilities not declared in the description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description promises a specialized creative-production pipeline for transforming stories into structured short-drama prompt assets. The supplied code does none of that. It only loads an index file, searches files for keywords using regex, gathers context lines, ranks and formats matches, and outputs results in text or JSON. This is a materially different primary purpose and capability set. Therefore the description does not accurately represent the code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个面向短剧制作的内容生成流水线,而代码只处理本地 JSON 索引文件并输出文档结构摘要。它没有任何与短剧、提示词工厂、内容生成、分镜、视频/音频提示词、API 编排相关的逻辑。其主要目的与声明严重不符,因此属于明显的描述-行为不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger list includes broad terms like '生成短剧', '短剧制作', and 'AI视频剧本', which can match many generic user requests and cause the skill to activate outside its intended scope. Over-broad activation increases the chance that the skill will intercept unrelated prompts, process sensitive user content unnecessarily, or crowd out a more appropriate and safer skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The rule states that prompts ‘必须’ use Chinese natural-language descriptions, which forces a specific language policy for all users. No opt-in, language selection step, or justification for a China-specific compliance or platform requirement is provided elsewhere in the file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file contains user-facing documentation only in Chinese, including headings, field descriptions, and examples. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Line L135 states '确定景别,用中文自然语言', which imposes a specific language requirement in the skill instructions. Because the file does not provide user opt-in, language alternatives, or a documented region-specific justification, this is a natural-language policy violation under the locale-choice rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file contains natural-language guidance that effectively forces a specific language/locale for skill content, including Chinese labels throughout and an explicit requirement that variant names use Chinese phrases. Under the policy, language constraints should be optional or clearly justified; neither is present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file contains user-facing natural language content exclusively in Chinese, including headings, criteria, and trigger examples. Under the policy rules, forcing a specific language without user opt-in can be a locale-policy violation unless the scope is explicitly documented as region- or language-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire guide is written in Chinese and all prescribed workflow labels and examples assume Chinese-language use, but there is no indication that language choice is optional or that the skill is intentionally limited to a Chinese-only context. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This file presents all skill guidance and output templates in a single forced language, which can amount to a language/locale policy violation when no user opt-in or alternative is provided. The content does not indicate that Chinese is optional or limited to a justified region-specific use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Line L005 states that prompts '统一使用中文自然语言', which imposes a fixed language requirement. This is a natural-language policy concern because it forces a specific language without user opt-in or an explicit justified regional constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file presents all instructions and examples exclusively in Chinese, which effectively forces a specific language for users of the skill. Under the policy, language constraints should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language strings that force a specific language/locale for usage instructions and output. Under the policy, locale constraints should either be optional for the user or clearly justified as region-specific; neither is present here.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script declares support for indexing a wide range of local document and source-code types unrelated to the advertised short-drama prompt-generation workflow. In a skill context, this broad file-inspection capability can enable unintended collection of sensitive local content, especially if other parts of the skill invoke it on workspace or home directories.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The directory indexer recursively traverses directories, reads full file contents, and aggregates metadata and keywords across many files. In a skill whose stated purpose is drama prompt production, this materially increases the risk of overbroad repository inspection and exposure of secrets, proprietary code, personal notes, or unrelated project data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language strings that present the tool description and usage exclusively in Chinese. Under the policy, forcing a specific language without offering a user choice or documenting a justified locale constraint is a language/locale policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Argument descriptions, error messages, and formatted search output are all hard-coded in Chinese, which imposes a single locale on users. The file does not offer an alternative language, a configuration flag, or a documented justification for this restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The template sets target_platform to 抖音, which encodes a specific language/locale/platform choice in a default manifest value. Under the policy, forcing a specific language or locale without offering user choice or documenting a justified regional constraint can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown file contains user-facing instructional content solely in Chinese, including the title and all operational guidance. Under the language/locale policy rule, forcing a specific language without user opt-in can be a natural-language policy violation when no alternative or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code file contains natural-language strings that present the tool description and usage exclusively in Chinese. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is justified, which is not indicated here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The argparse description and help strings are all Chinese-only, which constrains users to one language. The file does not offer an alternative locale or explain why the restriction is necessary.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The manifest describes internal staged processing that outputs API JSON for short-drama prompt packages, but this script independently saves a local documentation index file for arbitrary inputs. Persisting general document indexes is a different operational behavior from the claimed end-to-end story-to-prompt workflow.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.