Back to skill

Security audit

统一知识库(#kb)

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent, but it automatically sends user content, arbitrary local file contents, and fetched web content to Tencent IMA with broad local and network access.

Review before installing. Use this only for content you are willing to store in Tencent IMA and in the local workspace/memory. Do not pass secrets, private keys, browser profiles, internal documents, or arbitrary absolute paths. Avoid untrusted URLs unless the runtime blocks private, loopback, and metadata-network destinations, and protect or relocate the YouTube cookie file before use.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (3)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/store_kb.py:649
Finding

Unrestricted Local File Ingestion Can Exfiltrate Sensitive Data to IMA

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/store_kb.py:265
Finding

Unvalidated Web Fetching Enables SSRF and Internal Data Relay

Content
View full analysis
]*>(.*?)', resp.text, re.S) title = title.group(1).strip() if title else url content = re.sub(r'<[^>]+>', '', resp.text)[:3000] return {"title": title, "content": content, "url": url}, None except Exception as e: return None, f"抓取失败: {e}" ``` ```python else: # 普通网页 data, err = fetch_webpage(content) if err: print(f"❌ {err}") sys.exit(1) title = data["title"] source_url = content ima_kb_ok, ima_kb_msg = save_to_ima_urls(content, IMA_KB_ID) result_msg.append(f"IMA知识库: {'✅' if ima_kb_ok else '❌ ' + ima_kb_msg}") ima_kb_status = "✅" if ima_kb_ok else "❌" # 存 IMA 笔记(完整正文) note_id, _ = save_to_ima_notes(title, data["content"], tags) if note_id: note_ids.append(note_id) ``` ### Technical Analysis The `link` workflow passes a user-controlled URL directly to `requests.get()`. The implementation does not validate: - URL schemes. - Resolved IP addresses. - Loopback, private, link-local, reserved, or multicast ranges. - Cloud instance metadata addresses. - Redirect destinations. - DNS rebinding between validation and connection. - Response content type or maximum downloaded response size. The `requests` library follows redirects by default. Consequently, even an initially public URL may redirect the Skill to an internal service. The fetched response is converted to text, truncated to 3,000 characters, and passed to `save_to_ima_notes()`. This creates an external relay: informat ...[truncated 1790 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/store_kb.py:142
Finding

Predictable Shared Temporary Files Permit Subtitle Substitution and Symlink Abuse

Content
View full analysis
120秒)" except Exception as e: return None, f"字幕下载异常: {e}" ``` ### Technical Analysis The subtitle downloader uses globally predictable paths under the shared `/tmp` directory: - `/tmp/youtube_cookies.txt` - `/tmp/subs.vtt` - `/tmp/subs.srt` - `/tmp/subs.ass` The code only checks whether these paths exist. It does not verify ownership, permissions, file type, symbolic-link status, creation time, or whether the subtitle was produced by the current process. It also does not remove stale subtitle files before execution or isolate concurrent runs. Because the ...[truncated 1951 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (21)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The documented purpose does not accurately match the described behavior, including undisclosed handling paths and global index rebuilding. When a skill performs more than users and reviewers expect, it weakens informed consent and security review, and can hide side effects such as additional data processing, persistence, or cross-workspace modification.

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 128)May include surrounding context.

md
> ⚠️ **知识库 ID 配置**:请在 `scripts/store_kb.py` 顶部的 `IMA_KB_ID` 变量中设置目标知识库 ID。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> ⚠️ **知识库 ID 配置**:请在 `scripts/store_kb.py` 顶部的 `IMA_KB_ID` 变量中设置目标知识库 ID。

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill documentation describes capabilities to read local files, write to workspace and memory, invoke shell commands, and access external services, but it declares no explicit tool scope or permission boundaries. In an agent environment, this makes the effective authority opaque and increases the chance of unintended file access, command execution, or network exfiltration when the skill is triggered.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill supports local file paths and states it will read file contents and store them, but it does not present a prominent warning to users. In an agent setting, a user may casually reference a path without realizing the file will be read, copied into local knowledge stores, and potentially uploaded to an external service, which can expose sensitive filesystem data.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill expands from simple knowledge-base ingestion into shell-driven media extraction using yt-dlp, cookies, and local transcription tooling. That broader operational scope increases attack surface because untrusted URLs can drive external command execution, temporary file handling, and authenticated scraping behavior beyond what users may reasonably expect from the skill name and description.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill defaults to uploading user-provided content to an external IMA knowledge base without a clear warning or opt-in at the point of use. This creates a real data-exfiltration and privacy risk, especially if users pass sensitive notes, internal documents, or local file contents assuming the action is only local archiving.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill uses browser-exported YouTube cookies to perform subtitle extraction, but the user-facing behavior does not prominently warn that authenticated browser state is being reused. This is sensitive because cookies can grant account-linked access and create privacy, account security, and compliance issues if users do not realize they are enabling authenticated scraping.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

