Back to skill

Security audit

Pass Secrets

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent password-store helper, but it handles secrets in ways that could expose them or turn stored secret contents into shell commands if used unsafely.

Review carefully before installing. Use it only with password-store entries you control, avoid eval or source on the env helper output, and confirm exact secret paths before removing entries. Prefer direct pass commands or a revised helper that validates variable names, shell-escapes values, and adds explicit warnings for deletion and plaintext output.

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/pass-secrets.sh:42
Finding

Shell Command Injection in Generated Environment Export

Content
View full analysis

Vulnerability Details

File Location: scripts/pass-secrets.sh, lines 42–46
Vulnerability Type: Shell command injection through unsafe shell-code generation
Risk Level: High

Vulnerable Code

bash
env)
    [ -z "$path" ] && { echo "Error: path required"; exit 1; }
    value=$(pass show "$path" 2>/dev/null) || { echo "Error: secret not found: $path"; exit 1; }
    var_name=$(basename "$path" | tr '[:lower:]-' '[:upper:]_')_KEY
    echo "export $var_name=\"$value\""
    ;;

Technical Analysis

The env command builds executable shell syntax by directly interpolating both a decrypted secret and a path-derived variable name. Neither value is safely encoded for reuse by a shell.

A secret containing a double quote, command substitution, backticks, shell operators, or embedded newlines can break out of the quoted assignment when the output is evaluated or sourced. For example, a value containing "$(malicious_command)" can cause command execution in a shell that evaluates the generated line.

The derived variable name is also unsafe. tr only converts lowercase letters to uppercase and hyphens to underscores; it does not reject spaces, quotes, semicolons, command substitutions, newlines, or other shell metacharacters present in the path basename.

Printing the decrypted value to standard output additionally exposes it to terminal capture, logs, command pipelines, and other output collectors. The principal confirmed vulnerability, however, is command injection when the advertised export command is consumed as shell code.

Attack Path

  1. An attacker gains the ability to influence a stored secret value or secret path, such as through an import process, shared password store, repository synchronization, or another user-assisted workflow.
  2. The attacker inserts shell syntax into the secret value or the basename of its path.
  3. The victim runs:
    bash
    scripts/pass-secrets.sh env path
    

...[truncated 1163 chars]

Remediation
View remediation

Remediation Suggestions

  1. Avoid generating shell source code containing decrypted secrets. Prefer returning only the raw secret to a trusted caller or setting the environment variable directly within a controlled process.
  2. If shell-code generation is required, strictly validate the variable name:
    bash
    [[ "$var_name" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]] || {
        echo "Error: invalid environment variable name" >&2
        exit 1
    }
    
  3. Serialize the value with Bash-safe escaping rather than interpolating it inside double quotes:
    bash
    printf 'export %s=%q\n' "$var_name" "$value"
    
  4. Clearly document that generated output must not be evaluated when either the secret path or value originates from an untrusted source.
  5. Minimize secret exposure by avoiding terminal output where possible and ensuring CI systems, wrappers, and logs do not capture decrypted values.
  6. Add tests covering quotes, command substitutions, backticks, semicolons, spaces, and multiline values in both secret values and path basenames.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
86% confidence
Finding

The command uses a free-form path parameter in a destructive operation, which can be abused if an agent substitutes an unintended or attacker-influenced secret path. Because this skill is specifically for managing stored credentials, misuse of the parameter can delete important secrets and disrupt dependent systems.

Content

Scanner excerpt · SKILL.md (reported line 38)May include surrounding context.

Remove a secret

bash
pass rm path/to/secret

Current Secrets

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill documents destructive secret deletion with pass rm path/to/secret but provides no warning, confirmation guidance, backup advice, or safer workflow. In a secrets-management skill, this increases the likelihood of accidental deletion of credentials, causing service outages or loss of access if the secret is not recoverable.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The env command prints a shell export statement containing the plaintext secret directly to standard output. This can expose the secret through terminal scrollback, shell history if copied/evaluated, logs, CI job output, or other tooling that captures stdout, making unintended disclosure likely in real usage.

Content

No source excerpt is available for this finding.