{"id":"CVE-2026-29172","aliases":["CVE-2026-29172","GHSA-j3x5-mghf-xvfw"],"related":[],"kind":"vulnerability","state":"published","title":"Craft Commerce has a SQL Injection in Commerce Purchasables Table Sorting","summary":"Craft Commerce is an ecommerce platform for Craft CMS. Prior to 4.10.2 and 5.5.3, Craft Commerce is vulnerable to SQL Injection in the purchasables table endpoint. The sort parameter is split by | and the first part (column name) is passed directly as an array key to orderBy() without whitelist validation. Yii2's query builder does NOT escape array keys, allowing an authenticated attacker to inject arbitrary SQL into the ORDER BY clause. This vulnerability is fixed in 4.10.2 and 5.5.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Craft Commerce is an ecommerce platform for Craft CMS. Prior to 4.10.2 and 5.5.3, Craft Commerce is vulnerable to SQL Injection in the purchasables table endpoint. The sort parameter is split by | and the first part (column name) is passed directly as an array key to orderBy() without whitelist validation. Yii2's query builder does NOT escape array keys, allowing an authenticated attacker to inject arbitrary SQL into the ORDER BY clause. This vulnerability is fixed in 4.10.2 and 5.5.3.","source":"cvelist"},{"lang":"en","text":"## Summary\nCraft Commerce is vulnerable to **SQL Injection** in the purchasables table endpoint. The `sort` parameter is split by `|` and the first part (column name) is passed directly as an array key to `orderBy()` without whitelist validation. Yii2's query builder does **NOT** escape array keys, allowing an authenticated attacker to inject arbitrary SQL into the `ORDER BY` clause.\n\n---\n## PoC\n### Required Permissions\n- General\n\t- Access the control panel\n\t- Access Craft Commerce\n- Craft Commerce\n\t- Manage orders\n\t- Edit orders\n\n### Steps to reproduce\n1. Log in to the control panel\n2. Navigate to **Commerce** > **Orders** > Create a new order\n3. Click on \"Add a line item\" to show the purchasables table\n4. Intercept the AJAX request and modify the `sort` parameter as follows:\n```http\nGET /index.php?p=admin/actions/commerce/orders/purchasables-table&siteId=1&sort=id,(SELECT%20SLEEP(2))|asc\n```\n5. Observe the delay in the response, confirming the injection\n\nAlternatively, you can use the following `curl` (bash syntax) command (replace cookie and target domain as needed):\n```bash\ncurl --path-as-is -k -H $'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0' -H $'Accept: application/json, text/plain, */*' -b $'<Cookie>' $'http://craft.local/index.php?p=admin%2Factions%2Fcommerce%2Forders%2Fpurchasables-table&siteId=1&sort=id,(SELECT%20SLEEP(5))|asc'\n```\n\n### Impact\nWith this Blind SQLi, an attacker can:\n- **Exfiltrate data** character-by-character (same technique as [GHSA-pmgj-gmm4-jh6j](https://github.com/craftcms/commerce/security/advisories/GHSA-pmgj-gmm4-jh6j)).\n- **Modify or destroy data** (drop tables, update records, alter schema).","format":"markdown","source":"ghsa"},{"lang":"es","text":"Craft Commerce es una plataforma de comercio electrónico para Craft CMS. Antes de las versiones 4.10.2 y 5.5.3, Craft Commerce es vulnerable a inyecciones SQL en el punto final de la tabla de productos adquiribles. El parámetro de ordenación se divide mediante | y la primera parte (nombre de columna) se pasa directamente como clave de matriz a orderBy() sin validación de lista blanca. El generador de consultas de Yii2 NO escapa las claves de matriz, lo que permite a un atacante autenticado inyectar SQL arbitrario en la cláusula ORDER BY. Esta vulnerabilidad se ha corregido en las versiones 4.10.2 y 5.5.3.","source":"nvd"}],"published":"2026-03-10T18:23:07.000Z","modified":"2026-06-17T10:29:42.923Z","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":">= 4.0.0 < 4.10.2","status":"affected"},{"version":">= 5.0.0 < 5.5.3","status":"affected"}],"vendor":"craftcms","product":"commerce","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"4.0.0","status":"affected","fixed":"4.10.2"}],"ecosystem":"Packagist","package":"craftcms/commerce","purl":"pkg:composer/craftcms/commerce","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"5.0.0","status":"affected","fixed":"5.5.3"}],"ecosystem":"Packagist","package":"craftcms/commerce","purl":"pkg:composer/craftcms/commerce","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"4.0.0","fixed":"4.10.2"},{"status":"affected","introduced":"5.0.0","fixed":"5.5.3"}],"vendor":"craftcms","product":"craft_commerce","cpe":"cpe:2.3:a:craftcms:craft_commerce:*:*:*:*:*:craft_cms:*:*","source":"nvd"}],"references":[{"url":"https://github.com/craftcms/commerce/security/advisories/GHSA-j3x5-mghf-xvfw","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/craftcms/commerce/commit/b231b920b73db023e81e5b261b894d73e865c276","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/craftcms/commerce/commit/e4e0f4107cd895d29290523637f077fe280407b1","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-29172","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/craftcms/commerce","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-03-11T14:12:47.816Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-29172","url":"https://www.cve.org/CVERecord?id=CVE-2026-29172","licence":"CVE Terms of Use","modified":"2026-03-11T14:12:53.450Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j3x5-mghf-xvfw","url":"https://github.com/advisories/GHSA-j3x5-mghf-xvfw","licence":"CC-BY-4.0","modified":"2026-03-13T04:22:03.693Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-29172","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-29172","licence":"Public domain","modified":"2026-06-17T10:29:42.923Z"}],"updatedAt":"2026-11-25T22:59:15.650Z","epss":{"score":0.00607,"percentile":0.43194,"date":"2026-11-30T12:00:22.000Z"}}