T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/search.py:24- Finding
Overbroad Search of Credential-Bearing Environment Files
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Tavily search skill mostly does what it says, but it needs Review because it reads API keys from broader .env locations than documented and gives weak plaintext key-storage guidance.
Install only if you are comfortable sending search queries to Tavily and using a Tavily API key. Prefer setting TAVILY_API_KEY only for the current session or storing it in a locked-down secret store; if you use ~/.openclaw/.env, make it owner-readable only. Review or remove the ~/.env and current-directory .env fallback behavior before using this in shared, sensitive, or multi-project environments.
scripts/search.py:24Overbroad Search of Credential-Bearing Environment Files
SKILL.md:35Plaintext API-Key Storage Guidance Lacks Permission Hardening
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
method='POST'
)
with urllib.request.urlopen(req, timeout=30) as response:
result = json.loads(response.read().decode('utf-8'))
return result
The instruction to append TAVILY_API_KEY to ~/.openclaw/.env is credential persistence guidance that increases the chance of secret disclosure. In the context of a network-enabled search skill, exposure of the API key can allow unauthorized use of the user's Tavily account, quota consumption, and possible access to search activity associated with that key.
export TAVILY_API_KEY="tvly-..."
echo 'TAVILY_API_KEY=tvly-...' >> ~/.openclaw/.env
## Usage
Recommending in the Notes section that users add the API key to ~/.openclaw/.env reinforces insecure secret-at-rest handling without any safety warning. Repetition increases the likelihood that users will persist credentials in a broadly accessible location and overlook safer alternatives.
## Notes
- 首次使用需要先配置TAVILY_API_KEY
- 建议将API key添加到~/.openclaw/.env
- 超过免费额度后会返回错误提示
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
if api_key:
return api_key
# Check .env file in common locations
env_paths = [
os.path.expanduser('~/.openclaw/.env'),
os.path.expanduser('~/.env'),
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Check .env file in common locations
env_paths = [
os.path.expanduser('~/.openclaw/.env'),
os.path.expanduser('~/.env'),
'.env'
]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Check .env file in common locations
env_paths = [
os.path.expanduser('~/.openclaw/.env'),
os.path.expanduser('~/.env'),
'.env'
]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Check .env file in common locations
env_paths = [
os.path.expanduser('~/.openclaw/.env'),
os.path.expanduser('~/.env'),
'.env'
]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
api_key = get_api_key()
if not api_key:
return {
"error": "TAVILY_API_KEY not found. Please set it in environment or ~/.openclaw/.env"
}
# Build request payload
The skill documents capabilities that involve environment variables, reading local files, and making network requests, but it does not declare any explicit tool scope or permissions. That weakens least-privilege controls and makes it harder for users or a runtime to understand and constrain what the skill can access before execution.
The setup instructions recommend storing the API key in ~/.openclaw/.env without warning that this persists a credential on disk. Secrets written to local files can be exposed through weak filesystem permissions, backups, logs, accidental commits, or other local tooling that reads env files.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
import urllib.error
from datetime import datetime, timedelta
TAVILY_API_URL = "https://api.tavily.com/search"
def get_api_key():
"""Get Tavily API key from environment or config file."""
The script sends user search queries and the API key to a third-party service, but the code itself provides no explicit privacy or consent warning at the point of use. In an agent-skill context, users may submit sensitive prompts or internal data without realizing it will leave the local environment, creating a real data disclosure risk.
Natural-language policy violations include forcing a specific language without user opt-in. The primary description is written in Chinese with embedded English, which may impose a language expectation on users without explicitly stating that documentation or usage guidance is available by user preference.