CVE-2026-31858 CraftCMS's `ElementSearchController` Affected by Blind SQL Injection

High 8.7 Published Updated

Authenticated users can perform blind SQL injection in CraftCMS to extract full database contents via the ElementSearchController.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-31858?

CVE-2026-31858 is a high-severity SQL injection vulnerability in Craftcms Craft Cms, published on 11 Mar 2026. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

Craft is a content management system (CMS). The ElementSearchController::actionSearch() endpoint is missing the unset() protection that was added to ElementIndexesController in CVE-2026-25495. The exact same SQL injection vulnerability (including criteria[orderBy], the original advisory vector) works on this controller because the fix was never applied to it. Any authenticated control panel user (no admin required) can inject arbitrary SQL via criteria[where], criteria[orderBy], or other query properties, and extract the full database contents via boolean-based blind injection. Users should update to the patched 5.9.9 release to mitigate the issue.

Weakness: CWE-89

Which versions are affected by CVE-2026-31858?

2 open source packages ship an affected version, including craftcms/cms. It affects 1 product.

PackageAffectedFixed in
craftcms/cms PackagistFrom 5.0.0-RC15.9.9
craftcms/cms PackagistFrom 5.0.0-RC15.9.9

Products include Craftcms Craft Cms.

How do I fix CVE-2026-31858?

Upgrade craftcms/cms to 5.9.9 or later.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2026-31858 being exploited?

There is no known exploitation of CVE-2026-31858 in the wild and no public exploit code.

All Craftcms Craft Cms vulnerabilities

Sources

Also known as GHSA-g7j6-fmwx-7vp8.

Is CVE-2026-31858 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free