Back to skill

Security audit

Valve

Security checks for vulnerabilities and agentic risk

Overview

This skill is labeled as a valve sizing tool, but the inspected artifact is a local record manager with persistence and an unsafe config command.

Review before installing. This does not appear to exfiltrate data or install a background component, but it is not a real valve sizing tool, stores arbitrary entries in your home directory, can delete or export them, and contains an unsafe config command. Install only if you intend to use it as a local record manager and after fixing the config command input handling.

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/script.sh:139
Finding

Arbitrary Command Execution Through GNU sed Expression Injection

Content
View full analysis

Vulnerability Details

File Location: scripts/script.sh, lines 139–140
Vulnerability Type: Command injection through user-controlled sed program construction
Risk Level: High

bash
if [ -f "$cfg" ] && grep -q "^${key}=" "$cfg" 2>/dev/null; then
    sed -i "s|^${key}=.*|${key}=${val}|" "$cfg"

Technical Analysis

The config command incorporates the user-controlled key and val arguments directly into a sed substitution program. Shell quoting prevents ordinary shell expansion at that stage, but it does not prevent the supplied values from changing the syntax and behavior of the resulting sed program.

In particular, GNU sed supports the e substitution flag, which executes the generated replacement text as a shell command. An attacker can supply a replacement value beginning with the | delimiter to terminate the replacement field and introduce the e flag. The attacker-controlled key is also copied into the replacement text, allowing it to become the command executed by GNU sed.

Neither argument is validated or escaped for use as a regular expression, replacement string, or sed program. Other metacharacters can also alter matching and replacement behavior.

Attack Path

  1. Invoke the configuration command with a key containing the desired shell command so that a matching configuration entry is created:

    bash
    scripts/script.sh config 'touch /tmp/valve-pwned' seed
    

    This creates an entry resembling:

    text
    touch /tmp/valve-pwned=seed
    
  2. Update the same key with a crafted value that terminates the replacement and adds GNU sed's execution flag:

    bash
    scripts/script.sh config 'touch /tmp/valve-pwned' '|e;#'
    
  3. The vulnerable interpolation produces a sed program equivalent to:

    sed
    s|^touch /tmp/valve-pwned=.*|touch /tmp/valve-pwned=|e;#|
    
  4. GNU sed applies the substitution and ...[truncated 843 chars]

Remediation
View remediation

Remediation Suggestions

Do not build a sed program by interpolating user-controlled strings.

  1. Restrict configuration keys to an explicitly supported allowlist. If arbitrary names are required, enforce a conservative format:

    bash
    if [[ ! "$key" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then
        echo "Invalid configuration key" >&2
        return 1
    fi
    
  2. Define and enforce constraints for values, including rejecting embedded newlines and other characters that could corrupt the line-based configuration format.

  3. Replace the dynamic sed expression with a configuration parser that treats keys and values strictly as data. For example, use Python's standard library to parse and atomically rewrite the file, comparing keys as literal strings rather than regular expressions.

  4. If a text-processing utility remains necessary, pass data through dedicated argument channels and perform literal equality comparisons. Do not place values into program source, regular expressions, or replacement expressions.

  5. Write updates to a securely created temporary file in DATA_DIR, set restrictive permissions such as 0600, and atomically rename the completed file over config.txt.

  6. Add regression tests containing sed delimiters, backslashes, ampersands, newlines, command-like keys, and payloads such as |e;#, verifying that none are interpreted as executable syntax.

Vulnerability Patterns
  • 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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill is presented as a valve sizing and selection tool, but the documented behavior is a generic local record manager with persistence, export, and deletion features. This mismatch can mislead users and reviewers about what the skill actually does, reducing informed consent and increasing the chance that undocumented or unrelated data-handling behavior is trusted and executed.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest advertises an industrial engineering tool, while the commands describe CRUD-style local data management. Security-wise, deceptive or inaccurate interface descriptions are dangerous because they can hide the true operational surface area and cause users to authorize actions they would not expect from the stated purpose.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The inline comments and help text repeatedly claim valve-specific engineering functionality, but the code only stores, lists, searches, deletes, and exports free-form entries. This deceptive documentation increases security risk because users and reviewers may trust the tool with operational or sensitive engineering data under false assumptions about what it does.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script’s implemented behavior is a generic local note/logger CRUD store, not a valve sizing and selection tool as advertised. This functionality mismatch is dangerous because it misrepresents the skill’s purpose, expands data-handling behavior beyond user expectations, and can be used to collect or retain arbitrary user input under a misleading domain-specific label.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation claims valve sizing and selection functionality, but the command set contradicts that claim and instead documents record storage operations. Even without overtly malicious code, contradictory documentation undermines user trust and safe review, and may conceal risky behaviors behind an innocuous label.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file documents a remove command that deletes an entry, but it provides no warning about data loss, confirmation behavior, or whether removal is reversible. For markdown files, destructive behaviors that could affect user data should be accompanied by a clear warning to the user.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The remove command deletes a line from the persistent data file with sed -i and only reports the deletion afterward. While the command name suggests removal, this code provides no pre-action confirmation, cautionary comment, or other user disclosure around the irreversible modification of stored data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The skill description includes an export command that writes data to a file, but it does not warn the user that data will be written out or note any implications for file location or overwriting. For markdown skill descriptions, behaviors affecting user data or filesystem state should be disclosed clearly.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.