-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## What was on port 9091\n\nPort 9091 is documented as Milvus's metrics endpoint. The Go file that builds it names the function `registerHTTPServer`. The variable that holds the gin handler is named `metricsGinHandler`. The constant in `internal/http/server.go:41` is `DefaultListenPort = \"9091\"`. The nuclei template that ships with CVE-2026-26190 recommends finding instances with the Shodan query `http.html:\"404 page not found\" port:\"9091\"`. Four independent naming choices point at the same word.\n\nThis is what `metricsGinHandler` mounts in v2.6.9, the last unpatched release on the 2.6 line:\n\n```go\nmetricsGinHandler := gin.Default()\napiv1 := metricsGinHandler.Group(apiPathPrefix) // \"/api/v1\"\napiv1.Use(httpserver.RequestHandlerFunc)\nhandlers := httpserver.NewHandlers(s.proxy)\nhandlers.RegisterRoutesTo(apiv1)\nif p, ok := s.proxy.(*proxy.Proxy); ok {\n p.RegisterRestRouter(apiv1)\n}\n```\n\n`Handlers.RegisterRoutesTo` lives in `internal/distributed/proxy/httpserver/handler.go:42` and registers fifty routes against the gin group it was handed. The first six handle collections:\n\n```go\nrouter.POST(\"/collection\", wrapHandler(h.handleCreateCollection))\nrouter.DELETE(\"/collection\", wrapHandler(h.handleDropCollection))\nrouter.GET(\"/collection/existence\", wrapHandler(h.handleHasCollection))\nrouter.GET(\"/collection\", wrapHandler(h.handleDescribeCollection))\nrouter.POST(\"/collection/load\", wrapHandler(h.handleLoadCollection))\nrouter.DELETE(\"/collection/load\", wrapHandler(h.handleReleaseCollection))\n```\n\nFurther down the same file:\n\n```go\nrouter.POST(\"/entities\", wrapHandler(h.handleInsert))\nrouter.DELETE(\"/entities\", wrapHandler(h.handleDelete))\nrouter.POST(\"/search\", wrapHandler(h.handleSearch))\nrouter.POST(\"/query\", wrapHandler(h.handleQuery))\n```\n\nAnd at the end:\n\n```go\nrouter.POST(\"/credential\", wrapHandler(h.handleCreateCredential))\nrouter.PATCH(\"/credential\", wrapHandler(h.handleUpdateCredential))\nrouter.DELETE(\"/credential\", wrapHandler(h.handleDeleteCredential))\nrouter.GET(\"/credential/users\", wrapHandler(h.handleListCredUsers))\n```\n\n`Proxy.RegisterRestRouter` at `internal/proxy/impl.go:6440` adds the cluster-admin surface on top: every QueryCoord, DataCoord, QueryNode, and DataNode metrics endpoint the cluster exposes, plus database and collection listings. The advisory describes the scope as \"all business operations including data manipulation and credential management.\" There is no metrics-only handler set, no read-only filter, no separate `Handlers` type. The same `httpserver.NewHandlers(s.proxy)` constructor the main HTTP server uses for the documented `/v1` API is the constructor the metrics port mounts at `/api/v1`. The word \"metrics\" appears in the port's name, its variable, and its function. It does not appear in the routes.\n\n## Two functions, twelve lines apart\n\n`internal/distributed/proxy/service.go` declares two HTTP-server setup methods on `*Server` back to back. Both build a gin handler. Both mount the proxy's REST routes. Both can read `proxy.Params.CommonCfg`. One installs the `authenticate` middleware when `authorizationEnabled` is true. The other does not.\n\n`registerHTTPServer` at line 155 of v2.6.9, the metrics port:\n\n```go\nfunc (s *Server) registerHTTPServer() {\n if !proxy.Params.ProxyCfg.GinLogging.GetAsBool() {\n gin.DefaultWriter = io.Discard\n gin.DefaultErrorWriter = io.Discard\n }\n if !proxy.Params.HTTPCfg.DebugMode.GetAsBool() {\n gin.SetMode(gin.ReleaseMode)\n }\n metricsGinHandler := gin.Default()\n apiv1 := metricsGinHandler.Group(apiPathPrefix)\n apiv1.Use(httpserver.RequestHandlerFunc)\n handlers := httpserver.NewHandlers(s.proxy)\n handlers.RegisterRoutesTo(apiv1)\n if p, ok := s.proxy.(*proxy.Proxy); ok {\n p.RegisterRestRouter(apiv1)\n }\n mhttp.Register(&mhttp.Handler{\n Path: mhttp.RootPath,\n HandlerFunc: nil,\n Handler: metricsGinHandler.Handler(),\n })\n}\n```\n\n`startHTTPServer` at line 181 of the same file, the main external HTTP server:\n\n```go\nfunc (s *Server) startHTTPServer(errChan chan error) {\n defer s.wg.Done()\n ginHandler := gin.New()\n ginHandler.Use(httpserver.MetricsHandlerFunc)\n ginHandler.Use(accesslog.AccessLogMiddleware)\n ginHandler.Use(httpserver.LoggerHandlerFunc(), gin.Recovery())\n ginHandler.Use(httpserver.RequestHandlerFunc)\n ginHandler.Use(func(c *gin.Context) {\n c.Set(httpserver.ContextUsername, \"\")\n })\n if proxy.Params.CommonCfg.AuthorizationEnabled.GetAsBool() {\n ginHandler.Use(authenticate)\n }\n app := ginHandler.Group(\"/v1\")\n httpserver.NewHandlersV1(s.proxy).RegisterRoutesToV1(app)\n appV2 := ginHandler.Group(\"/v2/vectordb\")\n httpserver.NewHandlersV2(s.proxy).RegisterRoutesToV2(appV2)\n s.httpServer = &http.Server{Handler: ginHandler, ReadHeaderTimeout: time.Second}\n // ...\n}\n```\n\nThe canonical pattern is lines 191 through 193: the `if`, the `ginHandler.Use(authenticate)`, the closing brace. The divergent function ends on line 179 without it. The `authenticate` helper is declared at line 127, available by name to both functions. The flag is on `proxy.Params.CommonCfg`, read by `registerHTTPServer` already through `ProxyCfg.GinLogging` and by `startHTTPServer` through this exact path. Every component the canonical pattern requires is in the file, in scope, twelve lines down from the function that didn't reach for it.\n\nThe fix that ships in v2.5.27 and v2.6.10 is the commit on the 2.6 branch:\n\n```diff\n--- a/internal/distributed/proxy/service.go\n+++ b/internal/distributed/proxy/service.go\n@@ -166,6 +166,11 @@ func (s *Server) registerHTTPServer() {\n metricsGinHandler := gin.Default()\n apiv1 := metricsGinHandler.Group(apiPathPrefix)\n apiv1.Use(httpserver.RequestHandlerFunc)\n+ // Add authentication middleware if authorization is enabled\n+ // This ensures the metrics port follows the same security policy as the main HTTP server\n+ if proxy.Params.CommonCfg.AuthorizationEnabled.GetAsBool() {\n+ apiv1.Use(authenticate)\n+ }\n handlers := httpserver.NewHandlers(s.proxy)\n handlers.RegisterRoutesTo(apiv1)\n```\n\nThe committed comment names what the codebase already had: \"the same security policy as the main HTTP server.\" The patch is not a new control. The patch is the same control, in the second place it had to be.\n\n## The flag the metrics port never read\n\n`common.security.authorizationEnabled` is declared in `pkg/util/paramtable/component_param.go:793`. Its default is `false`. Its declared `Version` is `2.0.0`. The flag has been the entire user-visible interface for \"enable Milvus authentication\" since the project's first major release. Every operator who reads the security docs sets it to `true`. The docs do not enumerate which of the proxy's two HTTP ingresses consult it; the implicit contract is that the flag is the gate.\n\n`startHTTPServer` honours the contract. `registerHTTPServer` does not.\n\nAn operator who set `common.security.authorizationEnabled: true` in `milvus.yaml` before launching saw `curl :19530/v2/vectordb/collections/list` reject without an `Authorization` header. The flag did what the docs said it did, on the ingress the docs named. The metrics port, named for what the docs recommended scraping with Prometheus, served the same REST handlers at `/api/v1` and consulted nothing.\n\nThe exploit primitive against an instance with `authorizationEnabled: true`:\n\n```bash\n# Create a new credential on a Milvus instance with authentication\n# enabled on the documented REST port.\ncurl -X POST http://target:9091/api/v1/credential \\\n -H 'Content-Type: application/json' \\\n -d '{\"username\": \"attacker\", \"password\": \"attacker-chosen\"}'\n```\n\nThe handler is `Handlers.handleCreateCredential` at `internal/distributed/proxy/httpserver/handler.go:530`. It calls `h.proxy.CreateCredential(c, &req)`. The proxy code at the other end of the call does not know which ingress the request entered through. Neither does the gRPC backend the proxy forwards to. The credential persists. The attacker now authenticates to the same `/v1` and `/v2/vectordb` endpoints the operator believed they had closed, with the credential they wrote through the port the operator believed they were scraping for histogram counts.\n\nThe same logic exhausts every route in `Handlers.RegisterRoutesTo`: `POST /api/v1/entities` to insert, `POST /api/v1/search` to read, `DELETE /api/v1/collection` to drop. None of them reach `authenticate`. None of them ever did.\n\n## Parallel implementation gap\n\nThis is the [parallel-implementation-gap](/patterns/parallel-implementation-gap) shape, where the canonical pattern lived in the file the whole time and the divergent module never reached for it. The catalog has many exhibits at growing distances. [Astro's Cloudflare image endpoint](/posts/astro-shipped-two-image-endpoints) never imported `isRemoteAllowed` from the canonical module two packages away. [MLflow's basic-auth provider](/posts/mlflow-basic-auth-only-gated-flask) gated the legacy Flask app completely and left three of four FastAPI routers public because the two router tables had opposite defaults. [Axios's `maxContentLength`](/posts/axios-maxcontentlength-was-inside-the-buffer-loop) lived inside the buffered branch's chunk counter because the streaming branch had no chunk counter to put it next to. [NocoBase's `checkSQL`](/posts/nocobase-cve-2026-41641-checksql-two-of-three-actions) covered two of three actions in one object literal because the third action persisted SQL the next call would run.\n\nMilvus is the smallest-distance variant the pattern has surfaced. The canonical and divergent modules are not in different packages, files, branches, or runtimes. They are two functions in the same file, with the same `*Server` receiver, called from the same `Server.init` and `Server.start` plumbing, building handlers from the same `httpserver` package, gating against the same `proxy.Params.CommonCfg.AuthorizationEnabled` flag. The function that ends without installing `authenticate` is twelve lines above the function that installs it.\n\nA single utility that both functions had to call would have closed this gap structurally instead of by copy. There is no such utility. There never was. The codebase ships two HTTP ingresses with overlapping route surfaces and asks each function's author to remember the gate independently. One author remembered. The other did not. The patch does not introduce the shared utility; it retypes the canonical block into the divergent function, leaving the same architecture intact for the next ingress some future author writes.\n\n## What 9091 was, what 9091 is\n\n`internal/http/server.go:41` declares `DefaultListenPort = \"9091\"`. The variable that holds the listener's mux is `metricsServer`. The function that registers default handlers, `registerDefaults`, mounts `/healthz`, `/livez`, `/log/level`, `/eventlog`, `/expr`. The Prometheus exposition lives there too. None of those are wrong; all of those are what the port was named to be.\n\nThe fact about port 9091 the codebase did not mark in any naming convention is that the proxy's `metricsGinHandler` registers under `mhttp.RootPath = \"/\"` and catches every request to the same listener that does not have its own explicit handler. The metrics server's `http.ServeMux` routes `/healthz` to healthz, `/expr` to the expression endpoint, and everything else to the gin handler. Everything else includes `/api/v1`. Everything else includes the proxy's REST API. The port's name described its first four handlers. The fifth handler hosted the database.\n\nThe patched releases (v2.5.27 on the 2.5 line, v2.6.10 on the 2.6 line) change which port the fifth handler requires credentials on. They do not change what is hosted there. They do not rename the variable, the function, or the constant. Port 9091 is the metrics port and it has always served the REST API. The metrics port did not become the REST API in the patch. The patch documents that it always was.\n\nPoC: [projectdiscovery/nuclei-templates/http/cves/2026/CVE-2026-26190.yaml](https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2026/CVE-2026-26190.yaml)","closing_line":"`authorizationEnabled` was the flag the main HTTP server read. The metrics port had never read it.","hook_md":"Milvus's main HTTP server consults `common.security.authorizationEnabled` before any request reaches the REST API. The gate is three lines in `internal/distributed/proxy/service.go`: a conditional on the flag, a `ginHandler.Use(authenticate)`, the closing brace. The function declared in the same file twelve lines above it mounts the same REST routes on port 9091. It consults nothing.\n\nCVE-2026-26190 is those three lines, retyped into the function that didn't have them, in the file that already did.","post_id":582,"slug":"milvus-cve-2026-26190-metrics-port-mounted-the-rest-api","title":"CVE-2026-26190: Milvus's Metrics Port Mounted The Full REST API. The Authentication Middleware Stayed With The Other HTTP Server.","type":"initial","unreadable_sentence":"The metrics port did not become the REST API in the patch. The patch documents that it always was."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCawxp+QAKCRDeZjl4jgkQ JqSuAP45WDgNrCJ54qvscgsoieJU2eGi2mk51noy+svhFlCL6wEAz2y1NtGmJx8D QfE2+3vqBADYd7Q8HMIkIXSKohMrogs= =fWCw -----END PGP SIGNATURE-----