Описание
Craft CMS Vulnerable to SQL Injection in Element Indexes via criteria[orderBy]
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 BYclause executes per row.SLEEP(1)on 10 rows = 10s delay.
PoC
Required Permissions
- Access to the Control Panel
Steps to reproduce
- Log in to the control panel
- Navigate to any element index (e.g., Users
/admin/users, Entries, Assets, etc.) - Intercept the
POSTrequest to/index.php?p=admin/actions/element-indexes/get-elements - Modify the JSON body to the following:
- Send the request
- 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):
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.
Ссылки
- https://github.com/craftcms/cms/security/advisories/GHSA-2453-mppf-46cj
- https://nvd.nist.gov/vuln/detail/CVE-2026-25495
- https://github.com/craftcms/cms/commit/96c60d775c644ff0a0276da52fe29e11d4cd38d2
- https://github.com/craftcms/cms/releases/tag/4.16.18
- https://github.com/craftcms/cms/releases/tag/5.8.22
Пакеты
craftcms/cms
>= 5.0.0-RC1, <= 5.8.21
5.8.22
craftcms/cms
>= 4.0.0-RC1, <= 4.16.17
4.16.18
Связанные уязвимости
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.