CVE-2024-40648: matrix-sdk-crypto's `UserIdentity :is_verified` Not Checking Verification Status Vulnerability

MODERATE
Advisory Identifier: GHSA-4qg4-cvh2-crgg
CVSS 4.8
CWE-287 CWE-863
Published
Advisory Summary

CVE-2024-40648 is a MODERATE (CVSS 4.8) :is_verified` not checking verification status vulnerability (CWE-287: Improper Authentication) affecting matrix-sdk-crypto's `UserIdentity libraries in the crates.io ecosystem. The issue involves :is_verified` not checking verification status of own user identity while performing the check. Remediation is available by upgrading affected packages to version 0.7.2.

CVE-2024-40648 at a Glance

CVE Identifier CVE-2024-40648
GHSA Identifier GHSA-4qg4-cvh2-crgg
Severity MODERATE
CVSS v3.1 Base Score 4.8
CWE Classification CWE-287: Improper Authentication
Affected Product matrix-sdk-crypto's `UserIdentity
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 4.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2024-40648

To remediate this vulnerability, upgrade all affected matrix-sdk-crypto's `UserIdentity 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.7.2
Upgrade matrix-sdk-crypto to 0.7.2
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-2024-40648, inspect your project dependencies for matrix-sdk-crypto's `UserIdentity:

inspect dependencies for matrix-sdk-crypto

Analyze the terminal output to locate any version of matrix-sdk-crypto's `UserIdentity in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.2), 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's `UserIdentity, 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

The `UserIdentity::is_verified()` method in the matrix-sdk-crypto crate before version 0.7.2 doesn't take into account the verification status of the user's own identity while performing the check and may as a result return a value contrary to what is implied by its name and documentation. ### Impact If the method is used to decide whether to perform sensitive operations towards a user identity, a malicious homeserver could manipulate the outcome in order to make the identity appear trusted. This is not a typical usage of the method, which lowers the impact. The method itself is not used inside the `matrix-sdk-crypto` crate. ### Patches The 0.7.2 release of the `matrix-sdk-crypto` crate includes a fix. ### Workarounds None.

CVE-2024-40648 Affected matrix-sdk-crypto's `UserIdentity Versions

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

References

Frequently Asked Questions

What is CVE-2024-40648?
CVE-2024-40648 is a security vulnerability in matrix-sdk-crypto's `UserIdentity involving :is_verified` not checking verification status of own user identity while performing the check under CWE-287: Improper Authentication.
Which matrix-sdk-crypto's `UserIdentity versions are affected?
Affected versions include releases prior to 0.7.2 across affected packages: matrix-sdk-crypto.
What version fixes CVE-2024-40648?
Upgrading to 0.7.2 (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.7.2. Upgrade your dependency to 0.7.2 or later.
What is the CVSS score of CVE-2024-40648?
CVE-2024-40648 has a CVSS v3.1 base score of 4.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2024-40648?
CVE-2024-40648 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-2024-40648?
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-4qg4-cvh2-crgg",
  "modified" : "2024-07-19T15:27:44Z",
  "published" : "2024-07-18T15:28:07Z",
  "aliases" : [ "CVE-2024-40648" ],
  "summary" : "matrix-sdk-crypto's `UserIdentity::is_verified` not checking verification status of own user identity while performing the check",
  "details" : "The `UserIdentity::is_verified()` method in the matrix-sdk-crypto crate before version 0.7.2 doesn't take into account the verification status of the user's own identity while performing the check and may as a result return a value contrary to what is implied by its name and documentation.\n\n### Impact\n\nIf the method is used to decide whether to perform sensitive operations towards a user identity, a malicious homeserver could manipulate the outcome in order to make the identity appear trusted. This is not a typical usage of the method, which lowers the impact. The method itself is not used inside the `matrix-sdk-crypto` crate.\n\n### Patches\n\nThe 0.7.2 release of the `matrix-sdk-crypto` crate includes a fix.\n\n### Workarounds\n\nNone.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "matrix-sdk-crypto"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.7.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/security/advisories/GHSA-4qg4-cvh2-crgg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-40648"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/commit/76a7052149bb8f722df12da915b3a06d19a6695a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/releases/tag/0.7.2-crypto"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2024-0356.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287", "CWE-863" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-18T15:28:07Z",
    "nvd_published_at" : "2024-07-18T17:15:05Z"
  }
}