Back to skill

Security audit

shell-review

Security checks for vulnerabilities and agentic risk

Overview

This is a shell-script review checklist with some caution-worthy examples, but I found no hidden execution, persistence, credential access, or data exfiltration.

Install only if you want an agent to review shell scripts. Be aware that its triggers are broad, and treat its package-manager and xtrace snippets as examples to review carefully rather than commands to run blindly, especially in CI or scripts that handle secrets.

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

Warning
Location
modules/structure-patterns.md:157
Finding

Mandatory xtrace support can expose sensitive values in logs

Content
View full analysis

Vulnerability Details

File Location: modules/structure-patterns.md:157-169
Vulnerability Type: Sensitive information exposure through shell execution tracing
Risk Level: Medium

Vulnerable Code

sh
## xtrace support (-x / -t flags)

Every executable script must support a flag to enable `xtrace`
for debugging. The preferred flags are `-x` and `-t`.

XTRACE=0

# …inside main() after arg parsing:
case "${XTRACE}" in
  1) set -x ;;
esac

Technical Analysis

The guidance requires every executable script to support shell execution tracing through set -x. When enabled, xtrace writes expanded commands and their arguments to stderr. This can include passwords, API tokens, signed URLs, credentials passed through command-line arguments, environment-derived secrets, private file paths, and other sensitive runtime values.

The requirement provides no redaction mechanism, protected logging policy, exclusion for scripts that process secrets, or instruction to suspend tracing around sensitive operations. Consequently, scripts modified according to this guidance may expose confidential values in terminal output, CI logs, diagnostic captures, or retained build artifacts.

This is not automatic data exfiltration: a user or automation process must enable the tracing flag. Nevertheless, making the feature mandatory establishes a reusable disclosure channel in every reviewed executable script.

Attack Path

  1. The Skill reviews an executable shell script that handles credentials or other sensitive values.
  2. Following the mandatory structural rule, a developer adds -x or -t support that executes set -x.
  3. A developer, support operator, or CI job enables tracing while diagnosing a failure.
  4. The script executes commands containing expanded sensitive variables or arguments.
  5. The shell writes those expanded commands to stderr.
  6. CI systems, terminal recording, or l ...[truncated 723 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the requirement that every executable script provide an xtrace flag.

  2. Permit tracing only when it is explicitly justified for a script that does not process sensitive data.

  3. Add guidance requiring tracing to be disabled before reading, expanding, or transmitting secrets:

    sh
    set +x
    sensitive_operation "${SECRET:?SECRET must be set}"
    
  4. Do not pass secrets through command-line arguments, because process listings and trace output may expose them. Prefer protected files, standard input, or dedicated secret interfaces where supported.

  5. Replace broad execution tracing with structured diagnostic logging that uses fixed format strings and explicitly redacts sensitive fields.

  6. Ensure CI jobs do not enable xtrace globally and restrict access to diagnostic logs and retained artifacts.

  7. Document that existing trace output must be treated as potentially sensitive and that exposed credentials must be revoked and rotated.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (7)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
@include modules/exit-codes.md

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
@include modules/portability.md

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
@include modules/safety-patterns.md

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
@include modules/structure-patterns.md

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list contains broad generic terms like "shell", "bash", "posix", "scripting", and "hooks", which can cause the skill to activate in contexts far beyond intentional shell-script review. Unintended invocation is risky because this skill instructs the agent to run repository discovery and verification commands, increasing the chance of unnecessary file access or command execution in unrelated tasks.

Content

No source excerpt is available for this finding.

Overly Broad Trigger

Low
Category
Trigger Abuse
Confidence
97% confidence
Finding

The trigger "ci" is especially prone to accidental matches because it is only two letters and commonly appears as a substring or shorthand in many unrelated discussions. This can spuriously invoke the skill in non-shell-review contexts, causing inappropriate analysis behavior or command suggestions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This markdown file instructs readers to select a platform-specific installer and execute an install command, which can modify the host system by installing packages. The surrounding text does not include any caution, confirmation, or user-facing warning about system changes, package trust, or reviewing the selected packages before execution.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.generated_source_template_injection

User-controlled placeholder is embedded directly into generated source code.

Critical
Code
suspicious.generated_source_template_injection
Location
modules/structure-patterns.md:50