Security
We Built a Lab to Rebind an MCP Server. Here Is Exactly What Happened.
November 19, 2026 · 9 min read
Most write-ups about a disclosed vulnerability stop at the advisory. We did not — we built the whole attack in three Docker containers, on a laptop, with no internet access involved, and watched real database rows leave a server that was never supposed to be reachable at all. Here is exactly how, and what it says about every "local-only" tool your team runs.
A server that only listens on 127.0.0.1, or that only sits on the corporate LAN, feels safe by construction. Nothing outside can reach it, so why build real authentication for it? Inside a corporate network, that assumption is everywhere: a code-search tool a developer spun up for themselves, a metrics dashboard, an admin panel, an MCP server quietly feeding an AI assistant from a local database. All of it reasonable, all of it widespread, and all of it wrong in one specific, well-documented way: DNS rebinding.
1. Why "internal only" is not a defense, especially inside a corporate network
The attack this enables does not need to target anyone specific. An attacker does not need to know which employee runs what, or what their internal network looks like, in advance. One phishing email, or one compromised ad slot on an ordinary site, reaches every visitor at once — and the malicious page itself does the reconnaissance, per victim, after the click: it probes the visitor’s own loopback and local network for anything answering on common ports, then only arms the rebind against whatever it actually finds. VPN access does not change this calculus. The attacker is never “outside the network” in the way a firewall diagram implies — the request originates from inside the victim’s own browser, which is already wherever the victim is.
Scale that across a few thousand employees, each of whom might be running some self-hosted tool with no login screen because "it’s just internal," and the exposure is not one person’s mistake. It is a population-level bet that none of those tools ever gets reached from a browser that also happens to load the wrong page. We wanted to understand exactly how that bet gets lost — so we built it, end to end, against a real, widely-used open-source tool, and watched it happen.
2. DNS rebinding, explained
An attacker registers a domain, points it at their own server with a very short DNS TTL, and serves a page from it to a visitor. The browser loads the page, runs its JavaScript, and that JavaScript waits — or the TTL simply lapses on its own. The attacker then flips the same hostname to resolve to the victim’s internal or loopback address instead. The browser re-resolves the name, gets a different IP this time, and because the URL bar never changed, it treats the next request from that page as same-origin, even though the request now physically lands on a completely different machine.
That one mechanical trick — the same name quietly resolving to two different places over time — is the entire attack. It defeats exactly one kind of defense: "nobody outside this machine or network can reach this port." It does not hand the attacker a password, a session cookie for the real target, or any credential at all. It only matters against something that treats reachability itself as sufficient proof of trust.
3. DBHub: a real, disclosed example
DBHub is a popular, widely-deployed open-source MCP server — software that lets AI tools and coding assistants query a database through the Model Context Protocol. Run in its documented HTTP mode, it exposed an `/mcp` endpoint with no password, no API key, and no token of any kind. It was not naive about this: it shipped a guard specifically meant to stop a malicious website from reaching a locally-bound DBHub through a victim’s browser. The guard read the request’s Origin header, read its Host header, and rejected the request if the two hostnames did not match.
const origin = req.headers.origin;
const host = (req.headers.host ?? '').split(':')[0];
const originHost = new URL(origin).hostname;
if (originHost !== host) {
return res.status(403).json({ error: 'Forbidden' }); // DNS-rebinding "protection"
}
// ...request proceeds, AND the server reflects Origin back as
// Access-Control-Allow-Origin, explicitly granting the browser read accessThat stops the obvious case: a page on evil.com cannot make a request where Host says "localhost" and Origin says "evil.com" — they disagree. The flaw is in what the check actually proves. Origin and Host are both strings the browser fills in from the page’s own URL bar — and after a rebind, both say the same thing, because the attacker controls the one thing both headers are derived from: the hostname the page was loaded from. This is catalogued as GHSA-fm8p-53ww-hf6w, and the fix pull request closed it alongside related reports on the same theme — a tell that a self-referential "do these two attacker-controlled values agree" check tends to get found more than once, because it looks like protection and is not.
One detail worth sitting with: the browser’s same-origin policy is supposed to stop a page from reading a response from a different port, even on the same hostname — port is part of what makes an origin. It did not stop this, because DBHub’s code did not just approve the request, it explicitly echoed the attacker’s Origin back as Access-Control-Allow-Origin, with credentials allowed. That is CORS doing exactly what it is designed to do — grant a cross-origin page read access — faithfully carrying out a decision made by a check that should never have approved it. The browser enforced the rules correctly from the first byte to the last; the server told it the wrong thing.
DBHub’s maintainers fixed it by replacing the equality check with an explicit allow-list: loopback is always permitted, a wildcard bind auto-allows the machine’s own hostname and IPs, and anything else has to be named by the operator. A rebound request carries the attacker’s hostname — never the victim machine’s own name or IP — so it is never on that list, no matter what Origin claims.
4. If you run something sensitive over HTTP on your own machine or network
- Do not treat "only reachable from this machine or network" as authentication. If a service has no credential of its own, that is the pattern to find and fix — before a disclosure makes you find it the hard way.
- An Origin/Host equality check is not a Host allow-list. If your own code compares one request header to another, instead of to a configured, known-good set of hostnames, it has the exact shape of this bug.
- A firewall and a VPN do not help here. The request originates from inside the victim’s own browser, already inside whatever perimeter you drew.
- If a tool genuinely has no CORS headers at all, a browser will not let a page read its responses either way — but that only closes the read side. A blind, read-less request can still reach a state-changing endpoint, so a login-free admin action is still worth closing off on its own.
- Know what you run, including the tools you only run for yourselves. A disclosed GHSA against a self-hosted dependency only protects you if something is actually tracking that you run that dependency, and at what version — the same discipline SOC 2 CC7.1 and ISO 27001 A.8.8 ask for under the name "vulnerability management."
5. What we actually built, and watched happen
We did not want to just read the advisory and nod. We built the entire chain locally — no real domain, no public DNS, nothing touching the internet — as three Docker containers on one isolated network:
- A custom authoritative nameserver we wrote ourselves: the first query for our lab hostname gets answered with a decoy server’s address; every query after that gets the real target’s address instead. That is the entire "rebind" in code — maybe sixty lines.
- A decoy page, serving the exact JavaScript a real attacker’s site would serve — nothing hidden, nothing simulated.
- DBHub itself, checked out at the exact commit before the fix, running its documented demo HTTP mode against a seeded sample database.
We ran it. A test client resolved the lab hostname, got the decoy address, loaded the decoy page — exactly like a real browser would. That page’s own JavaScript re-requested the same hostname a moment later. The DNS answer had flipped. The request landed on DBHub instead, carrying a Host and an Origin that still agreed with each other, and the broken check waved it through.
The first thing that came back was not sensitive — it was DBHub’s own self-description: the tools it exposes, including one called execute_sql. We used exactly that, through the exact same bypass, to run a real SELECT against DBHub’s seeded employee database, and the server handed back real rows: names, hire dates, the works. We watched the “attacker’s” own server receive that exfiltrated data a moment later, over the network, in a real browser’s real DevTools Network tab — not a diagram, an actual request and an actual response.
DBHub is fixed in current releases — upgrade, and if you cannot yet, do not run its HTTP transport exposed beyond loopback without setting an explicit allowed-hosts policy. But the more useful habit is the one behind this whole exercise: when something sounds like it should be dangerous, the fastest way to actually know is to build it and watch it happen, the way we just did with three Docker containers and an afternoon.
About CATAAM — CATAAM unifies evidence-gated compliance (SOC 2, ISO 27001, ISO 42001, HIPAA, PCI-DSS) with attack-surface management for what your organization exposes outward. This particular bug class is a reminder that the discipline has to extend past the perimeter: a tool your own team runs for itself still needs a real identity check, not just an assumption about who can reach it.
Frequently asked questions
- What is DNS rebinding?
- A technique where an attacker’s domain first resolves to their own server (to serve malicious JavaScript to a visitor’s browser), then — using a very short DNS TTL — flips to resolve to an internal or loopback address instead. Because the hostname in the browser’s URL bar never changes, the browser treats later requests as same-origin even though they now land on a different machine, defeating network-position-based trust models.
- What was the DBHub vulnerability (GHSA-fm8p-53ww-hf6w)?
- DBHub’s HTTP transport defended its unauthenticated /mcp endpoint with a check that compared the request’s Origin header to its Host header and rejected mismatches. DNS rebinding makes both headers carry the same attacker-chosen hostname, so they always agree, and the check approves the request — letting a malicious webpage reach and query the database through a victim’s own browser.
- Is this fixed?
- Yes. DBHub’s maintainers replaced the equality check with an explicit Host allow-list (loopback by default, plus any hostnames the operator configures) in a fix that closed this report alongside related ones on the same theme. Current releases are not affected when run with the default allow-list.
- Does this only affect DBHub?
- No — DBHub is one example of a broader pattern: any locally- or internally-bound service that treats "only reachable from this machine or network" as sufficient authentication, instead of requiring a real credential, is structurally exposed to DNS rebinding. We built and tested the technique ourselves specifically to confirm it is not theoretical.
- If my service sets no CORS headers at all, am I safe from this?
- You are safe from the read-based version of this attack — without an Access-Control-Allow-Origin response, a browser will not let JavaScript read the response body, rebinding or not. You are not automatically safe from a blind, read-less request still reaching a state-changing endpoint, since the same-origin policy restricts reading a response, not sending a request.