Skip to content

fix(server): prevent /debug/* exposure via DefaultServeMux fallthrough#3240

Closed
matiasinsaurralde wants to merge 1 commit into
mainfrom
fix/cve-2026-6993-debug-endpoints
Closed

fix(server): prevent /debug/* exposure via DefaultServeMux fallthrough#3240
matiasinsaurralde wants to merge 1 commit into
mainfrom
fix/cve-2026-6993-debug-endpoints

Conversation

@matiasinsaurralde

@matiasinsaurralde matiasinsaurralde commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Kratos HTTP servers route unmatched requests to http.DefaultServeMux through their NotFoundHandler and MethodNotAllowedHandler. Standard-library packages such as net/http/pprof, expvar and golang.org/x/net/trace auto-register handlers on that global mux from their init() functions, so any unmatched route on a public server could leak /debug/pprof/*, /debug/vars and /debug/requests.

This adds a shared DenyDefaultMuxFallthrough helper that returns plain 404/405 handlers, severing the fallthrough on every network path, and applies it to the Control Plane and Artifact CAS HTTP and metrics servers. Registered routes continue to be matched by the router and are unaffected.

Review in cubic

Kratos' HTTP server routes unmatched requests to http.DefaultServeMux, where
net/http/pprof, expvar and golang.org/x/net/trace auto-register handlers from
their init() functions. As a result /debug/pprof/*, /debug/vars and
/debug/requests were reachable on the public control-plane and CAS HTTP servers
regardless of the enable_profiler flag.

Add a DenyDefaultMuxFallthrough helper that overrides the Kratos NotFoundHandler
and MethodNotAllowedHandler to return 404/405 instead of delegating to the
global mux, and apply it to the public-facing HTTP and metrics servers in both
the control plane and CAS. The dedicated :6060 profiler server is left unchanged
so profiling remains available when enable_profiler is set.

Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
@matiasinsaurralde matiasinsaurralde requested a review from a team June 25, 2026 09:59

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Re-trigger cubic

@jiparis

jiparis commented Jun 25, 2026

Copy link
Copy Markdown
Member

Superseded by #3241 which also removes the default import and configures a specific profiler at 6060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants