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

HIGH
Advisory Identifier: GHSA-r54v-qq87-px5r
CWE-89
Published
Advisory Summary

CVE-2026-32272 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 hasvariant/hasproduct blind sql injection. Remediation is available by upgrading affected packages to version 5.6.0.

CVE-2026-32272 at a Glance

CVE Identifier CVE-2026-32272
GHSA Identifier GHSA-r54v-qq87-px5r
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-32272

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: 5.6.0
Upgrade craftcms/commerce to 5.6.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-32272, 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 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-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

## Overview Craft Commerce’s `ProductQuery::hasVariant` and `VariantQuery::hasProduct` properties bypass the `unset()` blocklist added to `ElementIndexesController` in GHSA-2453-mppf-46cj. The blocklist only strips top-level Yii2 Query properties (`where`, `orderBy`, etc.), but `hasVariant` and `hasProduct` pass through untouched. Internally, these properties call `Craft::configure()` on a subquery without sanitization, re-introducing SQL injection via `criteria[hasVariant][where]=INJECTED_SQL`. An authenticated control panel user can perform boolean-based blind SQL injection through the patched `ElementIndexesController` and extract arbitrary database contents. ## Impact * Full database read access via blind SQL injection * Privilege escalation via security key extraction → forged admin sessions ## Prerequisites * Authenticated control panel user * Commerce plugin installed * Products with variants in the database

CVE-2026-32272 Affected Craftcms/commerce Versions

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

References

Frequently Asked Questions

What is CVE-2026-32272?
CVE-2026-32272 is a security vulnerability in Craftcms/commerce involving Craft Commerce hasVariant/hasProduct Blind SQL Injection 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 5.6.0 across affected packages: craftcms/commerce.
What version fixes CVE-2026-32272?
Upgrading to 5.6.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. Upgrade your dependency to 5.6.0 or later.
What CWE is associated with CVE-2026-32272?
CVE-2026-32272 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-32272?
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-r54v-qq87-px5r",
  "modified" : "2026-04-14T00:06:56Z",
  "published" : "2026-04-14T00:06:56Z",
  "aliases" : [ "CVE-2026-32272" ],
  "summary" : "Craft Commerce hasVariant/hasProduct Blind SQL Injection",
  "details" : "## Overview\n\nCraft Commerce’s `ProductQuery::hasVariant` and `VariantQuery::hasProduct` properties bypass the `unset()` blocklist added to `ElementIndexesController` in GHSA-2453-mppf-46cj.\n\nThe blocklist only strips top-level Yii2 Query properties (`where`, `orderBy`, etc.), but `hasVariant` and `hasProduct` pass\nthrough untouched. Internally, these properties call `Craft::configure()` on a subquery without sanitization, re-introducing SQL injection via `criteria[hasVariant][where]=INJECTED_SQL`.\n\nAn authenticated control panel user can perform boolean-based blind SQL injection through the patched `ElementIndexesController` and extract arbitrary database contents.\n\n## Impact\n\n* Full database read access via blind SQL injection\n* Privilege escalation via security key extraction → forged admin sessions\n\n## Prerequisites\n* Authenticated control panel user\n* Commerce plugin installed\n* Products with variants in the database",
  "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" : "5.0.0"
      }, {
        "fixed" : "5.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/craftcms/commerce/security/advisories/GHSA-r54v-qq87-px5r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-32272"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/craftcms/commerce/pull/4232"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-2453-mppf-46cj"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/craftcms/commerce"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/craftcms/commerce/releases/tag/5.6.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-14T00:06:56Z",
    "nvd_published_at" : "2026-04-13T21:16:24Z"
  }
}