CVE-2026-31867: Craft Commerce Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-vff3-pqq8-4cpq
CWE-639
Published
Advisory Summary

CVE-2026-31867 is a MODERATE remote code execution vulnerability (CWE-639: Authorization Bypass Through User-Controlled Key) affecting Craft Commerce libraries in the Packagist ecosystem. The issue involves potential idor in commerce carts. Remediation is available by upgrading affected packages to version 5.6.0, 4.11.0.

CVE-2026-31867 at a Glance

CVE Identifier CVE-2026-31867
GHSA Identifier GHSA-vff3-pqq8-4cpq
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-639: Authorization Bypass Through User-Controlled Key
Affected Product Craft Commerce
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-31867

To remediate this vulnerability, upgrade all affected Craft Commerce dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

craftcms/commerce fixed: 5.6.0
Upgrade craftcms/commerce to 5.6.0
craftcms/commerce fixed: 4.11.0
Upgrade craftcms/commerce to 4.11.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for craftcms/commerce

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-31867, inspect your project dependencies for Craft Commerce:

inspect dependencies for craftcms/commerce

Analyze the terminal output to locate any version of Craft Commerce in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.6.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-639: Authorization Bypass Through User-Controlled Key, where 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. In Craft Commerce, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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. ```php // 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 ... } ``` ```php // 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 ---

CVE-2026-31867 Affected Craft Commerce Versions

2 component(s)
Fixed Versions:
5.6.04.11.0
Product / Package Ecosystem Affected Versions Fixed Version
craftcms/commerce
Packagist
≥ 5.0.0
< 5.6.0
5.6.0
craftcms/commerce
Packagist
≥ 4.0.0
< 4.11.0
4.11.0

References

Frequently Asked Questions

What is CVE-2026-31867?
CVE-2026-31867 is a security vulnerability in Craft Commerce involving Potential IDOR in Commerce carts under CWE-639: Authorization Bypass Through User-Controlled Key.
Which Craft Commerce versions are affected?
Affected versions include releases prior to 5.6.0, 4.11.0 across affected packages: craftcms/commerce.
What version fixes CVE-2026-31867?
Upgrading to 5.6.0, 4.11.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is craftcms/commerce affected?
Yes, craftcms/commerce is affected in releases prior to 5.6.0, 4.11.0. Upgrade your dependency to 5.6.0, 4.11.0 or later.
What CWE is associated with CVE-2026-31867?
CVE-2026-31867 is classified under CWE-639: 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.).
How can I check Packagist dependencies for CVE-2026-31867?
Run the dependency tree command: 'inspect dependencies for craftcms/commerce'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vff3-pqq8-4cpq",
  "modified" : "2026-03-11T20:57:29Z",
  "published" : "2026-03-10T18:24:49Z",
  "aliases" : [ "CVE-2026-31867" ],
  "summary" : "Craft Commerce: Potential IDOR in Commerce carts",
  "details" : "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.\n\n## Vulnerability Details\n\n### Root Cause\n\nThe `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.\n\n```php\n// CartController.php:374-389 - actionLoadCart()\npublic function actionLoadCart(): ?Response\n{\n    $number = $this->request->getParam('number');\n\n    if ($number === null) {\n        return $this->asFailure(Craft::t('commerce', 'A cart number must be specified.'));\n    }\n\n    // No ownership check - returns any cart to any requester\n    $cart = Order::find()->number($number)->isCompleted(false)->one();\n\n    // Cart is loaded into attacker's session without authorization\n    ...\n}\n```\n\n```php\n// CartController.php:606-616 - _getCart()\n$orderNumber = $this->request->getBodyParam('number');\nif ($orderNumber) {\n    // Same issue - no ownership validation\n    $cart = Order::find()->number($orderNumber)->isCompleted(false)->one();\n    // Returns cart to any requester who knows the number\n}\n```\n---\n\n## Attack Scenario\n\n### Prerequisites\n- Target Craft Commerce installation with active shopping carts\n- Knowledge of a victim’s cart number (32-character hex string)\n\n### Cart Number Acquisition Vectors\n\n1. **Referrer Header Leakage**: Cart URLs shared externally expose the number\n2. **Browser History**: Accessible on shared/compromised devices\n3. **Proxy/WAF Logs**: Cart numbers logged in URL parameters\n4. **Social Engineering**: Support tickets, screenshots containing cart URLs\n5. **Brute Force**: While impractical for random targeting, feasible for targeted attacks against recently-created carts\n\n---",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "craftcms/commerce"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.6.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "craftcms/commerce"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.11.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/craftcms/commerce/security/advisories/GHSA-vff3-pqq8-4cpq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-31867"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/craftcms/commerce/pull/4207"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/craftcms/commerce"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-639" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-10T18:24:49Z",
    "nvd_published_at" : "2026-03-11T18:16:25Z"
  }
}