CVE-2022-24778: Github.com/containerd/imgcrypt Incorrect Authorization Vulnerability

HIGH
Advisory Identifier: GHSA-8v99-48m9-c8pm
CVSS 7.5
CWE-863
Published
Advisory Summary

CVE-2022-24778 is a HIGH (CVSS 7.5) incorrect authorization vulnerability (CWE-863: Incorrect Authorization) affecting Github.com/containerd/imgcrypt libraries in the Go ecosystem. The issue involves incorrect authorization in imgcrypt. Remediation is available by upgrading affected packages to version 1.1.4.

CVE-2022-24778 at a Glance

CVE Identifier CVE-2022-24778
GHSA Identifier GHSA-8v99-48m9-c8pm
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-863: Incorrect Authorization
Affected Product Github.com/containerd/imgcrypt
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:H/I:N/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 High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2022-24778

To remediate this vulnerability, upgrade all affected Github.com/containerd/imgcrypt 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/containerd/imgcrypt fixed: 1.1.4
Upgrade github.com/containerd/imgcrypt to 1.1.4
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/containerd/imgcrypt

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-24778, inspect your project dependencies for Github.com/containerd/imgcrypt:

inspect dependencies for github.com/containerd/imgcrypt

Analyze the terminal output to locate any version of Github.com/containerd/imgcrypt in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.4), 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-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. In Github.com/containerd/imgcrypt, 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

Imgcrypt implements a function `CheckAuthorization()` that is supposed to check whether a user is authorized to access an encrypted image given the keys that the user has provided on the command line that would enable decryption of the image. The check is to prevent that a user can start a container from an image that has previously been decrypted by another user on the same system and therefore a decrypted version of the image layers may be already available in the cache locally. The failure occurs when an image with a ManifestList is used and the architecture of the local host is not the first one in the ManifestList. In the version prior to the fix, only the first architecture in the list was tested, which may not have its layers available locally (were not pulled) since it cannot be run on the host architecture. Therefore, the verdict on unavailable layers was that the image could be run anticipating that image run failure would occur later due to the layers not being available. However, this verdict to allow the image to run lead to other architectures in the ManifestList be able to run an image without providing keys if that image had previously been decrypted. The fixed version now skips over irrelevant architectures and tests the Manifest of the local architecture, if available. Known projects that use the `CheckAuthorization()` of imgcrypt is for example the ctr-enc client tool provided by imgcrypt. In this implementation, the call to `CheckAuthorization()` is used on the client side and could therefore also be easily circumvented by a modified client tool not calling this function. In relation to the vulnerability in ctr-enc, affected environments would have to allow different users to invoke ctr-enc indirectly using some sort of management stack that gives user indirect access to ctr-enc. The patch has been applied to imgcrypt v1.1.4. Workarounds may include usage of different namespaces for each remote user.

CVE-2022-24778 Affected Github.com/containerd/imgcrypt Versions

1 component(s)
Fixed Versions:
1.1.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/containerd/imgcrypt
Go
< 1.1.4
1.1.4

References

Frequently Asked Questions

What is CVE-2022-24778?
CVE-2022-24778 is a security vulnerability in Github.com/containerd/imgcrypt involving Incorrect Authorization in imgcrypt under CWE-863: Incorrect Authorization.
Which Github.com/containerd/imgcrypt versions are affected?
Affected versions include releases prior to 1.1.4 across affected packages: github.com/containerd/imgcrypt.
What version fixes CVE-2022-24778?
Upgrading to 1.1.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/containerd/imgcrypt affected?
Yes, github.com/containerd/imgcrypt is affected in releases prior to 1.1.4. Upgrade your dependency to 1.1.4 or later.
What is the CVSS score of CVE-2022-24778?
CVE-2022-24778 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:H/I:N/A:N.
What CWE is associated with CVE-2022-24778?
CVE-2022-24778 is classified under CWE-863: Incorrect Authorization (The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.).
How can I check Go dependencies for CVE-2022-24778?
Run the dependency tree command: 'inspect dependencies for github.com/containerd/imgcrypt'. 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-8v99-48m9-c8pm",
  "modified" : "2024-05-20T20:48:13Z",
  "published" : "2022-03-28T19:33:44Z",
  "aliases" : [ "CVE-2022-24778" ],
  "summary" : "Incorrect Authorization in imgcrypt",
  "details" : "Imgcrypt implements a function `CheckAuthorization()` that is supposed to check whether a user is authorized to access an encrypted image given the keys that the user has provided on the command line that would enable decryption of the image. The check is to prevent that a user can start a container from an image that has previously been decrypted by another user on the same system and therefore a decrypted version of the image layers may be already available in the cache locally.\n\nThe failure occurs when an image with a ManifestList is used and the architecture of the local host is not the first one in the ManifestList. In the version prior to the fix, only the first architecture in the list was tested, which may not have its layers available locally (were not pulled) since it cannot be run on the host architecture. Therefore, the verdict on unavailable layers was that the image could be run anticipating that image run failure would occur later due to the layers not being available. However, this verdict to allow the image to run lead to other architectures in the ManifestList be able to run an image without providing keys if that image had previously been decrypted. The fixed version now skips over irrelevant architectures and tests the Manifest of the local architecture, if available.\n\nKnown projects that use the `CheckAuthorization()` of imgcrypt is for example the ctr-enc client tool provided by imgcrypt. In this implementation, the call to `CheckAuthorization()` is used on the client side and could therefore also be easily circumvented by a modified client tool not calling this function.\n\nIn relation to the vulnerability in ctr-enc, affected environments would have to allow different users to invoke ctr-enc indirectly using some sort of management stack that gives user indirect access to ctr-enc.\n\nThe patch has been applied to imgcrypt v1.1.4. Workarounds may include usage of different namespaces for each remote user.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/containerd/imgcrypt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/containerd/imgcrypt/security/advisories/GHSA-8v99-48m9-c8pm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24778"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containerd/imgcrypt/issues/69"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containerd/imgcrypt/commit/6fdd9818a4d8142107b7ecd767d839c9707700d9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/containerd/imgcrypt"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/containerd/imgcrypt/releases/tag/v1.1.4"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4SJUNSC7YZLA745EMKWK2GKEV57GE52K"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TAHAAOOA3KZJC2I5WHCR3XVBJBNWTWUE"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZFTJR5CR5EOYDVOSBZEMLBHLJRTPJPUA"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2021-0412"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-863" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-03-28T19:33:44Z",
    "nvd_published_at" : "2022-03-25T18:15:00Z"
  }
}