Back to skill

Security audit

Coc Helper

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent tabletop-game helper that writes only local game session state, with some quality and input-validation issues users should understand.

Reasonable to install for local tabletop use. Avoid running it on untrusted dice or SAN expressions until dice-count limits are added, and be aware that investigator data and rules are stored locally in session.json and delete/reset actions are immediate.

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
lib/dice.mjs:45
Finding

Unbounded Dice Count Enables Local Resource Exhaustion

Content
View full analysis
{ const trimmed = String(expr).trim(); if (/^-?\d+$/.test(trimmed)) { return { spec: trimmed, total: parseInt(trimmed, 10), fixed: true }; } return rollDice(trimmed, rng); }; ``` ### Technical Analysis The dice-expression parser accepts an arbitrary sequence of digits for the dice count and does not enforce an upper bound. `rollDice()` then performs one random-number operation and one array insertion for every requested die. An input such as `1000000000d6` therefore attempts to execute one billion loop iterations while retaining one billion roll results in memory. This can consume all available CPU and heap memory, trigger garbage-collection pressure, terminate the Node.js process with an out-of-memory error, or make the host unresponsive. The issue is directly exposed by ...[truncated 1894 chars]
Remediation
View remediation
MAX_DICE_COUNT) { throw new Error(`Dice count must be between 1 and ${MAX_DICE_COUNT}`); } if (!Number.isSafeInteger(sides) || sides < 1 || sides > MAX_DICE_SIDES) { throw new Error(`Dice sides must be between 1 and ${MAX_DICE_SIDES}`); } if ( !Number.isSafeInteger(multiplier) || multiplier < 1 || multiplier > MAX_MULTIPLIER ) { throw new Error("Dice multiplier is outside the permitted range"); } if ( !Number.isSafeInteger(modifier) || Math.abs(modifier) > MAX_ABSOLUTE_MODIFIER ) { throw new Error("Dice modifier is outside the permitted range"); } ``` 2. Apply the same validated parser to every dice-input path, including SAN success and failure loss expressions. Do not maintain separate permissive parsing logic. 3. Reject values that are not safe integers. This prevents very large decimal strings from producing imprecise or non-finite JavaScript numbers. 4. Limit output size independently of computation. If high dice counts are legitimately required, calculate the total incrementally and retain only a bounded sample instead of storing every roll. 5. When invoked by an agent or server, add defense-in-depth controls such as execution timeouts, memory limits, worker-process isolation, and maximum command-length limits. 6. Add regression tests for boundary and abusive inputs, including: - The maximum accepted dice count. - One count above the maximum. - Extremely long numeric counts. - Excessive side counts, multipliers, and modifiers. - Malicious expressions supplied through both `roll` and `san check`. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (21)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
Entry script: `cli.mjs` (Node.js ESM, zero dependencies, requires Node ≥ 18).

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · PROPOSAL.md (reported line 295)May include surrounding context.

md
These sheets are extracted to JSON and shipped in `lib/tables.mjs`:

| Source sheet                 | Data                                                                                                                            |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| 职业列表 (Occupations)       | Selected 30 occupations: credit rating range, occupational attribute formula, skill list, contacts, description                 |
| 本职技能 (Occupation skills) | Skill-group definitions used by occupations                                                                                     |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · PROPOSAL.md (reported line 298)May include surrounding context.

md
| Source sheet                 | Data                                                                                                                            |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| 职业列表 (Occupations)       | Selected 30 occupations: credit rating range, occupational attribute formula, skill list, contacts, description                 |
| 本职技能 (Occupation skills) | Skill-group definitions used by occupations                                                                                     |
| 武器列表 战斗 (Weapons)      | Selected 22 weapons: type, skill, damage, range, penetration, attacks/round, magazine, malfunction, era, price (1920s / modern) |
| 疯狂表 (Madness)             | 10 instant-sanity symptoms, 10 summary-sanity symptoms, phobia table, mania table                                               |
| 资产及物价参考 (Assets)      | (future) Credit-rating → cash/assets levels, item prices                                                                        |

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · PROPOSAL.zh.md (reported line 295)May include surrounding context.

md
下列工作表导出为 JSON 内置在 `lib/tables.mjs`:

