Back to skill

Security audit

Sort

Security checks for vulnerabilities and agentic risk

Overview

This sorting skill is mostly coherent, but one JSON sorting fallback can turn crafted input into Python code execution, and it keeps a persistent local history of processed filenames.

Review before installing. The skill does useful local sorting and analysis, but avoid using the json command on untrusted filenames or keys, especially on systems without jq. Also expect a local history file to retain names and metadata for files you process; do not use it on sensitive paths unless that audit trail is acceptable.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/script.sh:178
Finding

Arbitrary Python Code Execution Through Unsafe JSON Argument Interpolation

Content
View full analysis
``` 3. The script confirms that the supplied file exists. 4. If `jq` is unavailable, execu ...[truncated 863 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:43
Finding

Operation History Log Injection Through Unescaped User-Controlled Fields

Content
View full analysis
> "${HISTORY_FILE}" } ``` User-controlled arguments are included in log details at multiple call sites, including: ```bash log_operation "lines" "file=${file} flags=${sort_flags} lines=${original_count}" log_operation "csv" "file=${file} col=${col} rows=${total_lines}" log_operation "json" "file=${file} key=${key} entries=${count}" log_operation "json" "file=${file} key=${key}" log_operation "dedup" "file=${file} original=${original_count} deduped=${deduped_count} removed=${removed}" log_operation "shuffle" "file=${file} lines=${line_count}" log_operation "rank" "file=${file} col=${col} lines=${line_count}" log_operation "top" "file=${file} col=${col} n=${n}" log_operation "freq" "file=${file} lines=${line_count} unique=${unique_count}" log_operation "stats" "file=${file} lines=${line_count}" ``` ### Technical Analysis The logging function appends a line of unstructured text to `~/.local/share/sort/history.log`. The `detail` value contains filenames and, for the JSON command, arbitrary key values supplied by the caller. Shell quoting prevents these values from being split into shell commands, but it does not encode newline, carriage-return, terminal-control, or delimiter characters before they are written. Consequently, an argument containing a newline can create additional apparent log entries. Control characters can also alter how records are displayed by terminals or downstream log-processing tools. This vulnerability affects the integrity of the operation history rather than directly causing code execution. The risk becomes more significant if the history file is later used for incident investigation, compliance evidence, automated monitoring, or as input to another ...[truncated 1120 chars]
Remediation
View remediation
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill advertises itself primarily as a sorting utility, but it also declares additional analysis functions and persistent history logging that are not clearly reflected in the top-level purpose statement. Undisclosed persistence to ~/.local/share/sort/history.log can expose filenames, usage patterns, or sensitive operational context, and feature creep beyond the declared scope reduces transparency and informed consent for users and orchestrators selecting the skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The description says to use the skill when "monitoring changes, reporting results, alerting anomalies," which are broad, generic activities rather than specific trigger phrases or constrained contexts. In a manifest/markdown file, this can cause unintended invocation because the activation scope is not clearly limited to explicit sorting-related requests.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

User file operations are logged persistently, but the usage/help text does not warn users that filenames and metadata will be retained. The main danger is silent privacy loss: users may process confidential files assuming the tool is stateless, while the skill leaves an audit trail on disk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script persistently records operation names, filenames, flags, and counts to a history file without necessity for core sorting behavior. In a skill context that may process arbitrary user files, this can leak sensitive filenames, dataset characteristics, and usage patterns to local disk and to any other process or user with access to that account.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The JSON fallback embeds user-controlled file and key values directly into a python3 -c command string. If either value contains shell- or Python-significant characters, this can lead to command injection or unintended code execution, and even when not exploitable it expands the skill's execution surface through external interpreters beyond simple sorting.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script creates a persistent data directory and history log under the user's home directory, which goes beyond transient sorting behavior described by the skill. While not directly code-execution dangerous, it introduces undisclosed local data retention of filenames and usage metadata that may expose sensitive workflow information.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest focuses on sorting files, lines, and columns with custom ordering and deduplication. The implemented freq and stats commands perform analysis and reporting operations rather than sorting, which broadens the skill's behavior beyond the stated description.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.