Repository navigation
Description
Problem
The in-app browser's loopback/LAN firewall classifies the URL host string, not the address it resolves to. A public hostname that resolves to a loopback or private address is classified as public and allowed:
// apps/desktop/src/desktop-browser-policy.ts
if (!isLoopbackBrowserRequestHost(parsed.host)) {
return false; // allowed
}So a page can reach bb's own loopback services, and any other loopback port, by using a name that resolves to 127.0.0.1. This is pre-existing and already noted as a known residual in that file ("a public name that resolves to a private IP (DNS rebinding) is not caught here").
Why it is worth a ticket now
Reviewing #1522 turned this from a note into a demonstrated bypass. Two things make it sharper than the comment suggests:
-
http://<public-name>is not a potentially trustworthy URL, so Chromium sends noSec-Fetch-*headers, and ano-corsGET sends noOrigin. A rebound request therefore looks header-identical to a local Node process. Any server-side control that keys on browser headers alone cannot see it. -
Reproduced in real Electron against the production browser-view manager, with
--host-resolver-rules="MAP rebind.example 127.0.0.1":[proxy-stand-in] GET host=rebind.example:41999 guard=ALLOW via=none
#1522 mitigated the specific service it exposed — the host daemon's machine-auth proxy now requires its own loopback authority in Host. The general bypass remains for every other loopback service, including the bb server itself.
Suggested work
- Classify the resolved address rather than the URL host, or pin loopback decisions to the resolved peer address.
- Give the machine-auth proxy an unguessable capability in its URL. It is handed to runtime processes through
BB_SERVER_URL, so a path prefix the proxy strips would be transparent to them and unguessable to a page that can only scan ports. SlopCop raised this twice on [issue sweep] Let in-app browser pages reach other loopback ports #1522 as the stronger control; [issue sweep] Let in-app browser pages reach other loopback ports #1522 shipped theHostcheck instead because it is local and complete for that one service. - Consider requiring the same
Hostauthority check on the host-daemon local API.
Not a regression from #1522
Before that change, a rebound public hostname was already allowed by the same branch. #1522 did not widen this path; it widened cross-port loopback for pages that have committed a loopback origin, and reserved bb's own ports there.
AGENT GENERATED: by Claude Opus 5
Activity
SawyerHood commentedon Aug 13, 2026
Reassessment after the approach inverted. Keeping this open, with a smaller and clearer scope.
The original framing — "DNS rebinding bypasses the in-app browser loopback firewall" — is obsolete: #1537 deletes that firewall outright, deliberately. There is no longer a loopback firewall for rebinding to bypass, so that half of this issue resolves itself by deletion rather than by fix.
What remains is the part that was always the real concern: a rebound public hostname is header-indistinguishable from a local process, so any control keying on browser headers alone cannot see it.
What is now covered. The machine-auth proxy (#1536) requires the request
Hostto be its own loopback authority, so a rebound public name is rejected there. That was the highest-authority service, since it stampsx-bb-connect-machineonto everything it forwards.What remains uncovered. The server
/api/v1/*guard and the host-daemon local-API guard both key onOrigin. Against a rebound name:Origin: http://rebind.example, which is not a trusted origin → rejected. This is the case that matters, and it is covered.no-corsGET sends noOriginat all, becausehttp://rebind.exampleis not a potentially trustworthy URL so Chromium also omitsSec-Fetch-*→ passes the guard. Reads are unreadable cross-origin, and the GET audit in Guard bb's local HTTP services against foreign browser origins #1536 confirmed no/api/v1/*GET changes durable state, so the practical impact today is nil. It is still a gap in the control rather than in the outcome.Suggested remaining work, smaller than the original scope:
Hostauthority check to the server and the daemon local API that the machine-auth proxy now has. It is the control that catches whatOrigincannot.Not closing: item 1 above is real, and the "no
/api/v1GET mutates" property that makes it harmless today is a fact about the current routes, not an invariant anything enforces.[-]In-app browser: DNS rebinding bypasses the loopback firewall[/-][+]Rebound public hostnames are header-indistinguishable from local processes[/+]SawyerHood commentedon Aug 13, 2026
Closing. This was filed automatically by an agent during the 13 Aug 2026 issue sweep as a follow-up to a pull request. Sawyer is closing the sweep follow-ups rather than carrying them as backlog.
The analysis above stands on its own and is preserved here. Reopen if it becomes relevant.