{"id":"CVE-2026-32271","aliases":["CVE-2026-32271","GHSA-875v-7m49-8x88"],"related":[],"kind":"vulnerability","state":"published","title":"Craft Commerce: SQL Injection can lead to Remote Code Execution via TotalRevenue Widget","summary":"Craft Commerce is an ecommerce platform for Craft CMS. In versions 4.0.0 through 4.10.2 and 5.0.0 through 5.5.4, there is an SQL injection vulnerability in the Commerce TotalRevenue widget which allows any authenticated control panel user to achieve remote code execution through a four-step exploitation chain. The attack exploits unsanitized widget settings interpolated into SQL expressions, combined with PDO's default multi-statement query support, to inject a maliciously serialized PHP object into the queue table. When the queue consumer processes the injected job, the unrestricted unserialize() call in yii2-queue instantiates a GuzzleHttp FileCookieJar gadget chain whose __destruct() method writes a PHP webshell to the server's webroot. The complete chain requires only three HTTP requests, no administrative privileges, and results in arbitrary command execution as the PHP process user, with queue processing triggered via an unauthenticated endpoint. This issue has been fixed in versions 4.10.3 and 5.5.5.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Craft Commerce is an ecommerce platform for Craft CMS. In versions 4.0.0 through 4.10.2 and 5.0.0 through 5.5.4, there is an SQL injection vulnerability in the Commerce TotalRevenue widget which allows any authenticated control panel user to achieve remote code execution through a four-step exploitation chain. The attack exploits unsanitized widget settings interpolated into SQL expressions, combined with PDO's default multi-statement query support, to inject a maliciously serialized PHP object into the queue table. When the queue consumer processes the injected job, the unrestricted unserialize() call in yii2-queue instantiates a GuzzleHttp FileCookieJar gadget chain whose __destruct() method writes a PHP webshell to the server's webroot. The complete chain requires only three HTTP requests, no administrative privileges, and results in arbitrary command execution as the PHP process user, with queue processing triggered via an unauthenticated endpoint. This issue has been fixed in versions 4.10.3 and 5.5.5.","source":"cvelist"},{"lang":"en","text":"## 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)`","format":"markdown","source":"ghsa"},{"lang":"es","text":"Craft Commerce es una plataforma de comercio electrónico para Craft CMS. En las versiones 4.0.0 a 4.10.2 y 5.0.0 a 5.5.4, existe una vulnerabilidad de inyección SQL en el widget Commerce TotalRevenue que permite a cualquier usuario autenticado del panel de control lograr la ejecución remota de código a través de una cadena de explotación de cuatro pasos. El ataque explota configuraciones de widget no saneadas interpoladas en expresiones SQL, combinadas con el soporte de consultas multi-sentencia predeterminado de PDO, para inyectar un objeto PHP maliciosamente serializado en la tabla de la cola. Cuando el consumidor de la cola procesa el trabajo inyectado, la llamada unserialize() sin restricciones en yii2-queue instancia una cadena de gadgets GuzzleHttp FileCookieJar cuyo método __destruct() escribe una webshell PHP en la raíz web del servidor. La cadena completa requiere solo tres solicitudes HTTP, sin privilegios administrativos, y resulta en la ejecución arbitraria de comandos como el usuario del proceso PHP, con el procesamiento de la cola activado a través de un endpoint no autenticado. Este problema ha sido solucionado en las versiones 4.10.3 y 5.5.5.","source":"nvd"}],"published":"2026-04-13T20:19:19.486Z","modified":"2026-10-26T21:10:00.170Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":">= 4.0.0, < 4.10.3","status":"affected"},{"version":">= 5.0.0, < 5.5.5","status":"affected"}],"vendor":"craftcms","product":"commerce","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"4.0.0","status":"affected","fixed":"4.10.3"}],"ecosystem":"Packagist","package":"craftcms/commerce","purl":"pkg:composer/craftcms/commerce","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"5.0.0","status":"affected","fixed":"5.5.5"}],"ecosystem":"Packagist","package":"craftcms/commerce","purl":"pkg:composer/craftcms/commerce","source":"ghsa"}],"references":[{"url":"https://github.com/craftcms/commerce/security/advisories/GHSA-875v-7m49-8x88","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/craftcms/commerce/commit/6d2d24b3a2b0c06593856d05446f82bd8af92d72","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-32271","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/craftcms/commerce","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-04-16T13:21:36.304Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-32271","url":"https://www.cve.org/CVERecord?id=CVE-2026-32271","licence":"CVE Terms of Use","modified":"2026-04-16T13:26:40.649Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-875v-7m49-8x88","url":"https://github.com/advisories/GHSA-875v-7m49-8x88","licence":"CC-BY-4.0","modified":"2026-04-14T00:41:06.972Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-32271","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-32271","licence":"Public domain","modified":"2026-10-26T21:10:00.170Z"}],"updatedAt":"2026-11-25T22:59:18.642Z","epss":{"score":0.00506,"percentile":0.44764,"date":"2026-12-02T12:00:21.000Z"}}