Back to skill

Security audit

Ollama Web Search

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its stated web search/fetch purpose, but users should review it because it sends queries and URLs to Ollama and exposes the Ollama API key through curl command arguments while running.

Install only if you are comfortable sending search terms and fetched URLs to Ollama. Use a narrowly scoped or easily rotatable Ollama API key if available, avoid secrets or internal-only URLs, and prefer updating the script to pass the Authorization header without putting the token in process arguments.

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
ollama-web-search.sh:148
Finding

API Key Exposed Through curl Process Arguments

Content
View full analysis

Vulnerability Details

File Location: ollama-web-search.sh, lines 148–155 and 246–253
Vulnerability Type: API credential exposure through process arguments
Risk Level: Medium

Vulnerable Code

Search request at lines 148–155:

bash
HTTP_CODE=$(curl -s -o "$TEMP_DIR/response.txt" -w "%{http_code}" \
  --max-time "$TIMEOUT_SECONDS" \
  -X POST "https://ollama.com/api/web_search" \
  --header "Authorization: Bearer $OLLAMA_API_KEY" \
  --header "Content-Type: application/json" \
  -d "$JSON_PAYLOAD" 2>/dev/null || echo "000")

Fetch request at lines 246–253:

bash
HTTP_CODE=$(curl -s -o "$TEMP_DIR/response.txt" -w "%{http_code}" \
  --max-time "$TIMEOUT_SECONDS" \
  -X POST "https://ollama.com/api/web_fetch" \
  --header "Authorization: Bearer $OLLAMA_API_KEY" \
  --header "Content-Type: application/json" \
  -d "$JSON_PAYLOAD" 2>/dev/null || echo "000")

Technical Analysis

The shell expands OLLAMA_API_KEY before starting curl, placing the complete bearer token in curl's argument vector as part of the Authorization header. On systems where another local process can inspect that process's command-line arguments, the token may be visible through process-monitoring tools or process metadata such as /proc.

The safe_error redaction function only removes the key from application-generated error messages. It does not protect the argument vector, so it does not mitigate this exposure.

Sending an API credential to the fixed Ollama HTTPS endpoints is necessary and consistent with the Skill's declared search and fetch functionality. The vulnerability is specifically the local method used to pass that credential to curl, not the documented network transmission itself.

Exploitability depends on operating-system process-visibility controls, the attacker's local access, and whether the attacker can observe the relatively short-lived curl process.

Attack Path

  1. A vict ...[truncated 1021 chars]
Remediation
View remediation

Remediation Suggestions

  • Do not place the bearer token directly in curl's command-line arguments.
  • Supply the sensitive header through a permission-restricted temporary curl configuration file or another mechanism that does not expose the token in the argument vector.
  • Create any credential-bearing temporary file with restrictive permissions, such as mode 0600, and retain the existing cleanup trap.
  • Keep the authorization value out of logs, diagnostic traces, shell tracing, and error output.
  • Consider disabling shell tracing around credential handling if the script may run in environments using set -x.
  • Document that users should issue narrowly scoped API keys where supported and rotate the key immediately if local exposure is suspected.
  • Add a regression test that executes the request while examining curl's visible argument vector and verifies that the token does not appear.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (10)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README promotes web search and page fetching through the Ollama API but does not clearly disclose that user queries, target URLs, and fetched page content are transmitted to a third-party external service. This can cause unintended disclosure of sensitive prompts, internal URLs, or proprietary content if users assume processing is local.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
82% confidence
Finding

The README instructs users to perform searches and fetch remote pages via curl-backed API calls, which inherently sends user-provided queries and URLs to an external network service. In the context of a search/fetch skill this behavior is expected, but it is still security-relevant because it can leak sensitive data if users are not explicitly warned.

Content

Scanner excerpt · README.md (reported line 21)May include surrounding context.

3️⃣ 依赖检查

bash
python3 --version  # ✅ macOS 自带
curl --version     # ✅ macOS 自带

4️⃣ 测试

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill declares shell-capable behavior and references a local script plus external HTTP calls, but it does not define any explicit tool scope such as allowed-tools or permissions. In an agent ecosystem, this weakens execution boundaries and can let the skill be invoked with broader shell/file capabilities than users or hosts expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The conversational trigger examples are very broad, such as natural-language requests to search or fetch content, without strong invocation boundaries or confirmation requirements. This can cause accidental activation during ordinary conversation and may lead to unintended outbound requests or webpage retrieval.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 169)May include surrounding context.

| Web Search | https://ollama.com/api/web_search | POST | | Web Fetch | https://ollama.com/api/web_fetch | POST |

cURL 示例

bash
# Web Search
curl -X POST "https://ollama.com/api/web_search" \

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This shell script contains natural-language instructions, usage text, and status/error messages exclusively in Chinese. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, which is not present here.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · ollama-web-search.sh (reported line 149)May include surrounding context.

sh
echo ""
  
  # 执行请求并检查状态码
  HTTP_CODE=$(curl -s -o "$TEMP_DIR/response.txt" -w "%{http_code}" \
    --max-time "$TIMEOUT_SECONDS" \
    -X POST "https://ollama.com/api/web_search" \
    --header "Authorization: Bearer $OLLAMA_API_KEY" \

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · ollama-web-search.sh (reported line 247)May include surrounding context.

sh
echo ""
  
  # 执行请求并检查状态码
  HTTP_CODE=$(curl -s -o "$TEMP_DIR/response.txt" -w "%{http_code}" \
    --max-time "$TIMEOUT_SECONDS" \
    -X POST "https://ollama.com/api/web_fetch" \
    --header "Authorization: Bearer $OLLAMA_API_KEY" \

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The natural-language instructions throughout the README are written in Chinese, and there is no indication that users may choose another language or that the skill is intentionally region-specific. Per the stated policy, forcing a specific language without opt-in can be a locale policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

L003 的描述以及全文说明均固定为中文,但文档未说明这是面向特定中文用户群的区域化技能,也未提供语言选择或用户可切换的说明。根据语言/locale 政策,默认强制单一语言而无用户选择可能构成自然语言策略问题。

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.