Back to skill

Security audit

Filed — US Business Entity Search

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its business lookup purpose, but its search script can execute crafted search text as local code and should be fixed before routine use.

Review or patch the shell script before installing broadly, especially if the agent may search names copied from emails, webpages, tickets, or other untrusted sources. Prefer FILED_API_KEY over --api-key, and treat all lookup terms and identifiers as data sent to Filed.dev.

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

Error
Location
scripts/filed.sh:131
Finding
Arbitrary Python Code Execution Through Unsafe Query Encoding<![CDATA[ ## Vulnerability Details **File Location**: `scripts/filed.sh`, lines 131–133 **Vulnerability Type**: User-controlled input embedded directly into dynamically interpreted Python source **Risk Level**: High ### Vulnerable Code ```bash [[ -n "$name" ]] && url+="&name=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$name'))" 2>/dev/null || echo "$name")" [[ -n "$agent" ]] && url+="&agent=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$agent'))" 2>/dev/null || echo "$agent")" [[ -n "$officer" ]] && url+="&officer=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$officer'))" 2>/dev/null || echo "$officer")" ``` ### Technical Analysis The values supplied through `--name`, `--agent`, and `--officer` are inserted directly into Python source code executed using `python3 -c`. Although the shell variables are expanded within a shell-quoted argument, the expanded result is subsequently interpreted as Python program text. An attacker can include a single quote in an option value to terminate the intended Python string literal, append arbitrary Python statements, and comment out the remaining generated source. For example, a value structurally equivalent to the following can escape the intended string: ```text '); __import__("os").system("ATTACKER_COMMAND"); # ``` This causes the dynamically constructed Python program to invoke an attacker-selected operating-system command rather than merely URL-encoding the supplied value. The issue affects all three query parameters processed in this manner. The fallback `|| echo "$name"` does not mitigate the vulnerability because injected commands can execute before `python3` exits. It also returns unencoded input when Python is unavailable or fails, which can produce malformed or attacker-influenced query strings. ### Attack Path 1. An attacker influences a value passed to `filed.sh search` through `--name`, `--agent`, or `--officer`. 2. The script interpolates that value into t ...[truncated 1381 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Do not interpolate user-controlled data into dynamically interpreted Python source. Pass each value as a separate positional argument: ```bash urlencode() { python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=""))' "$1" } [[ -n "$name" ]] && url+="&name=$(urlencode "$name")" [[ -n "$agent" ]] && url+="&agent=$(urlencode "$agent")" [[ -n "$officer" ]] && url+="&officer=$(urlencode "$officer")" ``` A preferable approach is to avoid constructing the query string manually and delegate encoding to `curl`: ```bash curl -sS --get "${BASE_URL}/search" \ --data-urlencode "state=${state}" \ --data-urlencode "name=${name}" \ -H "Authorization: Bearer ${API_KEY}" \ -H "Content-Type: application/json" ``` Add optional parameters only when they are present. This separates query data from executable code and consistently encodes reserved characters. Additional hardening should include: 1. Validate `state` against the explicitly supported state-code allowlist. 2. Validate enumerated fields such as `status` and `type`. 3. Validate dates, limits, and offsets against their documented formats and ranges. 4. Reject malformed command-line options and missing option values explicitly. 5. Remove the unsafe unencoded `echo` fallback; fail closed if the selected encoding mechanism is unavailable. 6. Add regression tests containing apostrophes, quotation marks, semicolons, command-substitution syntax, newlines, and Unicode characters. 7. Avoid exposing API keys through command-line arguments where possible; prefer the environment variable or another protected secret mechanism. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill declares shell and network-capable behavior through required binaries and API usage, but it does not define an explicit tool permission boundary such as allowed-tools or permissions. That creates ambiguity about what execution and network capabilities the agent may exercise when invoking the skill, increasing the chance of overbroad tool access or unsafe reuse in environments with looser defaults.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script sends user-supplied business search terms and identifiers directly to a third-party API over the network without any explicit warning that names, officer names, agent names, and filing numbers will leave the local environment. In this KYB/due-diligence context, those queries can reveal sensitive investigative interests or personal data, so silent transmission creates a real privacy and compliance risk even though HTTPS is used.

Missing User Warnings

Low
Confidence
93% confidence
Finding
The documentation instructs consumers to send business search terms and an API key to an external service but does not warn that user-provided queries, officer names, registered-agent names, and credentials are being transmitted off-platform. In a skill context, this can create an informed-consent and data-handling gap, especially when users may input sensitive due-diligence targets or identifying information assuming the lookup is local or first-party.

Missing User Warnings

Low
Confidence
92% confidence
Finding
Allowing API keys via a --api-key command-line flag exposes the credential to shell history, process listings, and potentially audit logs on multi-user systems. The script mentions the flag but does not warn users of that exposure, making accidental credential disclosure more likely.

Static analysis

No suspicious patterns detected.