CVE-2022-39254: Matrix nio When Matrix-nio Receives Forwarded Room Vulnerability
HIGHCVE-2022-39254 is a HIGH (CVSS 8.6) when matrix-nio receives forwarded room vulnerability (CWE-322: Key Exchange without Entity Authentication) affecting Matrix nio libraries in the PyPI ecosystem. The issue involves when matrix-nio receives forwarded room keys, the receiver doesn't check if it requested the key from the forwarder. Remediation is available by upgrading affected packages to version 0.20.
CVE-2022-39254 at a Glance
Security Impact
CVSS: 8.6
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N).
How to Fix CVE-2022-39254
To remediate this vulnerability, upgrade all affected Matrix nio dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install matrix-nio>=0.20
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show matrix-nio
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2022-39254, inspect your installed packages using pip:
pip show matrix-nio
Analyze the terminal output to locate any version of Matrix nio in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.20), your application is affected.
Note: The pip show matrix-nio command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-322: Key Exchange without Entity Authentication, where the product performs a key exchange with an actor without verifying the identity of that actor. In Matrix nio, 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
CVE-2022-39254 Affected Matrix nio Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
matrix-nio
|
PyPI |
< 0.20
|
0.20
|
References
Frequently Asked Questions
What is CVE-2022-39254?
Which Matrix nio versions are affected?
What version fixes CVE-2022-39254?
Is matrix-nio affected?
What is the CVSS score of CVE-2022-39254?
What CWE is associated with CVE-2022-39254?
How can I check PyPI dependencies for CVE-2022-39254?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w4pr-4vjg-hffh",
"modified" : "2022-09-30T22:56:17Z",
"published" : "2022-09-30T22:56:17Z",
"aliases" : [ "CVE-2022-39254" ],
"summary" : "When matrix-nio receives forwarded room keys, the receiver doesn't check if it requested the key from the forwarder",
"details" : "When matrix-nio before 0.20 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.\n\n### For more information\nIf you have any questions or comments about this advisory, e-mail us at [poljar@termina.org.uk](mailto:poljar@termina.org.uk).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "matrix-nio"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.20"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/poljar/matrix-nio/security/advisories/GHSA-w4pr-4vjg-hffh"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39254"
}, {
"type" : "WEB",
"url" : "https://github.com/poljar/matrix-nio/commit/b1cbf234a831daa160673defd596e6450e9c29f0"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/poljar/matrix-nio"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-287", "CWE-322" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-09-30T22:56:17Z",
"nvd_published_at" : "2022-09-29T15:15:00Z"
}
}