Back to skill

Security audit

Ai Drama Prompt Factory.Skip

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed Chinese short-drama prompt workflow, but it ships broad local document indexing and retrieval scripts that can read and persist more local content than the creative workflow clearly scopes.

Install only if you are comfortable with a Chinese-first short-drama workflow that may create many project files and optional indexes. Keep indexing limited to the intended story/source directory, do not run the bundled search or fetch tools on indexes from untrusted sources, and review or delete generated index files if they may contain private file paths or content-derived keywords.

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

Arbitrary Local File Read Through Untrusted Index Paths in Document Fetcher

Content
View full analysis

Vulnerability Details

File Location: scripts/doc_fetch.py, lines 20-22, 39-52, 176, and 197-211
Vulnerability Type: Arbitrary local file read caused by trusting paths from an untrusted index
Risk Level: Medium

Vulnerable Code

python
def load_index(index_path: str) -> Dict[str, Any]:
    """加载索引文件"""
    with open(index_path, 'r', encoding='utf-8') as f:
        return json.load(f)
python
def find_file_in_index(index: Dict[str, Any], filename: str) -> Optional[Dict[str, Any]]:
    """在索引中查找文件"""
    files = index.get('files', [])
    
    # 精确匹配
    for f in files:
        if f['filename'] == filename or f['filepath'] == filename:
            return f
    
    # 模糊匹配
    for f in files:
        if filename.lower() in f['filename'].lower() or filename.lower() in f['filepath'].lower():
            return f
    
    return None
python
filepath = file_info['filepath']
python
if args.lines:
    start, end = parse_line_range(args.lines)
    print(f'📍 行范围: {start}-{end}')
    print('-' * 60)
    print(fetch_lines(filepath, start, end))
    return 0

# 获取全部
if args.all:
    print(f'📄 全文内容 (最多 {args.max_lines} 行):')
    print('-' * 60)
    print(fetch_all(filepath, args.max_lines))
    return 0

The resulting path reaches direct file operations in fetch_lines() and fetch_all():

python
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
    lines = f.readlines()

Technical Analysis

The utility treats the index JSON as authoritative and directly uses its filepath field when reading documents. It does not canonicalize the path, enforce a trusted document root, verify that the path belongs to the indexed source directory, reject symlink escapes, or compare the current file against the stored hash.

Consequently, anyone able to provide or modify an index file can point an entry at any file readable by the process. Selecting that entry with --file, or relying on automatic selection when ...[truncated 1212 chars]

Remediation
View remediation

Remediation Suggestions

  • Require a trusted document root when loading an index.
  • Store indexed file paths relative to that root rather than as unrestricted absolute paths.
  • Resolve both the trusted root and candidate path with Path.resolve(), then verify that the candidate remains beneath the root:
    python
    root = Path(document_root).resolve()
    candidate = (root / file_info["filepath"]).resolve()
    
    try:
        candidate.relative_to(root)
    except ValueError:
        raise ValueError("Indexed path escapes the trusted document root")
    
  • Define and validate a strict index schema before accessing fields.
  • Reject absolute paths and parent-directory traversal components in imported index entries.
  • Consider rejecting symlinks or explicitly checking every resolved component when symlink traversal is not required.
  • Verify the current file hash against the hash stored in the index before reading.
  • Avoid accepting indexes from untrusted sources. If imported indexes are required, document that they are untrusted and require explicit confirmation before accessing paths outside the expected source tree.
  • Add regression tests covering absolute paths, ../ traversal, symlink escapes, malformed index entries, and hash mismatches.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/doc_search.py:19
Finding

Arbitrary Local File Disclosure Through Crafted Search Index Entries

Content
View full analysis

Vulnerability Details

File Location: scripts/doc_search.py, lines 19-21, 25-29, and 76-78
Vulnerability Type: Arbitrary local file disclosure caused by unvalidated index paths
Risk Level: Medium

Vulnerable Code

python
def load_index(index_path: str) -> Dict[str, Any]:
    """加载索引文件"""
    with open(index_path, 'r', encoding='utf-8') as f:
        return json.load(f)
