Back to skill

Security audit

tool-use

Security checks for vulnerabilities and agentic risk

Overview

This skill is a tool-calling helper, but its dispatcher can run shell commands and Python functions while overstating its validation and confirmation safeguards.

Review before installing. Use this only with registries and arguments you trust, and do not feed unreviewed model-generated values into command templates. The dispatcher can execute arbitrary local shell commands or Python functions defined by the registry, and the documented safety checks are stronger than the implementation. The learner feature can also persist usage notes and preferences in learned_patterns.json for supplied skill directories.

Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (17)

subprocess module call

Medium
Category
Dangerous Code Execution
Content
t = entry.get("type", "command")
    if t == "command":
        cmd = entry["cmd"].format(**args)
        r = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=30)
        return r.returncode == 0, (r.stdout or r.stderr).strip()
    if t == "python":
        mod = __import__(entry["module"])
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Content
r = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=30)
        return r.returncode == 0, (r.stdout or r.stderr).strip()
    if t == "python":
        mod = __import__(entry["module"])
        fn = getattr(mod, entry["func"])
        res = fn(**args)
        return True, str(res)
Confidence
75% confidence
Finding
Dynamic __import__() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Content
return r.returncode == 0, (r.stdout or r.stderr).strip()
    if t == "python":
        mod = __import__(entry["module"])
        fn = getattr(mod, entry["func"])
        res = fn(**args)
        return True, str(res)
    return False, f"未知工具类型: {t}"
Confidence
50% confidence
Finding
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
描述与 dispatch.py、schema.py 的功能基本一致:生成函数调用 schema,以及对已注册工具进行参数检查并执行。但代码中还包含 learner.py,其功能明显超出“函数调用 / 工具编排助手”的声明范围。该模块会读写技能目录下的 learned_patterns.json,记录操作、错误、偏好并生成洞察和改进建议,这是新增的、未在描述中提及的能力,且其定位是“任意 WorkBuddy 技能可调用”的通用学习组件,不是函数调用核心的一部分。依据评估标准,这属于代码执行了描述未声明的能力,因此应判定为 mismatch。

Intent-Code Divergence

Medium
Confidence
97% confidence
Finding
模块文档在 L04-L06 声称会“按 schema 校验”参数后再执行工具,但 validate() 实际只检查工具名是否在注册表内,以及 required 列表中的必填参数是否存在,并未执行任何通用 schema 校验、类型校验或约束校验。这属于文档对安全保证的积极性表述与代码实际行为不一致。

Intent-Code Divergence

High
Confidence
95% confidence
Finding
模块文档把该调度器描述为会“安全执行已注册工具”,但 command 类型工具在 L31-L32 将参数直接格式化进命令字符串并通过 shell=True 执行,这并不能支撑“安全执行”的表述。即使只允许已注册工具,实际执行模型仍可能因参数拼接而产生与文档承诺不一致的安全语义。

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The manifest describes a function-calling/tool-orchestration assistant that turns natural language into structured tool calls, validates schemas, dispatches registered tools, and returns results. This file instead records usage telemetry, stores user preferences, analyzes error patterns, and generates optimization suggestions for arbitrary skills, which is a separate persistence/analytics capability not justified as an implementation detail of tool dispatch.

Context-Inappropriate Capability

Medium
Confidence
94% confidence
Finding
By resolving arbitrary skill directories, reading and writing learned_patterns.json, and storing per-skill usage history and preferences, the module builds persistent behavioral data outside the scope of schema generation and safe tool dispatch. A tool-calling core does not inherently require retaining user preferences or historical error analytics for arbitrary skills.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The description says the skill should be invoked when the user needs to "让 agent 调用工具" / "注册并调用工具" and similar phrases, but it does not define clear boundaries or exclusions for when this skill should versus should not activate. These triggers are broad within agent-building conversations and may overlap with many ordinary requests about tools or function calling.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
The manifest description and markdown content are presented in Chinese, which effectively imposes a language constraint on users reading or invoking the skill. There is no indication that users may choose another language, nor any justification that the skill is intentionally region-specific.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
This code executes registry-defined shell commands via subprocess.run(..., shell=True), which is a safety-critical operation. Although results are printed after execution, there is no prior confirmation prompt or clear user-facing disclosure at the execution point warning that arbitrary registered shell commands will be run.

Missing User Warnings

Low
Confidence
81% confidence
Finding
The dispatcher imports a module and calls a function specified by the registry, which is code execution with side-effect potential. The file does not provide a user-facing warning or confirmation at this point that registered Python functions will be imported and executed.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This Python file contains user-facing natural-language documentation and CLI descriptions entirely in Chinese, including the module description and usage text. The file does not offer any language choice or document that the skill is intentionally region-specific, which can violate language/locale policy requirements.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
The module docstring and usage text are written entirely in Chinese, and the CLI description later also uses Chinese. This imposes a specific language on users without any opt-in, fallback, or indication that the tool is intentionally region-specific, which matches the locale-policy concern for natural-language content.

Unvalidated Output Injection

High
Category
Output Handling
Content
t = entry.get("type", "command")
    if t == "command":
        cmd = entry["cmd"].format(**args)
        r = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=30)
        return r.returncode == 0, (r.stdout or r.stderr).strip()
    if t == "python":
        mod = __import__(entry["module"])
Confidence
95% confidence
Finding
Model output is used without validation or sanitization. Unvalidated output injected into downstream contexts (SQL, shell, HTML) enables injection attacks and arbitrary code execution.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
t = entry.get("type", "command")
    if t == "command":
        cmd = entry["cmd"].format(**args)
        r = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=30)
        return r.returncode == 0, (r.stdout or r.stderr).strip()
    if t == "python":
        mod = __import__(entry["module"])
Confidence
90% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Static analysis

No suspicious patterns detected.