Back to skill

Security audit

publish-knowledge-health-checker

Security checks for vulnerabilities and agentic risk

Overview

This knowledge-base checker is mostly purpose-aligned, but its repair and scheduling features can delete or rewrite files and include unsafe generated scripts that require careful review.

Install only after reviewing the repair and scheduling behavior. Back up the knowledge base first, avoid running generated auto-fix scripts without manual inspection, do not enable cron/email/Feishu delivery unless you explicitly want persistent scheduled runs, and treat generated HTML reports as potentially containing local path information.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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 (4)

T06 · System Persistence

Error
Location
SKILL.md:293
Finding

Recurring Cron Task Creates Cross-Session Persistence

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/auto_fix.py:78
Finding

Shell Command Injection in Generated Bash Repair Script

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/auto_fix.py:174
Finding

Python Source Injection Through Unsafely Embedded Knowledge-Base Path

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/report_generator.py:272
Finding

HTML Injection Through Unescaped Scan Path

Content
View full analysis

Knowledge-Base Health Report

{results['scan_path']}
``` ### Technical Analysis The scan path is inserted directly into the generated HTML document without calling the existing `escape_html()` helper. Other attacker-influenced fields in `generate_issues_html()` are escaped, but this field is not. If `scan_path` contains HTML markup, it can terminate the `div` content and inject arbitrary elements. A payload containing a script-capable element or event handler can execute JavaScript when the generated local report is opened. The report includes no restrictive Content Security Policy to limit inline script execution. The vulnerability can be reached through a crafted results JSON file or, depending on filesystem support, through a malicious directory name. ### Attack Path 1. An attacker controls a results JSON file or the name of a scanned directory. 2. The `scan_path` value contains malicious HTML. 3. `generate_report()` inserts the value into the report without contextual escaping. 4. The report is written to an HTML file. 5. The user opens the generated report in a browser. 6. The injected markup alters the report or executes JavaScript in the local-file context. ### Impact Assessment Exploitation can falsify report content, mislead the user, trigger navigation, or run browser-side JavaScript. Browser protections generally constrain local-file pages, but exact access depends on the browser and launch configuration. The project does not load remote scripts or implement direct data transmission, so external exfiltration is not asserted without an additional attacker-controlled channel. ]]>
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding

The core purpose is mostly aligned: the script is indeed a knowledge-base health checker that scans Markdown notes, detects empty/low-quality files, broken wiki links, content density issues, and graph/network properties. However, the declared description materially overstates several capabilities not present in the code. There is no implementation for Notion-specific or Logseq-specific parsing/import; the scan is limited to local .md files. There is also no visual report/card generation—results are returned as JSON. Finally, the description promises automatic repair suggestions, but the code only reports findings and scores without producing fixes or recommendations. No obvious unrelated or dangerous undeclared behavior is present; the mismatch is due to overstated features in the description.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

The skill includes generated shell commands using rm to delete files classified as 'empty shell' notes. This is dangerous because heuristic classification can be wrong, paths may be broader than intended, and users may execute the script with little scrutiny, causing irreversible data loss in a personal knowledge base.

Content

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

md
# 知识库自动修复脚本(需人工审查后执行)

# 1. 删除空壳文件
rm "memory/drafts/待研究.md"
rm "memory/temp/quick-note.md"

# 2. 修复断链(搜索相似文件名)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

This second rm example reinforces a pattern of destructive, parameterized shell output driven by analysis results. In the skill context, file paths originate from repository contents and heuristics, so mistakes or path-handling issues can translate directly into user-triggered deletion of legitimate notes.

Content

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

md
# 1. 删除空壳文件
rm "memory/drafts/待研究.md"
rm "memory/temp/quick-note.md"

# 2. 修复断链(搜索相似文件名)
sed -i '' 's/\[\[wave-function\]\]/[[wave-function-theory]]/g' "memory/physics/quantum-mechanics.md"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill describes capabilities that require filesystem reads, file writes, and shell/script generation, but it declares no explicit tool scope or permission boundaries. In an agent environment, missing least-privilege constraints increases the chance that the skill can be invoked with broader access than intended, especially because later sections discuss report generation, browser opening, cron setup, and fix-script creation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The manifest description and the entire user-facing documentation are written in Chinese, with no indication that the skill can operate in other languages or adapt to user preference. Under the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill prominently promotes automatic repair and later provides destructive deletion examples, but it lacks a strong upfront warning about data-loss risk. Users may treat generated fixes as routine maintenance and execute removal commands on notes that are merely short, placeholder, or misclassified.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

Optional HTTP checking of external links introduces network access to third-party servers, which goes beyond strictly local document analysis. This can leak browsing patterns, internal document references, or sensitive URLs embedded in the knowledge base, and may contact attacker-controlled endpoints during analysis.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill expands from local knowledge-base analysis into cron persistence and outbound delivery to Feishu/email, which materially broadens its operational scope. That introduces risks of unauthorized persistence, data exfiltration of scan results, and execution beyond the user's immediate session, none of which are necessary for a basic health checker.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file contains user-facing natural-language content entirely in Chinese, including headings and evaluation notes, with no indication that users may choose another language. The policy for this category requires flagging language or locale constraints unless the skill explicitly offers opt-in or documents a justified regional limitation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file presents all user-facing natural-language content in Chinese, including headings, descriptions, and release instructions. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains natural-language docstrings and runtime messages entirely in Chinese, starting with the module description and continuing through generated script comments and CLI output. Under the policy rule for language/locale, this is a violation because the skill imposes a specific language without any opt-in, fallback, or documented region-specific justification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script generates executable shell code that can delete files and rewrite content based entirely on scan results. Even though it warns the user to review first and uses shell escaping for file paths, this still turns analyzer output into actionable destructive operations, which is risky if the input data is wrong, manipulated, or over-broad.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document declares lang="zh-CN", and the visible UI text throughout the page is exclusively in Chinese. Under the policy rule, forcing a specific language or locale without user opt-in or a documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The report embeds a specific local filesystem path (/Users/mac/.openclaw/workspace/memory) directly in page content, which leaks host-specific environmental information to anyone who can view or receive the report. This is unnecessary for a health summary and can aid reconnaissance by revealing usernames, directory structure, workspace naming, and probable operating system details.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The plain-text disclosure of a user-specific local path exposes sensitive contextual metadata in a generated artifact that may be shared externally. In this skill context, reports are intended for diagnostics and export, so leaking workstation paths is more dangerous because the artifact is likely to leave the local environment and provide useful reconnaissance data to third parties.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This Python file contains user-facing natural-language documentation and status messages exclusively in Chinese, starting with the module docstring and continuing throughout the script. Under the language/locale policy, forcing a specific language without user opt-in is a violation unless the locale restriction is explicitly justified or a choice is offered.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file defines an HTML escaping helper and uses it in generate_issues_html, but the main HTML template still interpolates unescaped data such as results['scan_path'] and multiple score/stat fields directly into the document. If any of these values can be influenced by untrusted input, an attacker could inject HTML or script into the generated report, which would execute when the report is opened in a browser.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrase asks to 'check my knowledge base health' without any scope, path, repository, or confirmation constraints, and the expected behavior says to scan a default path and generate a report. In an agent skill, this can cause unintended activation during normal conversation and may lead to broad local content enumeration or analysis of files the user did not explicitly select.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The 'deep analysis' trigger is broad and the expected workflow includes network-structure analysis, connected components, and weak-link reporting, which implies extensive traversal and metadata extraction across the knowledge base. Without explicit constraints, exclusions, or consent for depth and scope, this increases the risk of over-collection, accidental activation, and costly or privacy-invasive analysis.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation mentions external HTTP link validation but does not clearly warn that this may contact third-party servers and reveal metadata. While lower severity than direct destructive actions, the omission can cause users to unknowingly expose internal link targets or analysis timing to external services.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The markdown file is entirely written in Chinese, including the title and section headings, with no indication that the skill supports other languages or that Chinese is required for a specific regional purpose. This can violate a language/locale policy when a skill implicitly mandates one language without user opt-in.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The docstring and function name describe a stronger Python auto-fix script, but the emitted script only backs up, prints candidate deletions, and explicitly leaves broken-link repair as TODO. This creates a mismatch between the claimed automatic repair behavior and what the generated script actually does.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The inline documentation claims this Python variant is '更强大', yet its emitted logic comments out deletion and leaves broken-link repair unimplemented, while the shell script performs actual rm and sed operations. This is an active contradiction between documentation and behavior rather than a mere omission.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module docstring and all user-facing strings are written exclusively in Chinese, and the generated HTML explicitly sets lang="zh-CN". This indicates a fixed language/locale choice without any opt-in or explanation that the skill is intended only for a Chinese-language context.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The prompt about having many 'empty shell files' is conversational and can overlap with ordinary discussion of note quality, making accidental routing to the skill more likely. While narrower than a full health scan, it still authorizes file inspection behavior without clear boundaries on which knowledge base or directory is in scope.

Content

No source excerpt is available for this finding.