Back to skill

Security audit

Duckduckgo Websearch

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward DuckDuckGo search skill with disclosed external network use and no evidence of hidden persistence, credential access, or destructive behavior.

Install only if you are comfortable with search terms being sent to DuckDuckGo. Avoid using it for secrets, private customer data, internal prompts, or credentials, and prefer locked installs such as npm ci because the package manifest allows compatible dependency updates.

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/ddg_search.js:12
Finding

Unbounded Network Response Buffering Can Cause Denial of Service

Content
View full analysis

Vulnerability Details

File Location: scripts/ddg_search.js, lines 12–21 and 27–59
Vulnerability Type: Unbounded response buffering and missing network safeguards
Risk Level: Medium

Vulnerable Code

js
function instantAnswer(query, cb) {
  const u = 'https://api.duckduckgo.com/?' + qs.stringify({ q: query, format: 'json', no_html: 1, no_redirect: 1 });
  https.get(u, res => {
    let data = '';
    res.on('data', c => data += c);
    res.on('end', () => {
      try {
        const j = JSON.parse(data);
        cb(null, j);
      } catch (e) { cb(e); }
    });
  }).on('error', cb);
}

function serpFallback(query, cb) {
  const u = 'https://duckduckgo.com/html/?' + qs.stringify({ q: query });
  https.get(u, res => {
    let data = '';
    res.on('data', c => data += c);
    res.on('end', () => {
      try {
        const root = parse(data);
        const results = [];
        // DuckDuckGo HTML uses .result__a for links in modern markup; fallback scanning
        const anchors = root.querySelectorAll('a.result__a');
        if (anchors.length === 0) {
          // older/simple HTML pages
          const items = root.querySelectorAll('.result');
          for (const it of items.slice(0, 10)) {
            const a = it.querySelector('a');
            if (!a) continue;
            const title = a.text.trim();
            const url = a.getAttribute('href');
            const snippetEl = it.querySelector('.result__snippet') || it.querySelector('.snippet') || null;
            const snippet = snippetEl ? snippetEl.text.trim() : '';
            results.push({ title, url, snippet });
          }
        } else {
          for (const a of anchors.slice(0, 10)) {
            const title = a.text.trim();
            const url = a.getAttribute('href');
            // try to find snippet nearby
            const parent = a.parentNode;
            let snippet 
...[truncated 2118 chars]
Remediation
View remediation

Remediation Suggestions

  • Enforce a strict maximum response size for both JSON and HTML responses. Track bytes as chunks arrive and immediately destroy the request when the limit is exceeded.
  • Configure connection and overall response deadlines with request.setTimeout() or an AbortController; destroy timed-out requests and return a controlled error.
  • Accept only successful HTTP status codes and explicitly handle or reject redirects.
  • Validate the expected content type before buffering and parsing. Require JSON for the Instant Answer endpoint and an appropriate HTML media type for the SERP endpoint.
  • Check Content-Length when present, while retaining streaming byte enforcement because that header may be absent or inaccurate.
  • Avoid parsing responses after a size, timeout, status, or media-type violation.
  • Add tests covering oversized responses, slow responses, incomplete bodies, invalid media types, malformed JSON or HTML, and non-2xx status codes.
  • Consider issuing the HTML request only when the Instant Answer response is insufficient, reducing unnecessary exposure and resource consumption.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill advertises very broad triggers such as general web queries, site-specific searches, and short summaries, which can cause it to activate for a large share of unrelated user requests. Over-broad invocation increases the chance that an agent routes sensitive or ambiguous tasks into external web access unexpectedly, creating privacy, data handling, and policy-enforcement risks.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This script sends the user-supplied search query to DuckDuckGo over the network, which is a real external data transmission. In an agent skill context, queries may contain sensitive prompts, user data, or internal task context, so transmitting them to a third-party service can create a privacy and data-leakage risk even though the behavior appears intended and not overtly malicious.

Content

Scanner excerpt · scripts/ddg_search.js (reported line 11)May include surrounding context.

js
const qs = require('querystring');

function instantAnswer(query, cb) {
  const u = 'https://api.duckduckgo.com/?' + qs.stringify({ q: query, format: 'json', no_html: 1, no_redirect: 1 });
  https.get(u, res => {
    let data = '';
    res.on('data', c => data += c);

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
93% confidence
Finding

The dependency version is specified with a caret range (^7.0.2), which permits automatic installation of newer compatible releases. This can introduce supply-chain risk because different environments may resolve to different package versions, including a newly published compromised or breaking release, reducing build reproducibility and weakening review controls.

Content

Scanner excerpt · scripts/package.json (reported line 13)May include surrounding context.

json
"author": "",
  "license": "ISC",
  "dependencies": {
    "node-html-parser": "^7.0.2"
  }
}

Static analysis

No suspicious patterns detected.