AlinsRan commented on PR #13959:
URL: https://github.com/apache/apisix/pull/13959#issuecomment-5728187628

   > [P1] The default same-origin check still permits DNS rebinding
   
   You are right, and the regression you asked for reproduced it. Fixed in 
abf0e41e0.
   
   `Origin` is no longer compared against `Host`. It is checked only against 
something the operator configured:
   
   1. `allowed_origins`, when set — the list governs on its own, `["*"]` 
accepts any.
   2. Otherwise, the hosts the Route declares in `host` / `hosts`. That is 
configuration the attacker's name does not satisfy, and a request carrying 
another `Host` does not match such a Route in the first place.
   3. Where the Route declares neither, the one remaining case is loopback at 
**both** ends: a page can only have `http://localhost` as its origin if it is 
served from the machine itself, and no rebinding produces that. This keeps the 
case MCP is written around — a local client talking to a local gateway — 
working without configuration.
   
   Anything else carrying an `Origin` is refused. A request with no `Origin` is 
still accepted, unchanged: no non-browser MCP client sends one.
   
   New regressions, both transports:
   
   | Route | `Host` | `Origin` | |
   |---|---|---|---|
   | no host predicate | `attacker.example` | `http://attacker.example` | 
**403** — the bypass you described, on both Streamable HTTP and SSE |
   | no host predicate | `localhost` | `http://localhost` | served |
   | no host predicate | `localhost` | `https://evil.example.com` | 403 |
   | `hosts: ["mcp.example.com"]` | `mcp.example.com` | 
`http://mcp.example.com` | 200 |
   | `hosts: ["mcp.example.com"]` | `mcp.example.com` | 
`https://evil.example.com` | 403 |
   
   The plugin docs now state the rule as "checked against what the operator 
configured" rather than describing rebinding as a limitation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to