The vulnerability, identified as GHSA-rmxw-jxxx-4cpc, is an authentication bypass in the OpenClaw Matrix plugin's Direct Message (DM) allowlist feature. The root cause was improper and weak validation of a sender's identity. The analysis of the patch 8f3bfbd1c4fb967a2ddb5b4b9a05784920814bcf reveals several key functions involved.
The primary vulnerable function is resolveMatrixAllowListMatch in extensions/matrix/src/matrix/monitor/allowlist.ts. Before the patch, this function would check the allowlist against a list of candidates that included not only the sender's full, unique Matrix ID (MXID) but also their non-unique, user-controlled display name and the 'localpart' of their MXID (the part before the colon). This allowed an attacker to impersonate an allowed user by either setting their display name to match an entry in the allowlist or by creating a user on a different homeserver with the same localpart.
The function createMatrixRoomMessageHandler in extensions/matrix/src/matrix/monitor/handler.ts is the entry point that processes incoming messages. It would fetch the sender's profile, including their display name, and pass this information to resolveMatrixAllowListMatch, thereby triggering the vulnerable check.
Additionally, the resolveMatrixTargets function in extensions/matrix/src/resolve-targets.ts contributed to the issue at configuration time. It would resolve display names to MXIDs for the allowlist, but if a name was ambiguous (matched multiple users), it would insecurely pick the first match. This could lead to an administrator unintentionally creating an insecure allowlist.
The patch rectifies these issues by removing the display name and localpart from the list of candidates in resolveMatrixAllowListMatch, ensuring that checks are only performed against the full, verified MXID. It also hardens resolveMatrixTargets to only resolve names that have a unique and exact match.