CVE-2023-2253: Github.com/docker/distribution Distribution Catalog API Endpoint Can Vulnerability

HIGH
Advisory Identifier: GHSA-hqxw-f8mx-cpmw
CVSS 7.5
CWE-770 CWE-475
Published
Advisory Summary

CVE-2023-2253 is a HIGH (CVSS 7.5) distribution catalog api endpoint can vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Github.com/docker/distribution libraries in the Go ecosystem. The issue involves distribution catalog api endpoint can lead to oom via malicious user input. Remediation is available by upgrading affected packages to version 2.8.2-beta.1.

CVE-2023-2253 at a Glance

CVE Identifier CVE-2023-2253
GHSA Identifier GHSA-hqxw-f8mx-cpmw
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Github.com/docker/distribution
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.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:N/I:N/A:H).

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 None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2023-2253

To remediate this vulnerability, upgrade all affected Github.com/docker/distribution 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/docker/distribution fixed: 2.8.2-beta.1
Upgrade github.com/docker/distribution to 2.8.2-beta.1
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/docker/distribution

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-2253, inspect your project dependencies for Github.com/docker/distribution:

inspect dependencies for github.com/docker/distribution

Analyze the terminal output to locate any version of Github.com/docker/distribution in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.8.2-beta.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-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Github.com/docker/distribution, 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 Systems that run `distribution` built after a specific commit running on memory-restricted environments can suffer from denial of service by a crafted malicious `/v2/_catalog` API endpoint request. ### Patches Upgrade to at least 2.8.2-beta.1 if you are running `v2.8.x` release. If you use the code from the main branch, update at least to the commit after [f55a6552b006a381d9167e328808565dd2bf77dc](https://github.com/distribution/distribution/commit/f55a6552b006a381d9167e328808565dd2bf77dc). ### Workarounds There is no way to work around this issue without patching. Restrict access to the affected API endpoint: see the recommendations section. ### References `/v2/_catalog` endpoint accepts a parameter to control the maximum amount of records returned (query string: `n`). When not given the default `n=100` is used. The server trusts that `n` has an acceptable value, however when using a maliciously large value, it allocates an array/slice of `n` of strings before filling the slice with data. This behaviour was introduced ~7yrs ago [1]. ### Recommendation The `/v2/_catalog` endpoint was designed specifically to do registry syncs with search or other API systems. Such an endpoint would create a lot of load on the backend system, due to overfetch required to serve a request in certain implementations. Because of this, we strongly recommend keeping this API endpoint behind heightened privilege and avoiding leaving it exposed to the internet. ### For more information If you have any questions or comments about this advisory: * Open an issue in [distribution repository](https://github.com/distribution/distribution) * Email us at [cncf-distribution-security@lists.cncf.io](mailto:cncf-distribution-security@lists.cncf.io) [1] [faulty commit](https://github.com/distribution/distribution/blob/b7e26bac741c76cb792f8e14c41a2163b5dae8df/registry/handlers/catalog.go#L45)

CVE-2023-2253 Affected Github.com/docker/distribution Versions

1 component(s)
Fixed Versions:
2.8.2-beta.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/docker/distribution
Go
< 2.8.2-beta.1
2.8.2-beta.1

References

Frequently Asked Questions

What is CVE-2023-2253?
CVE-2023-2253 is a security vulnerability in Github.com/docker/distribution involving distribution catalog API endpoint can lead to OOM via malicious user input under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Github.com/docker/distribution versions are affected?
Affected versions include releases prior to 2.8.2-beta.1 across affected packages: github.com/docker/distribution.
What version fixes CVE-2023-2253?
Upgrading to 2.8.2-beta.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/docker/distribution affected?
Yes, github.com/docker/distribution is affected in releases prior to 2.8.2-beta.1. Upgrade your dependency to 2.8.2-beta.1 or later.
What is the CVSS score of CVE-2023-2253?
CVE-2023-2253 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2023-2253?
CVE-2023-2253 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check Go dependencies for CVE-2023-2253?
Run the dependency tree command: 'inspect dependencies for github.com/docker/distribution'. 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-hqxw-f8mx-cpmw",
  "modified" : "2023-05-11T20:37:54Z",
  "published" : "2023-05-11T20:37:54Z",
  "aliases" : [ "CVE-2023-2253" ],
  "summary" : "distribution catalog API endpoint can lead to OOM via malicious user input",
  "details" : "### Impact\n\nSystems that run `distribution` built after a specific commit running on memory-restricted environments can suffer from denial of service by a crafted malicious `/v2/_catalog` API endpoint request. \n\n### Patches\n\nUpgrade to at least 2.8.2-beta.1 if you are running `v2.8.x` release. If you use the code from the main branch, update at least to the commit after [f55a6552b006a381d9167e328808565dd2bf77dc](https://github.com/distribution/distribution/commit/f55a6552b006a381d9167e328808565dd2bf77dc).\n\n### Workarounds\n\nThere is no way to work around this issue without patching. Restrict access to the affected API endpoint: see the recommendations section.\n\n### References\n\n`/v2/_catalog` endpoint accepts a parameter to control the maximum amount of records returned (query string: `n`).\n\nWhen not given the default `n=100` is used.  The server trusts that `n` has an acceptable value, however when using a \nmaliciously large value, it allocates an array/slice of `n` of strings before filling the slice with data.\n\nThis behaviour was introduced ~7yrs ago [1].\n\n### Recommendation\n\nThe `/v2/_catalog` endpoint was designed specifically to do registry syncs with search or other API systems. Such an endpoint would create a lot of load on the backend system, due to overfetch required to serve a request in certain implementations.\n\nBecause of this, we strongly recommend keeping this API endpoint behind heightened privilege and avoiding leaving it exposed to the internet.\n\n###  For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [distribution repository](https://github.com/distribution/distribution)\n* Email us at [cncf-distribution-security@lists.cncf.io](mailto:cncf-distribution-security@lists.cncf.io)\n\n[1] [faulty commit](https://github.com/distribution/distribution/blob/b7e26bac741c76cb792f8e14c41a2163b5dae8df/registry/handlers/catalog.go#L45)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/docker/distribution"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.8.2-beta.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/distribution/distribution/security/advisories/GHSA-hqxw-f8mx-cpmw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-2253"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/distribution/distribution/commit/f55a6552b006a381d9167e328808565dd2bf77dc"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2189886"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/distribution/distribution"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/06/msg00035.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-475", "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-05-11T20:37:54Z",
    "nvd_published_at" : "2023-06-06T20:15:12Z"
  }
}