python
def search_in_file(filepath: str, keywords: List[str], context_lines: int = 2, 
                   max_matches: int = 10) -> List[Dict[str, Any]]:
    """在文件中搜索关键词"""
    try:
        with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
            lines = f.readlines()
    except Exception as e:
        return [{'error': str(e)}]
python
for file_info in files:
    filepath = file_info['filepath']
    filename = file_info['filename']
    
    # 先检查索引中的关键词
    file_keywords = set(file_info.get('keywords', []))
    keyword_hits = sum(1 for kw in keywords if kw.lower() in 
                     (k.lower() for k in file_keywords))
    
    # 在文件中搜索
    matches = search_in_file(filepath, keywords, context_lines, max_matches_per_file)

Technical Analysis

The search utility loads caller-supplied JSON and directly opens every filepath listed in it. There is no trusted-root validation, canonicalization, symlink policy, schema validation, or integrity check.

A malicious index can therefore direct the search process toward arbitrary readable local files. When a query matches, the utility returns the matching line together with neighboring lines, providing selective disclosure. Repeated queries can be used for reconnaissance and incremental extraction.

Attack Path

  1. An attacker creates or modifies an index so that one or more filepath entries reference sensitive local files.
  2. The victim runs a search against the malicious index:
    bash
    python3 scripts/doc_search.py \
      --index malicious-index.json \
      --query "PRIVA
    

...[truncated 919 chars]

Remediation
View remediation

Remediation Suggestions

  • Bind every index to an explicit, trusted source root.
  • Save relative paths in generated indexes and reject absolute paths in imported indexes.
  • Canonicalize each candidate path and enforce containment beneath the trusted root before opening it.
  • Establish a clear symlink policy; reject symlink escapes when indexes may be untrusted.
  • Validate index structure and field types against a strict schema.
  • Compare each target's current hash with the hash recorded during indexing before searching it.
  • Consider rebuilding indexes locally rather than accepting externally supplied index files.
  • Return a clear validation error instead of silently attempting paths that fail policy checks.
  • Add security tests for absolute-path entries, traversal sequences, symlink escapes, malformed fields, and modified files.
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 (27)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared end-to-end drama factory behavior conflicts with a detected implementation that summarizes document structure from an existing index. That kind of hidden retrieval/analysis behavior is dangerous because it can be used to inspect project files or extracted indices under the guise of content creation, violating least surprise and potentially leaking sensitive content.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared end-to-end drama factory behavior conflicts with a detected implementation that summarizes document structure from an existing index. That kind of hidden retrieval/analysis behavior is dangerous because it can be used to inspect project files or extracted indices under the guise of content creation, violating least surprise and potentially leaking sensitive content.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared end-to-end drama factory behavior conflicts with a detected implementation that summarizes document structure from an existing index. That kind of hidden retrieval/analysis behavior is dangerous because it can be used to inspect project files or extracted indices under the guise of content creation, violating least surprise and potentially leaking sensitive content.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared end-to-end drama factory behavior conflicts with a detected implementation that summarizes document structure from an existing index. That kind of hidden retrieval/analysis behavior is dangerous because it can be used to inspect project files or extracted indices under the guise of content creation, violating least surprise and potentially leaking sensitive content.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill appears to rely on file read/write capabilities but does not declare any explicit tool scope or permission boundary. That creates hidden capability risk: the agent may access or modify local files beyond what users expect, especially because the workflow references reading source materials and generating many output files.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The description embeds many trigger phrases such as “短剧制作”, “生成短剧”, and “短剧项目”, several of which are broad enough to overlap with ordinary user requests rather than a narrowly scoped skill invocation. The file does not provide exclusion conditions or negative examples to clarify when the skill should not activate.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The instruction says prompt words 'must use Chinese natural language description', which imposes a language policy on outputs. Because the file does not offer opt-in language selection or explain that the skill is intentionally limited to a Chinese-only context, this 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
94% confidence
Finding

