Skip to content

Inline secrets exposure

High
rfratto published GHSA-9c4x-5hgq-q3wh Dec 8, 2021

Package

gomod grafana/agent (Go)

Affected versions

>= 0.14.0

Patched versions

v0.20.1 or >= v0.21.2

Description

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_address in the server block. 127.0.0.1 is the most restrictive, 0.0.0.0 is the default.
  • Configure Grafana Agent to use HTTPS with client authentication.
  • Use firewall rules to restrict external access to Grafana Agent's API.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N

CVE ID

CVE-2021-41090

Weaknesses

No CWEs