CVE-2026-31867: Craft Commerce: Potential IDOR in Commerce carts
An Insecure Direct Object Reference (IDOR) vulnerability exists in Craft Commerce’s cart functionality that allows users to hijack any shopping cart by knowing or guessing its 32-character number. This vulnerability enables the takeover of shopping sessions and potential exposure of PII. Vulnerability Details Root Cause The CartController accepts a user-supplied number parameter to load and modify shopping carts.
Published Mar 10, 2026 · Updated Mar 11, 2026
Affected packages
craftcms/commerce
- Ecosystem
- Composer (PHP)
- Affected
- >= 5.0.0, < 5.6.0
- Fixed in
- 5.6.0
- Check
composer show craftcms/commerce
craftcms/commerce
- Ecosystem
- Composer (PHP)
- Affected
- >= 4.0.0, < 4.11.0
- Fixed in
- 4.11.0
- Check
composer show craftcms/commerce
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
An Insecure Direct Object Reference (IDOR) vulnerability exists in Craft Commerce’s cart functionality that allows users to hijack any shopping cart by knowing or guessing its 32-character number. This vulnerability enables the takeover of shopping sessions and potential exposure of PII.
Vulnerability Details
Root Cause
The CartController accepts a user-supplied number parameter to load and modify shopping carts. No ownership validation is performed - the code only checks if the order exists and is incomplete, not whether the requester has authorization to access it.
// CartController.php:374-389 - actionLoadCart()
public function actionLoadCart(): ?Response
{
$number = $this->request->getParam('number');
if ($number === null) {
return $this->asFailure(Craft::t('commerce', 'A cart number must be specified.'));
}
// No ownership check - returns any cart to any requester
$cart = Order::find()->number($number)->isCompleted(false)->one();
// Cart is loaded into attacker's session without authorization
...
}// CartController.php:606-616 - _getCart()
$orderNumber = $this->request->getBodyParam('number');
if ($orderNumber) {
// Same issue - no ownership validation
$cart = Order::find()->number($orderNumber)->isCompleted(false)->one();
// Returns cart to any requester who knows the number
}---
Attack Scenario
Prerequisites
- Target Craft Commerce installation with active shopping carts
- Knowledge of a victim’s cart number (32-character hex string)
Cart Number Acquisition Vectors
- Referrer Header Leakage: Cart URLs shared externally expose the number
- Browser History: Accessible on shared/compromised devices
- Proxy/WAF Logs: Cart numbers logged in URL parameters
- Social Engineering: Support tickets, screenshots containing cart URLs
- Brute Force: While impractical for random targeting, feasible for targeted attacks against recently-created carts
---
Credited to rlarabee, RajChowdhury240.
References
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-29172
Craft Commerce is Vulnerable to SQL Injection in Commerce Purchasables Table Sorting
high8.7Mar 10, 2026
