Back to skill

Security audit

NewsAPI Search

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward NewsAPI search skill with no hidden execution or persistence, though its credential handling is broader than ideal.

Before installing, keep ~/.openclaw/.env limited to the NewsAPI key or avoid storing unrelated secrets there. Be aware that NewsAPI request URLs may contain the API key, so avoid running this through tooling that logs full URLs unless those logs redact sensitive query parameters.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/search.js:7
Finding

Overbroad Loading of Credentials from a Shared Environment File

Content
View full analysis
{ const match = line.match(/^([^#=]+)=(.*)$/); if (match) { process.env[match[1].trim()] = match[2].trim(); } }); } } ``` ### Technical Analysis The Skill requires only `NEWSAPI_KEY`, but both scripts read the complete shared `~/.openclaw/.env` file and copy every matching `KEY=value` entry into `process.env`. This behavior exceeds the minimum access necessary for the declared NewsAPI functionality. If the shared file contains credentials for other services, those unrelated secrets become accessible to all code executing in the Node.js process. The loader also overwrites existing environment variables without checking whether they were already defined, which can unexpectedly alter trusted process configuration. The reviewed code does not transmit unrelated environment variables. The risk arises from unnecessarily broad secret access and the resulting exposure to future code changes, injected code, or compromised runtime components. ### Attack Path 1. A user stores `NEWSAPI_KEY` and unrelated service credentials in `~/.openclaw/.env`. 2. The user invokes `scripts/search.js` or `scripts/sources.js`. 3. The script reads the entire shared credential file rather than retrieving only `NEWSAPI_KEY`. 4. Every parsed entry is copied into `process.env`. 5. Any subsequently executed or compromised code in the same process can read those unrelated credentials through `process.env`. 6. The exposed credentials could t ...[truncated 808 chars]
Remediation
View remediation
entry.startsWith('NEWSAPI_KEY=')); return line ? line.slice('NEWSAPI_KEY='.length).trim() : undefined; } const API_KEY = loadNewsApiKey(); ``` ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/search.js:200
Finding

NewsAPI Credential Included in Request URLs

Content
View full analysis
Remediation
View remediation
{ const options = new URL(url); const requestOptions = { hostname: options.hostname, path: options.pathname + options.search, method: 'GET', headers: { 'User-Agent': 'NewsAPISearch/1.0 (Research Tool)', 'X-Api-Key': API_KEY } }; const req = https.request(requestOptions, (res) => { let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { try { resolve(JSON.parse(data)); } catch (error) { reject(new Error('Invalid JSON response')); } }); }); req.on('error', reject); req.setTimeout(30000, () => { req.destroy(); reject(new Error('Request timeout')); }); req.end(); }); } ``` Construct request parameters without the credential: ```javascript const params = new URLSearchParams({ pageSize: options.limit?.toString() || '10', page: options.page?.toString() || '1', sortBy: options.sort || 'relevancy' }); ``` ]]>
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (46)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The description says the skill searches news articles and supports article-oriented filters such as time windows, sources, domains, and languages. The code instead calls NewsAPI's sources endpoint to retrieve source metadata, not articles. Its implemented filters are country, category, and language, with no support for time windows, domains, or article source filtering in the described sense. This is a material purpose mismatch, not just an implementation detail.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search.js "technology" --days 7

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/sources.js --country us --category general

Static analysis

No suspicious patterns detected.