CVE-2022-39250: CWE-322: Key Exchange without Entity Authentication in matrix-org matrix-js-sdk
Matrix JavaScript SDK is the Matrix Client-Server software development kit (SDK) for JavaScript. Prior to version 19.7.0, an attacker cooperating with a malicious homeserver could interfere with the verification flow between two users, injecting its own cross-signing user identity in place of one of the users’ identities. This would lead to the other device trusting/verifying the user identity under the control of the homeserver instead of the intended one. The vulnerability is a bug in the matrix-js-sdk, caused by checking and signing user identities and devices in two separate steps, and inadequately fixing the keys to be signed between those steps. Even though the attack is partly made possible due to the design decision of treating cross-signing user identities as Matrix devices on the server side (with their device ID set to the public part of the user identity key), no other examined implementations were vulnerable. Starting with version 19.7.0, the matrix-js-sdk has been modified to double check that the key signed is the one that was verified instead of just referencing the key by ID. An additional check has been made to report an error when one of the device ID matches a cross-signing key. As this attack requires coordination between a malicious homeserver and an attacker, those who trust their homeservers do not need a particular workaround.
AI Analysis
Technical Summary
CVE-2022-39250 is a vulnerability in the matrix-org matrix-js-sdk, a JavaScript software development kit used for Matrix Client-Server communication. The flaw exists in versions prior to 19.7.0 and relates to the key exchange process during user identity verification. Specifically, the vulnerability arises because the SDK performs the verification and signing of user identities and devices in two separate steps without adequately binding the keys being signed between these steps. This design flaw allows an attacker, in cooperation with a malicious homeserver, to interfere with the verification flow between two users. The attacker can inject a cross-signing user identity under their control in place of one of the legitimate users’ identities. Consequently, the other user’s device may trust and verify the attacker-controlled identity instead of the intended one, undermining the integrity of the authentication process. The root cause is partly due to the design decision to treat cross-signing user identities as Matrix devices on the server side, with device IDs set to the public part of the user identity key. Notably, other Matrix SDK implementations were not found vulnerable to this issue. The vulnerability does not require user interaction but does require a malicious or compromised homeserver cooperating with the attacker. Starting with version 19.7.0, the matrix-js-sdk mitigates this issue by double-checking that the key signed matches the key that was verified, rather than referencing the key by ID alone. Additionally, it reports errors if a device ID matches a cross-signing key, preventing the injection attack. There are no known exploits in the wild, and the severity is classified as medium. This vulnerability primarily impacts the confidentiality and integrity of user identity verification within the Matrix communication ecosystem, potentially enabling man-in-the-middle style attacks or impersonation if the homeserver is compromised or malicious.
Potential Impact
For European organizations using Matrix-based communication platforms that rely on the matrix-js-sdk versions prior to 19.7.0, this vulnerability could lead to unauthorized impersonation of users within internal or external communications. This undermines trust in end-to-end encryption and identity verification, potentially exposing sensitive information or enabling fraudulent communications. The impact is particularly significant for organizations that rely on Matrix for secure collaboration, such as government agencies, financial institutions, and critical infrastructure operators. Since exploitation requires a malicious or compromised homeserver, organizations that operate their own homeservers or use trusted providers are at lower risk. However, those using third-party or less trusted homeservers could be vulnerable to targeted attacks. The vulnerability could facilitate man-in-the-middle attacks, allowing attackers to intercept or manipulate communications without detection. This compromises confidentiality and integrity but does not directly affect availability. The scope of affected systems is limited to clients using the vulnerable matrix-js-sdk versions, which are common in web and desktop Matrix clients. Given the medium severity and the requirement for a malicious homeserver, the overall risk is moderate but non-negligible for sensitive European organizations.
Mitigation Recommendations
1. Upgrade all instances of matrix-js-sdk to version 19.7.0 or later to ensure the vulnerability is patched. 2. For organizations operating their own homeservers, implement strict security controls to prevent compromise or malicious behavior, including regular audits, hardened configurations, and monitoring for anomalous activities. 3. Avoid using untrusted or third-party homeservers, especially for sensitive communications, to reduce the risk of collusion with attackers. 4. Implement additional application-layer verification mechanisms where feasible, such as out-of-band verification of user identities, to detect potential impersonation. 5. Educate users and administrators about the importance of verifying homeserver trustworthiness and encourage the use of homeservers with strong security postures. 6. Monitor for updates and advisories from matrix-org and related communities to stay informed about any emerging exploits or additional mitigations. 7. Consider deploying network-level protections such as TLS interception detection and anomaly detection to identify suspicious traffic patterns that may indicate exploitation attempts. These steps go beyond generic patching by emphasizing homeserver trust management and layered verification to mitigate the unique threat model posed by this vulnerability.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Norway, Denmark
CVE-2022-39250: CWE-322: Key Exchange without Entity Authentication in matrix-org matrix-js-sdk
Description
Matrix JavaScript SDK is the Matrix Client-Server software development kit (SDK) for JavaScript. Prior to version 19.7.0, an attacker cooperating with a malicious homeserver could interfere with the verification flow between two users, injecting its own cross-signing user identity in place of one of the users’ identities. This would lead to the other device trusting/verifying the user identity under the control of the homeserver instead of the intended one. The vulnerability is a bug in the matrix-js-sdk, caused by checking and signing user identities and devices in two separate steps, and inadequately fixing the keys to be signed between those steps. Even though the attack is partly made possible due to the design decision of treating cross-signing user identities as Matrix devices on the server side (with their device ID set to the public part of the user identity key), no other examined implementations were vulnerable. Starting with version 19.7.0, the matrix-js-sdk has been modified to double check that the key signed is the one that was verified instead of just referencing the key by ID. An additional check has been made to report an error when one of the device ID matches a cross-signing key. As this attack requires coordination between a malicious homeserver and an attacker, those who trust their homeservers do not need a particular workaround.
AI-Powered Analysis
Technical Analysis
CVE-2022-39250 is a vulnerability in the matrix-org matrix-js-sdk, a JavaScript software development kit used for Matrix Client-Server communication. The flaw exists in versions prior to 19.7.0 and relates to the key exchange process during user identity verification. Specifically, the vulnerability arises because the SDK performs the verification and signing of user identities and devices in two separate steps without adequately binding the keys being signed between these steps. This design flaw allows an attacker, in cooperation with a malicious homeserver, to interfere with the verification flow between two users. The attacker can inject a cross-signing user identity under their control in place of one of the legitimate users’ identities. Consequently, the other user’s device may trust and verify the attacker-controlled identity instead of the intended one, undermining the integrity of the authentication process. The root cause is partly due to the design decision to treat cross-signing user identities as Matrix devices on the server side, with device IDs set to the public part of the user identity key. Notably, other Matrix SDK implementations were not found vulnerable to this issue. The vulnerability does not require user interaction but does require a malicious or compromised homeserver cooperating with the attacker. Starting with version 19.7.0, the matrix-js-sdk mitigates this issue by double-checking that the key signed matches the key that was verified, rather than referencing the key by ID alone. Additionally, it reports errors if a device ID matches a cross-signing key, preventing the injection attack. There are no known exploits in the wild, and the severity is classified as medium. This vulnerability primarily impacts the confidentiality and integrity of user identity verification within the Matrix communication ecosystem, potentially enabling man-in-the-middle style attacks or impersonation if the homeserver is compromised or malicious.
Potential Impact
For European organizations using Matrix-based communication platforms that rely on the matrix-js-sdk versions prior to 19.7.0, this vulnerability could lead to unauthorized impersonation of users within internal or external communications. This undermines trust in end-to-end encryption and identity verification, potentially exposing sensitive information or enabling fraudulent communications. The impact is particularly significant for organizations that rely on Matrix for secure collaboration, such as government agencies, financial institutions, and critical infrastructure operators. Since exploitation requires a malicious or compromised homeserver, organizations that operate their own homeservers or use trusted providers are at lower risk. However, those using third-party or less trusted homeservers could be vulnerable to targeted attacks. The vulnerability could facilitate man-in-the-middle attacks, allowing attackers to intercept or manipulate communications without detection. This compromises confidentiality and integrity but does not directly affect availability. The scope of affected systems is limited to clients using the vulnerable matrix-js-sdk versions, which are common in web and desktop Matrix clients. Given the medium severity and the requirement for a malicious homeserver, the overall risk is moderate but non-negligible for sensitive European organizations.
Mitigation Recommendations
1. Upgrade all instances of matrix-js-sdk to version 19.7.0 or later to ensure the vulnerability is patched. 2. For organizations operating their own homeservers, implement strict security controls to prevent compromise or malicious behavior, including regular audits, hardened configurations, and monitoring for anomalous activities. 3. Avoid using untrusted or third-party homeservers, especially for sensitive communications, to reduce the risk of collusion with attackers. 4. Implement additional application-layer verification mechanisms where feasible, such as out-of-band verification of user identities, to detect potential impersonation. 5. Educate users and administrators about the importance of verifying homeserver trustworthiness and encourage the use of homeservers with strong security postures. 6. Monitor for updates and advisories from matrix-org and related communities to stay informed about any emerging exploits or additional mitigations. 7. Consider deploying network-level protections such as TLS interception detection and anomaly detection to identify suspicious traffic patterns that may indicate exploitation attempts. These steps go beyond generic patching by emphasizing homeserver trust management and layered verification to mitigate the unique threat model posed by this vulnerability.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-09-02T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9845c4522896dcbf463a
Added to database: 5/21/2025, 9:09:25 AM
Last enriched: 6/22/2025, 4:20:49 PM
Last updated: 8/8/2025, 9:41:48 AM
Views: 15
Related Threats
CVE-2025-9022: SQL Injection in SourceCodester Online Bank Management System
MediumCVE-2025-9021: SQL Injection in SourceCodester Online Bank Management System
MediumCVE-2025-9020: Use After Free in PX4 PX4-Autopilot
LowCVE-2025-8604: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in wptb WP Table Builder – WordPress Table Plugin
MediumCVE-2025-9016: Uncontrolled Search Path in Mechrevo Control Center GX V2
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.