Back to Blog
high SEVERITY8 min read

How Information Disclosure happens in Go dependency management and how to fix it

CVE-2026-42151 is a high-severity information disclosure vulnerability in the Prometheus monitoring library (github.com/prometheus/prometheus) that exposed Azure OAuth client secrets through the Prometheus configuration API endpoint. Applications depending on versions prior to v0.311.3 were at risk of leaking sensitive Azure credentials to anyone with access to the config API. The fix involves upgrading the dependency in go.mod from v0.310.0 to v0.311.3.

O
By Orbis AppSec
•Technically reviewed by Anupam Mediratta•Published August 26, 2026•Reviewed August 26, 2026

Answer Summary

CVE-2026-42151 is a high-severity information disclosure vulnerability (CWE-200) in github.com/prometheus/prometheus affecting Go applications using versions prior to v0.311.3. The flaw caused Azure OAuth client secrets to be exposed in plaintext through the Prometheus configuration API endpoint. The fix is a dependency upgrade in go.mod from v0.310.0 to v0.311.3, which patches the config API to redact sensitive OAuth credentials before they are returned to callers.

Vulnerability at a Glance

cweCWE-200
fixUpgrade github.com/prometheus/prometheus from v0.310.0 to v0.311.3 in go.mod
riskAzure OAuth client secrets exposed via Prometheus config API to any caller with API access
languageGo
root causePrometheus config API serialized Azure OAuth credentials including client_secret without redaction
vulnerabilityInformation Disclosure of Azure OAuth Client Secret

Introduction

The go.mod file in any Go project is the authoritative list of what your application trusts. When one of those trusted dependencies has a security flaw, every application that pulls it in inherits the risk—silently, and often without any obvious code change on your part.

That's exactly what happened with CVE-2026-42151: a high-severity information disclosure vulnerability in github.com/prometheus/prometheus that caused Azure OAuth client secrets to be exposed in plaintext through the Prometheus configuration API. Any application embedding Prometheus and exposing its config endpoint—even internally—was potentially leaking cloud credentials to anyone who could reach that endpoint.

The fix was a single line change in go.mod:

-  github.com/prometheus/prometheus v0.310.0
+  github.com/prometheus/prometheus v0.311.3

But understanding why this line matters requires understanding how Prometheus handles Azure OAuth configuration, what the config API exposes, and why credential redaction is a security requirement, not just a nice-to-have.


The Vulnerability Explained

What the Prometheus Config API Does

Prometheus exposes a /api/v1/status/config HTTP endpoint that returns the currently loaded configuration in YAML format. This is genuinely useful for operators: it lets you inspect the running configuration without needing filesystem access to the server. However, this convenience becomes a critical security hole when the configuration contains secrets.

Azure OAuth in Prometheus

Prometheus supports scraping metrics from Azure Monitor using an OAuth2 client credentials flow. The configuration for this looks something like:

azure_sd_configs:
  - environment: AzurePublicCloud
    authentication_method: OAuth
    subscription_id: "your-subscription-id"
    tenant_id: "your-tenant-id"
    client_id: "your-client-id"
    client_secret: "your-super-secret-value"  # ← THIS is the problem

In versions prior to v0.311.3 (including v0.310.0), when the config API serialized this configuration struct back to YAML for the API response, the client_secret field was included verbatim. There was no redaction step that replaced the secret value with a placeholder like <secret> before returning the response.

The Attack Scenario

Consider a real-world scenario: a platform engineering team runs Prometheus inside a Kubernetes cluster to monitor Azure-hosted workloads. They've configured Azure service discovery using an OAuth client secret that has Reader permissions on their Azure subscription.

An attacker who gains access to the internal network—through a compromised pod, a misconfigured ingress, or a lateral movement step—can simply call:

GET http://prometheus-server:9090/api/v1/status/config

The response includes the full Prometheus configuration in YAML, including the client_secret in plaintext. The attacker now has valid Azure OAuth credentials and can enumerate Azure resources, access storage accounts, or escalate privileges depending on what that service principal can access.

