返回公告列表GHSA-HJWH-XVFW-QRWJ 中危已审查
SearXNG Basic Authentication Credentials Exposed Through MCP Logs and JSON-RPC Error Responses OSV 1.4.0 · github-reviewed · 修改于 2026-08-20 03:32
GitHub 审查时间
2026-08-20 03:32
源文件
advisories/github-reviewed/2026/08/GHSA-hjwh-xvfw-qrwj/GHSA-hjwh-xvfw-qrwj.json
Summary
mcp-searxng version 1.11.0 exposes SearXNG Basic Authentication credentials embedded in the SEARXNG_URL environment variable.
When the server starts in STDIO mode and an MCP client connects, the complete SEARXNG_URL, including its username and password, is sent to the client through an MCP notifications/message logging notification.
Additionally, when URL validation fails, the complete credential-bearing URL is included in the configuration error. This error is logged through MCP and returned to the client as a JSON-RPC error response.
For example, a value such as:
http://username:[email protected]
is exposed without redaction.
A connected MCP client or anyone with access to captured server logs may recover the SearXNG credentials and use them to access the configured SearXNG instance.
The issue was confirmed in:
mcp-searxng 1.11.0
Suggested severity: Medium
Details
mcp-searxng supports SearXNG Basic Authentication by embedding credentials in the URL userinfo component:
https://username:[email protected]
The project contains a redaction function named redactSearxngInstanceUrl(), but it is not used in several logging and error-handling paths.
Startup console disclosure
In src/index.ts:373-378, the server retrieves the raw SearXNG URLs and writes them directly to stderr:
const searxngInstances = getSearxngInstances();
if (searxngInstances.length > 0) {
console.error(`🌐 SearXNG URLs: ${searxngInstances.join("; ")}`);
}
getSearxngInstances() returns the unmodified environment-variable values.
Relevant code in src/searxng-instances.ts:25-38:
export function parseSearxngUrls(
raw: string | undefined = process.env.SEARXNG_URL
): string[] {
if (raw === undefined) {
return [];
}
return raw
.split(";")
.map((entry) => entry.trim())
.filter((entry) => entry !== "");
}
export function getSearxngInstances(): string[] {
return parseSearxngUrls();
}
MCP logging notification disclosure After the MCP client connects, src/index.ts:388-393 sends the complete URL through the MCP logging interface:
const searxngInstances = getSearxngInstances();
logMessage(
mcpServer,
"info",
`SearXNG URLs: ${
searxngInstances.length > 0
? searxngInstances.join("; ")
: "not configured"
}`
);
logMessage() passes this value to sendLoggingMessage() in src/logging.ts:15-25:
mcpServer.sendLoggingMessage({
level,
data: notificationData
});
As a result, the connected MCP client receives a message containing the username and password:
{
"method": "notifications/message",
"params": {
"level": "info",
"data": {
"message": "SearXNG URLs: http://username:[email protected] "
}
},
"jsonrpc": "2.0"
}
Configuration error disclosure The URL validation function includes the complete unredacted value in error messages.
Relevant code in src/searxng-instances.ts:44-52:
export function validateSearxngInstanceUrl(
value: string
): string | null {
try {
const url = new URL(value);
if (!["http:", "https:"].includes(url.protocol)) {
return `SEARXNG_URL invalid protocol for "${value}": ${url.protocol}`;
}
} catch {
return `SEARXNG_URL invalid format: ${value}`;
}
return null;
}
The validation error is aggregated by validateEnvironment() in src/error-handler.ts:175-203:
const validationError =
validateSearxngInstanceUrl(searxngUrl);
if (validationError) {
issues.push(validationError);
}
The complete error is then thrown from src/search.ts:689-693:
const validationError = validateEnvironment();
if (validationError) {
logMessage(mcpServer, "error", "Configuration invalid");
throw new MCPSearXNGError(validationError);
}
The tool handler in src/index.ts:254-260 sends the error message and stack trace through MCP logging, then rethrows it:
logMessage(
mcpServer,
"error",
`Tool execution error: ${
error instanceof Error
? error.message
: String(error)
}`,
{
tool: name,
args: args,
error:
error instanceof Error
? error.stack
: String(error)
}
);
throw error;
Rethrowing the error causes the same unredacted credential-bearing URL to be returned in the JSON-RPC error response.
Existing redaction function is not used The project already contains a suitable redaction function in src/searxng-instances.ts:57-69:
export function redactSearxngInstanceUrl(
raw: string
): string {
try {
const url = new URL(raw);
if (!url.username && !url.password) {
return raw;
}
url.username = "";
url.password = "";
return url.toString();
} catch {
return raw.replace(
/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)[^/]*@/,
"$1"
);
}
}
However, this function is not applied before startup logging, MCP logging, or configuration error construction.
The MCP manifest also marks SEARXNG_URL as non-secret in .mcp/server.json:20-25:
{
"name": "SEARXNG_URL",
"description": "URL of your SearXNG instance",
"isRequired": true,
"isSecret": false,
"format": "string"
}
Because credentials may be embedded in this variable, it should be classified as a secret.
PoC The following proof of concept uses fake credentials. A real SearXNG server is not required.
Requirements Node.js 20 or newer
npm
mcp-searxng 1.11.0 source code
Build the application unzip mcp-searxng-main.zip
cd mcp-searxng-main
npm ci
npm run build
Test 1: Credential disclosure through MCP logging Create an MCP initialization request:
cat > /tmp/mcp-init.jsonl <<'EOF'
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"credential-leak-poc","version":"1.0.0"}}}
EOF
Start the server with fake credentials embedded in a valid HTTP URL:
SEARXNG_URL='http://MCP_POC_USER_7391:[email protected] :9' \
timeout 8s node dist/cli.js \
< /tmp/mcp-init.jsonl \
2>&1 | tee credential-log-leak.txt
Search the output for the credentials:
grep -nE \
'MCP_POC_USER_7391|MCP_POC_PASS_7391' \
credential-log-leak.txt
Observed result The complete credential-bearing URL is exposed:
It is also delivered to the MCP client:
{
"method": "notifications/message",
"params": {
"level": "info",
"data": {
"message": "SearXNG URLs: http://MCP_POC_USER_7391:[email protected] :9"
}
},
"jsonrpc": "2.0"
}
This confirms that a connected MCP client can recover the configured username and password without accessing the host environment.
Test 2: Credential disclosure through JSON-RPC errors Create initialization and tool-call requests:
cat > /tmp/mcp-error-poc.jsonl <<'EOF'
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"credential-error-poc","version":"1.0.0"}}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"searxng_web_search","arguments":{"query":"credential leak test"}}}
EOF
Start the server with a credential-bearing URL that uses an unsupported protocol:
SEARXNG_URL='ftp://MCP_POC_USER_7391:[email protected] ' \
timeout 8s node dist/cli.js \
< /tmp/mcp-error-poc.jsonl \
2>&1 | tee credential-error-leak.txt
grep -nE \
'MCP_POC_USER_7391|MCP_POC_PASS_7391' \
credential-error-leak.txt
Observed result The complete URL is exposed in the MCP logging notification:
Tool execution error: Configuration Issues: SEARXNG_URL invalid protocol for "ftp://MCP_POC_USER_7391:[email protected] ": ftp:
It is also returned directly in the JSON-RPC error:
{
"jsonrpc": "2.0",
"id": 2,
"error": {
"code": -32603,
"message": "Configuration Issues: SEARXNG_URL invalid protocol for \"ftp://MCP_POC_USER_7391:[email protected] \": ftp:"
}
}
The raw username and password are therefore exposed through both logging and protocol responses.
Impact This is a sensitive credential disclosure vulnerability.
The following parties may obtain the credentials:
A connected MCP client receiving logging notifications.
A client capable of invoking a tool and receiving JSON-RPC errors.
A user or process with access to captured stderr output.
A centralized logging or monitoring system collecting application logs.
Other users with access to shared log files or container logs.
The exposed credentials may allow an attacker to authenticate directly to the configured SearXNG instance.
Depending on the SearXNG deployment and the permissions associated with the account, this may allow:
Unauthorized use of a private SearXNG service.
Access to functionality restricted through Basic Authentication.
Consumption of private server resources.
Exposure of information available only to authenticated users.
Further account compromise where the credentials have been reused.
The default STDIO transport limits the exposure to the connected parent MCP client and local logging environment. However, MCP clients should not receive upstream service credentials, and the project security documentation explicitly treats credentials embedded in SEARXNG_URL as secrets that must be redacted.
Suggested mitigation Apply redactSearxngInstanceUrl() before including any SearXNG URL in console or MCP logging:
const redactedInstances = getSearxngInstances()
.map(redactSearxngInstanceUrl);
logMessage(
mcpServer,
"info",
`SearXNG URLs: ${
redactedInstances.length > 0
? redactedInstances.join("; ")
: "not configured"
}`
);
Do not include raw configuration values in validation errors. A generic error can be returned instead:
return `SEARXNG_URL entry has an unsupported protocol: ${url.protocol}`;
return "SEARXNG_URL contains an invalid URL";
The following additional changes are recommended:
Redact URLs before writing them to stderr.
Redact secrets before sending MCP logging notifications.
Avoid including raw environment-variable values in exceptions.
Avoid returning detailed stack traces containing secrets to MCP clients.
Mark SEARXNG_URL as secret in .mcp/server.json:
Add regression tests that assert usernames and passwords never appear in:
stderr output
MCP logging notifications
JSON-RPC error responses
stack traces
configuration resources
CVSS_V3 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
原始 OSV JSON{
"id": "GHSA-hjwh-xvfw-qrwj",
"aliases": [],
"details": "### Summary\n\nmcp-searxng version 1.11.0 exposes SearXNG Basic Authentication credentials embedded in the `SEARXNG_URL` environment variable.\n\nWhen the server starts in STDIO mode and an MCP client connects, the complete `SEARXNG_URL`, including its username and password, is sent to the client through an MCP `notifications/message` logging notification.\n\nAdditionally, when URL validation fails, the complete credential-bearing URL is included in the configuration error. This error is logged through MCP and returned to the client as a JSON-RPC error response.\n\nFor example, a value such as:\n\n```text\nhttp://username:[email protected] \n```\n\nis exposed without redaction.\n\nA connected MCP client or anyone with access to captured server logs may recover the SearXNG credentials and use them to access the configured SearXNG instance.\n\nThe issue was confirmed in:\n\n```text\nmcp-searxng 1.11.0\n```\n\nSuggested severity: **Medium**\n\n### Details\n\nmcp-searxng supports SearXNG Basic Authentication by embedding credentials in the URL userinfo component:\n\n```text\nhttps://username:[email protected] \n```\n\nThe project contains a redaction function named `redactSearxngInstanceUrl()`, but it is not used in several logging and error-handling paths.\n\n#### Startup console disclosure\n\nIn `src/index.ts:373-378`, the server retrieves the raw SearXNG URLs and writes them directly to stderr:\n\n```typescript\nconst searxngInstances = getSearxngInstances();\n\nif (searxngInstances.length > 0) {\n console.error(`🌐 SearXNG URLs: ${searxngInstances.join(\"; \")}`);\n}\n```\n\n`getSearxngInstances()` returns the unmodified environment-variable values.\n\nRelevant code in `src/searxng-instances.ts:25-38`:\n\n```typescript\nexport function parseSearxngUrls(\n raw: string | undefined = process.env.SEARXNG_URL\n): string[] {\n if (raw === undefined) {\n return [];\n }\n\n return raw\n .split(\";\")\n .map((entry) => entry.trim())\n .filter((entry) => entry !== \"\");\n}\n\nexport function getSearxngInstances(): string[] {\n return parseSearxngUrls();\n}\n```\n\n#### MCP logging notification disclosure\n\nAfter the MCP client connects, `src/index.ts:388-393` sends the complete URL through the MCP logging interface:\n\n```typescript\nconst searxngInstances = getSearxngInstances();\n\nlogMessage(\n mcpServer,\n \"info\",\n `SearXNG URLs: ${\n searxngInstances.length > 0\n ? searxngInstances.join(\"; \")\n : \"not configured\"\n }`\n);\n```\n\n`logMessage()` passes this value to `sendLoggingMessage()` in `src/logging.ts:15-25`:\n\n```typescript\nmcpServer.sendLoggingMessage({\n level,\n data: notificationData\n});\n```\n\nAs a result, the connected MCP client receives a message containing the username and password:\n\n```json\n{\n \"method\": \"notifications/message\",\n \"params\": {\n \"level\": \"info\",\n \"data\": {\n \"message\": \"SearXNG URLs: http://username:[email protected] \"\n }\n },\n \"jsonrpc\": \"2.0\"\n}\n```\n\n#### Configuration error disclosure\n\nThe URL validation function includes the complete unredacted value in error messages.\n\nRelevant code in `src/searxng-instances.ts:44-52`:\n\n```typescript\nexport function validateSearxngInstanceUrl(\n value: string\n): string | null {\n try {\n const url = new URL(value);\n\n if (![\"http:\", \"https:\"].includes(url.protocol)) {\n return `SEARXNG_URL invalid protocol for \"${value}\": ${url.protocol}`;\n }\n } catch {\n return `SEARXNG_URL invalid format: ${value}`;\n }\n\n return null;\n}\n```\n\nThe validation error is aggregated by `validateEnvironment()` in `src/error-handler.ts:175-203`:\n\n```typescript\nconst validationError =\n validateSearxngInstanceUrl(searxngUrl);\n\nif (validationError) {\n issues.push(validationError);\n}\n```\n\nThe complete error is then thrown from `src/search.ts:689-693`:\n\n```typescript\nconst validationError = validateEnvironment();\n\nif (validationError) {\n logMessage(mcpServer, \"error\", \"Configuration invalid\");\n throw new MCPSearXNGError(validationError);\n}\n```\n\nThe tool handler in `src/index.ts:254-260` sends the error message and stack trace through MCP logging, then rethrows it:\n\n```typescript\nlogMessage(\n mcpServer,\n \"error\",\n `Tool execution error: ${\n error instanceof Error\n ? error.message\n : String(error)\n }`,\n {\n tool: name,\n args: args,\n error:\n error instanceof Error\n ? error.stack\n : String(error)\n }\n);\n\nthrow error;\n```\n\nRethrowing the error causes the same unredacted credential-bearing URL to be returned in the JSON-RPC error response.\n\n#### Existing redaction function is not used\n\nThe project already contains a suitable redaction function in `src/searxng-instances.ts:57-69`:\n\n```typescript\nexport function redactSearxngInstanceUrl(\n raw: string\n): string {\n try {\n const url = new URL(raw);\n\n if (!url.username && !url.password) {\n return raw;\n }\n\n url.username = \"\";\n url.password = \"\";\n return url.toString();\n } catch {\n return raw.replace(\n /^([a-zA-Z][a-zA-Z0-9+.-]*:\\/\\/)[^/]*@/,\n \"$1\"\n );\n }\n}\n```\n\nHowever, this function is not applied before startup logging, MCP logging, or configuration error construction.\n\nThe MCP manifest also marks `SEARXNG_URL` as non-secret in `.mcp/server.json:20-25`:\n\n```json\n{\n \"name\": \"SEARXNG_URL\",\n \"description\": \"URL of your SearXNG instance\",\n \"isRequired\": true,\n \"isSecret\": false,\n \"format\": \"string\"\n}\n```\n\nBecause credentials may be embedded in this variable, it should be classified as a secret.\n\n### PoC\n\nThe following proof of concept uses fake credentials. A real SearXNG server is not required.\n\n#### Requirements\n\n```text\nNode.js 20 or newer\nnpm\nmcp-searxng 1.11.0 source code\n```\n\n#### Build the application\n\n```bash\nunzip mcp-searxng-main.zip\ncd mcp-searxng-main\n\nnpm ci\nnpm run build\n```\n\n#### Test 1: Credential disclosure through MCP logging\n\nCreate an MCP initialization request:\n\n```bash\ncat > /tmp/mcp-init.jsonl <<'EOF'\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"credential-leak-poc\",\"version\":\"1.0.0\"}}}\nEOF\n```\n\nStart the server with fake credentials embedded in a valid HTTP URL:\n\n```bash\nSEARXNG_URL='http://MCP_POC_USER_7391:[email protected] :9' \\\ntimeout 8s node dist/cli.js \\\n< /tmp/mcp-init.jsonl \\\n2>&1 | tee credential-log-leak.txt\n```\n\nSearch the output for the credentials:\n\n```bash\ngrep -nE \\\n'MCP_POC_USER_7391|MCP_POC_PASS_7391' \\\ncredential-log-leak.txt\n```\n\n#### Observed result\n\nThe complete credential-bearing URL is exposed:\n\n```text\nSearXNG URLs: http://MCP_POC_USER_7391:[email protected] :9\n```\n\nIt is also delivered to the MCP client:\n\n```json\n{\n \"method\": \"notifications/message\",\n \"params\": {\n \"level\": \"info\",\n \"data\": {\n \"message\": \"SearXNG URLs: http://MCP_POC_USER_7391:[email protected] :9\"\n }\n },\n \"jsonrpc\": \"2.0\"\n}\n```\n\nThis confirms that a connected MCP client can recover the configured username and password without accessing the host environment.\n\n#### Test 2: Credential disclosure through JSON-RPC errors\n\nCreate initialization and tool-call requests:\n\n```bash\ncat > /tmp/mcp-error-poc.jsonl <<'EOF'\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"credential-error-poc\",\"version\":\"1.0.0\"}}}\n{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"searxng_web_search\",\"arguments\":{\"query\":\"credential leak test\"}}}\nEOF\n```\n\nStart the server with a credential-bearing URL that uses an unsupported protocol:\n\n```bash\nSEARXNG_URL='ftp://MCP_POC_USER_7391:[email protected] ' \\\ntimeout 8s node dist/cli.js \\\n< /tmp/mcp-error-poc.jsonl \\\n2>&1 | tee credential-error-leak.txt\n```\n\nSearch the response:\n\n```bash\ngrep -nE \\\n'MCP_POC_USER_7391|MCP_POC_PASS_7391' \\\ncredential-error-leak.txt\n```\n\n#### Observed result\n\nThe complete URL is exposed in the MCP logging notification:\n\n```text\nTool execution error: Configuration Issues: SEARXNG_URL invalid protocol for \"ftp://MCP_POC_USER_7391:[email protected] \": ftp:\n```\n\nIt is also returned directly in the JSON-RPC error:\n\n```json\n{\n \"jsonrpc\": \"2.0\",\n \"id\": 2,\n \"error\": {\n \"code\": -32603,\n \"message\": \"Configuration Issues: SEARXNG_URL invalid protocol for \\\"ftp://MCP_POC_USER_7391:[email protected] \\\": ftp:\"\n }\n}\n```\n\nThe raw username and password are therefore exposed through both logging and protocol responses.\n\n### Impact\n\nThis is a sensitive credential disclosure vulnerability.\n\nThe following parties may obtain the credentials:\n\n1. A connected MCP client receiving logging notifications.\n2. A client capable of invoking a tool and receiving JSON-RPC errors.\n3. A user or process with access to captured stderr output.\n4. A centralized logging or monitoring system collecting application logs.\n5. Other users with access to shared log files or container logs.\n\nThe exposed credentials may allow an attacker to authenticate directly to the configured SearXNG instance.\n\nDepending on the SearXNG deployment and the permissions associated with the account, this may allow:\n\n1. Unauthorized use of a private SearXNG service.\n2. Access to functionality restricted through Basic Authentication.\n3. Consumption of private server resources.\n4. Exposure of information available only to authenticated users.\n5. Further account compromise where the credentials have been reused.\n\nThe default STDIO transport limits the exposure to the connected parent MCP client and local logging environment. However, MCP clients should not receive upstream service credentials, and the project security documentation explicitly treats credentials embedded in `SEARXNG_URL` as secrets that must be redacted.\n\n### Suggested mitigation\n\nApply `redactSearxngInstanceUrl()` before including any SearXNG URL in console or MCP logging:\n\n```typescript\nconst redactedInstances = getSearxngInstances()\n .map(redactSearxngInstanceUrl);\n\nlogMessage(\n mcpServer,\n \"info\",\n `SearXNG URLs: ${\n redactedInstances.length > 0\n ? redactedInstances.join(\"; \")\n : \"not configured\"\n }`\n);\n```\n\nDo not include raw configuration values in validation errors. A generic error can be returned instead:\n\n```typescript\nreturn `SEARXNG_URL entry has an unsupported protocol: ${url.protocol}`;\n```\n\nFor malformed URLs:\n\n```typescript\nreturn \"SEARXNG_URL contains an invalid URL\";\n```\n\nThe following additional changes are recommended:\n\n1. Redact URLs before writing them to stderr.\n2. Redact secrets before sending MCP logging notifications.\n3. Avoid including raw environment-variable values in exceptions.\n4. Avoid returning detailed stack traces containing secrets to MCP clients.\n5. Mark `SEARXNG_URL` as secret in `.mcp/server.json`:\n\n```json\n\"isSecret\": true\n```\n\n6. Add regression tests that assert usernames and passwords never appear in:\n\n * stderr output\n * MCP logging notifications\n * JSON-RPC error responses\n * stack traces\n * configuration resources",
"summary": "SearXNG Basic Authentication Credentials Exposed Through MCP Logs and JSON-RPC Error Responses",
"affected": [
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "0"
},
{
"fixed": "1.12.0"
}
]
}
],
"package": {
"name": "mcp-searxng",
"ecosystem": "npm"
}
}
],
"modified": "2026-08-19T19:32:46Z",
"severity": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
}
],
"published": "2026-08-19T19:32:46Z",
"references": [
{
"url": "https://github.com/ihor-sokoliuk/mcp-searxng/security/advisories/GHSA-hjwh-xvfw-qrwj",
"type": "WEB"
},
{
"url": "https://github.com/ihor-sokoliuk/mcp-searxng",
"type": "PACKAGE"
},
{
"url": "https://github.com/ihor-sokoliuk/mcp-searxng/releases/tag/v1.12.0",
"type": "WEB"
}
],
"schema_version": "1.4.0",
"database_specific": {
"cwe_ids": [
"CWE-209",
"CWE-532"
],
"severity": "MODERATE",
"github_reviewed": true,
"nvd_published_at": null,
"github_reviewed_at": "2026-08-19T19:32:46Z"
}
}