Back to skill

Security audit

故事接龙

Security checks for vulnerabilities and agentic risk

Overview

This story-writing skill is not clearly malicious, but it has unsafe local file handling and overstates its AI, image, and collaboration features.

Review this skill carefully before installing. Use it only in a contained, non-sensitive environment, avoid passing hand-written or path-like story IDs, and do not store important JSON files near its workspace until story ID validation and delete confirmation are added. Also treat the advertised AI, image, and collaboration capabilities as not implemented in this artifact.

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

Error
Location
index.js:163
Finding

Path Traversal Allows Unauthorized JSON File Reading, Modification, and Deletion

Content
View full analysis

Vulnerability Details

File Location: index.js:163-169, index.js:178-181, index.js:469-482, and index.js:508-523
Vulnerability Type: Path traversal through an unvalidated story identifier
Risk Level: High
Classification: T09: Insecure Skill Coding Practices

Vulnerable Code

The story identifier is inserted directly into a filesystem path when reading a story:

js
function getStory(storyId) {
  const storyFile = path.join(STORIES_DIR, `${storyId}.json`);
  if (!fs.existsSync(storyFile)) {
    return null;
  }
  try {
    return JSON.parse(fs.readFileSync(storyFile, 'utf-8'));
  } catch (e) {
    return null;
  }
}

A story object's id is similarly trusted when saving it:

js
function saveStory(story) {
  const storyFile = path.join(STORIES_DIR, `${story.id}.json`);
  story.updatedAt = Date.now();
  fs.writeFileSync(storyFile, JSON.stringify(story, null, 2));
}

The switch command accepts the identifier directly from command-line input and passes it to getStory:

js
case 'switch':
case '切换': {
  const storyId = args[1];
  if (!storyId) {
    console.log('❌ Please provide a story ID');
    console.log('Usage: node index.js switch <story ID>');
    return;
  }

  const story = getStory(storyId);
  if (!story) {
    console.log('❌ Story does not exist');
    return;
  }

  setCurrentStoryId(storyId);
  console.log(`\n✅ Switched to story: ${story.title}`);
  console.log(`📖 ID: ${storyId}`);
  break;
}

The delete command also constructs a path directly from the untrusted identifier:

