CVE-2022-21646: Github.com/authzed/spicedb Lookup Operations Do Not Take Vulnerability

HIGH
Advisory Identifier: GHSA-7p8f-8hjm-wm92
CVSS 8.1
CWE-20 CWE-155
Published
Advisory Summary

CVE-2022-21646 is a HIGH (CVSS 8.1) lookup operations do not take vulnerability (CWE-20: Improper Input Validation) affecting Github.com/authzed/spicedb libraries in the Go ecosystem. The issue involves lookup operations do not take into account wildcards in spicedb. Remediation is available by upgrading affected packages to version 1.4.0.

CVE-2022-21646 at a Glance

CVE Identifier CVE-2022-21646
GHSA Identifier GHSA-7p8f-8hjm-wm92
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-20: Improper Input Validation
Affected Product Github.com/authzed/spicedb
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

How to Fix CVE-2022-21646

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

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-21646, inspect your project dependencies for Github.com/authzed/spicedb:

inspect dependencies for github.com/authzed/spicedb

Analyze the terminal output to locate any version of Github.com/authzed/spicedb in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.0), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Github.com/authzed/spicedb, 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 Any user making use of a wildcard relationship under the right hand branch of an `exclusion` or within an `intersection` operation will see `Lookup`/`LookupResources` return a resource as "accessible" if it is *not* accessible by virtue of the inclusion of the wildcard in the intersection or the right side of the exclusion. For example, given schema: ```zed definition user {} definition resource { relation viewer: user relation banned: user | user:* permission view = viewer - banned } ``` If `user:*` is placed into the `banned` relation for a particular resource, `view` should return false for *all* resources. in `v1.3.0`, the wildcard is ignored entirely in lookup's dispatch, resulting in the `banned` wildcard being ignored in the exclusion. ### Workarounds Don't make use of wildcards on the right side of intersections or within exclusions. ### References https://github.com/authzed/spicedb/issues/358 ### For more information If you have any questions or comments about this advisory: * Open an issue in [SpiceDB](https://github.com/authzed/spicedb) * Ask a question in the [SpiceDB Discord](https://authzed.com/discord)

CVE-2022-21646 Affected Github.com/authzed/spicedb Versions

1 component(s)
Fixed Versions:
1.4.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/authzed/spicedb
Go
≥ 1.3.0
< 1.4.0
All 1 versions
1.3.0
1.4.0

References

Frequently Asked Questions

What is CVE-2022-21646?
CVE-2022-21646 is a security vulnerability in Github.com/authzed/spicedb involving Lookup operations do not take into account wildcards in SpiceDB under CWE-20: Improper Input Validation.
Which Github.com/authzed/spicedb versions are affected?
Affected versions include releases prior to 1.4.0 across affected packages: github.com/authzed/spicedb.
What version fixes CVE-2022-21646?
Upgrading to 1.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/authzed/spicedb affected?
Yes, github.com/authzed/spicedb is affected in releases prior to 1.4.0. Upgrade your dependency to 1.4.0 or later.
What is the CVSS score of CVE-2022-21646?
CVE-2022-21646 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2022-21646?
CVE-2022-21646 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Go dependencies for CVE-2022-21646?
Run the dependency tree command: 'inspect dependencies for github.com/authzed/spicedb'. 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-7p8f-8hjm-wm92",
  "modified" : "2022-01-13T15:02:31Z",
  "published" : "2022-01-13T15:05:41Z",
  "aliases" : [ "CVE-2022-21646" ],
  "summary" : "Lookup operations do not take into account wildcards in SpiceDB",
  "details" : "### Impact\nAny user making use of a wildcard relationship under the right hand branch of an `exclusion` or within an `intersection` operation will see `Lookup`/`LookupResources` return a resource as \"accessible\" if it is *not* accessible by virtue of the inclusion of the wildcard in the intersection or the right side of the exclusion.\n\nFor example, given schema:\n\n```zed\ndefinition user {}\n\ndefinition resource {\n   relation viewer: user\n   relation banned: user | user:*\n   permission view = viewer - banned\n}\n```\n\nIf `user:*` is placed into the `banned` relation for a particular resource, `view` should return false for *all* resources. in `v1.3.0`, the wildcard is ignored entirely in lookup's dispatch, resulting in the `banned` wildcard being ignored in the exclusion.\n\n### Workarounds\nDon't make use of wildcards on the right side of intersections or within exclusions. \n\n### References\nhttps://github.com/authzed/spicedb/issues/358\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [SpiceDB](https://github.com/authzed/spicedb)\n* Ask a question in the [SpiceDB Discord](https://authzed.com/discord)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/authzed/spicedb"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.3.0"
      }, {
        "fixed" : "1.4.0"
      } ]
    } ],
    "versions" : [ "1.3.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/authzed/spicedb/security/advisories/GHSA-7p8f-8hjm-wm92"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21646"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/authzed/spicedb/issues/358"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/authzed/spicedb/commit/15bba2e2d2a4bda336a37a7fe8ef8a35028cd970"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/authzed/spicedb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/authzed/spicedb/releases/tag/v1.4.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-155", "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-11T21:06:45Z",
    "nvd_published_at" : "2022-01-11T22:15:00Z"
  }
}