Back to skill

Security audit

Eam

Security checks for vulnerabilities and agentic risk

Overview

The skill is a local asset tracker, but its helper script has unsafe input handling that can let crafted config data run commands and can corrupt or unsafe-export stored records.

Review before installing. Use this only with trusted input until the script is fixed, avoid storing secrets in config, and be careful with remove and export because they persistently change local files and exports may overwrite files in the current directory.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/script.sh:137
Finding

Arbitrary Command Execution Through GNU sed Program 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 ``` ### Technical Analysis The user-controlled `key` and `val` parameters are inserted directly into a dynamically constructed `sed` program. Double-quoting the shell argument prevents shell word splitting, but it does not make the resulting text safe for the `sed` interpreter. An attacker can place the `|` delimiter and newline characters in a value to terminate the intended substitution and append another GNU `sed` command. GNU `sed` supports the `e` command, which executes a command through a shell. Consequently, crafted configuration input can change the `sed` program from a data update into arbitrary local command execution. The configuration key is also interpreted as a regular expression by both `grep` and `sed`, further demonstrating that untrusted configuration data is being treated as executable syntax rather than literal text. ### Attack Path 1. The attacker creates an ordinary configuration entry so that `config.txt` exists and the target key follows the update branch: ```bash scripts/script.sh config demo initial ``` 2. The attacker updates the same key with a value containing a delimiter, newline, and GNU ` ...[truncated 1038 chars]
Remediation
View remediation
&2 return 1 } ``` - Reject carriage returns, newlines, NUL-equivalent input, and other control characters in configuration values unless explicitly required. - Replace the dynamic `sed` update with a data-oriented implementation. For example, read the file line by line, compare keys as literal strings, and write results to a securely created temporary file. - Create temporary files inside `DATA_DIR` with `mktemp`, restrictive permissions, and an exit trap; then atomically rename the completed file. - If `sed` remains in use, escape both regular-expression and replacement syntax. This is less robust than avoiding dynamic interpreter input and should not be the primary defense. - Add regression tests containing delimiters, backslashes, regular-expression metacharacters, and embedded newlines. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:11
Finding

JSONL Injection and Persistent Record Corruption

Content
View full analysis
> "$DATA_DIR/data.jsonl" } ``` ### Technical Analysis The function manually constructs JSON using `printf` and inserts `cmd` and `val` without JSON encoding. Shell quoting only controls how arguments reach `printf`; it does not escape JSON-special characters inside those arguments. Values containing double quotes or backslashes can alter or invalidate the JSON structure. Values containing literal newline characters can terminate the current JSONL record and inject one or more additional lines. Because other commands treat each physical line as an entry, an attacker can create forged records that were not independently added by the application. The readers also extract fields with `grep` and `cut` rather than a JSON parser, so malformed or attacker-shaped records can produce misleading display, search, statistics, removal, and export behavior. ### Attack Path 1. The attacker invokes `add` with an entry containing a closing JSON fragment and a literal newline. 2. `cmd_add` forwards the value to `_save_entry`. 3. `_save_entry` writes the value verbatim into `data.jsonl`. 4. The newline creates an additional physical line that downstream commands count as a separate record. 5. The attacker-controlled line can resemble a legitimate JSON object with arbitrary timestamp, command, and value fields. 6. `list`, `search`, `stats`, `remove`, and `export` subsequently process the corrupted or forged records. ### Impact Assessment The vulnerability compromises the integrity of the asset database. An attacker able to supply command arguments can forge entries, corrupt legitimate records, manipulat ...[truncated 323 chars]
Remediation
View remediation
> "$DATA_DIR/data.jsonl" ``` - Validate that each serialized output is exactly one JSON object before appending it. - Use a JSON parser such as `jq` for listing, searching, and exporting records instead of extracting fields with `grep` and `cut`. - If multiline values are not supported, explicitly reject carriage returns and newlines before serialization. Even when they are supported, encode them through the JSON serializer. - Write updates atomically and consider file locking to prevent concurrent writers from interleaving JSONL records. - Add tests for quotes, backslashes, Unicode, tabs, carriage returns, and newlines. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:107
Finding

Spreadsheet Formula Injection and Malformed CSV Export

Content
View full analysis
"$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" ;; ``` ### Technical Analysis The exporter concatenates fields with commas and writes them with `echo`, without standards-compliant CSV quoting or escaping. Values can contain commas, double quotes, carriage returns, or newlines, allowing an attacker to alter the logical rows and columns of the resulting file. Additionally, spreadsheet applications may interpret cells beginning with `=`, `+`, `-`, or `@` as formulas. Because the entry value is attacker-controlled and is exported without neutralization, opening the generated CSV in affected spreadsheet software can evaluate an attacker-supplied formula. This issue is triggered in the downstream spreadsheet context rather than while the shell script generates the export. ### Attack Path 1. The attacker adds an entry whose value begins with a spreadsheet formula marker, such as `=`, `+`, `-`, or `@`. 2. A user invokes: ```bash scripts/script.sh export csv ``` 3. The exporter writes the attacker-controlled value directly into `eam-export.csv`. 4. The user opens the exported file in spreadsheet software. 5. If the spreadsheet application evaluates CSV formulas, it interprets the value as a formula rather than inert text. 6. Depending on the application and its security configuration, the formula may display deceptive content, initiate external requests, or expos ...[truncated 605 chars]
Remediation
View remediation
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 (3)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file describes a remove command that deletes an entry, but provides no warning about data loss, confirmation behavior, or whether removal is reversible. For markdown files, omissions around behaviors that affect user data or system integrity should be flagged when the description lacks appropriate warnings.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The skill description states that export writes data to a file, but does not warn that asset data will be copied to an output file or note any privacy or overwrite considerations. Markdown skill descriptions should disclose behaviors that affect user data so users understand persistence and sharing implications.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The config command persists arbitrary key/value pairs into $DATA_DIR/config.txt, which is a file write affecting user data. While the code prints a success message after writing, there is no prior comment, docstring, or explicit warning that values provided to this command will be stored on disk, which matters because users may enter sensitive settings.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.