js
case 'delete':
case '删除': {
  const storyId = args[1];
  if (!storyId) {
    console.log('❌ 请提供故事ID');
    console.log('用法: node index.js delete <故事ID>');
    return;
  }

  const storyFile = path.join(STORIES_DIR, `${storyId}.json`);
  if (!fs.existsSync(storyFile)) {
    console.log('❌ 故
...[truncated 4006 chars]
Remediation
View remediation

Remediation Suggestions

  1. Strictly validate story identifiers

    Require the canonical generated format before performing any filesystem operation:

    js
    function validateStoryId(storyId) {
      if (typeof storyId !== 'string' || !/^STORY-[A-Z0-9]{4}$/.test(storyId)) {
        throw new Error('Invalid story ID');
      }
      return storyId;
    }
    
  2. Resolve and contain every story path

    Use path.resolve() and verify that the final path remains inside the intended directory:

    js
    function getStoryPath(storyId) {
      validateStoryId(storyId);
    
      const base = path.resolve(STORIES_DIR);
      const candidate = path.resolve(base, `${storyId}.json`);
    
      if (!candidate.startsWith(`${base}${path.sep}`)) {
        throw new Error('Story path escapes the story directory');
      }
    
      return candidate;
    }
    

    Use this centralized function for all story reads, writes, switches, and deletions.

  3. Reject dangerous path syntax explicitly

    Reject absolute paths, .., path separators, null bytes, and platform-specific separators before path construction. Strict allowlist validation should remain the primary control.

  4. Do not trust identifiers loaded from JSON

    Before calling saveStory(story), validate story.id. Prefer passing the already validated active story ID separately rather than deriving the destination path from file contents.

  5. Validate persisted state

    Validate currentStoryId after reading current.json. If it is malformed, reject it and clear the active-story state rather than passing it to filesystem functions.

  6. Apply least privilege

    Avoid a hard-coded root-owned workspace and do not run the application as root. Store data in a configurable, user-owned directory with restrictive permissions.

  7. Use safer deletion controls

    Resolve and validate the target before deletion, verify that it is a regula ...[truncated 335 chars]

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill documentation materially overstates capabilities and understates behavior, especially around AI generation, multi-user collaboration, image generation, and local file operations. This is dangerous because users may grant trust or use the skill under false assumptions, leading to unexpected data persistence, deletions, or reliance on nonexistent privacy/collaboration guarantees.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The top-level documentation presents "AI智能续写" and "支持图文生成" as existing functionality. However, the roadmap later states "接入真实AI模型进行续写" and "支持图文生成" as future work, which directly contradicts the earlier claims about what the skill currently does.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The quick-start section says the AI will generate the opening and automatically continue the next chapter, implying implemented AI behavior. Later, the development plan states that integrating a real AI model for continuation is still pending, so the documentation's examples overstate current behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file documents a delete <ID> command, which is a destructive operation affecting user data, but provides no warning about deletion consequences, permanence, or recovery. Under the markdown-specific SQP-2 criteria, destructive behavior should be disclosed so users understand the risk before invoking the command.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description, examples, and command list are entirely in Chinese and present Chinese command phrases as the activation/interface language, with no indication that other languages are supported or that the Chinese locale is an intentional limitation. Per policy, forcing a specific language without user opt-in or justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Documenting a deletion command without warning about irreversible data loss or requiring confirmation increases the risk of accidental destruction of story data. In a creative-writing skill where users may accumulate substantial content, an unsafe delete flow can cause meaningful user harm even if it is not a system-compromise issue.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest and header describe 'AI智能续写,支持图文生成', implying AI-backed continuation and image generation features. In reality, the implementation uses hardcoded text templates for openings and continuations (L240-L311) and contains no image generation logic at all, so the delivered behavior is materially narrower than claimed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code permanently deletes a story file with fs.unlinkSync and only notifies the user after the deletion has already occurred. There is no confirmation prompt, pre-delete warning, or explanatory comment/docstring indicating that this command irreversibly removes stored story data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README consistently presents the skill interface and instructions in Chinese, and does not indicate that users may choose another language or that the skill is intentionally region-specific. This can violate a language/locale policy when a specific language is effectively forced without opt-in or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The skill advertises automatic saving and persistent storage but does not warn users that their story content will be stored locally. This can expose sensitive or personal creative content to unintended retention, especially on shared systems or environments where users assume the session is ephemeral.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The configuration sets defaultStyle to 悬疑, which imposes a Chinese-language locale/value by default with no indication of user choice or opt-in. The policy for this audit flags language or locale constraints when they are enforced without an explicit user-selectable option or documented justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill hard-codes the locale 'zh-CN' when formatting timestamps, which forces a specific language/locale presentation regardless of user preference. The file also uses Chinese-only user-facing text throughout, but does not offer a locale option or explain that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The comment '实际应该调用AI' explicitly indicates the function is expected to use AI for continuation, but the code immediately below only selects from static continuation templates. This is an intent-level contradiction between the documentation comment and the implemented behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill hard-codes the locale 'zh-CN' when formatting timestamps, which forces a specific language/locale presentation regardless of user preference. The file also uses Chinese-only user-facing text throughout, but does not offer a locale option or explain that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill hard-codes the locale 'zh-CN' when formatting timestamps, which forces a specific language/locale presentation regardless of user preference. The file also uses Chinese-only user-facing text throughout, but does not offer a locale option or explain that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The natural-language description at L04 is entirely in Chinese, which imposes a specific language context without indicating that users can choose another language or that the skill is region-specific. Under the policy criteria, this is a language/locale constraint that should be explicitly optional or justified.

Content

No source excerpt is available for this finding.