This function is the central exfiltration path that sends user-provided notes, fetched web content, and local file contents to an external IMA API using stored credentials. In this skill context, external transmission is expected as a feature, but it becomes a true vulnerability because the implementation does not enforce explicit consent, data minimization, or sensitive-content safeguards before transmitting potentially private local material.

Content

Scanner excerpt · scripts/store_kb.py (reported line 59)May include surrounding context.

python
if not IMA_CLIENT_ID or not IMA_API_KEY:
        return None, "IMA凭证未配置"
    try:
        resp = requests.post(
            f"https://ima.qq.com/{path}",
            headers={
                "ima-openapi-clientid": IMA_CLIENT_ID,

Tainted flow: 'body' from requests.get (line 341, network input) → requests.post (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/store_kb.py (reported line 59)May include surrounding context.

python
if not IMA_CLIENT_ID or not IMA_API_KEY:
        return None, "IMA凭证未配置"
    try:
        resp = requests.post(
            f"https://ima.qq.com/{path}",
            headers={
                "ima-openapi-clientid": IMA_CLIENT_ID,

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest describes a unified knowledge-base ingestion flow for supported content types, but this implementation shells out to another skill's exporter for WeChat content and elsewhere to yt-dlp/node and an index rebuild script. Spawning subprocesses is not an obvious requirement of a KB entry skill itself and expands execution capability beyond simple ingestion/storage behavior.

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/store_kb.py (reported line 91)May include surrounding context.

python
output_dir = "/tmp/kb_wechat"
    os.makedirs(output_dir, exist_ok=True)
    try:
        result = subprocess.run(
            ["python3", script, url, output_dir],
            capture_output=True, text=True, timeout=30
        )

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest enumerates supported inputs as WeChat articles, generic web links, YouTube videos, plain text, and file paths. The implementation adds special-case handling for X/Twitter URLs, fetches their contents, and stores them, which is broader behavior than the stated supported scope.

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/store_kb.py (reported line 163)May include surrounding context.

python
]

    try:
        result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
        if result.returncode != 0:
            return None, f"yt-dlp 失败: {result.stderr[-500:]}"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill fetches remote webpage/X content and then forwards the retrieved content into IMA notes without a clear user warning that third-party content will be collected, transformed, and stored on another remote platform. This creates privacy, compliance, and data-handling risk, especially if the fetched pages contain personal data, copyrighted text, or content behind user-authenticated contexts.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

For file inputs, the skill reads local file contents and uploads the extracted text to the remote IMA service without any explicit confirmation, redaction step, or policy check. In a local-agent context this is dangerous because users may supply sensitive internal documents, source code, credentials, or personal data expecting local indexing, but the skill silently transmits the contents off-host.

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/store_kb.py (reported line 761)May include surrounding context.

python
try:
        import subprocess
        rebuild_script = "/home/xdl/.openclaw/workspace/scripts/rebuild_kb_index.py"
        result = subprocess.run(["python3", rebuild_script], 
                              capture_output=True, text=True, timeout=30)
        if result.returncode == 0:
            result_msg.append("KB索引: ✅ 已更新")

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The manifest describes content ingestion and storage flows, but does not mention credential access or environment-variable usage. While credentials may be operationally necessary for IMA integration, accessing environment variables is a capability beyond the user-facing purpose as written.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

generate_summary produces fixed Traditional Chinese section headings such as 影片來源, 頻道, and 內容摘要, and the script generally emits Chinese-language user-facing text. This imposes a locale/language choice in natural-language output without any opt-in or configuration path for users who may expect another language.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The manifest says YouTube is supported with subtitle extraction, followed by IMA storage, workspace archival, and memory recording. The implementation additionally generates a derived summary, stores both summary and full transcript as separate IMA notes and local files, which is a materially broader output behavior than the declared description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest describes automatic download, IMA storage, workspace/kb archival, and memory recording. After those steps, the code also executes a separate script to rebuild a KB master index, adding an additional side effect not reflected in the declared behavior.

Content

No source excerpt is available for this finding.