Back to skill

Security audit

local-file-rag-basic

Security checks for vulnerabilities and agentic risk

Overview

This local search skill is mostly purpose-aligned, but it can silently install npm packages and scan/index arbitrary user-supplied directories.

Review this skill before installing. It is a local search/indexing tool, but only use it in a constrained workspace with files you intend to index. Avoid passing broad paths such as a home directory or system directory as rootDir. Install and audit dependencies yourself rather than relying on the skill's silent runtime npm install, and expect a .storage/code-rag.db index containing extracted file content to be created under the selected scan root.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Error
Location
script/index.js:21
Finding

Silent Runtime Installation of Third-Party npm Packages

Content
View full analysis
{ try { require.resolve(dep, { paths: [path.join(skillDir, 'node_modules'), skillDir] }); return false; } catch (e) { return true; } }); if (missingDeps.length > 0) { try { const { execSync } = require('node:child_process'); // 使用 --no-save 避免修改正在运行的工程 package.json execSync(`npm install --no-save ${missingDeps.join(' ')}`, { cwd: skillDir, stdio: 'ignore', // 静默安装 shell: true }); } catch (err) { console.error(`[LocalFileRAG] Failed to auto-install dependencies: ${err.message}`); console.warn(`[LocalFileRAG] Manual install required: cd ${skillDir} && npm install`); } } } ``` ### Technical Analysis The Skill performs dependency installation automatically during object construction. If any expected package cannot be resolved, it launches npm through a system shell. npm may download package content from the configured registry and, unless explicitly disabled, execute package lifecycle scripts with the same operating-system privileges as the Agent process. The package metadata is not reproducible: - `script/package.json` declares `mammoth`, `pdf-parse`, and `xlsx` using mutable caret ranges. - The root dependency list in `script/package-lock.json` does not include `xlsx`. - The package names in `package.json` and `package-lock.json` are inconsistent. - The installation command does not use `npm ci`, `--ignore-scripts`, or another mechanism that strictly enforces a reviewed dependency gra ...[truncated 1792 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
script/index.js:64
Finding

Caller-Controlled Root Directory Allows Scanning Outside the Intended Workspace

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill installs dependencies automatically, modifies the runtime environment, and allows arbitrary root directory scanning despite only advertising local search, it exceeds the declared trust boundary. Executing external commands such as npm install and scanning user-supplied directories can introduce supply-chain risk, alter the host unexpectedly, and expand access to sensitive files outside the expected workspace.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the skill installs dependencies automatically, modifies the runtime environment, and allows arbitrary root directory scanning despite only advertising local search, it exceeds the declared trust boundary. Executing external commands such as npm install and scanning user-supplied directories can introduce supply-chain risk, alter the host unexpectedly, and expand access to sensitive files outside the expected workspace.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The advertised capability is local file retrieval, but the implementation also changes the runtime environment by installing packages on demand. That mismatch is security-relevant because users may grant trust appropriate for read-only local indexing while the code performs network/package-management actions with side effects and potential execution of untrusted install hooks.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill executes npm install --no-save ... via execSync with shell: true to auto-install missing dependencies at runtime. This is dangerous because it mutates the host environment, pulls and executes unpinned third-party package install scripts, and expands a local file RAG capability into arbitrary package-management behavior that could be abused or lead to supply-chain compromise.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: @xmldom/xmldom==0.8.11 — 15 advisory(ies): CVE-2026-83608 (xmldom: DocType `name` Injection Bypasses requireWellFormed); CVE-2026-41673 (xmldom: Uncontrolled recursion in XML serialization leads to DoS); CVE-2026-83605 (xmldom: Attribute name injection via setAttribute() bypasses requireWellFormed) +12 more

High
Category
Supply Chain
Confidence
95% confidence
Finding

The lockfile pins @xmldom/xmldom to 0.8.11, and the supplied finding indicates multiple known HIGH-severity advisories affecting that exact version. In this skill, mammoth processes DOCX files, which are ZIP/XML-based and therefore can expose XML parsing/serialization paths to attacker-controlled document content, making dependency-level XML parser flaws materially relevant rather than theoretical.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill description is written in Chinese and the usage examples instruct users to speak to OpenClaw in Chinese, but the document does not offer an alternative language option or state that the skill is intentionally limited to a Chinese-speaking context. This can violate language/locale policy requirements when skills must not force a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The code defines a FileChunker class for workspace scanning and chunking, but the final export exposes CodeChunker, which is not defined anywhere in the file. This directly diverges from the implemented module intent and would prevent consumers from using the documented/implemented class as written.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill silently runs a shell command to install packages with stdio: 'ignore', giving no user-facing prompt or visibility before environment changes occur. Lack of notice and consent increases operational risk, hides unexpected network/process activity, and makes it harder to detect or investigate malicious or failed installs.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The comment suggests safety because --no-save avoids editing the current project's package.json, but the code still performs an install into the skill directory and therefore modifies the environment and may execute package lifecycle scripts. This can mislead reviewers or users into underestimating the risk while the same core supply-chain and side-effect concerns remain.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The comment at L005 is written in Chinese and indicates implementation intent in a fixed language, with no indication that language choice is configurable or user-selected. Per the policy, forcing or assuming a specific language without opt-in can be a natural-language locale/language policy issue.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The manifest frames the skill as a basic local file RAG suite, but the implementation supports a broad set of file types including images, audio, video, PDFs, DOCX, and spreadsheets, and performs metadata sniffing plus deep text extraction for some binary formats. That is a broader behavior profile than a narrowly understood 'basic' local file chunker/indexer, even though it remains local-only.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file's human-readable comments and docstrings are written exclusively in Chinese, which imposes a specific language for maintainers or auditors without any indication of opt-in or locale justification. Under the language/locale policy, this is a natural-language constraint rather than a code behavior issue.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The dependency version for mammoth uses a caret range, which allows newer minor/patch releases to be installed over time. This weakens build reproducibility and can introduce supply-chain risk if a newly resolved version contains a vulnerability or malicious code, though the package.json alone does not show active exploitation.

Content

Scanner excerpt · script/package.json (reported line 9)May include surrounding context.

json
"author": "OpenClaw Community",
  "license": "MIT",
  "dependencies": {
    "mammoth": "^1.6.0",
    "pdf-parse": "^1.1.1",
    "xlsx": "^0.18.5"
  }

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The pdf-parse dependency is specified with a caret range, so different installations may resolve to different versions. This creates a supply-chain exposure window and reduces reproducibility, making it harder to ensure that only vetted dependency versions are used.

Content

Scanner excerpt · script/package.json (reported line 10)May include surrounding context.

json
"license": "MIT",
  "dependencies": {
    "mammoth": "^1.6.0",
    "pdf-parse": "^1.1.1",
    "xlsx": "^0.18.5"
  }
}

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

The xlsx dependency is unpinned, allowing npm to resolve newer compatible releases automatically. In this case the risk is elevated because xlsx has a history of security advisories, so leaving the version range open increases the chance of deploying an affected or otherwise unreviewed version in a file-processing skill that handles untrusted document input.

Content

Scanner excerpt · script/package.json (reported line 11)May include surrounding context.

json
"dependencies": {
    "mammoth": "^1.6.0",
    "pdf-parse": "^1.1.1",
    "xlsx": "^0.18.5"
  }
}

Unverifiable Dependency: xlsx has 5 known advisory(ies) (CVE-2021-32012 (Denial of Service in SheetJS Pro); CVE-2023-30533 (Prototype Pollution in sheetJS); CVE-2024-22363 (SheetJS Regular Expression Denial of Service (ReDoS)) +2 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
89% confidence
Finding

The manifest includes xlsx, a package with multiple known advisories, but the version is not pinned, so it is not possible to verify whether deployed installs are affected. Because this skill is a local file RAG tool likely to parse attacker-controlled spreadsheets, any unresolved xlsx flaw such as prototype pollution or denial of service is more relevant than in a non-file-processing context.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
script/index.js:37