CVE-2022-23536: Github.com/cortexproject/cortex Cortex's Alertmanager Can Expose Local Vulnerability

MODERATE
Advisory Identifier: GHSA-cq2g-pw6q-hf7j
CVSS 6.5
CWE-641 CWE-73 CWE-184
Published
Advisory Summary

CVE-2022-23536 is a MODERATE (CVSS 6.5) cortex's alertmanager can expose local vulnerability (CWE-641: Improper Restriction of Names for Files and Other Resources) affecting Github.com/cortexproject/cortex libraries in the Go ecosystem. The issue involves cortex's alertmanager can expose local files content via specially crafted config. Remediation is available by upgrading affected packages to version 1.14.1, 1.13.2.

CVE-2022-23536 at a Glance

CVE Identifier CVE-2022-23536
GHSA Identifier GHSA-cq2g-pw6q-hf7j
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-641: Improper Restriction of Names for Files and Other Resources
Affected Product Github.com/cortexproject/cortex
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:L/UI:N/S:U/C:H/I:N/A:N).

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

How to Fix CVE-2022-23536

To remediate this vulnerability, upgrade all affected Github.com/cortexproject/cortex 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/cortexproject/cortex fixed: 1.14.1
Upgrade github.com/cortexproject/cortex to 1.14.1
github.com/cortexproject/cortex fixed: 1.13.2
Upgrade github.com/cortexproject/cortex to 1.13.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/cortexproject/cortex

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-23536, inspect your project dependencies for Github.com/cortexproject/cortex:

inspect dependencies for github.com/cortexproject/cortex

