Back to skill

Security audit

Query Router

Security checks for vulnerabilities and agentic risk

Overview

This skill is a query classifier/router, but its claimed switching, rollback, and locking protections do not match the implementation and it retains prompt text in local logs.

Review carefully before installing. Treat this as a recommendation/classification tool, not a reliable model switcher with rollback. Avoid routing secrets or private data through it unless audit logging is disabled or changed, because prompt prefixes are saved locally in plaintext.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/router.py:155
Finding

Model Switching and Rollback Are Reported but Never Executed

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/router.py:32
Finding

File Lock Is Released Before the Protected Routing Operation

Content
View full analysis
bool: """Acquire a file lock to prevent concurrent routing.""" ensure_dirs() lock_path = LOCK_DIR / f"{lock_name}.lock" lock_file = open(lock_path, "w") try: fcntl.flock(lock_file.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) return True except BlockingIOError: return False def release_lock(lock_name: str): lock_path = LOCK_DIR / f"{lock_name}.lock" lock_path.unlink(missing_ok=True) ``` ### Technical Analysis A POSIX `flock` remains associated with an open file description. The `lock_file` object is local to `acquire_lock()` and is neither returned nor retained by the caller. In normal CPython execution, its reference count reaches zero when the function returns, causing the file to close and the lock to be released before the protected routing code executes. The `release_lock()` function does not unlock or close the original file descriptor. It only unlinks a pathname. Unlinking a lock file can make synchronization less reliable because another process may create and lock a new file at the same path while an earlier process still references the old inode. The unused `timeout` argument also gives callers the false impression that timed acquisition is implemented, while acquisition is actually a single nonblocking attempt. ### Attack Path 1. Two processes invoke the router at approximately the same time. 2. The first process opens the lock file and obtains an exclusive lock. 3. `acquire_lock()` returns `True`, dropping the only retained reference to `lock_file`. 4. The file is closed and the operating system releases the lock before routing begins. 5. The second process opens ...[truncated 957 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/router.py:49
Finding

Raw User Query Content Is Persisted in Plaintext Audit Logs

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documentation claims safety controls like lock protection, verify-after-switch, rollback, and audit logs, but the supplied skill content does not substantiate that those protections are actually implemented. This can mislead users and integrators into trusting a routing or model-switch workflow as safe and atomic when it may only classify or recommend actions, increasing the chance of unsafe automation, failed rollbacks, or untracked model changes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The router claims to perform switching, verification, and rollback, but never actually executes any model-change operation before reporting success-like states. This can mislead operators and downstream automation into believing safety controls were enforced when no switch or rollback occurred, creating a dangerous false sense of protection and potentially routing sensitive work to the wrong model.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code's comments and user-facing messages state that a switch and rollback occur, but the logic only logs and returns status objects without performing either operation. In a routing/safety skill, deceptive operational semantics are security-relevant because users may rely on rollback and verification guarantees that do not exist during failures or model mismatches.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises and invokes scripts that can perform shell execution, file access, logging, and model-switching behavior, yet the skill manifest declares no explicit tool scope or allowed-tools. That creates an authorization and review gap: operators cannot easily constrain what the skill is permitted to do, and downstream systems may execute it with broader privileges than intended.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill includes broad invocation phrases such as 'route this query', 'classify this', and 'which model should I use', which can cause unintended activation in ordinary conversation. In a routing skill, accidental invocation is especially relevant because it may trigger model-selection logic or follow-on automation for benign user text that was not meant as a command.

Content

No source excerpt is available for this finding.

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

Scanner excerpt · scripts/classify.py (reported line 128)May include surrounding context.

python
return _AVAILABLE_MODELS
    try:
        import urllib.request
        req = urllib.request.Request("http://localhost:11434/api/tags")
        with urllib.request.urlopen(req, timeout=5) as resp:
            data = json.loads(resp.read())
            _AVAILABLE_MODELS = [m["name"] for m in data.get("models", [])]

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest describes a unified query router with operational safety features around switching and logging. In this file, the core classify function only scores content type/complexity and returns a recommended model; there is no lock handling, verification after model switch, rollback logic, or audit log generation anywhere in the implementation shown.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The audit logger writes a portion of the user query to disk without any consent, redaction, or sensitivity filtering. Because routed queries may contain secrets, personal data, source code, or internal prompts, this creates a local data exposure risk through log files, especially in shared environments or when logs are collected centrally.

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

python
def get_current_model() -> str:
    """Get currently active model."""
    try:
        result = subprocess.run(
            ["openclaw", "status", "--json"],
            capture_output=True, text=True, timeout=10
        )

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

python
"""
    try:
        # Check via openclaw status
        result = subprocess.run(
            ["openclaw", "status", "--json"],
            capture_output=True, text=True, timeout=timeout
        )

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The documentation claims a specific set of prefix shortcuts as part of the merged routing approach. In the code, only aliases listed under PREFIX_MAP are expanded via ALIAS_TO_PREFIX, and '@q' and '@cl' have empty alias lists, so the docstring's grouped wording is misleading about what is implemented as alias-based shorthand.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The code performs an HTTP request to a local service at http://localhost:11434/api/tags to discover available models, but there is no print/log message, confirmation, or nearby comment/docstring warning that the skill makes a network call. For code files, outbound or network operations that transmit system or user context should include some visible disclosure unless clearly covered elsewhere in the skill description, which is not shown here.

Content

No source excerpt is available for this finding.