Junglewise Threat Intelligence

CVE-2022-39250: Matrix.js SDK user impersonation in SAS verification

CVE-2022-39250 · Severity: low · CVSS 3.1 · Published 2022-09-30

Technologies: matrix-js-sdk (npm). Vendors: npm, Matrix.org.

Executive brief

matrix-js-sdk is a JavaScript library used by Matrix chat clients like Element to handle end-to-end encrypted messaging. A vulnerability in the verification process (SAS verification) allows a malicious server operator to inject their own identity during user verification, causing other users to trust the wrong party. This attack enables account takeover and impersonation of users during encrypted conversations.

Technical details

This is an authentication bypass vulnerability (CWE-287) in matrix-js-sdk's Short Authentication String (SAS) verification mechanism. The root cause is a key/device identifier confusion bug: the SDK checks and signs user identities and devices in two separate steps without adequately locking the keys between those steps. Since cross-signing user identities are represented as Matrix devices on the server side, an attacker cooperating with a malicious homeserver can substitute their own identity key. The attack requires network-level access (cooperation with the homeserver) and occurs during the SAS verification handshake. An attacker can break emoji-based verification and cause a user's client to trust a server-controlled identity instead of the intended user's identity. The vulnerability was patched in matrix-js-sdk v19.7.0 by double-checking that the key signed matches the key that was verified, and by rejecting device IDs that match cross-signing key formats.

Affected products

  • Matrix.org matrix-js-sdk < 19.7.0

Timeline

  • 2022-09-28: disclosed: Public blog post and coordinated disclosure
  • 2022-09-28: patched: Fixed in matrix-js-sdk v19.7.0
  • 2022-09-30: advisory: GHSA-5w8r-8pgj-5jmf published

References

Related threats