← MCP server and skill grades

duckduckgo-mcp-server

nickclyde/duckduckgo-mcp-server

B
Type
MCP server
Scanned
Nov 12, 2026
Version
8182af3f2295
Files read
15

This MCP server lets an AI coding agent search DuckDuckGo and fetch readable text from web pages. Its biggest risks are that malicious web servers can bypass its internal-network block via DNS rebinding during retry delays, and running it in optional HTTP mode on all interfaces exposes its tools without authentication or browser origin checks.

What it can reach

Network
Sends search queries to DuckDuckGo, downloads public HTTP and HTTPS web pages (and private or local addresses only if explicitly enabled), and optionally listens on a TCP port when started with SSE or streamable-http transport.

Findings

1 medium4 low
  1. MediumSSRF protection can be bypassed via DNS rebinding during unguarded HTTP 429 retries

    src/duckduckgo_mcp_server/server.py:600

    Before fetching a page, fetch_content resolves the hostname to verify it is a public IP, then lets httpx or curl_cffi resolve the hostname again when connecting rather than pinning the validated IP. Furthermore, if a server responds with HTTP 429 and a Retry-After header, both fetch backends sleep for up to 30 seconds and retry the request without re-running _guard_url, giving even cached DNS records time to expire and rebind to 127.0.0.1, private network hosts, or cloud metadata endpoints like 169.254.169.254.

    Fix: Pin outbound HTTP connections to the exact IP address validated by _validate_public_url (for example via a custom httpcore network backend), and re-validate the target URL before any 429 retry.

  2. LowHTTP transport has no authentication, uses wildcard CORS, and drops Origin checks on 0.0.0.0

    src/duckduckgo_mcp_server/server.py:1745

    When started with --transport sse or --transport streamable-http, the server requires no password or token and configures CORS with allow_origins=['*']. On the default 127.0.0.1 bind address, the MCP SDK still rejects cross-origin browser requests, but when --host 0.0.0.0 is passed without an explicit allow-list (as shown in the README) or when --disable-dns-rebinding-protection is used, host and origin checks are not active, allowing anyone on the network and any website the user visits in a browser to call the server's tools directly.

    Fix: Require bearer-token authentication on HTTP transports, restrict CORSMiddleware allow_origins instead of using '*', and keep Host and Origin validation enabled even when binding to 0.0.0.0 unless an explicit allow-list or disable flag is set.

  3. LowMarkdown parse mode renders hidden HTML comments as visible page text

    src/duckduckgo_mcp_server/server.py:790

    When fetch_content is called with parse_mode='markdown', _render_markdown and _inline_markdown check isinstance(el, NavigableString) and emit str(el). Because BeautifulSoup's Comment class inherits from NavigableString, HTML comments (<!-- ... -->) are stripped of their comment markers and included directly in the output given to the AI agent, making invisible prompt-injection text inside comments indistinguishable from normal page content.

    Fix: Exclude BeautifulSoup PreformattedString subclasses such as Comment and Doctype before treating an element as a plain NavigableString (for example, check type(el) is NavigableString).

  4. LowWebpage downloads have no response size limit before buffering and parsing

    src/duckduckgo_mcp_server/server.py:137

    Both _fetch_httpx and _fetch_curl read and decompress the entire HTTP response body into memory before parsing it with BeautifulSoup and storing the full extracted text in the in-memory cache, even though fetch_content returns only 8,000 characters by default. A fetched URL that serves a very large body or a compressed response bomb within the 30-second timeout can exhaust memory and crash the server.

    Fix: Stream responses and abort once a reasonable byte limit (such as a few megabytes) is exceeded, and reject non-text Content-Type responses early.

  5. LowDocker image runs as root and copies the full build context without a .dockerignore

    Dockerfile:11

    The Dockerfile does not create or switch to a non-root USER before starting the server, and the repository has no .dockerignore file so local builds copy everything in the working directory (such as .git or local .env files) into the container image.

    Fix: Add a .dockerignore file excluding .git, .env, and virtual environments, and add a non-root USER instruction before ENTRYPOINT.