No authentication bypass is needed. No memory corruption. Just a single HTTP GET to a monitoring endpoint that was never supposed to be a credential vault.

Why This Affects Your Go Application

If your Go application embeds Prometheus (as many observability platforms, SLO tools, and monitoring agents do), and it exposes the Prometheus config API, it inherited this vulnerability through its go.mod dependency on github.com/prometheus/prometheus v0.310.0. The vulnerability lives entirely within the Prometheus library code—your application code didn't need to do anything wrong.


The Fix

What Changed in go.mod

The fix is a version bump in two files:

go.mod — the dependency declaration:

-  github.com/prometheus/prometheus v0.310.0
+  github.com/prometheus/prometheus v0.311.3

go.sum — the cryptographic integrity hashes for the new version (updated automatically by go mod tidy).

The go.sum changes also reflect updated transitive dependencies pulled in by the new Prometheus version, including:

+cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM=
+github.com/aws/aws-sdk-go-v2 v1.41.4 h1:10f50G7WyU02T56ox1wWXq+zTX9I1zxG46HYuG1hH/k=
+github.com/aws/aws-sdk-go-v2/config v1.32.12 h1:O3csC7HUGn2895eNrLytOJQdoL2xyJy0iYXhoZ1OmP0=

These transitive updates are part of Prometheus v0.311.3's dependency tree and are verified by the hash entries in go.sum.

What Prometheus v0.311.3 Actually Fixed

The core fix in Prometheus v0.311.3 is in the Azure service discovery configuration struct. The client_secret field (and similar credential fields) are now redacted before serialization when the config API marshals the configuration to YAML.

The pattern before the fix effectively allowed:

// Simplified representation of the vulnerable behavior
type AzureSDConfig struct {
    ClientID     string `yaml:"client_id"`
    ClientSecret string `yaml:"client_secret"` // serialized as-is
    TenantID     string `yaml:"tenant_id"`
}

After the fix, sensitive fields use Prometheus's config.Secret type (or equivalent redaction mechanism), which implements a custom YAML marshaler that outputs <secret> instead of the actual value:

// Simplified representation of the fixed behavior
type AzureSDConfig struct {
    ClientID     string        `yaml:"client_id"`
    ClientSecret config.Secret `yaml:"client_secret"` // marshals as "<secret>"
    TenantID     string        `yaml:"tenant_id"`
}

This means the config API can still be used for debugging and operational visibility—it just no longer leaks the actual secret values.

Why Both go.mod and go.sum Must Change

A common misconception is that only go.mod matters. In practice, go.sum is the security layer: it contains the expected cryptographic hashes of every module version your build depends on. If go.sum doesn't contain the hash for the new version, go build will refuse to proceed. Both files must be updated together for the fix to be complete and verifiable.


Key Takeaways

  • The Prometheus config API in v0.310.0 serialized client_secret fields from Azure OAuth configurations without any redaction, making them readable to anyone who could reach the endpoint.
  • A single line change in go.mod — upgrading from v0.310.0 to v0.311.3 — is sufficient to remediate this vulnerability in any Go application using this dependency.
  • go.sum must be updated alongside go.mod: the hash entries for github.com/prometheus/prometheus v0.311.3 and its updated transitive dependencies (including aws-sdk-go-v2 v1.41.4) must be present for the build to succeed.
  • Monitoring infrastructure is a high-value target: Prometheus, Grafana, and similar tools often hold credentials for every system they monitor. Their APIs deserve the same access controls as production services.
  • Credential redaction at the serialization layer is the correct fix: restricting API access reduces exposure but doesn't eliminate the root cause. The secret should never appear in the API response at all.

