You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Craft CMS Vulnerable to SQL Injection in Element Indexes via `criteria[orderBy]`
High severity
GitHub Reviewed
Published
Feb 9, 2026
in
craftcms/cms
•
Updated Feb 9, 2026
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
Log in to the control panel
Navigate to any element index (e.g., Users/admin/users, Entries, Assets, etc.)
Intercept the POST request to /index.php?p=admin/actions/element-indexes/get-elements
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
Learn more on MITRE.
Summary
The
element-indexes/get-elementsendpoint is vulnerable to SQL Injection via thecriteria[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 BYclause by omittingviewState[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
Steps to reproduce
/admin/users, Entries, Assets, etc.)POSTrequest to/index.php?p=admin/actions/element-indexes/get-elements{"context":"index","elementType":"craft\\elements\\User","source":"*","baseCriteria":{"siteId":1},"criteria":{"limit":100,"orderBy": "(elements.id) DESC, (SELECT SLEEP(5)) --"},"viewState":{"static":false}}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:
Root Cause
The
orderByparameter is not validated or sanitized. Wrapping the payload in parentheses (e.g.,(elements.id)) bypasses internal quoting mechanisms.References