Back to skill

Security audit

paper-reader (XuRuitian version)

Security checks for vulnerabilities and agentic risk

Overview

This paper-reading skill is broadly purpose-aligned, but it has under-disclosed persistence and unsafe local file-writing behavior that users should review before installing.

Install only if you are comfortable with the skill reading uploaded papers, creating intermediate analysis data, and writing DOCX reports locally. Prefer using it in a constrained workspace, avoid sensitive unpublished documents, review or sanitize output filenames, and do not enable external web search unless you explicitly want paper context sent to search tools.

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

Warning
Location
scripts/generate_report.js:359
Finding

Path Traversal and Arbitrary File Overwrite Through Unvalidated Report Filename

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_report.js, lines 359-368
Vulnerability Type: Path traversal and unsafe file overwrite
Risk Level: Medium

Vulnerable Code

javascript
const data = JSON.parse(fs.readFileSync(jsonPath, 'utf-8'));
const outputPath = data.filename
  ? path.join(getDesktopPath(), `${data.filename}.docx`)
  : path.join(getDesktopPath(), '精读报告.docx');

const doc = generateDocument(data);
const buffer = await Packer.toBuffer(doc);
fs.writeFileSync(outputPath, buffer);
console.log('Word document created: ' + outputPath);

Technical Analysis

The filename property is read from an externally supplied JSON file and passed directly to path.join without validation or canonical-path containment checks. Contrary to the intended behavior, path.join does not guarantee that the resulting path remains inside the Desktop directory. Traversal components such as ../ are normalized and can move the destination outside that directory.

The destination is then passed to fs.writeFileSync, which overwrites an existing file by default. The operation may also follow a symbolic link at the destination. Appending .docx limits the resulting filename suffix but does not prevent directory traversal or replacement of an existing .docx-suffixed file.

Attack Path

  1. An attacker supplies or influences the JSON analysis file consumed by --data.
  2. The attacker sets filename to a traversal value such as ../../Documents/target.
  3. The user or agent executes:
    bash
    node scripts/generate_report.js --data attacker-controlled.json
    
  4. path.join normalizes the traversal components, producing a destination outside the Desktop directory.
  5. fs.writeFileSync creates or overwrites target.docx at that destination.
  6. If the selected destination is a symbolic link, the process may overwrite the link target instead.

Exploitation is constrained b ...[truncated 720 chars]

Remediation
View remediation

Remediation Suggestions

  • Treat data.filename as an untrusted basename rather than a path.
  • Reject absolute paths, path separators, . and .. components, control characters, and platform-specific separator variants.
  • Apply a strict allowlist for report names, such as letters, numbers, spaces, underscores, and hyphens.
  • Resolve both the Desktop directory and final destination with path.resolve, then verify that the destination remains beneath the Desktop directory.
  • Detect existing files and request confirmation or generate a unique filename instead of overwriting them silently.
  • Where overwrite behavior is unnecessary, use exclusive creation flags such as { flag: 'wx' }.
  • Consider checking for symbolic links before writing and using a safer file-creation strategy that minimizes time-of-check/time-of-use races.

Example hardening logic:

javascript
const desktop = path.resolve(getDesktopPath());
const requestedName = String(data.filename || 'reading-report');

if (
  requestedName !== path.basename(requestedName) ||
  !/^[A-Za-z0-9 _-]+$/.test(requestedName)
) {
  throw new Error('Invalid report filename');
}

const outputPath = path.resolve(desktop, `${requestedName}.docx`);
if (!outputPath.startsWith(desktop + path.sep)) {
  throw new Error('Output path escapes the Desktop directory');
}

fs.writeFileSync(outputPath, buffer, { flag: 'wx' });

T08 · Insecure Dependencies

Note
Location
README.md:40
Finding

Unpinned and Globally Installed Third-Party Dependencies

Content
View full analysis

Vulnerability Details

File Location: README.md, lines 40-48
Vulnerability Type: Uncontrolled third-party dependency resolution
Risk Level: Low

Vulnerable Code

bash
pip install PyMuPDF pdfplumber python-docx openpyxl xlrd python-pptx
bash
npm install -g docx

Technical Analysis

The installation instructions do not pin package versions, provide integrity hashes, or use repository lockfiles. Package managers therefore resolve mutable package versions from their configured registries at installation time. The effective code installed on a user's system can change without any corresponding modification to the audited project.

The docx package is also installed globally. A global installation unnecessarily broadens the package's effect on the user's environment and makes dependency provenance and reproducibility more difficult to control.

No evidence was found that the named packages are intentionally malicious. The issue is the absence of controls that would constrain dependency resolution to reviewed artifacts.

Attack Path

  1. A user follows the dependency installation commands in README.md.
  2. pip and npm resolve the latest versions available from the user's configured registries.
  3. A compromised upstream release, registry account, registry mirror, or dependency in the transitive dependency tree is selected.
  4. Package installation or subsequent package loading executes the compromised dependency code with the privileges of the user performing the installation.
  5. A globally installed Node.js package can affect other projects or workflows that resolve packages through the global module path.

This attack path depends on compromise or manipulation of the package supply chain; the repository itself does not contain a demonstrated malicious dependency payload.

Impact Assessment

A compromised dependency could execute code with the installing user's privileges. ...[truncated 417 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin every direct dependency to a reviewed version.
  • Provide a hash-verified Python requirements file, generated through a dependency-management process that also reviews transitive dependencies.
  • Add a local package.json and lockfile for Node.js dependencies.
  • Replace global installation with a project-local installation.
  • Document trusted package registries and avoid unreviewed registry mirrors.
  • Use automated dependency scanning and update dependencies through reviewed pull requests.
  • Run document parsers with least privilege because they process potentially hostile document formats.

