Back to skill

Security audit

Ollama Web Search CLI

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says, but it handles an Ollama API key and sends user queries or URLs to Ollama with some privacy and credential-exposure concerns.

Install only if you are comfortable sending search queries and fetch URLs to Ollama. Do not use it for secrets, private internal URLs, regulated data, or confidential research topics. Prefer a limited or easily revocable Ollama API key, and be aware that the current shell implementation may expose the key through local process monitoring while curl is running.

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 Command-Line Arguments## Vulnerability Details **File Location**: `ollama-web-search.sh:148-154` and `ollama-web-search.sh:241-247`; insecure usage is also documented in `SKILL.md:151-161` and `README.md:113-116` **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code Search request in `ollama-web-search.sh:148-154`: ```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 in `ollama-web-search.sh:241-247`: ```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") ``` The same insecure pattern is promoted in the documentation: ```bash curl -X POST "https://ollama.com/api/web_search" \ -H "Authorization: Bearer $OLLAMA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"query":"what is ollama","max_results":5}' ``` ```bash curl -X POST "https://ollama.com/api/web_search" \ -H "Authorization: Bearer $OLLAMA_API_KEY" \ -d '{"query":"test"}' ``` ### Technical Analysis The shell expands `OLLAMA_API_KEY` before launching `curl`, placing the complete bearer token in the process argument vector. Depending on the operating system, process permissions, container configuration, and monitoring environment, command-line arguments may be visible through process inspection utilities, `/proc`, audit logs, endpoint monitoring, crash diagnostics, or process telemetry. The Skill legitimately needs to authenticate to Ollama and therefore m ...[truncated 1875 chars]
Remediation
## Remediation Suggestions 1. Avoid expanding the API key directly into `curl` command-line arguments. 2. Provide the sensitive header through a temporary curl configuration file or another mechanism that does not expose the token in the process argument vector. 3. Create any credential-bearing temporary file with restrictive permissions and delete it immediately after use. For example: ```bash umask 077 CURL_CONFIG="$TEMP_DIR/curl.conf" { printf 'header = "Authorization: Bearer %s"\n' "$OLLAMA_API_KEY" printf 'header = "Content-Type: application/json"\n' } > "$CURL_CONFIG" HTTP_CODE=$(curl --config "$CURL_CONFIG" \ -s -o "$TEMP_DIR/response.txt" -w "%{http_code}" \ --max-time "$TIMEOUT_SECONDS" \ -X POST "https://ollama.com/api/web_search" \ -d "$JSON_PAYLOAD" 2>/dev/null || echo "000") rm -f "$CURL_CONFIG" ``` 4. Verify that the selected mechanism does not expose the secret through verbose output, shell tracing, diagnostic logs, or error messages. 5. Keep `set -x` disabled while credentials are processed and document that users must not enable shell tracing around these requests. 6. Update the examples in `SKILL.md` and `README.md` so users are not instructed to reproduce the insecure pattern. 7. Recommend narrowly scoped, short-lived API keys where supported, and provide clear key-rotation and revocation guidance.
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 (12)

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The README instructs users to perform web searches and page fetching via the Ollama Web Search API but does not clearly disclose that search queries, target URLs, and fetched page content will be transmitted to an external third-party service. This can mislead users into sending sensitive prompts, internal URLs, or confidential page content off-host without informed consent, which is a real privacy and data-handling risk.

External Transmission

Medium
Category
Data Exfiltration
Content
### 3️⃣ 依赖检查
```bash
python3 --version  # ✅ macOS 自带
curl --version     # ✅ macOS 自带
```

### 4️⃣ 测试
Confidence
90% confidence
Finding
The documented commands direct users to invoke a web search and fetch workflow that necessarily sends user-supplied queries and URLs to a remote API endpoint. In this skill's context, external transmission is expected functionality, but it still constitutes a genuine security/privacy concern because the README does not prominently warn about outbound data flow or scope what information is safe to transmit.

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill documents shell-based and file-reading capabilities but does not declare any explicit tool scope such as permissions or allowed-tools. This can lead to overbroad execution in agent environments, where the skill may receive more capability than users expect, increasing the chance of unintended command execution or local file access.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill is explicitly designed to perform web search and web fetch against external Ollama API endpoints, but the description does not prominently warn that user queries and URLs will be transmitted off-system. This can cause accidental disclosure of sensitive prompts, internal URLs, or private research topics to a third-party service.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The natural-language instructions and descriptions in the file are presented in Chinese throughout, but the document does not offer an alternative language or indicate that Chinese is an intentional, region-specific requirement. This can violate language/locale policy when a skill effectively forces one language without user opt-in.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The conversational examples use broad natural-language triggers such as asking the agent to search or fetch content, which can overlap with ordinary user requests. In agent systems that auto-route based on phrasing, this raises the risk of unintentional tool invocation and sending user-provided content or URLs to external services without a clear opt-in.

External Transmission

Medium
Category
Data Exfiltration
Content
| **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" \
Confidence
94% confidence
Finding
The documented cURL examples send user-controlled query strings, URLs, and an authorization bearer token to external Ollama endpoints. External transmission is expected for this skill's purpose, but it remains security-relevant because sensitive inputs, internal-only URLs, or credentials mishandling could lead to data leakage or unintended third-party exposure.

External Transmission

Medium
Category
Data Exfiltration
Content
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" \
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This shell script performs outbound HTTP requests to Ollama endpoints using user-supplied search terms and URLs, and includes an Authorization header derived from an environment variable. While the help text explains how to use the commands, it does not explicitly warn that the entered query/URL content will be transmitted to a remote service, which is a user-facing disclosure expected for network/data-transfer operations.

External Transmission

Medium
Category
Data Exfiltration
Content
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" \
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
The skill documentation is written entirely in Chinese, with no indication that other languages are supported or that Chinese is a deliberate region-specific requirement. Per the policy rule, forcing a specific language without user opt-in can be a natural-language policy violation.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
All natural-language strings in the script, including help, errors, and status output, are hard-coded in Chinese with no option to select another language. This is a language/locale policy issue because the skill imposes a specific language on all users without opt-in or justification.

Static analysis

No suspicious patterns detected.