Back to skill

Security audit

施炜诊断方法论

Security checks for vulnerabilities and agentic risk

Overview

The skill is not clearly malicious, but its PPT scripts are unsafe and mismatched enough that users should review it before installing.

Install only after reviewing or fixing the scripts. At minimum, make the PPT generator read explicit input/output paths, remove the hard-coded client deck/output path, replace execSync shell execution with execFileSync or spawnSync argument arrays, pin dependencies with a lockfile, and add clear consent and confidentiality rules before processing company interviews, questionnaires, financial data, or leadership materials.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/audit_ppt.js:212
Finding

Arbitrary Command Execution Through a Crafted PPTX File Path

Content
View full analysis

Vulnerability Details

File Location: scripts/audit_ppt.js:212-253
Vulnerability Type: OS command injection through shell-based subprocess execution
Risk Level: High

Vulnerable Code:

javascript
const pythonScript = `
import sys
try:
    from pptx import Presentation
    from pptx.util import Inches, Pt
except ImportError:
    print("PYTHON_PPTX_NOT_INSTALLED")
    sys.exit(1)

prs = Presentation(r"${pptxPath.replace(/\\/g, "\\\\")}")
print(f"SLIDE_COUNT:{len(prs.slides)}")

# Check each slide for size and content overflow
for i, slide in enumerate(prs.slides):
    page_num = i + 1
    for shape in slide.shapes:
        if shape.has_text_frame:
            try:
                x = shape.left / 914400
                y = shape.top / 914400
                w = shape.width / 914400
                h = shape.height / 914400
                if y + h > 5.5:
                    print(f"OVERFLOW:p{page_num}:y={y:.2f},h={h:.2f},y+h={y + h:.2f}")
                if x + w > 9.8:
                    print(f"RIGHT_OVERFLOW:p{page_num}:x={x:.2f},w={w:.2f},x+w={x + w:.2f}")
            except:
                pass

print("PYTHON_AUDIT_DONE")
`;

