CVE-2021-41090: Github.com/grafana/agent Instance Config Inline Secret Exposure Vulnerability

MODERATE
Advisory Identifier: GHSA-9c4x-5hgq-q3wh
CVSS 6.5
CWE-312 CWE-200
Published
Advisory Summary

CVE-2021-41090 is a MODERATE (CVSS 6.5) instance config inline secret exposure vulnerability (CWE-312: Cleartext Storage of Sensitive Information) affecting Github.com/grafana/agent libraries in the Go ecosystem. The issue involves instance config inline secret exposure in grafana. Remediation is available by upgrading affected packages to version 0.21.2.

CVE-2021-41090 at a Glance

CVE Identifier CVE-2021-41090
GHSA Identifier GHSA-9c4x-5hgq-q3wh
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-312: Cleartext Storage of Sensitive Information
Affected Product Github.com/grafana/agent
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2021-41090

To remediate this vulnerability, upgrade all affected Github.com/grafana/agent dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/grafana/agent fixed: 0.21.2
Upgrade github.com/grafana/agent to 0.21.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/grafana/agent

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-41090, inspect your project dependencies for Github.com/grafana/agent:

inspect dependencies for github.com/grafana/agent

Analyze the terminal output to locate any version of Github.com/grafana/agent in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.21.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-312: Cleartext Storage of Sensitive Information, where the product stores sensitive information in cleartext within a resource that might be accessible to another control sphere. In Github.com/grafana/agent, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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](https://github.com/grafana/agent/releases/tag/v0.20.1) or any version past [v0.21.2](https://github.com/grafana/agent/releases/tag/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.

CVE-2021-41090 Affected Github.com/grafana/agent Versions

1 component(s)
Fixed Versions:
0.21.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/grafana/agent
Go
≥ 0.14.0
< 0.21.2
0.21.2

References

Frequently Asked Questions

What is CVE-2021-41090?
CVE-2021-41090 is a security vulnerability in Github.com/grafana/agent involving Instance config inline secret exposure in Grafana under CWE-312: Cleartext Storage of Sensitive Information.
Which Github.com/grafana/agent versions are affected?
Affected versions include releases prior to 0.21.2 across affected packages: github.com/grafana/agent.
What version fixes CVE-2021-41090?
Upgrading to 0.21.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/grafana/agent affected?
Yes, github.com/grafana/agent is affected in releases prior to 0.21.2. Upgrade your dependency to 0.21.2 or later.
What is the CVSS score of CVE-2021-41090?
CVE-2021-41090 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2021-41090?
CVE-2021-41090 is classified under CWE-312: Cleartext Storage of Sensitive Information (The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.).
How can I check Go dependencies for CVE-2021-41090?
Run the dependency tree command: 'inspect dependencies for github.com/grafana/agent'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9c4x-5hgq-q3wh",
  "modified" : "2021-12-14T15:32:21Z",
  "published" : "2021-12-08T19:52:40Z",
  "aliases" : [ "CVE-2021-41090" ],
  "summary" : "Instance config inline secret exposure in Grafana",
  "details" : "### Impact\nSome inline secrets are exposed in plaintext over the Grafana Agent HTTP server:\n\n* Inline secrets for metrics instance configs in the base YAML file are exposed at `/-/config` \n* Inline secrets for integrations are exposed at `/-/config`\n* Inline secrets for Consul ACL tokens and ETCD basic auth when configured for the scraping service at `/-/config`.\n* Inline secrets for the Kafka receiver for OpenTelemetry-Collector tracing at `/-/config`.\n* Inline secrets for metrics instance configs loaded from the scraping service are exposed at `/agent/api/v1/configs/{name}`.\n\nInline secrets will be exposed to anyone being able to reach these endpoints.\n\nSecrets found in these sections are used for:\n\n* Delivering metrics to a Prometheus Remote Write system \n* Authenticating against a system for discovering Prometheus targets \n* Authenticating against a system for collecting metrics (scrape_configs and integrations)\n* Authenticating against a Consul or ETCD for storing configurations to distribute in scraping service mode \n* Authenticating against Kafka for receiving traces\n\nNon-inlined secrets, such as `*_file`-based secrets, are not impacted by this vulnerability. \n\n### Patches\n\nDownload [v0.20.1](https://github.com/grafana/agent/releases/tag/v0.20.1) or any version past [v0.21.2](https://github.com/grafana/agent/releases/tag/v0.21.2) to patch Grafana Agent. These patches obfuscate the listed impacted secrets from the vulnerable endpoints.\n\nThe patches also disable the endpoints by default. Pass the command-line flag `--config.enable-read-api` to opt-in and re-enable the endpoints.  \n \n### Workarounds\nIf for some reason you cannot upgrade, use non-inline secrets where possible. Not all configuration options may have a non-inline equivalent.\n\nYou also may desire to restrict API access to Grafana Agent, with some combination of:\n\n* 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. \n* Configure Grafana Agent to use HTTPS with client authentication. \n* Use firewall rules to restrict external access to Grafana Agent's API.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/grafana/agent"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.14.0"
      }, {
        "fixed" : "0.21.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/grafana/agent/security/advisories/GHSA-9c4x-5hgq-q3wh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41090"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/agent/pull/1152"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/agent/commit/a5479755e946e5c7cddb793ee9adda8f5692ba11"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/agent/commit/af7fb01e31fe2d389e5f1c36b399ddc46b412b21"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/grafana/agent"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/agent/releases/tag/v0.20.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/grafana/agent/releases/tag/v0.21.2"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20211229-0004"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200", "CWE-312" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-12-08T19:32:31Z",
    "nvd_published_at" : "2021-12-08T17:15:00Z"
  }
}