SurrealDB versions before 2.0.5, 2.1.x before 2.1.5, and 2.2.x before 2.2.2 contain a vulnerability that allows authenticated users with OWNER or EDITOR permissions to define custom database functions using nested FOR loops. This can lead to excessive CPU consumption that is not stopped by configured timeouts, causing the server to become unresponsive until manually restarted.