Back to skill

Security audit

tldr-cmd: CLI command TL;DR

Security checks for vulnerabilities and agentic risk

Overview

This skill is a small command-summary helper, but it can execute an arbitrary user-supplied local command despite saying it does not run the command.

Install only if you are comfortable with this skill potentially running the command name you ask about with --help. Avoid using it on untrusted command names, paths, or repositories that may alter PATH. A safer version would remove the executable fallback or require explicit confirmation before running any command.

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
bin/tldr-cmd:34
Finding

Untrusted Command Execution Through the Help Fallback

Content
View full analysis

Vulnerability Details

File Location: bin/tldr-cmd, lines 34–37
Vulnerability Type: Untrusted local executable invocation
Risk Level: Medium

bash
# 2) fallback to --help
if [[ -z "$about" && -z "$usage" ]] && command -v "$cmd" >/dev/null 2>&1; then
  help="$("$cmd" --help 2>&1 || true)"
  if [[ -n "$help" ]]; then

Technical Analysis

The script accepts its first argument as cmd and, when no useful manual-page content is found, resolves and executes that value with --help. Although "$cmd" is quoted and therefore does not permit ordinary shell metacharacter injection, it can still identify an attacker-controlled executable through either a supplied path or a manipulated PATH.

command -v only verifies that the input resolves to something the shell can invoke; it does not establish that the executable is trusted or that invoking it with --help is safe. The --help option is merely a convention, and an executable can perform arbitrary actions before, during, or instead of printing help text.

This behavior also conflicts with the statement in SKILL.md that the Skill “does not run the command,” potentially causing callers to treat untrusted command input as harmless.

Attack Path

  1. An attacker creates a malicious executable and makes it accessible at a known path, or places it earlier in the invoking process's PATH.
  2. The attacker or another untrusted input source causes the Skill to receive that executable's path or command name as its first argument.
  3. If no usable manual-page summary is obtained, the fallback condition is reached.
  4. command -v "$cmd" successfully resolves the malicious executable.
  5. The script invokes the executable as "$cmd" --help.
  6. The executable performs attacker-defined actions with the privileges and environment of the user running the Skill.

Impact Assessment

Successful exploitation provides arbitrary local code execution under th ...[truncated 450 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the executable fallback and generate summaries exclusively from non-executing sources such as trusted local manual-page data. This is the safest option and makes implementation behavior consistent with the documentation.
  2. If executable fallback is essential, clearly document that the target program will be executed and require explicit user confirmation before doing so.
  3. Reject absolute paths, relative paths, values containing /, option-like input beginning with -, and command names outside a conservative allowlist or validation pattern.
  4. Resolve commands only from administrator-controlled directories rather than relying on the caller's unrestricted PATH. Construct a minimal trusted environment before resolution and execution.
  5. Execute the fallback in a constrained sandbox with no unnecessary filesystem access, credentials, sensitive environment variables, or network access.
  6. Apply a short execution timeout and output-size limit to reduce denial-of-service risks from commands that hang or produce unbounded output.
  7. Prefer a curated allowlist of known commands whose help behavior has been reviewed. Do not treat --help as a guarantee that execution is side-effect free.
  8. Update SKILL.md so its stated behavior accurately reflects any remaining command execution.
Vulnerability Patterns
  • 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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (4)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
bin/tldr-cmd <command>

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
bin/tldr-cmd <command>

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
bin/tldr-cmd <command>

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script executes a user-supplied program by invoking "$cmd" --help when no man page data is available. Even though the argument is safely quoted and this is not shell injection, many binaries and scripts can perform side effects, expensive initialization, or unsafe code paths when run with --help, especially if a malicious executable earlier in PATH is chosen. In an agent skill context, this is more dangerous because the tool may be used on arbitrary command names supplied by an LLM or user, turning documentation lookup into unintended code execution.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.