Line L135 explicitly requires shot descriptions to be written '用中文自然语言', which is a language-policy constraint expressed in natural language. Because the file does not provide an opt-in, alternative language option, or a documented region-specific justification, this is a policy violation under the locale/language rule.

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 instructions and examples are entirely in Chinese, including required output schema field meanings and workflow guidance, with no indication that another language is supported or that Chinese is optional. This creates a natural-language policy concern because the skill effectively imposes a specific language/locale on users without documented opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations. This markdown document presents all operational instructions and trigger examples only in Chinese, which effectively forces a specific language without user opt-in or any documented reason that the skill is region- or locale-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown guidance forces a specific language context throughout the file and provides no opt-in or alternative language option. Under the policy, language constraints should either be user-selectable or clearly documented as justified for a region-specific use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This markdown file contains natural-language instructions and output templates entirely in Chinese, including required output headings and fields. Because the skill does not indicate that Chinese is optional or that the skill is specifically limited to a Chinese-language context, it may violate language/locale policy by implicitly forcing a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document states that prompts '统一使用中文自然语言', which imposes a specific language policy across the system. This is a natural-language policy violation because it forces a locale/language choice without any opt-in or alternative path for users who may prefer another language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains natural-language descriptions and CLI help text that force a specific language for interaction. Under the policy, locale-specific language is a violation unless the skill offers user opt-in or clearly justifies a region-specific constraint, 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
96% confidence
Finding

The argparse help strings and printed status/error messages are all in Chinese, which imposes a fixed language on users. The file does not offer an alternative locale, a language selection flag, or a justified regional limitation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script trusts the filepath values from the JSON index and opens them directly, so anyone who can supply or tamper with the index can make the tool read arbitrary local files rather than only the intended indexed documents. In this skill context, the tool is explicitly designed for document retrieval, so this broadens its capability into unintended local file disclosure.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes an end-to-end pipeline for turning novels or story ideas into structured short-drama prompt packages, but this file implements a standalone document/code indexing CLI that scans directories, parses many file types, extracts keywords, computes file hashes, and writes a JSON index. Those operations are not part of the stated drama-generation workflow and represent materially different functionality rather than an obvious implementation detail.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script recursively reads supported files, extracts structural metadata and keywords, records absolute paths and hashes, and writes the aggregate output to a JSON file without any consent prompt, sensitivity warning, or exclusion safeguards beyond a few hardcoded directories. In the context of a skill unrelated to repository indexing, this increases concern because it can silently persist sensitive repository intelligence such as filenames, project structure, and content-derived terms that may expose secrets, internal code names, or private data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and CLI help text are entirely in Chinese, presenting the skill as Chinese-only behavior with no indication that users can opt into another language or locale. Under the policy, forcing a specific language without user choice is a natural-language policy violation unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

This JSON defines natural-language prompt content under hard-coded "en" and "cn" keys, and the same pattern continues throughout the file. Because there is no accompanying indication that the user can choose locale or that the locale is constrained for a justified regional purpose, this may reflect a language/locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest template sets "target_platform" to "抖音", which embeds a specific language/locale/platform assumption into the default configuration. Because the file provides no indication that this is optional, selectable, or region-specific by design, it may conflict with organizational expectations that skills not force a locale without user opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation states that the scene and characters in storyboard_prompt and video_prompt must completely match. However, the example shot at L161-L163 changes descriptive style details between the two prompts and omits the explicitly documented gender note in the storyboard prompt while adding broader dynamic content in the video prompt, making the example inconsistent with the stated strict correspondence rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

Line L053 instructs that variant names must use Chinese phrases, and the overall document content is exclusively in Chinese. This imposes a specific language choice without indicating user opt-in or documenting a justified locale-specific constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file consists solely of Chinese-language instructions and examples, with no indication that users may choose another language or locale. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

This markdown file contains user-facing instructions that consistently require Chinese-language output formats, labels, and examples, but it does not state that Chinese is optional or limited to a region-specific use case. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.