The vulnerability allows a user with select permissions to cause a Denial of Service (DoS) on a table, preventing any CREATE, UPDATE, or DELETE operations. This is achieved by registering a LIVE query with a malicious WHERE clause that is designed to always fail during evaluation.
The root cause of the vulnerability was in the error handling within the LIVE query notification process. When a write operation triggered a notification for the malicious LIVE query, the surrealdb::core::doc::lives::Document::lq_check function would evaluate the WHERE clause. The evaluation would fail as intended by the attacker, and lq_check would return an error.
The critical flaw was in the calling function, surrealdb::core::doc::lives::Document::notify. Before the patch, this function would propagate the error up the call stack. This error propagation was not contained within the LIVE query processing logic and would instead cause the entire parent database transaction for the write operation to be aborted and rolled back.
The fix, implemented in commit b29e03f0714d1c4ec091fc6f27f1edbe243b8aec, was to change the behavior of the notify function. It now catches the error from lq_check, sends an Action::Error notification to the subscriber of the LIVE query, and then returns Ok(()). This decouples the LIVE query evaluation from the write transaction, allowing the write to succeed even if the LIVE query evaluation fails, thus mitigating the DoS vulnerability. A further hardening was also added to surrealdb::core::expr::statements::live::LiveStatement::analyse to reject some invalid queries at registration time.