The vulnerability is a denial of service in the matrix-sdk-base crate, caused by a serialization panic when processing m.room.join_rules events with non-standard values. The analysis of the provided patches, specifically commit ba1560d22349b9d9efe1cd37554550268c8fac02, reveals the exact location of the flaw.
The file crates/matrix-sdk-base/src/room/room_info.rs contains the logic for updating a room's information based on state events received during a sync. The functions BaseRoomInfo::handle_state_event (for joined rooms) and BaseRoomInfo::handle_stripped_state_event (for invited rooms) were identified as vulnerable.
Prior to the fix, both functions would unconditionally attempt to convert the RoomJoinRules event into an internal representation using .into(). However, the underlying ruma library does not support serializing unknown or custom string variants for the JoinRule enum, causing a panic when a non-standard join_rule was received from the server. This panic would crash the sync loop, preventing the client from processing any further events for all rooms, thus causing a denial of service.
The patch rectifies this by introducing a match statement to validate the join_rule against a list of known variants before conversion. If the join_rule is a custom value, it is now skipped, and a warning is logged, preventing the crash and allowing the sync to continue. An attacker could trigger this vulnerability by inviting a victim to a room that has a state event with a custom join_rule value.