Example installation approach:

bash
python -m pip install --require-hashes -r requirements.txt
npm ci

The project should commit requirements.txt with exact versions and hashes, along with package.json and a generated lockfile.

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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This second mismatch is more concrete: the skill promises file parsing and multilingual analysis, yet also performs undeclared local file writing to the Desktop. Undisclosed side effects combined with overstated capabilities can cause users to expose local documents or accept writes they did not knowingly authorize.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This second mismatch is more concrete: the skill promises file parsing and multilingual analysis, yet also performs undeclared local file writing to the Desktop. Undisclosed side effects combined with overstated capabilities can cause users to expose local documents or accept writes they did not knowingly authorize.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README's security statement is inaccurate: it claims the skill only performs read-only text extraction, while the documented workflow explicitly creates and writes a Word file to the user's desktop. This is a security-relevant misrepresentation because users and reviewers may grant broader trust or consent based on a false understanding of the skill's side effects.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill instructs use of shell execution plus local file read/write behavior, but it declares no explicit tool scope or permissions boundary. This is dangerous because an agent may execute filesystem and shell actions more broadly than users expect, reducing transparency and weakening policy enforcement around sensitive local operations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad and conversational, increasing the chance the skill activates unintentionally for vague requests. In this context, unintended activation matters because the skill can read uploaded files and initiate downstream local file-writing behavior, making accidental invocation more than a mere UX issue.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill mandates automatic creation of a Word file on the user's Desktop, which exceeds a normal read/analyze workflow and introduces an unprompted side effect on the local system. Even if not overtly malicious, automatic writes can leak sensitive paper contents into persistent storage, create clutter, or overwrite user expectations about where data is stored.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill promises automatic saving to the Desktop without an upfront warning or consent flow, which is a risky surprise side effect. Because the written document may contain extracted content from user-uploaded papers, this can create unintended local persistence of sensitive or copyrighted material.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The instruction “中文书写,学术名词附英文” mandates Chinese as the output language. This is a language-policy constraint presented without user opt-in or an explicit choice, which can violate locale or language preference policies.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The workflow requires writing both an intermediate JSON file and a final DOCX file, turning a nominal analysis skill into a persistent file-writing process. Intermediate storage is risky because it may retain sensitive extracted content longer than necessary and may be accessible to other local processes or users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The instruction to write analysis data to a local JSON file creates undisclosed intermediate storage of document-derived content. This is dangerous because users may believe the skill only analyzes content transiently, while in reality it persists structured extracts that may remain on disk and expose sensitive information.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Line L099 explicitly requires responses to be written in Chinese, with no opt-in or alternative language option. This is a natural-language locale policy issue because it forces a specific language regardless of user preference or context.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill is advertised as analyzing user-uploaded academic documents, but these instructions explicitly expand scope to external web searches for 'latest research', market data, regulations, and clinical guidance. That creates a scope drift risk: the agent may retrieve untrusted or unnecessary external content, disclose user context to third-party services, or produce results influenced by live web data rather than the uploaded paper alone.

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 documentation and runtime messages exclusively in Chinese, including the tool description and later CLI/help/log output. That imposes a language choice on users without any opt-in or alternative locale, which matches the policy's language/locale violation criterion.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill processes untrusted .doc files by delegating parsing to external system commands (textutil/antiword). In a document-ingestion skill, this increases attack surface because malformed files may trigger vulnerabilities in those external parsers or cause unintended host interaction outside the Python runtime.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/extract_text.py (reported line 82)May include surrounding context.

python
if system == "Darwin":
        import subprocess
        try:
            result = subprocess.run(
                ["textutil", "-convert", "txt", "-stdout", filepath],
                capture_output=True, text=True, timeout=30
            )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/extract_text.py (reported line 97)May include surrounding context.

python
# python-docx 本身不支持 .doc,但可以通过 antiword 备选
            import subprocess
            # 尝试 antiword(需安装)
            result = subprocess.run(
                ["antiword", filepath], capture_output=True, text=True, timeout=30
            )
            if result.returncode == 0:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Argument descriptions, error messages, and completion notices are all presented only in Chinese, and the script exposes no flag or configuration for language preference. This forces one locale for operational interaction, which is a natural-language policy issue under the provided rules.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script accepts an arbitrary --output path and writes extracted document contents there, which expands capability from pure analysis into file-writing. In an agent skill context, that can enable unintended overwrite of files accessible to the agent environment, especially if higher-level orchestration passes attacker-influenced paths.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script writes a .docx file to the user's Desktop based on input data, which is a file-system side effect beyond pure analysis/reporting and may violate least-privilege expectations for a paper-reading skill. While this is not overtly malicious, it creates or overwrites files in a user-visible location without an explicit, constrained output path or clear consent flow, increasing the risk of unwanted file creation and data handling outside the stated scope.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The manifest and prompt overview emphasize output structured around six dimensions, but these lines introduce an additional mandatory '灵感时刻' section and label it as the most critical part of the report. This is not merely omitted detail; it changes the stated primary intent of the report from six-dimension analysis to idea generation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code file includes natural-language instructions and usage text exclusively in Chinese, such as the header description and usage guidance. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless the constraint is explicitly justified, which is not present here.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The skill's stated purpose is deep reading and analysis of academic papers, but this code inspects HOME/USERPROFILE to derive the Desktop path for file output. Accessing environment-derived user location data is ancillary system access that is not inherent to academic document analysis as described.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.