How to fix: Prometheus /metrics Endpoint Exposed Without Authentication
The response body contains real Prometheus text-exposition-format output: paired '# HELP' and '# TYPE' comment lines plus at least one actual metric sample line (metric_name{labels} value), not just the word 'Prometheus' or a documentation reference to the format.
Why it matters
Default Prometheus client library metrics reveal process start time, Go/JVM runtime internals, request counts and latencies broken down by route, and often labels containing internal hostnames, pod names, or upstream service addresses. An attacker gets a detailed operational fingerprint of the service and its dependencies without needing any credentials.
The /metrics endpoint is meant to be scraped only by a trusted Prometheus server on an internal network, not served to arbitrary internet clients. Application frameworks that auto-register a metrics endpoint often leave it on the same public port as the application by default.
How to fix it
- 1Serve /metrics on a separate internal-only port; most client libraries support a distinct metrics listener address.
- 2Restrict access to /metrics with a firewall rule or security group that allows only the Prometheus server's IP.
- 3If it must share the public port, put it behind authentication (basic auth or mTLS) in the reverse proxy.
- 4Audit custom metric labels for internal hostnames, IPs, or identifiers that shouldn't be publicly visible.
Code examples
Nginx: restrict /metrics to the internal scraper
location /metrics {
allow 10.0.0.0/8;
deny all;
}Prometheus client (Go): bind metrics to a separate internal listener
go func() {
mux := http.NewServeMux()
mux.Handle("/metrics", promhttp.Handler())
// Internal-only listener, never the public-facing port
log.Fatal(http.ListenAndServe("127.0.0.1:9100", mux))
}()References
Detected automatically by VulnRadar. The check id is prometheus-metrics-exposed, stable across every scan so you can filter or diff on it.
More info disclosure checks
- MediumRails Session Cookie Missing HttpOnly Flag
- InfoServer header truncated
- InfoPHP session cookie naming exposes runtime
- Infoconfig.js / settings.js referenced (verify contents)
- Infoenv.js / environment.js referenced (verify contents)
- InfoSitemap.xml publicly accessible
- InfoOpenAPI schema version exposed in URL
- LowCORS exposes internal CDN hostname
Questions
- How severe is Prometheus /metrics Endpoint Exposed Without Authentication?
- VulnRadar rates this medium severity in the info disclosure category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id prometheus-metrics-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Prometheus /metrics Endpoint Exposed Without Authentication map to?
- It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.