Analyze the terminal output to locate any version of Github.com/cortexproject/cortex in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.14.1), 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-641: Improper Restriction of Names for Files and Other Resources, where the product constructs the name of a file or other resource using input from an upstream component, but it does not restrict or incorrectly restricts the resulting name. In Github.com/cortexproject/cortex, 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 A local file inclusion vulnerability exists in Cortex versions v1.13.0, v1.13.1 and v1.14.0, where a malicious actor could remotely read local files as a result of parsing maliciously crafted Alertmanager configurations when submitted to the [Alertmanager Set Configuration API](https://cortexmetrics.io/docs/api/#set-alertmanager-configuration). Only users of the Cortex Alertmanager service using `-experimental.alertmanager.enable-api` or `enable_api: true` are affected. ### Specific Go Packages Affected github.com/cortexproject/cortex/pkg/alertmanager ### Patches Affected Cortex users are advised to upgrade to versions 1.13.2 or 1.14.1. ### Workarounds Patching is ultimately advised. Using out-of-bound validation, Cortex administrators may reject Alertmanager configurations containing the `api_key_file` setting in the `opsgenie_configs` section and `opsgenie_api_key_file` in the `global` section before sending to the [Set Alertmanager Configuration API](https://cortexmetrics.io/docs/api/#set-alertmanager-configuration) as a workaround. ### References - Fixed Versions: - https://github.com/cortexproject/cortex/releases/tag/v1.14.1 - https://github.com/cortexproject/cortex/releases/tag/v1.13.2 - https://cortexmetrics.io/docs/api/#set-alertmanager-configuration ### For more information If you have any questions or comments about this advisory: * Open an issue in [cortex](https://github.com/cortexproject/cortex/issues/new/choose) * Email us at [cortex-team@googlegroups.com](mailto:cortex-team@googlegroups.com).

CVE-2022-23536 Affected Github.com/cortexproject/cortex Versions

2 component(s)
Fixed Versions:
1.14.11.13.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cortexproject/cortex
Go
≥ 1.14.0
< 1.14.1
All 1 versions
1.14.0
1.14.1
github.com/cortexproject/cortex
Go
≥ 1.13.0
< 1.13.2
1.13.2

References

Frequently Asked Questions

What is CVE-2022-23536?
CVE-2022-23536 is a security vulnerability in Github.com/cortexproject/cortex involving Cortex's Alertmanager can expose local files content via specially crafted config under CWE-641: Improper Restriction of Names for Files and Other Resources.
Which Github.com/cortexproject/cortex versions are affected?
Affected versions include releases prior to 1.14.1, 1.13.2 across affected packages: github.com/cortexproject/cortex.
What version fixes CVE-2022-23536?
Upgrading to 1.14.1, 1.13.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/cortexproject/cortex affected?
Yes, github.com/cortexproject/cortex is affected in releases prior to 1.14.1, 1.13.2. Upgrade your dependency to 1.14.1, 1.13.2 or later.
What is the CVSS score of CVE-2022-23536?
CVE-2022-23536 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2022-23536?
CVE-2022-23536 is classified under CWE-641: Improper Restriction of Names for Files and Other Resources (The product constructs the name of a file or other resource using input from an upstream component, but it does not restrict or incorrectly restricts the resulting name.).
How can I check Go dependencies for CVE-2022-23536?
Run the dependency tree command: 'inspect dependencies for github.com/cortexproject/cortex'. 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-cq2g-pw6q-hf7j",
  "modified" : "2023-10-02T11:04:41Z",
  "published" : "2022-12-19T21:09:05Z",
  "aliases" : [ "CVE-2022-23536" ],
  "summary" : "Cortex's Alertmanager can expose local files content via specially crafted config",
  "details" : "### Impact\n\nA local file inclusion vulnerability exists in Cortex versions v1.13.0, v1.13.1 and v1.14.0, where a malicious actor could remotely read local files as a result of parsing maliciously crafted Alertmanager configurations when submitted to the [Alertmanager Set Configuration API](https://cortexmetrics.io/docs/api/#set-alertmanager-configuration). Only users of the Cortex Alertmanager service using `-experimental.alertmanager.enable-api` or `enable_api: true` are affected.\n\n### Specific Go Packages Affected\ngithub.com/cortexproject/cortex/pkg/alertmanager\n\n### Patches\nAffected Cortex users are advised to upgrade to versions 1.13.2 or 1.14.1.\n\n### Workarounds\nPatching is ultimately advised. Using out-of-bound validation, Cortex administrators may reject Alertmanager configurations containing the `api_key_file` setting in the `opsgenie_configs` section and `opsgenie_api_key_file` in the `global` section before sending to the [Set Alertmanager Configuration API](https://cortexmetrics.io/docs/api/#set-alertmanager-configuration) as a workaround.\n\n### References\n- Fixed Versions:\n   - https://github.com/cortexproject/cortex/releases/tag/v1.14.1\n   - https://github.com/cortexproject/cortex/releases/tag/v1.13.2\n- https://cortexmetrics.io/docs/api/#set-alertmanager-configuration\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n* Open an issue in [cortex](https://github.com/cortexproject/cortex/issues/new/choose)\n* Email us at [cortex-team@googlegroups.com](mailto:cortex-team@googlegroups.com).\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cortexproject/cortex"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.14.0"
      }, {
        "fixed" : "1.14.1"
      } ]
    } ],
    "versions" : [ "1.14.0" ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cortexproject/cortex"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.13.0"
      }, {
        "fixed" : "1.13.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cortexproject/cortex/security/advisories/GHSA-cq2g-pw6q-hf7j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23536"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cortexproject/cortex/commit/03e023d8b012887b31cc268d0d011b01e1e65506"
  }, {
    "type" : "WEB",
    "url" : "https://cortexmetrics.io/docs/api/#set-alertmanager-configuration"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cortexproject/cortex"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cortexproject/cortex/releases/tag/v1.13.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cortexproject/cortex/releases/tag/v1.14.1"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2022-1175"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-184", "CWE-641", "CWE-73" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-12-19T21:09:05Z",
    "nvd_published_at" : "2022-12-19T22:15:00Z"
  }
}