Back to skill

Security audit

Process Flow Navigator

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches a flow-navigation purpose, but its CLI can execute injected Python from a crafted node argument, so it needs review before installation.

Only install or run this after fixing the CLI argument handling, especially before allowing agents or other users to supply node names. Treat the bundled path-planning command as incomplete, and expect Chinese-language documentation and output unless the publisher adds localization notes.

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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/navigate.sh:39
Finding

Arbitrary Python Code Execution Through Unsanitized Node Argument

Content
View full analysis

Vulnerability Details

File Location: scripts/navigate.sh, lines 39-52
Vulnerability Type: Python source-code injection
Risk Level: High

Vulnerable Code

bash
get_node_code() {
    local node=$1
    if [ -f "$DATA_FILE" ]; then
        python3 -c "
import json
with open('$DATA_FILE') as f:
    data = json.load(f)
node = '$node'
if node in data['nodes']:
    n = data['nodes'][node]
    print(f\"校验:{n.get('check', 'N/A')}\")
    print(f\"执行:{n.get('exec', 'N/A')}\")
    print(f\"下一步:{n.get('next', 'N/A')}\")
else:
    print(f'节点 {node} 未找到')
"

Technical Analysis

The code command passes its second command-line argument to get_node_code, where it is assigned to the shell variable node. That variable is then interpolated directly into source code supplied to python3 -c:

bash
node = '$node'

Shell expansion occurs before Python parses the resulting program. Consequently, an attacker-controlled argument containing a single quote and additional Python syntax can terminate the intended string literal and inject arbitrary Python statements.

This is not merely malformed-input handling. Injected Python can import operating-system modules and start arbitrary local programs. No validation, escaping, or separation between code and data prevents this behavior.

Although DATA_FILE is also embedded into the generated Python source, it is derived from the script directory rather than directly from a command-line argument. The confirmed exploit path is the user-controlled node value.

Attack Path

  1. An attacker constructs a node argument containing Python syntax that closes the single-quoted node string.

  2. The attacker directly invokes, or persuades a user or agent to invoke, the following command pattern:

    bash
    ./scripts/navigate.sh code "ATTACKER_CONTROLLED_VALUE"
    
  3. The main command dispatcher forwards the value as $2:

    bash
    get_node_code "$2"
    
  4. get_node_code expands that value ...[truncated 1036 chars]

Remediation
View remediation

Remediation Suggestions

Do not generate Python source code by interpolating shell arguments. Pass the data file and node value as positional arguments so Python receives them strictly as data:

bash
get_node_code() {
    local node=$1

    if [ -f "$DATA_FILE" ]; then
        python3 - "$DATA_FILE" "$node" <<'PY'
import json
import sys

data_file = sys.argv[1]
node = sys.argv[2]

with open(data_file, encoding="utf-8") as f:
    data = json.load(f)

if node in data["nodes"]:
    entry = data["nodes"][node]
    print(f"Check: {entry.get('check', 'N/A')}")
    print(f"Execute: {entry.get('exec', 'N/A')}")
    print(f"Next: {entry.get('next', 'N/A')}")
else:
    print(f"Node {node} not found")
PY
    else
        echo -e "${RED}Data file not found${NC}"
        return 1
    fi
}

Additional hardening measures should include:

  1. Validate node identifiers against the keys loaded from flow-rules.json; do not attempt to sanitize input for safe source-code interpolation.
  2. Pass all dynamic values through sys.argv, standard input, or environment variables rather than embedding them in executable code.
  3. Return a nonzero status for invalid nodes and data-loading failures.
  4. Run the script with the minimum filesystem, credential, and network permissions required.
  5. Add regression tests using node values containing quotes, semicolons, newlines, command-substitution syntax, and Python metacharacters, verifying that all such values remain inert data.
  6. Apply the same code-versus-data separation rule to future shell integrations with Python or other interpreters.
Vulnerability Patterns
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file presents the skill name, description, and usage content in Chinese, and does not indicate that language selection is optional or that the skill is intended only for a Chinese-speaking context. This can violate language/locale policy when users are not given an explicit opt-in or alternative language.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The judgment output uses an ambiguous continuation condition: '继续流转 (根据来源节点决定去向)'. This creates nondeterministic routing because the next step is not explicitly encoded in the judgment itself, increasing the risk that an agent or downstream consumer will infer the wrong branch, skip required checks, or enter an unintended flow. In a process-navigation skill, ambiguity in control flow is directly security-relevant because it can misroute users across procedural branches.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This shell script includes command usage, help text, examples, and most operational output in Chinese, which effectively forces a specific language for users. Under the policy, locale or language restrictions should either be optional for the user or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The help text documents path <起点> <终点> as a command that plans a route from a start node to an end node. However, the actual path handler only prints a placeholder message telling the user to use interactive mode or ask an AI assistant, so the documentation materially overstates what the script does.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes a process-flow navigation assistant that helps users navigate and plan paths across the workflow. In this file, the path command is effectively unimplemented and only emits a guidance message, creating a mismatch between the claimed navigation/planning capability and the actual behavior delivered by the code.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description, headings, and example prompts are presented in Chinese throughout, including the user-facing interaction examples at L49-L55. Because the file does not offer an alternative language or state that the skill is intentionally limited to a Chinese-speaking context, this appears to impose a locale/language preference without explicit user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The skill name and all user-facing labels are written in Chinese, but this file does not indicate that the language is user-selectable or intentionally limited to a Chinese-only context. That can conflict with language/locale policy expectations when a skill implicitly assumes one language without offering opt-in or documenting the constraint.

Content

No source excerpt is available for this finding.