Archived
server: stop treating the loopback socket as identity
Three guards read a loopback peer plus a matching Origin as "this is the machine's operator". Two real topologies forge exactly that: DNS rebinding hands a hostile page its victim's own browser, so the peer IS loopback, and the page is same-origin with the server, so the Origin/Host compare stays silent. Only the Host still says which name the client asked for, and the attacker's domain cannot be made to read as the loopback. The documented TLS-proxy topology puts every remote client behind a loopback socket, and a non-browser client sends no Origin at all; the proxy passes the public Host, which the new check refuses. Server::local_operator now guards the keyless routes: the socket, the Origin, and a Host naming the loopback, --allow-host, or a concrete bind address. GET /admin/control-vector takes the guard POST already had, placed before the 404-that-means-no-vector so a remote page can probe neither; keyless DELETE /sessions and /reset_prefix_cache -- which destroy other clients' cached conversations -- answer the machine only. --allow-host (repeatable) admits names an operator reaches the box by from the box itself. A local user at the console stays admitted; nothing about a key-set server changes. GUIDE 6.6 states the new posture.
This commit is contained in:
1 parent
d54f3b9e6e
commit
ec53bce5dc
14 files changed
+257
-43
No files matched your search
@@ -183,6 +183,9 @@ struct ServerOptions {
|
||||
std::function<std::vector<std::string>()> gen_lora_names;
|
||||
|
||||
std::string api_key;
|
||||
/* Extra Host authorities the keyless "loopback only" guards accept (--allow-host): names an
|
||||
* operator reaches the box by that the loopback IP check cannot know. Case-insensitive. */
|
||||
std::vector<std::string> local_hosts;
|
||||
bool cors = true;
|
||||
|
||||
/* The transport's timeouts and body bound. See TransportOptions. */
|
||||
@@ -227,6 +230,14 @@ public:
|
||||
/* Renders each --reasoning-effort-map target as a request's effort. Empty when the template
|
||||
* takes all of them; otherwise the first refusal, naming the target. */
|
||||
std::string check_reasoning_effort_map() const;
|
||||
/* The identity the keyless "loopback only" guards accept: the socket is loopback, the
|
||||
* request carries no foreign Origin, and the Host names the loopback, one of
|
||||
* ServerOptions::local_hosts, or the address --host names. Two ways forge the socket alone:
|
||||
* a DNS-rebinding page is same-origin with the server and its victim's browser *is* the
|
||||
* loopback peer — only the Host still tells which page asked for it — and a localhost TLS
|
||||
* proxy puts every remote client behind the loopback socket, carrying the public Host. An
|
||||
* attacker at the console of this machine is a local user either way, and stays admitted. */
|
||||
bool local_operator(const HttpRequest& req) const;
|
||||
void stop();
|
||||
int port() const { return transport_.port(); } /* 0 until run() is accepting */
|
||||
|
||||
|
||||
Reference in new issue
Block a user