| 源工作表       | 数据                                                                                           |
| -------------- | ---------------------------------------------------------------------------------------------- |
| 职业列表       | 精选 30 个职业:信用评级范围、职业属性公式、技能列表、关系人、介绍                             |
| 本职技能       | 各职业使用的技能组定义                                                                         |

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The help text documents persistent writes to session.json and the code supports deletion and multiple state-changing operations, but there is no visible confirmation prompt or warning before actions like inv delete, config reset, or other persistent updates. Because these operations alter stored user data irreversibly or semi-irreversibly, the file lacks user-facing disclosure for safety-critical state changes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code file contains user-facing natural-language labels, comments, error messages, and reasons primarily in Chinese, including bilingual labels that still default to Chinese-first phrasing. Under the policy, forcing a specific language or locale without explicit user opt-in or a documented region-specific justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The deleteInvestigator function removes stored investigator records and saves the modified session immediately, but there is no confirmation step, user-facing disclosure, or warning comment indicating that the deletion is destructive. This is an irreversible state-changing operation affecting persisted user data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file's human-facing comments and thrown error messages are entirely in Chinese, including the user-visible error at L120 and range-validation errors at L151 and L154. This suggests a fixed language choice without any documented user opt-in or locale-selection mechanism.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This file’s natural-language content, including comments and returned note/detail/notes strings, is entirely in Chinese and does not provide any user opt-in or alternative locale. Under the policy, forcing a specific language without user choice is a natural-language policy violation unless the locale restriction is clearly justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The helper text in sanThreshold() tells users that dropping below SAN/5 causes indefinite insanity, but the main implementation and comments elsewhere use different triggers: cumulative daily loss or a large single-loss event. In a tabletop assistant, misleading rule guidance can directly cause incorrect game-state decisions and inconsistent downstream automation, especially if users or chained tools rely on this text as authoritative output.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The markdown explicitly says session state is persisted to JSON, which affects user data by storing character and session information locally. There is no accompanying warning about automatic persistence, retention, or where data will be stored until later architectural notes, and no user-facing caution is provided near the feature description.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The command inv delete <name> removes investigator data, which is an irreversible user-data operation unless backups exist. The proposal lists the command but does not mention confirmation, recovery limits, or any caution to the user.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

该文件明确指向“权威的 v1.0 描述见 SKILL.zh.md”,并且整份技能说明与触发示例均固定为中文语境。按规则,若未向用户提供语言选择或明确的区域性合理性说明,这类自然语言约束可构成语言/locale 政策问题。

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The markdown states that SAN changes persist to session.json, which means user-created investigator/session data is written to disk. While persistence is part of the skill's purpose, this section does not explicitly warn users that local session data will be stored and retained between runs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This section explains that investigator state persists to session.json, which affects user data retention on disk. The description is factual but does not clearly warn users about the privacy/integrity implication that character data will remain locally stored across commands.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code file contains natural-language strings that largely force a Chinese interface for commands, help text, and operational messages, while only a narrow --zh|--en option exists for NPC/name generation rather than the CLI as a whole. That creates a locale-policy concern because users are not given a general opt-in or language selection for the main skill interaction surface.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This module writes investigator session data to session.json and later supports deletion of investigator records, but the code provides no confirmation prompt, user-facing log/print, or warning comment/docstring that these operations persist and overwrite user data. Because these are file-modifying operations with cross-command persistence, the lack of explicit disclosure is a safety-quality gap under the code-file warning criterion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

This code performs persistent file writes to session.json via a temporary file and rename sequence, which affects user data on disk. Although comments describe the persistence behavior, there is no user-facing confirmation, prompt, or runtime disclosure in the code around the write operation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The API documentation and function signature state that lang defaults to 'en', which imposes a specific language choice by default rather than offering a neutral or user-selected locale. Under the policy, forcing a specific language without opt-in can be a natural-language locale violation unless clearly justified as a region-specific constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

randomNpc inherits the same locale behavior by defaulting lang to 'en' in its API contract and implementation. This makes English the implicit output language for generated content without an explicit user choice, which can conflict with the language/locale policy.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest describes the skill as a tabletop assistant focused on dice, SAN mechanics, investigator management, tables, NPCs, combat initiative, and configurable rules. This file additionally implements a plot/story hook generator, which is a creative scenario-generation feature not clearly covered by those stated capabilities.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.