Back to skill

Security audit

Plc

Security checks for vulnerabilities and agentic risk

Overview

The skill is labeled as a PLC programming helper, but the inspected artifacts implement a generic local data store with deletion/export features and an unsafe config path.

Review before installing. Treat this as a local note/config store, not a PLC programming helper. Avoid storing sensitive industrial details or credentials in it, and do not run the config command with untrusted values until the sed injection issue and export/serialization handling 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:143
Finding

Arbitrary Command Execution Through sed Program Injection

Content
View full analysis
/dev/null; then sed -i "s|^${key}=.*|${key}=${val}|" "$cfg" ``` ### Technical Analysis The user-controlled `key` and `val` arguments are interpolated directly into a dynamically constructed sed program. Neither value is escaped for use as a regular expression, replacement string, or sed command. Although the shell quotes prevent ordinary shell metacharacters in the arguments from being interpreted directly by Bash, they do not prevent sed-language injection. An attacker can include the `|` delimiter and newline characters in a value to terminate the intended substitution and append additional sed commands. On GNU sed, the `e` command executes a supplied command through the system shell. Consequently, a malicious multiline value can transform the generated sed expression into multiple commands, including an attacker-controlled `e` command. The vulnerable branch is reached only when the selected key already exists in `config.txt`, but an attacker able to invoke the Skill can create the key in one request and update it with a malicious value in a subsequent request. ### Attack Path 1. The attacker invokes `scripts/script.sh config safe initial` to create an existing configuration key. 2. The attacker invokes the same command again with `safe` as the key and a crafted multiline value. 3. The value closes the intended `s|...|...|` expression and introduces a new GNU sed `e` instruction. 4. `cmd_config` embeds the value into the sed program without escaping. 5. GNU sed processes the injected `e` instruction and invokes the associated command through a shell. 6. The injected command runs with the operating-system privileges and environment of the user executing the Skill. ### Impact Assessme ...[truncated 547 chars]
Remediation
View remediation
&2 return 1 } ``` 2. Replace the dynamic sed expression with a configuration update routine that treats keys and values exclusively as data. A small dedicated parser or a safe structured format such as JSON is preferable. 3. If `awk` is used, pass values through `-v` rather than embedding them in program source, compare keys literally, and write the result to a securely created temporary file. 4. Atomically replace `config.txt` only after the rewritten file has been generated successfully. 5. Define and enforce a policy for control characters. Reject newlines and NUL bytes if configuration values are intended to remain one record per line. 6. Add regression tests using values containing sed delimiters, backslashes, ampersands, newlines, regular-expression characters, and strings resembling sed commands. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:13
Finding

Unsafe JSONL and CSV Serialization of Attacker-Controlled Entry Values

Content
View full analysis
> "$DATA_DIR/data.jsonl" ``` The same data is exported to CSV without CSV quoting or spreadsheet formula neutralization: ```bash 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" ``` ### Technical Analysis `_save_entry` inserts the attacker-controlled entry value directly between JSON quotation marks. JSON metacharacters such as quotation marks, backslashes, carriage returns, and newlines are not escaped. A crafted value can therefore terminate the intended `val` string, add fields, create additional physical records, or make the JSONL file syntactically invalid. The later parsing code uses `grep` and `cut` rather than a JSON parser, so malformed or injected records may be misinterpreted by listing, searching, and exporting operations. The CSV export separately concatenates fields with commas. It does not quote fields containing commas, quotation marks, carriage returns, or newlines as required by CSV conventions. It also does not neutralize values beginning with spreadsheet formula indicators such as `=`, `+`, `-`, or `@`. If an exported file is opened in spreadsheet software, attacker-controlled values may be interpreted as formulas rather than text. The exact effects depend on the spreadsheet application and its security policy, but may include misleading displayed content, external-resource requests, or activation of dangerous legacy formula features. ### Attack Path ...[truncated 1392 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 (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill is presented as a PLC programming helper, but the documented behavior is a generic local record-management utility with persistence, deletion, search, and export features. That mismatch can mislead users and downstream agents into granting trust or permissions inappropriate for the actual behavior, increasing the risk of unintended data handling or execution in sensitive industrial contexts.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest and description claim PLC programming assistance, but every documented command performs generic CRUD-style local data management. In an agent ecosystem, this kind of semantic deception is dangerous because tools may be selected based on metadata, causing an agent or user to invoke a skill under false assumptions about its purpose and trust boundary.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The body documentation reinforces a PLC-helper label while describing only entry storage, search, removal, export, and config operations. This contradiction can enable social-engineering-style misuse by making a generic filesystem-writing utility appear domain-specific and harmless, especially in industrial environments where operators may trust PLC-labelled tools more readily.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The manifest and help text claim this skill is for programmable logic controller programming, but the implemented commands only add, list, search, remove, export, and configure entries in a local JSONL/text store. There is no PLC-specific logic such as ladder logic handling, code generation, device communication, or program validation, so the actual behavior does not match the declared purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script persistently stores user-provided entries in $HOME/.plc/data.jsonl without any notice, consent prompt, retention policy, or sensitivity warning. In the context of a purported PLC programming helper, users may paste controller logic, network details, plant identifiers, credentials, or operational notes, causing sensitive industrial information to be silently retained on disk and later exposed to other local users, backups, or compromise of the workstation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The markdown lists a remove command with the description 'Remove entry by number', which indicates a destructive data operation. There is no accompanying warning about deletion, reversibility, or confirmation behavior, so the user is not informed of the risk to stored data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file describes an export command and later notes that data is stored in ~/.plc/, which means the skill can write user data to disk. The description lacks any explicit warning about file creation, overwrite behavior, or the destination of exported data, so users are not clearly informed about data-affecting behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The export feature copies stored data into a predictable file in the current working directory without warning, which can unintentionally duplicate potentially sensitive entries into less controlled locations. In PLC/industrial workflows, operators may run the command from shared project directories, removable media, or synced folders, increasing the chance of accidental disclosure of stored notes or configuration-related content.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.