CVE-2022-39252: Matrix sdk crypto Matrix-sdk-crypto Contains Potential Impersonation Vulnerability

MODERATE
Advisory Identifier: GHSA-vp68-2wrm-69qm
CVSS 6.5
CWE-287
Published
Advisory Summary

CVE-2022-39252 is a MODERATE (CVSS 6.5) matrix-sdk-crypto contains potential impersonation vulnerability (CWE-287: Improper Authentication) affecting Matrix sdk crypto libraries in the crates.io ecosystem. The issue involves matrix-sdk-crypto contains potential impersonation via room key forward responses. Remediation is available by upgrading affected packages to version 0.6.0.

CVE-2022-39252 at a Glance

CVE Identifier CVE-2022-39252
GHSA Identifier GHSA-vp68-2wrm-69qm
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-287: Improper Authentication
Affected Product Matrix sdk crypto
Package Ecosystem crates.io
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:N/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 None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2022-39252

To remediate this vulnerability, upgrade all affected Matrix sdk crypto dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

matrix-sdk-crypto fixed: 0.6.0
Upgrade matrix-sdk-crypto to 0.6.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 matrix-sdk-crypto

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-39252, inspect your project dependencies for Matrix sdk crypto:

inspect dependencies for matrix-sdk-crypto

Analyze the terminal output to locate any version of Matrix sdk crypto in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.6.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-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Matrix sdk crypto, 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 When matrix-rust-sdk before 0.6 requests a room key from our devices, it correctly accepts key forwards only if they are a response to a previous request. However, it doesn't check that the device that responded matches the device the key was requested from. This allows a malicious homeserver to insert room keys of questionable validity into the key store in some situations, potentially assisting in an impersonation attack. Note that even if key injection succeeds in this way, all forwarded keys have the `imported` flag set, which is used as an indicator that such keys have lesser authentication properties (and should be marked as such in clients, e.g. with a grey shield besides the message). ### For more information If you have any questions or comments about this advisory, e-mail us at [security@matrix.org](mailto:security@matrix.org).

CVE-2022-39252 Affected Matrix sdk crypto Versions

1 component(s)
Fixed Versions:
0.6.0
Product / Package Ecosystem Affected Versions Fixed Version
matrix-sdk-crypto
crates.io
< 0.6.0
0.6.0

References

Frequently Asked Questions

What is CVE-2022-39252?
CVE-2022-39252 is a security vulnerability in Matrix sdk crypto involving matrix-sdk-crypto contains potential impersonation via room key forward responses under CWE-287: Improper Authentication.
Which Matrix sdk crypto versions are affected?
Affected versions include releases prior to 0.6.0 across affected packages: matrix-sdk-crypto.
What version fixes CVE-2022-39252?
Upgrading to 0.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is matrix-sdk-crypto affected?
Yes, matrix-sdk-crypto is affected in releases prior to 0.6.0. Upgrade your dependency to 0.6.0 or later.
What is the CVSS score of CVE-2022-39252?
CVE-2022-39252 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:N/I:H/A:N.
What CWE is associated with CVE-2022-39252?
CVE-2022-39252 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check crates.io dependencies for CVE-2022-39252?
Run the dependency tree command: 'inspect dependencies for matrix-sdk-crypto'. 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-vp68-2wrm-69qm",
  "modified" : "2022-09-30T22:51:57Z",
  "published" : "2022-09-30T22:51:57Z",
  "aliases" : [ "CVE-2022-39252" ],
  "summary" : "matrix-sdk-crypto contains potential impersonation via room key forward responses",
  "details" : "### Impact\n\nWhen matrix-rust-sdk before 0.6 requests a room key from our devices, it correctly accepts key forwards only if they are a response to a previous request. However, it doesn't check that the device that responded matches the device the key was requested from.\n\nThis allows a malicious homeserver to insert room keys of questionable validity into the key store in some situations, potentially assisting in an impersonation attack. Note that even if key injection succeeds in this way, all forwarded keys have the `imported` flag set, which is used as an indicator that such keys have lesser authentication properties (and should be marked as such in clients, e.g. with a grey shield besides the message).\n\n### For more information\nIf you have any questions or comments about this advisory, e-mail us at [security@matrix.org](mailto:security@matrix.org).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "matrix-sdk-crypto"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/security/advisories/GHSA-vp68-2wrm-69qm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39252"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/commit/093fb5d0aa21c0b5eaea6ec96b477f1075271cbb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/commit/41449d2cc360e347f5d4e1c154ec1e3185f11acd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/releases/tag/matrix-sdk-0.6.0"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2022-0085.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-30T22:51:57Z",
    "nvd_published_at" : "2022-09-29T15:15:00Z"
  }
}