Back to skill

Security audit

Exa X Search

Security checks for vulnerabilities and agentic risk

Overview

The skill has a legitimate Twitter/X search purpose, but its command templates can turn an untrusted search topic into local shell execution if followed literally.

Install only if agents using this skill will pass search topics as safe process arguments rather than interpolating them into shell strings. Be aware it may read a local product-marketing context file when present and use that context in the search workflow.

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
SKILL.md:29
Finding

Shell Command Injection Through Unsafely Interpolated Search Queries

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 29-45
Vulnerability Type: Shell command injection
Risk Level: High

The skill instructs the agent to insert a user-provided topic or brand directly into shell commands:

bash
node tools/clis/exa.js search --query "[topic or brand]" --category "tweet" --num-results 20

For recent tweets only:

bash
node tools/clis/exa.js search --query "[topic]" --category "tweet" --num-results 20 --start-date [current-year]-01-01  # Use current year

The dry-run command uses the same unsafe construction:

bash
node tools/clis/exa.js search --query "[topic]" --category "tweet" --dry-run

Technical Analysis

The search topic originates from user-controlled input and is interpolated into a command that the skill explicitly directs the agent to run through exec. Enclosing the value in double quotes does not make shell interpolation safe. POSIX-compatible shells still evaluate command substitutions such as $(command) and backtick expressions inside double-quoted strings.

Consequently, a crafted topic can alter execution before the Node.js process receives the query argument. The vulnerability affects normal searches, date-filtered searches, and dry runs. The --dry-run option only changes the Exa CLI's behavior; it does not prevent the shell from evaluating injected substitutions first.

For example, if an untrusted topic contains a command-substitution expression, the resulting shell command executes that expression locally while also passing its output as part of the search query.

Attack Path

  1. An attacker asks the agent to search X/Twitter for a topic containing shell metacharacters or command substitution, such as a value shaped like brand $(attacker-command).
  2. The agent follows SKILL.md and replaces the [topic] placeholder with the supplied text.
  3. The agent submits the resulting command through a shell-backed exec o ...[truncated 1387 chars]
Remediation
View remediation

Remediation Suggestions

  1. Do not interpolate user input into a shell command string. Invoke Node.js with an argument-array API that bypasses shell parsing, such as:

    javascript
    execFile("node", [
      "tools/clis/exa.js",
      "search",
      "--query",
      topic,
      "--category",
      "tweet",
      "--num-results",
      "20"
    ]);
    
  2. Update the skill instructions to require a non-shell process execution interface. Explicitly state that the topic must be passed as one argument and that shell execution must be disabled.

  3. Apply the same correction to the normal, recent-results, and dry-run workflows. A dry run must not be represented as safe when its command is still parsed by a shell.

  4. If the available execution tool only accepts shell strings, use a well-tested platform-specific argument-escaping library rather than manual quoting. Reject command-substitution syntax and shell control characters as defense in depth, but do not treat validation alone as a substitute for argument-array execution.

  5. Add adversarial tests using topics containing spaces, quotes, semicolons, newlines, backticks, $(), pipes, and redirection operators. Verify that every value reaches the CLI as inert data and never causes an additional process or shell operation.

  6. Run the agent and CLI with least privilege, narrowly scoped credentials, restricted filesystem access, and constrained outbound network access to reduce impact if command construction regresses.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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 (1)

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill explicitly instructs the agent to read a local workspace file before proceeding, which creates a data exposure risk because it accesses potentially sensitive repository context without an explicit user-facing consent step. While the target file appears business-related rather than secret-focused, any automatic workspace read broadens data access and can unintentionally incorporate confidential internal strategy into outputs or downstream tool calls.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.