Back to skill

Security audit

生成每日金融市场 Word 日报

Security checks for vulnerabilities and agentic risk

Overview

This skill mostly does what it says, but it loads executable configuration from a hard-coded external workspace path before generating the report, which creates a real review concern.

Review this skill before installing. It is purpose-aligned as a financial Word report generator, but only use it if you trust the external workspace-yoyo configuration directory and understand that Python code in that config path may run when the report script starts. Prefer a packaged or non-executable config file and narrower trigger wording before routine use.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T08 · Insecure Dependencies

Error
Location
scripts/generate_word.py:17
Finding

Untrusted External Python Module Loading Through Search-Path Precedence

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_word.py, lines 17–25
Vulnerability Type: Untrusted dependency loading / Python module search-path manipulation
Risk Level: High

Vulnerable Code

python
import sys
sys.path.insert(0, r"C:\Users\qu669\.openclaw\workspace-yoyo")
sys.stdout.reconfigure(encoding='utf-8')
import os, json, datetime, logging, re
from docx import Document
from docx.shared import Pt, RGBColor, Inches
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
import config

Technical Analysis

The script prepends an external user-workspace directory to sys.path and then imports the generically named config module. Because index zero has the highest module-resolution priority, Python will load config.py or a compatible config package from that external directory before searching lower-priority locations.

A Python import executes the imported module's top-level code. The referenced module is outside the audited project and cannot be integrity-verified from this package. If an attacker can create or replace the external config module, arbitrary Python code will run immediately when generate_word.py starts.

This configuration module also supplies sensitive runtime paths such as LOG_FILE, MARKET_DATA_FILE, and OUTPUT_DIR. Consequently, even without an overt executable payload, a malicious configuration module could redirect data reads, report writes, or logs to attacker-selected filesystem locations.

Attack Path

  1. The attacker obtains write access to C:\Users\qu669\.openclaw\workspace-yoyo, whether through another compromised process, unsafe directory permissions, or an existing foothold in the same user account.
  2. The attacker creates or modifies config.py in that directory.
  3. The malicious module includes attacker-controlled top-level Python code and may expose the attributes expected by the report generator.
  4. A user or agent invokes `scripts/generate_word. ...[truncated 762 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the external search-path insertion and package required configuration with the project:

    python
    # Remove:
    # sys.path.insert(0, r"C:\Users\qu669\.openclaw\workspace-yoyo")
    
  2. Prefer a non-executable configuration format such as JSON or TOML and parse it with a standard parser. Validate every configured path before use.

  3. If Python-based configuration is unavoidable, place it inside a uniquely named, trusted project package and use an explicit package-relative import rather than the generic module name config.

  4. If external configuration must remain supported:

    • Resolve and validate the canonical configuration path.
    • Restrict accepted paths to an administrator-controlled directory.
    • Verify ownership and permissions before loading.
    • Reject writable-by-untrusted-user files and directories.
    • Apply an integrity check or trusted signature.
    • Avoid executing configuration as Python code.
  5. Validate LOG_FILE, MARKET_DATA_FILE, and OUTPUT_DIR against approved base directories to prevent unintended file reads or writes.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个面向整体流程的日报生成能力:基于市场数据直接产出每日金融市场Word日报/报告。而实际代码只是一个局部内容构建函数 build_tech(mdata),其作用限于处理“科技企业动态”数据:按关键词筛选核心事件、排除部分主题、清洗文本、去重,并输出最多3条段落,作为科技章节内容。代码没有任何与Word文档创建、文件写出、完整报告拼装、跨章节汇总相关的行为。因此其实际主功能与声明的“生成每日金融市场Word日报”存在明显不一致,属于功能范围显著缩小且目的不同的情况。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
80% confidence
Finding

The skill describes reading local files such as workspace-yoyo/config.py and E:\daily\{YYYY-MM-DD}\market_data.json, but it declares no permissions or allowed-tools scope. That creates an authorization gap where the runtime may permit file access without an explicit least-privilege contract, making review and policy enforcement harder.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases include broad terms like “生成报告” and generic workflow references, which can cause the skill to activate in contexts beyond the intended financial daily-report use case. Overbroad invocation increases the chance of unintended file access, incorrect automation, or chaining into downstream actions without clear user intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The docstring is a natural-language instruction written entirely in Chinese and specifies the chapter content in Chinese, indicating the skill is designed to produce Chinese-language output. There is no visible user opt-in, language selection mechanism, or documented region-specific justification in this file, which conflicts with the policy against forcing a specific language or locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and all generated document headings/body text are fixed in Chinese, which can impose a specific language/locale on users without opt-in. Under the stated policy, forcing a language without offering choice or justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The docstring for build_market_performance_us explicitly documents five return elements including a separate '[1] 美国经济情况'. However, the function later concatenates only employment-related content into para5 and returns [para1, para3, para4, para5], leaving para2 unused. This is an active contradiction between code documentation and actual behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The get_text docstring says 'Extract content field only; do NOT fall back to title', yet the surrounding policy utilities include _str(), which explicitly falls back to title fields for policy items. Even if _str() is not used in the final loop, the in-file documentation presents conflicting intent about whether title fallback is permitted in policy extraction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code performs a filesystem write by saving the generated .docx report, including fallback saves to alternate filenames on permission errors. Although the operation is logged, the logging is implementation-facing and there is no explicit user warning or confirmation about creating files in the configured output directory.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.