CVE-2026-32271: Craftcms/commerce Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-875v-7m49-8x88
CWE-89
Published
Advisory Summary

CVE-2026-32271 is a HIGH remote code execution vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Craftcms/commerce libraries in the Packagist ecosystem. The issue involves craft commerce has a sql injection can lead to remote code execution via totalrevenue widget. Remediation is available by upgrading affected packages to version 4.10.3, 5.5.5.

CVE-2026-32271 at a Glance

CVE Identifier CVE-2026-32271
GHSA Identifier GHSA-875v-7m49-8x88
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Craftcms/commerce
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-32271

To remediate this vulnerability, upgrade all affected Craftcms/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: 4.10.3
Upgrade craftcms/commerce to 4.10.3
craftcms/commerce fixed: 5.5.5
Upgrade craftcms/commerce to 5.5.5
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-32271, inspect your project dependencies for Craftcms/commerce:

inspect dependencies for craftcms/commerce

Analyze the terminal output to locate any version of Craftcms/commerce in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.10.3), 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-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Craftcms/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

## Summary A SQL injection in the Commerce TotalRevenue widget can lead to remote code execution through a chain of four vulnerabilities: * SQL Injection -- The TotalRevenue stat interpolates unsanitized widget settings directly into a sprintf-based SQL Expression. Any control panel user can create any widget type without permission checks. * PDO Multi-Statement Queries -- PHP `PDO MySQL` enables `CLIENT_MULTI_STATEMENTS` by default. Neither Yii2 nor Craft CMS disables it. This allows stacking an INSERT statement after the injected SELECT , writing a maliciously serialized PHP object into the queue table. * Unrestricted `unserialize()` -- The yii2-queue PhpSerializer calls `unserialize()` with no allowed_classes restriction on every queue job. When the queue consumer processes the injected job, it instantiates the attacker-controlled object. * Gadget Chain (FileCookieJar) -- `GuzzleHttp\Cookie\FileCookieJar` (a standard Guzzle dependency) has an unguarded `__destruct()` method that calls `file_put_contents()`. The attacker’s serialized payload writes a PHP webshell to the server’s webroot. PHP tags survive `json_encode()` because Guzzle uses `options=0` (no `JSON_HEX_TAG`). The complete chain requires 3 HTTP requests and achieves arbitrary command execution as the PHP process user. Queue processing is triggered via GET `/actions/queue/run`, an endpoint that requires no authentication (`$allowAnonymous = ['run']`). ## RCE Exploitation Steps * Authenticate as any control panel user * POST to `/admin/actions/dashboard/create-widget` with stacked SQL injection: * `settings[type]` contains the stacked INSERT with the serialized gadget chain * Response: HTTP 500 (expected -- INSERT already committed) * Trigger queue processing: `GET /actions/queue/run` * Queue consumer deserializes the gadget chain * `FileCookieJar::__destruct()` writes webshell to webroot * Access the webshell: `GET /poc_rce.php?c=id` * Response: `uid=1000(home) gid=1000(home) groups=1000(home)`

CVE-2026-32271 Affected Craftcms/commerce Versions

2 component(s)
Fixed Versions:
4.10.35.5.5
Product / Package Ecosystem Affected Versions Fixed Version
craftcms/commerce
Packagist
≥ 4.0.0
< 4.10.3
4.10.3
craftcms/commerce
Packagist
≥ 5.0.0
< 5.5.5
5.5.5

References

Frequently Asked Questions

What is CVE-2026-32271?
CVE-2026-32271 is a security vulnerability in Craftcms/commerce involving Craft Commerce has a SQL Injection can lead to Remote Code Execution via TotalRevenue Widget under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Craftcms/commerce versions are affected?
Affected versions include releases prior to 4.10.3, 5.5.5 across affected packages: craftcms/commerce.
What version fixes CVE-2026-32271?
Upgrading to 4.10.3, 5.5.5 (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 4.10.3, 5.5.5. Upgrade your dependency to 4.10.3, 5.5.5 or later.
What CWE is associated with CVE-2026-32271?
CVE-2026-32271 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Packagist dependencies for CVE-2026-32271?
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-875v-7m49-8x88",
  "modified" : "2026-04-14T00:07:34Z",
  "published" : "2026-04-14T00:07:34Z",
  "aliases" : [ "CVE-2026-32271" ],
  "summary" : "Craft Commerce has a SQL Injection can lead to Remote Code Execution via TotalRevenue Widget",
  "details" : "## Summary\n\nA SQL injection in the Commerce TotalRevenue widget can lead to remote code execution through a chain of four vulnerabilities:\n\n* SQL Injection -- The TotalRevenue stat interpolates unsanitized widget settings directly into a sprintf-based SQL Expression.  Any control panel user can create any widget type without permission checks.\n\n* PDO Multi-Statement Queries -- PHP `PDO MySQL` enables `CLIENT_MULTI_STATEMENTS` by default. Neither Yii2 nor Craft CMS disables it. This allows stacking an INSERT statement after the injected SELECT , writing a maliciously serialized PHP object into the queue table.\n\n* Unrestricted `unserialize()` -- The yii2-queue PhpSerializer calls `unserialize()` with no allowed_classes restriction on every queue job. When the queue consumer processes the injected job, it instantiates the attacker-controlled object.\n\n* Gadget Chain (FileCookieJar) -- `GuzzleHttp\\Cookie\\FileCookieJar` (a standard Guzzle dependency) has an unguarded `__destruct()` method that calls `file_put_contents()`. The attacker’s serialized payload writes a PHP webshell to the server’s webroot. PHP tags survive `json_encode()` because Guzzle uses `options=0` (no `JSON_HEX_TAG`).\n\nThe complete chain requires 3 HTTP requests and achieves arbitrary command execution as the PHP process user. Queue processing is triggered via GET `/actions/queue/run`, an endpoint that requires no authentication (`$allowAnonymous = ['run']`).\n\n## RCE Exploitation Steps\n\n* Authenticate as any control panel user\n* POST to `/admin/actions/dashboard/create-widget` with stacked SQL injection:\n* `settings[type]` contains the stacked INSERT with the serialized gadget chain\n* Response: HTTP 500 (expected -- INSERT already committed)\n* Trigger queue processing: `GET /actions/queue/run`\n* Queue consumer deserializes the gadget chain\n* `FileCookieJar::__destruct()` writes webshell to webroot\n* Access the webshell: `GET /poc_rce.php?c=id`\n* Response: `uid=1000(home) gid=1000(home) groups=1000(home)`",
  "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "craftcms/commerce"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.10.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 4.10.2"
    }
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "craftcms/commerce"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.5.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.5.4"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/craftcms/commerce/security/advisories/GHSA-875v-7m49-8x88"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-32271"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/craftcms/commerce/commit/6d2d24b3a2b0c06593856d05446f82bd8af92d72"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/craftcms/commerce"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-14T00:07:34Z",
    "nvd_published_at" : "2026-04-13T21:16:24Z"
  }
}