CVE-2024-42369: matrix-js-sdk will freeze when a user sets a room with itself as a its predecessor
Impact A malicious homeserver can craft a room or room structure such that the predecessors form a cycle. The matrix-js-sdk's getRoomUpgradeHistory function will infinitely recurse in this case, causing the code to hang. This method is public but also called by the 'leaveRoomChain()' method, so leaving a room will also trigger the bug.
Published Aug 20, 2024
Affected packages
matrix-js-sdk
- Ecosystem
- npm
- Affected
- < 34.3.1
- Fixed in
- 34.3.1
- Check
npm ls matrix-js-sdk
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
A malicious homeserver can craft a room or room structure such that the predecessors form a cycle. The matrix-js-sdk's getRoomUpgradeHistory function will infinitely recurse in this case, causing the code to hang. This method is public but also called by the 'leaveRoomChain()' method, so leaving a room will also trigger the bug.
Even if the CVSS score would be 4.1 (AV:N/AC:L/PR:L/UI:R/S:C/C:N/I:N/A:L) we classify this as High severity issue.
Patches
This was patched in matrix-js-sdk 34.3.1.
Workarounds
Sanity check rooms before passing them to the matrix-js-sdk or avoid calling either getRoomUpgradeHistory or leaveRoomChain.
References
N/A.
Credited to morguldir.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More npm vulnerabilities
All npm entriesCVE-2025-59160
matrix-js-sdk has insufficient validation when considering a room to be upgraded by another
medium6.9Sep 16, 2025CVE-2024-50336
matrix-js-sdk has insufficient MXC URI validation which allows client-side path traversal
medium5.3Nov 12, 2024CVE-2024-47080
Matrix JavaScript SDK's key history sharing could share keys to malicious devices
high8.7Oct 15, 2024