How Orbis AppSec Detected This

  • Source: The client_secret field in Azure OAuth service discovery configuration, supplied by operators via Prometheus configuration files and stored in the AzureSDConfig struct.
  • Sink: The Prometheus /api/v1/status/config HTTP endpoint, which marshaled the full configuration struct—including unredacted credential fields—into a YAML API response.
  • Missing control: No redaction or masking of the client_secret field prior to YAML serialization in the config API handler. The field used a plain string type rather than a config.Secret type with a custom marshaler.
  • CWE: CWE-200 — Exposure of Sensitive Information to an Unauthorized Actor.
  • Fix: Upgraded github.com/prometheus/prometheus from v0.310.0 to v0.311.3 in go.mod, which includes the upstream patch that redacts credential fields before config API serialization.

Orbis AppSec automatically detected this vulnerability and opened a pull request with the fix. Try Orbis AppSec on your repositories to find and fix issues like this automatically.


Conclusion

CVE-2026-42151 is a reminder that security vulnerabilities don't always look like buffer overflows or SQL injections. Sometimes they're a missing redaction step in a monitoring tool's API response—quiet, hard to spot in a code review, but potentially catastrophic when Azure credentials end up in the wrong hands.

The fix is straightforward: upgrade github.com/prometheus/prometheus to v0.311.3 in your go.mod. But the broader lesson is about the security posture of your entire dependency graph. Every library you import is code you're responsible for. Automated scanning tools like Trivy and govulncheck, combined with automated remediation workflows, are no longer optional—they're the baseline for responsible Go development.

If you're running Prometheus with Azure service discovery, audit your config API exposure today, apply this upgrade, and consider rotating any Azure OAuth client secrets that may have been exposed.


Prevention and further reading

View the Security Fix

Check out the pull request that fixed this vulnerability

View PR #4

Related Articles

critical

redmine_drawio View Hook Inlines Base64 Redmine API Keys

The Redmine drawio plugin's body-bottom view listener embedded the logged-in user's Redmine REST API key into client-side JavaScript on every wiki and issue page, "protected" only by Base64 encoding of the reversed string. Any script on the page — or anyone with browser developer tools, a cached copy of the HTML, or a proxy log — could decode it in one line and act as that user through the Redmine REST API. The fix removes the embedded credential from the rendered page entirely; the plugin's dia

critical

Yandex Translate API Key Leaked via URL Query Parameter

The `translateYandex()` helper built its request URL by interpolating the caller-supplied API key directly into the query string, meaning every call leaked the credential into server access logs, proxy logs, and any Referer header sent by intermediaries. The fix switches the request from a GET with the key in the URL to a POST with the key in the request body via `URLSearchParams`, removing the credential from any URL-logging surface entirely.

critical

Google Generative AI Keys Exposed in Client-Side Fetch URLs

A client-side AI model discovery utility was embedding Google Generative AI API keys directly in fetch request URLs, making them visible to any user inspecting network traffic or browser DevTools. The fix moves the key from the URL query parameter to a secure HTTP header, eliminating exposure while maintaining API authentication.

critical

How credential leakage through console logging happens in JavaScript browser extensions and how to fix it

A browser extension's `src/background/credentials.js` printed the full Strava authentication cookie string — including a signed JWT and CloudFront-Signature values — straight into the extension console via `console.debug`. Anyone who could open DevTools on the background page (or any tooling that scraped the console) could copy a live session and impersonate the user. The fix replaces the credential payload in both log statements with `Boolean(credentials)` and strips a realistic-looking JWT out

critical

How Hardcoded Secrets Compromise Authentication in JavaScript and How to Fix It

A critical vulnerability in `Tool/QuantumultX/Rewrite/RRSP.js` exposed hardcoded API authentication credentials—a TOKEN and UMID device identifier—directly in source code. Anyone with repository access could extract these credentials to impersonate the legitimate user and gain full account access to the RRTV API service. The fix replaced hardcoded secrets with empty placeholders, forcing users to manually configure credentials through secure channels.

critical

How API Key Exposure in Request Bodies happens in React and how to fix it

The Chatbot component in gitforme was transmitting Azure OpenAI API keys inside JSON request bodies, causing them to be logged by servers, proxies, and middleware. By moving the apiKey from requestBody.apiKey to an Authorization header, credentials are now protected from persistence in generic request logging infrastructure.