Miggo Logo

GHSA-pxw4-94j3-v9pf: SurrealDB CPU exhaustion via custom functions result in total DoS

N/A

CVSS Score

Basic Information

CVE ID
-
EPSS Score
-
Published
4/11/2025
Updated
4/11/2025
KEV Status
No
Technology
TechnologyRust

Technical Details

CVSS Vector
-
Package NameEcosystemVulnerable VersionsFirst Patched Version
surrealdbrust>= 2.2.0, < 2.2.22.2.2
surrealdbrust>= 2.1.0, < 2.1.52.1.5
surrealdbrust< 2.0.52.0.5

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability describes a CPU exhaustion issue due to nested FOR loops in custom SurrealDB functions. The primary patch location, as stated in the vulnerability description ('A patch has been introduced that adds a check in the ForEachStatement'), points directly to the process method within ForEachStatement. Analysis of commit fd286b9b3734d44f50b1bfdfdc918b210b438ae1 confirms that crates/core/src/sql/statements/foreach.rs was modified to add timeout and cooperative yielding checks within the loop of the ForEachStatement::process method. This function is therefore directly vulnerable as it contained the flawed loop execution logic. Additionally, the fnc::script::main::run function, which is responsible for executing these custom functions (scripts), was also patched in the same commit to include a general script execution timeout. This function processes the malicious input (the script) and, before its own patch, would have allowed the script to run for an extended period if the underlying ForEachStatement didn't yield. Thus, it's also considered relevant, though the root of the loop exhaustion is in ForEachStatement::process.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

Surr**l** *llows *ut**nti**t** us*rs wit* `OWN*R` or `**ITOR` p*rmissions *t t** root, **t***s* or n*m*sp*** l*v*ls to ***in* t**ir own **t***s* *un*tions usin* t** `***IN* *UN*TION` st*t*m*nt * *ustom **t***s* *un*tion *ompris*s * n*m* to**t**r wit

Reasoning

T** vuln*r**ility **s*ri**s * *PU *x**ustion issu* *u* to n*st** `*OR` loops in *ustom Surr**l** *un*tions. T** prim*ry p*t** lo**tion, *s st*t** in t** vuln*r**ility **s*ription ('* p*t** **s ***n intro*u*** t**t ***s * ****k in t** `*or****St*t*m*n