Back to skill

Security audit

专家工具箱

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local expert-prompt selector that reads configured Markdown role files and returns role prompts without network calls, file writes, or persistence, but users should trust the external role files it loads.

Install this only if you trust the role Markdown files under the configured agency-orchestrator roles directory. Keep that directory from being modified by untrusted parties, and be cautious about setting EXPERT_TOOLKIT_ROLES_ROOT to broad or private document locations.

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

T01 · Skill Instruction Hijacking

Warning
Location
scripts/expert_toolkit.py:281
Finding

Untrusted Role Files Are Promoted into Agent Instructions Without Validation

Content
View full analysis

Vulnerability Details

File Location: scripts/expert_toolkit.py:27-28, 121-137, 281-291, 360, 377
Vulnerability Type: Prompt injection through untrusted local role content
Risk Level: Medium

Vulnerable Code

python
DEFAULT_ROLES_ROOT = os.path.expanduser(
    "~/.openclaw/workspace/knowledge/agency-orchestrator/roles"
)
ROLES_ROOT = Path(os.getenv(
    "EXPERT_TOOLKIT_ROLES_ROOT",
    DEFAULT_ROLES_ROOT
))
python
for md_file in category_dir.glob('*.md'):
    if md_file.name.startswith('.'):
        continue

    try:
        with open(md_file, 'r', encoding='utf-8') as f:
            content = f.read()
    except OSError as e:
        print(f"⚠️  读取 {md_file} 失败: {e},跳过")
        continue

    chinese_name = self._extract_chinese_name(
        content,
        md_file.stem
    )
    role = ExpertRole(
        md_file,
        md_file.stem,
        category,
        chinese_name
    )
    role.content = content
python
def build_system_prompt(role: ExpertRole, user_query: str) -> str:
    """构建完整的system prompt"""
    role_content = role.load_content()
    return f"""{role_content}

---

# 用户问题

{user_query}

请以{role.chinese_name}的专业身份回答用户问题。
"""
python
prompt = build_system_prompt(role, args.strip())
python
output.append(build_system_prompt(role, requirement))

Technical Analysis

The Skill discovers Markdown role files in a directory that can be changed through the EXPERT_TOOLKIT_ROLES_ROOT environment variable. It reads each selected file in full and inserts its contents verbatim before the user's request in a string explicitly constructed as a system prompt.

There is no integrity verification, provenance validation, trusted-file allowlist, content filtering, or effective instruction boundary between imported role content and controlling Agent instructions. The audited package does not in ...[truncated 2122 chars]

Remediation
View remediation

Remediation Suggestions

  1. Bundle reviewed role files with the Skill or maintain an explicit allowlist of approved files and cryptographic hashes.
  2. Resolve and canonicalize the role root and every discovered file before reading it. Reject files outside the approved root and reject symbolic links unless they are explicitly required and securely validated.
  3. Avoid permitting unrestricted environment-variable replacement of the trusted role repository. If configurability is necessary, require an administrator-approved path and verify its ownership and permissions.
  4. Treat role Markdown as untrusted data rather than system-level instructions. Keep platform safety rules and task constraints at a higher instruction priority.
  5. Wrap imported role content in a clearly defined data boundary and instruct the consuming Agent not to follow commands embedded in that data.
  6. Validate role documents against an approved schema and reject content containing prohibited instruction patterns or unexpected tool-use directives. Filtering should supplement, not replace, instruction isolation and integrity checks.
  7. Run the consuming Agent with least privilege and require explicit user confirmation for sensitive filesystem, shell, network, credential, or memory operations.
  8. Record the selected role's canonical path and integrity hash for auditing, and fail closed when validation cannot be completed.
Vulnerability Patterns
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (10)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The markdown explicitly frames the skill as optimized for Chinese users and the document as a whole is written in Chinese, but it does not offer users an opt-in choice of language or explain that the skill is intentionally region/language-specific. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The keyword "bug" is a very common term used in many ordinary conversations and support requests, so mapping it directly to multiple engineering skills can cause unintended or overly broad skill invocation. This creates a prompt-routing weakness where unrelated user input may trigger higher-capability agents than the user intended, increasing the chance of data overexposure or unsafe downstream actions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The keyword "review" is highly ambiguous and can refer to code review, document review, product review, or general feedback. Without scope constraints, this mapping may incorrectly route benign or unrelated requests to security or code-review skills, causing over-triggering and possible unnecessary access to sensitive context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Many of the Chinese keywords in this range, such as terms for design, testing, security, data, product, and planning, are generic words commonly used in everyday or cross-domain requests. Mapping these directly to specialized skills increases the risk of accidental invocation, misrouting, and unintended exposure of user content to agents that were not actually needed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module description, command help text, category mappings, and response templates are written to assume Chinese usage, and the generated prompt explicitly instructs the model to answer in the expert's Chinese identity context. Because no opt-in or alternative locale handling is provided, this constitutes a natural-language locale policy issue rather than a technical bug.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

User-controlled input is inserted verbatim into the generated system prompt together with trusted role content, creating a prompt-injection and data-handling risk. A user can include instruction-like text or sensitive data that later gets elevated into a high-trust prompt context, increasing the chance of policy bypass, unintended disclosure, or reproduction of sensitive content in downstream model output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The prompt instruction 请以{role.chinese_name}的专业身份回答用户问题。 binds the response framing to a Chinese-named expert persona and does not offer the user any language or locale choice. This is a natural-language policy concern because it can override user expectations about response language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This JSON file maps multiple Chinese-language terms to skill identifiers, which reflects a locale/language-specific behavior. Because there is no accompanying indication in this file that users can choose their language or opt into this locale constraint, it may violate the language/locale policy for natural-language behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The config includes both English and Chinese trigger terms, but there is no accompanying natural-language indication of how language selection is handled or whether users can choose their preferred locale. This may create a language/locale policy concern if invocation behavior implicitly favors certain languages without explicit opt-in or documentation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code contains user-facing and instructional natural language only in Chinese, including the module description and the error message. That can violate a language/locale policy when no user opt-in or documented region-specific justification is provided.

Content

No source excerpt is available for this finding.