Back to skill

Security audit

Tavily Plus

Security checks for vulnerabilities and agentic risk

Overview

This Tavily search skill is mostly coherent, but it needs review because it can send API keys to an unvalidated endpoint and can save sensitive search reports locally.

Install only if you trust the execution environment and the Tavily endpoint configuration. Keep TAVILY_BASE_URL unset or pinned to the real Tavily API, do not put secrets or private internal material in search queries, and use exportDoc only when you are comfortable retaining the report on disk.

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

Warning
Location
scripts/smart-search.js:8
Finding

Unrestricted API Base URL Allows Tavily Credential Disclosure

Content
View full analysis

Vulnerability Details

File Location: scripts/smart-search.js, lines 8 and 76–83
Vulnerability Type: Unrestricted credential forwarding to a configurable endpoint
Risk Level: Medium

Vulnerable Code

js
const BASE_URL = process.env.TAVILY_BASE_URL || "https://api.tavily.com";
js
const response = await fetch(`${BASE_URL}/search`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${apiKey}`,
    "X-Client-Source": "openclaw-tavily-plus"
  },
  body: JSON.stringify(body),
  signal: AbortSignal.timeout(DEFAULT_TIMEOUT)
});

Technical Analysis

The TAVILY_BASE_URL environment variable is accepted without validating its scheme, hostname, port, or trust boundary. The search function then attaches the selected Tavily API key to the Authorization header of every request made to that URL.

Consequently, anyone able to influence the process environment can redirect requests to an attacker-controlled endpoint. Invoking the skill then sends both the Tavily credential and the user's search query to that endpoint. The API-key rotation logic can expose additional configured keys during repeated requests or simulated HTTP 429 responses.

This is a credential-exfiltration weakness caused by forwarding secrets to an unrestricted destination.

Attack Path

  1. An attacker gains the ability to control or influence TAVILY_BASE_URL in the skill's execution environment.
  2. The attacker sets it to an endpoint under their control, such as https://attacker.example.
  3. A user or agent invokes smartSearch.
  4. getApiKey() reads a Tavily API key from the environment.
  5. searchWithRetry() sends a request to https://attacker.example/search with the key in the Authorization: Bearer ... header.
  6. The attacker's server records the credential and the user's query.
  7. If the server responds with HTTP 429, the retry logic may send other configured keys in subsequent requests.

Impact

...[truncated 525 chars]

Remediation
View remediation

Remediation Suggestions

  1. Parse the configured URL with the standard URL class and reject malformed values.
  2. Require HTTPS and reject plaintext HTTP or other schemes.
  3. Enforce an explicit hostname allowlist, such as api.tavily.com, before attaching credentials.
  4. Reject unexpected ports, embedded credentials, and untrusted redirects.
  5. Disable automatic cross-origin redirects or revalidate the final destination before forwarding the Authorization header.
  6. If custom Tavily-compatible endpoints are required, make that behavior an explicit trusted-administrator setting rather than an unrestricted environment override.
  7. Bind each credential to its intended origin and never reuse Tavily production keys for a different host.
  8. Add tests confirming that attacker-controlled hosts, non-HTTPS URLs, deceptive subdomains, and redirects cannot receive API keys.
  9. Rotate any API keys that may previously have been used while TAVILY_BASE_URL pointed to an untrusted destination.

Example validation pattern:

js
const configuredUrl =
  process.env.TAVILY_BASE_URL || "https://api.tavily.com";
const parsedBaseUrl = new URL(configuredUrl);

if (
  parsedBaseUrl.protocol !== "https:" ||
  parsedBaseUrl.hostname !== "api.tavily.com" ||
  parsedBaseUrl.port !== ""
) {
  throw new Error("Untrusted Tavily API endpoint");
}

const BASE_URL = parsedBaseUrl.origin;
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill advertises network access, environment-variable API key usage, and file export behavior but does not declare any explicit tool scope such as allowed tools or permissions. This creates an authorization and review gap: operators cannot easily constrain or audit what the skill is permitted to access, which is especially risky for a search skill that may read secrets from env and write content to disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill supports offline report generation that writes search queries, results, and AI summaries to a local path, but it does not warn that potentially sensitive user content will be persisted on disk. This can expose confidential research topics, extracted web content, or personal data to other local users, backups, logs, or later unintended reuse.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The header comment advertises 'AI Enhancement' with intent recognition, sub-question decomposition, and summarization, but the actual implementations are simple keyword/rule-based logic in recognizeIntent/decomposeQuery and summary generation is just joined snippets. This is an active contradiction between documented capability and code behavior, not merely an omitted detail.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

User queries and derived sub-questions are sent to a third-party service, which can expose sensitive prompts, research topics, or embedded secrets if users provide them. In this skill context, the decomposition step can amplify disclosure by transmitting multiple reformulations of the same potentially sensitive request, increasing privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The export feature persists the full query, derived sub-questions, results, and summary to a predictable local path under the user's home directory. If the search contains sensitive topics, credentials, internal URLs, or regulated data, this creates a local confidentiality risk through unintended retention, later access by other local users/processes, backups, or accidental sharing.

Content

No source excerpt is available for this finding.