CVE-2025-53549: Matrix sdk SQL Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-275g-g844-73jh
CWE-89
Published
Advisory Summary

CVE-2025-53549 is a MODERATE sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Matrix sdk libraries in the crates.io ecosystem. The issue involves matrix rust sdk vulnerable to sql injection through its eventcache implementation. Remediation is available by upgrading affected packages to version 0.13.0.

CVE-2025-53549 at a Glance

CVE Identifier CVE-2025-53549
GHSA Identifier GHSA-275g-g844-73jh
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Matrix sdk
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix CVE-2025-53549

To remediate this vulnerability, upgrade all affected Matrix sdk 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 fixed: 0.13.0
Upgrade matrix-sdk to 0.13.0
matrix-sdk-sqlite fixed: 0.13.0
Upgrade matrix-sdk-sqlite to 0.13.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

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-53549, inspect your project dependencies for Matrix sdk:

inspect dependencies for matrix-sdk

Analyze the terminal output to locate any version of Matrix sdk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.13.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-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Matrix sdk, 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

An SQL injection vulnerability in the `EventCache::find_event_with_relations` method of matrix-sdk 0.11 and 0.12 allows malicious room members to execute arbitrary SQL commands in Matrix clients that directly pass relation types provided by those room members into this method, when used with the default sqlite-based store backend. Exploitation is unlikely, as no known clients currently use the API in this manner. ### Workarounds Passing only trusted (or sanitised) relation types to the `filter` argument of `EventCache::find_event_with_relations()` avoids the issue. ### Patches The issue is fixed in matrix-sdk 0.13. ### References The issue was introduced in https://github.com/matrix-org/matrix-rust-sdk/pull/4849.

CVE-2025-53549 Affected Matrix sdk Versions

2 component(s)
Fixed Versions:
0.13.0
Product / Package Ecosystem Affected Versions Fixed Version
matrix-sdk
crates.io
≥ 0.11.0
< 0.13.0
0.13.0
matrix-sdk-sqlite
crates.io
≥ 0.11.0
< 0.13.0
0.13.0

References

Frequently Asked Questions

What is CVE-2025-53549?
CVE-2025-53549 is a security vulnerability in Matrix sdk involving Matrix Rust SDK vulnerable to SQL Injection through its EventCache implementation under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Matrix sdk versions are affected?
Affected versions include releases prior to 0.13.0 across affected packages: matrix-sdk, matrix-sdk-sqlite.
What version fixes CVE-2025-53549?
Upgrading to 0.13.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is matrix-sdk affected?
Yes, matrix-sdk is affected in releases prior to 0.13.0. Upgrade your dependency to 0.13.0 or later.
Is matrix-sdk-sqlite affected?
Yes, matrix-sdk-sqlite is affected in releases prior to 0.13.0. Upgrade your dependency to 0.13.0 or later.
What CWE is associated with CVE-2025-53549?
CVE-2025-53549 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check crates.io dependencies for CVE-2025-53549?
Run the dependency tree command: 'inspect dependencies for matrix-sdk'. 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-275g-g844-73jh",
  "modified" : "2025-07-11T20:45:34Z",
  "published" : "2025-07-10T17:41:16Z",
  "aliases" : [ "CVE-2025-53549" ],
  "summary" : "Matrix Rust SDK vulnerable to SQL Injection through its EventCache implementation",
  "details" : "An SQL injection vulnerability in the `EventCache::find_event_with_relations` method of matrix-sdk 0.11 and 0.12 allows malicious room members to execute arbitrary SQL commands in Matrix clients that directly pass relation types provided by those room members into this method, when used with the default sqlite-based store backend. Exploitation is unlikely, as no known clients currently use the API in this manner.\n\n### Workarounds\n\nPassing only trusted (or sanitised) relation types to the `filter` argument of `EventCache::find_event_with_relations()` avoids the issue.\n\n### Patches\n\nThe issue is fixed in matrix-sdk 0.13.\n\n### References\n\nThe issue was introduced in https://github.com/matrix-org/matrix-rust-sdk/pull/4849.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "matrix-sdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.11.0"
      }, {
        "fixed" : "0.13.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "matrix-sdk-sqlite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.11.0"
      }, {
        "fixed" : "0.13.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/security/advisories/GHSA-275g-g844-73jh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-53549"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/pull/4849"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk/commit/d0c01006e4808db5eb96ad5c496416f284d8bd3c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-rust-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2025-0043.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-10T17:41:16Z",
    "nvd_published_at" : "2025-07-10T19:15:26Z"
  }
}