CVE-2022-23542: Github.com/openfga/openfga OpenFGA Authorization Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-m3q4-7qmj-657m
CWE-285
Published
Advisory Summary

CVE-2022-23542 is a HIGH openfga authorization bypass vulnerability (CWE-285: Improper Authorization) affecting Github.com/openfga/openfga libraries in the Go ecosystem. The issue involves openfga authorization bypass. Remediation is available by upgrading affected packages to version 0.3.1.

CVE-2022-23542 at a Glance

CVE Identifier CVE-2022-23542
GHSA Identifier GHSA-m3q4-7qmj-657m
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-285: Improper Authorization
Affected Product Github.com/openfga/openfga
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2022-23542

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

How to Check if You Are Affected

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

inspect dependencies for github.com/openfga/openfga

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

### Overview During our internal security assessment, it was discovered that OpenFGA versions v0.3.0 is vulnerable to authorization bypass under certain conditions. ### Am I Affected? You are affected by this vulnerability if **all** of the following applies: 1. You are using OpenFGA v0.3.0 2. You created a model using modeling language v1.1 that applies a type restriction to an object e.g. `define viewer: [user]` 3. You created tuples based on the aforementioned model, e.g. `document:1#viewer@user:jon` 4. You updated the previous model by adding a new type and replacing the previous restriction with the newly added type e.g. `define viewer: [employee]` 5. You use the tuples created against the first model (step 3) and issue checks against the updated model e.g. `user=user:jon, relation=viewer, object:document:1` ### How to fix that? Upgrade to version v0.3.1 ### Backward Compatibility This update is backward compatible.

CVE-2022-23542 Affected Github.com/openfga/openfga Versions

1 component(s)
Fixed Versions:
0.3.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/openfga/openfga
Go
≥ 0.3.0
< 0.3.1
All 1 versions
0.3.0
0.3.1

References

Frequently Asked Questions

What is CVE-2022-23542?
CVE-2022-23542 is a security vulnerability in Github.com/openfga/openfga involving OpenFGA Authorization Bypass under CWE-285: Improper Authorization.
Which Github.com/openfga/openfga versions are affected?
Affected versions include releases prior to 0.3.1 across affected packages: github.com/openfga/openfga.
What version fixes CVE-2022-23542?
Upgrading to 0.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/openfga/openfga affected?
Yes, github.com/openfga/openfga is affected in releases prior to 0.3.1. Upgrade your dependency to 0.3.1 or later.
What CWE is associated with CVE-2022-23542?
CVE-2022-23542 is classified under CWE-285: Improper Authorization (The product does not perform or incorrectly performs an authorization check when an actor attempts to access a resource or perform an action.).
How can I check Go dependencies for CVE-2022-23542?
Run the dependency tree command: 'inspect dependencies for github.com/openfga/openfga'. 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-m3q4-7qmj-657m",
  "modified" : "2022-12-20T19:33:27Z",
  "published" : "2022-12-20T19:33:27Z",
  "aliases" : [ "CVE-2022-23542" ],
  "summary" : "OpenFGA Authorization Bypass",
  "details" : "### Overview\nDuring our internal security assessment, it was discovered that OpenFGA versions v0.3.0 is vulnerable to authorization bypass under certain conditions.\n\n### Am I Affected?\nYou are affected by this vulnerability if **all** of the following applies:\n\n1.  You are using OpenFGA v0.3.0\n2. You created a model using modeling language v1.1 that applies a type restriction to an object e.g. `define viewer: [user]`\n3. You created tuples based on the aforementioned model, e.g. `document:1#viewer@user:jon`\n4. You updated the previous model by adding a new type and replacing the previous restriction with the newly added type e.g. `define viewer: [employee]`\n5. You use the tuples created against the first model (step 3) and issue checks against the updated model e.g. `user=user:jon, relation=viewer, object:document:1`\n\n### How to fix that?\nUpgrade to version v0.3.1\n\n### Backward Compatibility\nThis update is backward compatible.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/openfga/openfga"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.3.0"
      }, {
        "fixed" : "0.3.1"
      } ]
    } ],
    "versions" : [ "0.3.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/openfga/openfga/security/advisories/GHSA-m3q4-7qmj-657m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23542"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openfga/openfga/pull/422"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/openfga/openfga"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openfga/openfga/releases/tag/v0.3.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-285" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-12-20T19:33:27Z",
    "nvd_published_at" : "2022-12-20T21:15:00Z"
  }
}