try {
  const result = execSync(`python3 -c "${pythonScript.replace(/"/g, '\\"')}"`, {
    encoding: "utf8",
    timeout: 30000,
  });

Technical Analysis

The PPTX path originates from a command-line argument and is inserted directly into dynamically generated Python source. The resulting Python program is then placed inside a shell command executed through execSync().

The implementation only doubles backslashes in the path and escapes double quotes in the final Python source. It does not neutralize shell substitutions such as $() or backticks. Because string-based execSync() uses a shell by default, shell metacharacters embedded in a valid filename can be interpreted before Python starts.

The preceding `fs.exi ...[truncated 1682 chars]

Remediation
View remediation

Remediation Suggestions

  • Eliminate shell interpretation by replacing string-based execSync() with execFileSync() or spawnSync() and passing arguments as an array.
  • Pass the PPTX path as a separate Python argument instead of embedding it in Python source:
    javascript
    const { execFileSync } = require("child_process");
    
    const pythonScript = `
    import sys
    from pptx import Presentation
    
    pptx_path = sys.argv[1]
    prs = Presentation(pptx_path)
    print(f"SLIDE_COUNT:{len(prs.slides)}")
    `;
    
    const result = execFileSync(
      "python3",
      ["-c", pythonScript, pptxPath],
      {
        encoding: "utf8",
        timeout: 30000,
        shell: false,
      }
    );
    
  • Verify with fs.statSync() that the supplied path refers to a regular file.
  • Resolve the path with path.resolve() and, when audits are restricted to a workspace, ensure the resolved path remains inside that approved directory.
  • Retain the .pptx extension check as a file-type hint, but do not treat it as a security boundary.
  • Add regression tests using filenames containing spaces, quotes, dollar signs, parentheses, backticks, and newline characters.

T08 · Insecure Dependencies

Warning
Location
scripts/generate_ppt.js:14
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_ppt.js:14-17
Vulnerability Type: Unpinned npm dependency and non-reproducible supply-chain installation
Risk Level: Medium

Vulnerable Code:

javascript
 * 依赖:npm install pptxgenjs
 */

const pptxgen = require("pptxgenjs");

Technical Analysis

The script instructs users to install pptxgenjs without an exact version. The project does not provide a package.json or lockfile in the audited directory structure, so npm resolves whichever package and transitive dependency versions are current at installation time.

This makes execution non-reproducible and allows dependency behavior to change after the Skill has been reviewed. npm packages may also execute lifecycle scripts during installation. A future compromised release, compromised maintainer account, or malicious transitive dependency could consequently execute code in the installation environment.

The audit found no evidence that the currently named package is intentionally malicious. The risk arises from the unsafe and unpinned dependency acquisition process.

Attack Path

  1. A user follows the source-code instruction and runs:
    bash
    npm install pptxgenjs
    
  2. npm resolves the latest available package version and its current transitive dependency graph.
  3. If a resolved package version or transitive dependency has been compromised, its installation scripts or runtime code execute in the user's environment.
  4. The compromised component inherits the permissions of the npm or Node.js process and can access data available to that account.
  5. Subsequent execution of generate_ppt.js loads the installed package through require("pptxgenjs"), providing another code-execution opportunity.

Impact Assessment

A compromised dependency could execute arbitrary code with the privileges of the installing or report-generating user. Potential exposure includes diagnos ...[truncated 421 chars]

Remediation
View remediation

Remediation Suggestions

  • Add a project-level package.json that declares an exact reviewed version of pptxgenjs; avoid version ranges such as ^ and ~.
  • Generate and commit package-lock.json so direct and transitive dependency versions and integrity hashes are fixed.
  • Replace ad hoc installation instructions with:
    bash
    npm ci
    
  • Review package provenance, maintainers, published artifacts, lifecycle scripts, and the complete transitive dependency tree before approving a version.
  • Use automated dependency scanning and update packages only through reviewed change requests.
  • Where operationally appropriate, install dependencies with lifecycle scripts disabled during validation:
    bash
    npm ci --ignore-scripts
    
    Confirm first that the approved dependency does not legitimately require an installation script.
  • Run package installation and PPT generation in a restricted environment with minimal filesystem access, no unnecessary credentials, and no elevated privileges.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (24)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documented skill promises general-purpose enterprise diagnosis and structured MD/PPT output, but the referenced implementation behavior appears to be a fixed, project-specific PPT workflow rather than dynamic diagnosis from user inputs. This creates a trust boundary problem: operators may rely on the declared behavior while hidden or mismatched implementation performs unrelated processing, which is especially risky in agent environments.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The documented skill promises general-purpose enterprise diagnosis and structured MD/PPT output, but the referenced implementation behavior appears to be a fixed, project-specific PPT workflow rather than dynamic diagnosis from user inputs. This creates a trust boundary problem: operators may rely on the declared behavior while hidden or mismatched implementation performs unrelated processing, which is especially risky in agent environments.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **方式A(推荐)**:运行同目录下的 `audit_ppt.js` 自动化审计脚本,输出 PASS/FAIL 报告

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **方式A(推荐)**:运行同目录下的 `audit_ppt.js` 自动化审计脚本,输出 PASS/FAIL 报告

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **方式A(推荐)**:运行同目录下的 `audit_ppt.js` 自动化审计脚本,输出 PASS/FAIL 报告

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**门禁规则**:FAIL项 > 0 时,必须先修复(自动修复或手动修改 `generate_ppt.js`),重新生成后重新审计,直到全部 PASS 才可调用的 `present_files` 交付给用户。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**门禁规则**:FAIL项 > 0 时,必须先修复(自动修复或手动修改 `generate_ppt.js`),重新生成后重新审计,直到全部 PASS 才可调用的 `present_files` 交付给用户。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
**门禁规则**:FAIL项 > 0 时,必须先修复(自动修复或手动修改 `generate_ppt.js`),重新生成后重新审计,直到全部 PASS 才可调用的 `present_files` 交付给用户。

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file comments explicitly state a generalized approach: read the diagnosis MD, follow the reference structure, and extract slides content from MD instead of hard-coding it. The implementation contradicts this intent by embedding all report content directly in code across the presentation-building logic.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script advertises that it accepts a Markdown input path and an output .pptx path, but it ignores both and instead always generates a fixed deck to a hard-coded filesystem location. In an agent or automation context, this is dangerous because callers may believe user-selected data is being processed while the script silently writes elsewhere, causing data misrouting, accidental overwrites, and broken trust boundaries between user input and file output.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger terms are very broad and match common business language, making unintentional activation likely. Overbroad activation increases the chance that the skill will process unrelated conversations or sensitive business content without clear user intent, which is a security and privacy risk in agent systems.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill directs collection and analysis of interviews, questionnaires, leadership remarks, and company materials, all of which may contain sensitive personal, strategic, or confidential business data, but it provides no privacy or data-handling safeguards. In consulting and enterprise contexts, this omission can lead to over-collection, improper processing, or disclosure of sensitive information.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The instruction to 'automatically enter' the workflow when users provide materials lacks explicit consent and scope controls. In practice, this can cause the skill to begin processing uploaded company documents, interview notes, or questionnaire data without a clear activation handshake, increasing privacy and overreach risks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file title and introductory text present the report template entirely in Chinese and define it as the standard structure and writing规范 for the final document. There is no indication that language selection is optional or that the Chinese-only requirement is justified by a region-specific compliance or business constraint, which creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

该技能清单声明的核心能力是基于施炜方法论进行企业管理诊断,并输出结构化诊断文档/可参照模板生成诊断PPT。这里的代码实际实现的是对PPT文件和PPT生成脚本进行版式/合规审计,还会检查页数、颜色、箭头、溢出等演示文稿工程细节,这属于独立的PPT质量审计能力,而非管理诊断本身。

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script invokes an external Python interpreter and passes a dynamically constructed command string through execSync. Even though the intended purpose is PPT inspection, this expands execution capability beyond simple file auditing and creates command-injection risk if the PPT path or embedded script content can influence shell parsing. In this skill context, the extra interpreter execution is more dangerous because the declared business-diagnosis use case does not require shelling out, so users may not expect code execution side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code executes python3 -c via execSync using a dynamically assembled shell command, with the PPTX path embedded into the Python snippet and the whole payload shell-escaped only by ad hoc string replacement. This is dangerous because shell invocation plus interpreter inline code increases the attack surface for command injection or quoting bypasses, especially if an attacker can control filenames or execution context. In this skill, the behavior is less justified by the stated purpose, making unexpected code execution more concerning.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Writing the output PPT to a fixed local path without user control or confirmation can overwrite existing files and place generated content in an unintended location. In a skill/agent environment, this increases the risk of unauthorized file modification, leakage of potentially sensitive report data to a predictable path, and unsafe assumptions about the host filesystem.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

Embedding shell command fragments directly in a methodology document, especially with a side-effecting echo, blurs the line between documentation and executable instructions. In an agent or automation context, this can lead to accidental command execution or parser confusion, producing unintended local side effects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This markdown file is written entirely in Chinese from the title onward, with no indication that alternate languages are supported or that the user can choose their preferred locale. Under the stated 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.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document title and all instructional content are written exclusively in Chinese, with no indication that other languages are supported or that the user can choose a preferred locale. Under the policy rule for natural-language violations, a skill that effectively mandates a specific language without opt-in should be flagged.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

模块头部文档明确写的是“德施曼诊断PPT生成审计脚本”,而该技能清单宣称的是通用的施炜企业管理诊断方法论能力。虽然代码确实在做PPT审计,但这段文档把目标对象限定为特定客户/项目,和技能层面的通用方法论定位发生了意图层面的偏移。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file’s user-facing header and usage instructions are written only in Chinese, and the runtime output messages throughout the script also assume Chinese as the interaction language. Under the language/locale policy, forcing a specific language without opt-in can be 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
86% confidence
Finding

The natural-language content throughout the script is fixed in Chinese, including titles, labels, and report text, with no indication that the user can select another language. The policy for natural-language violations applies to all file types and flags forcing a specific language or locale without user opt-in or clear documented justification.

Content

No source excerpt is available for this finding.