6.5medium
Instance config inline secret exposure
- Severity
- 6.5medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.76% (higher than 56% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-9c4x-5hgq-q3whGO-2022-0305
Description
Grafana Agent is a telemetry collector for sending metrics, logs, and trace data to the opinionated Grafana observability stack. Prior to versions 0.20.1 and 0.21.2, inline secrets defined within a metrics instance config are exposed in plaintext over two endpoints: metrics instance configs defined in the base YAML file are exposed at `/-/config` and metrics instance configs defined for the scraping service are exposed at `/agent/api/v1/configs/:key`. Inline secrets will be exposed to anyone being able to reach these endpoints. If HTTPS with client authentication is not configured, these endpoints are accessible to unauthenticated users. Secrets found in these sections are used for delivering metrics to a Prometheus Remote Write system, authenticating against a system for discovering Prometheus targets, and authenticating against a system for collecting metrics. This does not apply for non-inlined secrets, such as `*_file` based secrets. This issue is patched in Grafana Agent versions 0.20.1 and 0.21.2. A few workarounds are available. Users who cannot upgrade should use non-inline secrets where possible. Users may also desire to restrict API access to Grafana Agent with some combination of restricting the network interfaces Grafana Agent listens on through `http_listen_address` in the `server` block, configuring Grafana Agent to use HTTPS with client authentication, and/or using firewall rules to restrict external access to Grafana Agent's API.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| grafana agent | >= 0.14.0, < 0.20.1, >= 0.21.0, < 0.21.2, from 0.14.0 before 0.20.1, from 0.21.0 before 0.21.2 | CVE List, NVD |
| github.com/grafana/agent (Go) | from 0.14.0 before 0.21.2 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| NVD | 4.3medium CVSS:2.0 | AV:N/AC:M/Au:N/C:P/I:N/A:N |
Classification
What each source says
CVE List
Grafana Agent is a telemetry collector for sending metrics, logs, and trace data to the opinionated Grafana observability stack. Prior to versions 0.20.1 and 0.21.2, inline secrets defined within a metrics instance config are exposed in plaintext over two endpoints: metrics instance configs defined in the base YAML file are exposed at `/-/config` and metrics instance configs defined for the scraping service are exposed at `/agent/api/v1/configs/:key`. Inline secrets will be exposed to anyone being able to reach these endpoints. If HTTPS with client authentication is not configured, these endpoints are accessible to unauthenticated users. Secrets found in these sections are used for delivering metrics to a Prometheus Remote Write system, authenticating against a system for discovering Prometheus targets, and authenticating against a system for collecting metrics. This does not apply for non-inlined secrets, such as `*_file` based secrets. This issue is patched in Grafana Agent versions 0.20.1 and 0.21.2. A few workarounds are available. Users who cannot upgrade should use non-inline secrets where possible. Users may also desire to restrict API access to Grafana Agent with some combination of restricting the network interfaces Grafana Agent listens on through `http_listen_address` in the `server` block, configuring Grafana Agent to use HTTPS with client authentication, and/or using firewall rules to restrict external access to Grafana Agent's API.
GitHub Advisory Database
Impact
Some inline secrets are exposed in plaintext over the Grafana Agent HTTP server:
- Inline secrets for metrics instance configs in the base YAML file are exposed at
/-/config - Inline secrets for integrations are exposed at
/-/config - Inline secrets for Consul ACL tokens and ETCD basic auth when configured for the scraping service at
/-/config. - Inline secrets for the Kafka receiver for OpenTelemetry-Collector tracing at
/-/config. - Inline secrets for metrics instance configs loaded from the scraping service are exposed at
/agent/api/v1/configs/{name}.
Inline secrets will be exposed to anyone being able to reach these endpoints.
Secrets found in these sections are used for:
- Delivering metrics to a Prometheus Remote Write system
- Authenticating against a system for discovering Prometheus targets
- Authenticating against a system for collecting metrics (scrape_configs and integrations)
- Authenticating against a Consul or ETCD for storing configurations to distribute in scraping service mode
- Authenticating against Kafka for receiving traces
Non-inlined secrets, such as *_file-based secrets, are not impacted by this vulnerability.
Patches
Download v0.20.1 or any version past v0.21.2 to patch Grafana Agent. These patches obfuscate the listed impacted secrets from the vulnerable endpoints.
The patches also disable the endpoints by default. Pass the command-line flag --config.enable-read-api to opt-in and re-enable the endpoints.
Workarounds
If for some reason you cannot upgrade, use non-inline secrets where possible. Not all configuration options may have a non-inline equivalent.
You also may desire to restrict API access to Grafana Agent, with some combination of:
- Restrict network interfaces Grafana Agent listens on through
http_listen_addressin theserverblock.127.0.0.1is the most restrictive,0.0.0.0is the default. - Configure Grafana Agent to use HTTPS with client authentication.
- Use firewall rules to restrict external access to Grafana Agent's API.
Go Vulnerability Database
Instance config inline secret exposure in Grafana in github.com/grafana/agent
NVD (es)
Grafana Agent es un recolector de telemetría para enviar métricas, registros y datos de rastreo a la pila de observabilidad de Grafana. Antes de las versiones 0.20.1 y 0.21.2, los secretos en línea definidos dentro de una configuración de instancia de métrica se exponen en texto plano en dos endpoints: las configuraciones de instancia de métrica definidas en el archivo YAML base se exponen en "/-/config" y las configuraciones de instancia de métrica definidas para el servicio de raspado se exponen en "/agent/api/v1/configs/:key". Los secretos en línea son expuestos a cualquiera que pueda alcanzar estos endpoints. Si no se configura HTTPS con autenticación de cliente, estos endpoints son accesibles a usuarios no autenticados. Los secretos que son encontrados en estas secciones son usados para entregar métricas a un sistema de escritura remota de Prometheus, autenticar contra un sistema para detectar objetivos de Prometheus y autenticar contra un sistema para recopilar métricas. Esto no es aplicado a los secretos no alineados, como los secretos basados en "*_file". Este problema se ha parcheado en Grafana Agent versiones 0.20.1 y 0.21.2. Se presentan algunas soluciones disponibles. Los usuarios que no puedan actualizares deberían usar secretos no basados en la línea siempre que sea posible. Los usuarios también pueden querer restringir el acceso a la API de Grafana Agent con alguna combinación de restricción de las interfaces de red que escucha Grafana Agent mediante "http_listen_address" en el bloque "server", configurando Grafana Agent para usar HTTPS con autenticación de cliente, y/o usando reglas de firewall para restringir el acceso externo a la API de Grafana Agent
References
| https://github.com/grafana/agent/security/advisories/GHSA-9c4x-5hgq-q3wh | advisory, third-party-advisory, web | |
| https://github.com/grafana/agent/pull/1152 | fix, patch, third-party-advisory, web | |
| https://github.com/grafana/agent/commit/af7fb01e31fe2d389e5f1c36b399ddc46b412b21 | fix, patch, third-party-advisory, web | |
| https://github.com/grafana/agent/releases/tag/v0.20.1 | release-notes, third-party-advisory, web | |
| https://github.com/grafana/agent/releases/tag/v0.21.2 | release-notes, third-party-advisory, web | |
| https://security.netapp.com/advisory/ntap-20211229-0004/ | third-party-advisory | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-41090 | advisory | |
| https://github.com/grafana/agent/commit/a5479755e946e5c7cddb793ee9adda8f5692ba11 | fix, web | |
| https://github.com/grafana/agent | package | |
| https://security.netapp.com/advisory/ntap-20211229-0004 | web | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-41090 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-9c4x-5hgq-q3wh changed 2026-07-08 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2022-0305 changed 2026-03-03 | CC-BY-4.0 |
| NVD | CVE-2021-41090 changed 2026-06-17 | Public domain |