Back to skill

Security audit

Scada

Security checks for vulnerabilities and agentic risk

Overview

This skill is mislabeled as a SCADA tool but is actually a local record manager, and its shell script has unsafe input handling that can lead to command execution.

Review before installing. Do not treat this as an industrial SCADA integration; it is a local file-based notes/config tool. Avoid passing untrusted text to config or exporting/opening CSV files until the sed command construction and JSON/CSV escaping issues are fixed.

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:136
Finding

Arbitrary Command Execution Through GNU sed Expression Injection

Content
View full analysis
)"; fi elif [ -z "$val" ]; then grep "^${key}=" "$cfg" 2>/dev/null | cut -d= -f2- || echo "(not set)" else if [ -f "$cfg" ] && grep -q "^${key}=" "$cfg" 2>/dev/null; then sed -i "s|^${key}=.*|${key}=${val}|" "$cfg" else echo "${key}=${val}" >> "$cfg" fi echo "Set: $key=$val" fi } ``` ### Technical Analysis The `key` and `val` command-line arguments are interpolated directly into a GNU `sed` substitution program. Neither value is escaped for the regular-expression, replacement-string, delimiter, or command contexts. An attacker can include the `|` delimiter and a newline in an argument to terminate the intended substitution and inject additional `sed` syntax. In GNU `sed`, the `e` substitution flag executes the resulting replacement text through a shell. A crafted replacement can therefore cause an attacker-selected shell command to run. The same code also permits regular-expression manipulation through `key`, but command execution through the replacement and GNU `sed` execution flag is the most severe consequence. ### Attack Path 1. The attacker invokes the `config` command with a benign key and value so that a matching entry is created in `config.txt`. 2. The attacker invokes `config` again for the same key, ensuring execution enters the update branch containing `sed -i`. 3. The attacker supplies a value containing a delimiter, the GNU `sed` `e` flag, and a n ...[truncated 1095 chars]
Remediation
View remediation
&2 return 1 fi ``` - Treat values exclusively as data. Rewrite the configuration through a safely quoted parser and a temporary file rather than using dynamic `sed` expressions. - Create the temporary file inside the data directory with `mktemp`, restrictive permissions, and an exit trap, then atomically replace the original file. - If `sed` must be retained, separately escape regular-expression metacharacters in the key and delimiter, backslash, ampersand, and newline characters in the replacement. Strictly reject control characters. A parser-based rewrite is preferable because escaping dynamic `sed` syntax is error-prone. - Add regression tests with delimiters, ampersands, backslashes, newlines, regular-expression syntax, and strings resembling `sed` flags. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:11
Finding

Unescaped Entry Data Produces Invalid JSONL and Formula-Injection-Prone CSV Exports

Content
View full analysis
> "$DATA_DIR/data.jsonl" } ``` ```bash cmd_export() { local fmt="${1:-json}" local out="scada-export.$fmt" if [ ! -f "$DATA_DIR/data.jsonl" ]; then echo "No data."; return 0; fi case "$fmt" in json) cp "$DATA_DIR/data.jsonl" "$out" ;; csv) echo "timestamp,command,value" > "$out" while IFS= read -r line; do ts=$(echo "$line" | grep -o '"ts":"[^"]*' | cut -d'"' -f4) c2=$(echo "$line" | grep -o '"cmd":"[^"]*' | cut -d'"' -f4) vl=$(echo "$line" | grep -o '"val":"[^"]*' | cut -d'"' -f4) echo "$ts,$c2,$vl" >> "$out" done < "$DATA_DIR/data.jsonl" ;; *) echo "Formats: json, csv"; return 1 ;; esac echo "Exported: $out ($(wc -c < "$out") bytes)" } ``` ### Technical Analysis `_save_entry` inserts attacker-controlled entry text directly into a JSON string without escaping quotation marks, backslashes, control characters, or newlines. The resulting file is therefore not reliably valid JSONL. A crafted value can terminate the intended string, inject additional properties, or create additional physical records. The export implementation then parses JSON using `grep` and `cut` rather than a JSON parser. This parsing fails for escaped characters and can interpret injected delimiters or records as legitimate content. For CSV export, fields are concatenated with commas without RFC 4180 quoting. Commas, quotation marks, carriage returns, and newlines can alter the row and column structure. In addition, a field b ...[truncated 1653 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description suggests software for supervising and controlling industrial processes and acquiring telemetry/data from external systems. The code does not interface with hardware, networks, sensors, PLCs, or any control systems, nor does it perform monitoring beyond counting local saved entries. Its true function is a simple local record manager that appends user-provided text to a file and offers CRUD-like operations plus export and config editing. This is a materially different primary purpose, so the description does not accurately represent the code's behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill documents data-modifying commands such as add, remove, export, and config without warning users that they change or delete local state in ~/.scada. In an agent context, this can lead to unintended file modification or data loss if a user or downstream tool invokes commands assuming they are read-only or harmless.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file header explicitly labels the tool as 'scada -- Supervisory control and data acquisition manager'. The code does not manage supervisory control or data acquisition systems and instead performs basic local CRUD-style operations on a text data store, making the documentation actively misleading about the skill's intent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest and help text present the skill as a 'Supervisory control and data acquisition manager', which implies interacting with industrial control or telemetry systems. However, the implemented commands only store and manipulate free-form local entries in a JSONL file, with no supervisory control, device communication, or data acquisition behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The export command creates or overwrites an output file in the current working directory, including with shell redirection for CSV output, but the help only says 'Export data to file' and does not warn about creating local files or possible overwrite behavior. This is a file-write operation that lacks meaningful user disclosure beyond the post-action success message.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The config command modifies or appends to a persistent file in $DATA_DIR/config.txt, but there is no preceding comment or help text warning that provided key/value pairs will be stored on disk. Although the command prints a success message after writing, that does not disclose the persistence behavior in advance.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.