Skip to content

Potential IDOR in Commerce carts

Moderate
angrybrad published GHSA-vff3-pqq8-4cpq Mar 9, 2026

Package

composer craftcms/commerce (Composer)

Affected versions

>= 5.0.0, < 5.6.0
>= 4.0.0, < 4.11.0

Patched versions

5.6.0
4.11.0

Description

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

  1. Referrer Header Leakage: Cart URLs shared externally expose the number
  2. Browser History: Accessible on shared/compromised devices
  3. Proxy/WAF Logs: Cart numbers logged in URL parameters
  4. Social Engineering: Support tickets, screenshots containing cart URLs
  5. Brute Force: While impractical for random targeting, feasible for targeted attacks against recently-created carts

References

Severity

Moderate

CVE ID

CVE-2026-31867

Weaknesses

Authorization Bypass Through User-Controlled Key

The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. Learn more on MITRE.

Credits