{
    "document": {
        "category": "csaf_base",
        "csaf_version": "2.0",
        "distribution": {
            "tlp": {
                "label": "WHITE"
            }
        },
        "lang": "en",
        "notes": [
            {
                "category": "legal_disclaimer",
                "text": "The Netherlands Cyber Security Center (henceforth: NCSC-NL) maintains this portal to enhance access to its information and vulnerabilities. The use of this information is subject to the following terms and conditions:\n\nThe vulnerabilities disclosed in this portal are gathered by NCSC-NL from a variety of open sources, which the user can retrieve from other platforms. NCSC-NL makes every reasonable effort to ensure that the content of this portal is kept up to date, and that it is accurate and complete. Nevertheless, NCSC-NL cannot entirely rule out the possibility of errors, and therefore cannot give any warranty in respect of its completeness, accuracy or real-time keeping up-to-date. NCSC-NL does not control nor guarantee the accuracy, relevance, timeliness or completeness of information obtained from these external sources. The vulnerabilities disclosed in this portal are intended solely for the convenience of professional parties to take appropriate measures to manage the risks posed to the cybersecurity. No rights can be derived from the information provided therein.\n\nNCSC-NL and the Kingdom of the Netherlands assume no legal liability or responsibility for any damage resulting from either the use or inability of use of the vulnerabilities disclosed in this portal. This includes damage resulting from the inaccuracy of incompleteness of the information contained in it.\nThe information on this page is subject to Dutch law. All disputes related to or arising from the use of this portal regarding the disclosure of vulnerabilities will be submitted to the competent court in The Hague. This choice of means also applies to the court in summary proceedings."
            }
        ],
        "publisher": {
            "category": "coordinator",
            "contact_details": "cert@ncsc.nl",
            "name": "National Cyber Security Centre",
            "namespace": "https://www.ncsc.nl/"
        },
        "title": "CVE-2026-31824",
        "tracking": {
            "current_release_date": "2026-03-23T03:27:40.570240Z",
            "generator": {
                "date": "2026-02-17T15:00:00Z",
                "engine": {
                    "name": "V.E.L.M.A",
                    "version": "1.7"
                }
            },
            "id": "CVE-2026-31824",
            "initial_release_date": "2026-03-10T22:26:09.472892Z",
            "revision_history": [
                {
                    "date": "2026-03-10T22:26:09.472892Z",
                    "number": "1",
                    "summary": "CVE created.| Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| References created (1).| CWES updated (1)."
                },
                {
                    "date": "2026-03-10T22:26:12.651798Z",
                    "number": "2",
                    "summary": "NCSC Score created."
                },
                {
                    "date": "2026-03-10T22:38:37.831524Z",
                    "number": "3",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| Products connected (9).| References created (1).| CWES updated (1)."
                },
                {
                    "date": "2026-03-10T22:38:40.467478Z",
                    "number": "4",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-11T00:53:22.105819Z",
                    "number": "5",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| References created (2).| CWES updated (1)."
                },
                {
                    "date": "2026-03-11T06:39:57.122664Z",
                    "number": "6",
                    "summary": "References created (1)."
                },
                {
                    "date": "2026-03-11T14:54:33.665324Z",
                    "number": "7",
                    "summary": "Source created.| CVE status created. (valid)| EPSS created."
                },
                {
                    "date": "2026-03-11T16:39:34.729519Z",
                    "number": "8",
                    "summary": "Unknown change."
                },
                {
                    "date": "2026-03-11T20:25:55.329817Z",
                    "number": "9",
                    "summary": "Products connected (9).| Product Identifiers created (9)."
                },
                {
                    "date": "2026-03-11T20:26:02.433501Z",
                    "number": "10",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-11T20:40:57.454589Z",
                    "number": "11",
                    "summary": "Description removed for source.| Description created for source."
                },
                {
                    "date": "2026-03-19T15:29:41.666958Z",
                    "number": "12",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| References created (3).| CWES updated (1)."
                },
                {
                    "date": "2026-03-20T09:32:47.288764Z",
                    "number": "13",
                    "summary": "Source connected.| CVE status created. (valid)| EPSS created."
                }
            ],
            "status": "interim",
            "version": "13"
        }
    },
    "product_tree": {
        "branches": [
            {
                "branches": [
                    {
                        "branches": [
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/<1.9.12",
                                "product": {
                                    "name": "vers:unknown/<1.9.12",
                                    "product_id": "CSAFPID-5778750",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/>=1.10.0|<1.10.16",
                                "product": {
                                    "name": "vers:unknown/>=1.10.0|<1.10.16",
                                    "product_id": "CSAFPID-5778749",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/>=1.11.0|<1.11.17",
                                "product": {
                                    "name": "vers:unknown/>=1.11.0|<1.11.17",
                                    "product_id": "CSAFPID-5778748",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/>=1.12.0|<1.12.23",
                                "product": {
                                    "name": "vers:unknown/>=1.12.0|<1.12.23",
                                    "product_id": "CSAFPID-5778747",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/>=1.13.0|<1.13.15",
                                "product": {
                                    "name": "vers:unknown/>=1.13.0|<1.13.15",
                                    "product_id": "CSAFPID-5778746",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/>=1.14.0|<1.14.18",
                                "product": {
                                    "name": "vers:unknown/>=1.14.0|<1.14.18",
                                    "product_id": "CSAFPID-5778745",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/>=2.0.0|<2.0.16",
                                "product": {
                                    "name": "vers:unknown/>=2.0.0|<2.0.16",
                                    "product_id": "CSAFPID-5778702",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/>=2.1.0|<2.1.12",
                                "product": {
                                    "name": "vers:unknown/>=2.1.0|<2.1.12",
                                    "product_id": "CSAFPID-5778701",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/>=2.2.0|<2.2.3",
                                "product": {
                                    "name": "vers:unknown/>=2.2.0|<2.2.3",
                                    "product_id": "CSAFPID-5778700",
                                    "product_identification_helper": {
                                        "cpe": "cpe:2.3:a:sylius:sylius:*:*:*:*:*:*:*:*"
                                    }
                                }
                            }
                        ],
                        "category": "product_name",
                        "name": "Sylius"
                    }
                ],
                "category": "vendor",
                "name": "Sylius"
            }
        ]
    },
    "vulnerabilities": [
        {
            "cve": "CVE-2026-31824",
            "cwe": {
                "id": "CWE-362",
                "name": "Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')"
            },
            "notes": [
                {
                    "category": "description",
                    "text": "Sylius is an Open Source eCommerce Framework on Symfony. A Time-of-Check To Time-of-Use (TOCTOU) race condition was discovered in the promotion usage limit enforcement. The same class of vulnerability affects the promotion usage limit (the global used counter on Promotion entities), coupon usage limit (the global used counter on PromotionCoupon entities), and coupon per-customer usage limit (the per-customer redemption count on PromotionCoupon entities). In all three cases, the eligibility check reads the used counter (or order count) from an in-memory Doctrine entity during validation, while the actual usage increment in OrderPromotionsUsageModifier happens later during order completion — with no database-level locking or atomic operations between the two phases. Because Doctrine flushes an absolute value (SET used = 1) rather than an atomic increment (SET used = used + 1), and because the affected entities lack optimistic locking, concurrent requests all read the same stale usage counts and pass the eligibility checks simultaneously. An attacker can exploit this by preparing multiple carts with the same limited-use promotion or coupon and firing simultaneous PATCH /api/v2/shop/orders/{token}/complete requests. All requests pass the usage limit checks and complete successfully, allowing a single-use promotion or coupon to be redeemed an arbitrary number of times. The per-customer limit can be bypassed in the same way by a single customer completing multiple orders concurrently. No authentication is required to exploit this vulnerability. This may lead to direct financial loss through unlimited redemption of limited-use promotions and discount coupons. The issue is fixed in versions: 1.9.12, 1.10.16, 1.11.17, 1.12.23, 1.13.15, 1.14.18, 2.0.16, 2.1.12, 2.2.3 and above.",
                    "title": "nvd - https://nvd.nist.gov/vuln/detail/CVE-2026-31824"
                },
                {
                    "category": "description",
                    "text": "Sylius is an Open Source eCommerce Framework on Symfony. A Time-of-Check To Time-of-Use (TOCTOU) race condition was discovered in the promotion usage limit enforcement. The same class of vulnerability affects the promotion usage limit (the global used counter on Promotion entities), coupon usage limit (the global used counter on PromotionCoupon entities), and coupon per-customer usage limit (the per-customer redemption count on PromotionCoupon entities). In all three cases, the eligibility check reads the used counter (or order count) from an in-memory Doctrine entity during validation, while the actual usage increment in OrderPromotionsUsageModifier happens later during order completion — with no database-level locking or atomic operations between the two phases. Because Doctrine flushes an absolute value (SET used = 1) rather than an atomic increment (SET used = used + 1), and because the affected entities lack optimistic locking, concurrent requests all read the same stale usage counts and pass the eligibility checks simultaneously. An attacker can exploit this by preparing multiple carts with the same limited-use promotion or coupon and firing simultaneous PATCH /api/v2/shop/orders/{token}/complete requests. All requests pass the usage limit checks and complete successfully, allowing a single-use promotion or coupon to be redeemed an arbitrary number of times. The per-customer limit can be bypassed in the same way by a single customer completing multiple orders concurrently. No authentication is required to exploit this vulnerability. This may lead to direct financial loss through unlimited redemption of limited-use promotions and discount coupons. The issue is fixed in versions: 1.9.12, 1.10.16, 1.11.17, 1.12.23, 1.13.15, 1.14.18, 2.0.16, 2.1.12, 2.2.3 and above.",
                    "title": "cveprojectv5 - https://www.cve.org/CVERecord?id=CVE-2026-31824"
                },
                {
                    "category": "description",
                    "text": "### Impact\nA Time-of-Check To Time-of-Use (TOCTOU) race condition was discovered in the promotion usage limit enforcement. The same class of vulnerability affects three independent limits:\n\n1. **Promotion usage limit** - the global `used` counter on `Promotion` entities\n2. **Coupon usage limit** - the global `used` counter on `PromotionCoupon` entities\n3. **Coupon per-customer usage limit** - the per-customer redemption count on `PromotionCoupon` entities\n\nIn all three cases, the eligibility check reads the `used` counter (or order count) from an in-memory Doctrine entity during validation, while the actual usage increment in `OrderPromotionsUsageModifier` happens later during order completion — with no database-level locking or atomic operations between the two phases.\n\nBecause Doctrine flushes an absolute value (`SET used = 1`) rather than an atomic increment (`SET used = used + 1`), and because the affected entities lack optimistic locking, concurrent requests all read the same stale usage counts and pass the eligibility checks simultaneously.\n\nAn attacker can exploit this by preparing multiple carts with the same limited-use promotion or coupon and firing simultaneous `PATCH /api/v2/shop/orders/{token}/complete` requests. All requests pass the usage limit checks and complete successfully, allowing a single-use promotion or coupon to be redeemed an arbitrary number of times. The per-customer limit can be bypassed in the same way by a single customer completing multiple orders concurrently. No authentication is required to exploit this vulnerability.\n\nThis may lead to direct financial loss through unlimited redemption of limited-use promotions and discount coupons.\n\n### Patches\nThe issue is fixed in versions: 1.9.12, 1.10.16, 1.11.17, 1.12.23, 1.13.15, 1.14.18, 2.0.16, 2.1.12, 2.2.3 and above.\n\n### Workarounds\n\nDecoration of the `OrderPromotionsUsageModifier` service to use atomic operations based on actual database-synchronized values.\n\nThe decorated service id in Sylius >=2.0 is `sylius.modifier.promotion.order_usage`, while <2.0 it's `sylius.promotion_usage_modifier`; The following instruction uses the latter, but it needs to be changed depending on the Sylius version.\n\n#### Step 1. Create the decorator service\n\n`src/Modifier/AtomicOrderPromotionsUsageModifier.php`:\n\n```php\n<?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Modifier;\n\nuse Doctrine\\DBAL\\Connection;\nuse Doctrine\\ORM\\OptimisticLockException;\nuse Sylius\\Component\\Core\\Model\\OrderInterface;\nuse Sylius\\Component\\Core\\Model\\PromotionCouponInterface;\nuse Sylius\\Component\\Core\\Promotion\\Modifier\\OrderPromotionsUsageModifierInterface;\nuse Sylius\\Component\\Promotion\\Model\\PromotionInterface;\n// use Symfony\\Component\\DependencyInjection\\Attribute\\AsDecorator;\n\n// #[AsDecorator(decorates: 'sylius.promotion_usage_modifier')]\nfinal class AtomicOrderPromotionsUsageModifier implements OrderPromotionsUsageModifierInterface\n{\n    /** @var Connection */\n    private $connection;\n\n    public function __construct(Connection $connection)\n    {\n        $this->connection = $connection;\n    }\n\n    public function increment(OrderInterface $order): void\n    {\n        foreach ($order->getPromotions() as $promotion) {\n            $this->incrementPromotionUsage($promotion);\n        }\n\n        /** @var PromotionCouponInterface|null $coupon */\n        $coupon = $order->getPromotionCoupon();\n        if (null === $coupon) {\n            return;\n        }\n\n        $this->incrementCouponUsage($coupon, $order);\n    }\n\n    public function decrement(OrderInterface $order): void\n    {\n        foreach ($order->getPromotions() as $promotion) {\n            $this->decrementPromotionUsage($promotion);\n        }\n\n        /** @var PromotionCouponInterface|null $coupon */\n        $coupon = $order->getPromotionCoupon();\n        if (null === $coupon) {\n            return;\n        }\n\n        if (OrderInterface::STATE_CANCELLED === $order->getState() && !$coupon->isReusableFromCancelledOrders()) {\n            return;\n        }\n\n        $this->decrementCouponUsage($coupon);\n    }\n\n    private function incrementPromotionUsage(PromotionInterface $promotion): void\n    {\n        $affected = $this->doExecuteStatement(\n            'UPDATE sylius_promotion\n             SET used = used + 1\n             WHERE id = :id AND (usage_limit IS NULL OR used < usage_limit)',\n            ['id' => $promotion->getId()]\n        );\n\n        if (0 === $affected) {\n            throw new OptimisticLockException(sprintf('Promotion \"%s\" is no longer applicable.', $promotion->getCode()), $promotion);\n        }\n\n        $newUsed = (int) $this->doFetchOne(\n            'SELECT used FROM sylius_promotion WHERE id = :id',\n            ['id' => $promotion->getId()]\n        );\n\n        $promotion->setUsed($newUsed);\n    }\n\n    private function decrementPromotionUsage(PromotionInterface $promotion): void\n    {\n        $this->doExecuteStatement(\n            'UPDATE sylius_promotion SET used = GREATEST(used - 1, 0) WHERE id = :id',\n            ['id' => $promotion->getId()]\n        );\n\n        $newUsed = (int) $this->doFetchOne(\n            'SELECT used FROM sylius_promotion WHERE id = :id',\n            ['id' => $promotion->getId()]\n        );\n\n        $promotion->setUsed($newUsed);\n    }\n\n    private function incrementCouponUsage(PromotionCouponInterface $coupon, OrderInterface $order): void\n    {\n        $row = $this->doFetchAssociative(\n            'SELECT used, usage_limit, per_customer_usage_limit FROM sylius_promotion_coupon WHERE id = :id FOR UPDATE',\n            ['id' => $coupon->getId()]\n        );\n\n        if (false === $row) {\n            throw new OptimisticLockException(sprintf('Promotion coupon \"%s\" is no longer applicable.', $coupon->getCode()), $coupon);\n        }\n\n        if (null !== $row['usage_limit'] && (int) $row['used'] >= (int) $row['usage_limit']) {\n            throw new OptimisticLockException(sprintf('Promotion coupon \"%s\" is no longer applicable.', $coupon->getCode()), $coupon);\n        }\n\n        if (null !== $row['per_customer_usage_limit']) {\n            $this->assertPerCustomerCouponUsageLimitNotReached(\n                $coupon,\n                $order,\n                (int) $row['per_customer_usage_limit']\n            );\n        }\n\n        $this->doExecuteStatement(\n            'UPDATE sylius_promotion_coupon SET used = used + 1 WHERE id = :id',\n            ['id' => $coupon->getId()]\n        );\n\n        $coupon->setUsed((int) $row['used'] + 1);\n    }\n\n    private function assertPerCustomerCouponUsageLimitNotReached(\n        PromotionCouponInterface $coupon,\n        OrderInterface $order,\n        int $perCustomerUsageLimit\n    ): void {\n        $customer = $order->getCustomer();\n        if (null === $customer || null === $customer->getId()) {\n            return;\n        }\n\n        $sql = 'SELECT o.id FROM sylius_order o\n                WHERE o.customer_id = :customerId\n                AND o.promotion_coupon_id = :couponId\n                AND o.state != :stateCart';\n        $params = [\n            'customerId' => $customer->getId(),\n            'couponId' => $coupon->getId(),\n            'stateCart' => OrderInterface::STATE_CART,\n        ];\n\n        if ($coupon->isReusableFromCancelledOrders()) {\n            $sql .= ' AND o.state != :stateCancelled';\n            $params['stateCancelled'] = OrderInterface::STATE_CANCELLED;\n        }\n\n        $sql .= ' FOR UPDATE';\n\n        $count = count($this->doFetchAllAssociative($sql, $params));\n\n        if ($count >= $perCustomerUsageLimit) {\n            throw new OptimisticLockException(sprintf('Promotion coupon \"%s\" is no longer applicable.', $coupon->getCode()), $coupon);\n        }\n    }\n\n    private function decrementCouponUsage(PromotionCouponInterface $coupon): void\n    {\n        $this->doExecuteStatement(\n            'UPDATE sylius_promotion_coupon SET used = GREATEST(used - 1, 0) WHERE id = :id',\n            ['id' => $coupon->getId()]\n        );\n\n        $newUsed = (int) $this->doFetchOne(\n            'SELECT used FROM sylius_promotion_coupon WHERE id = :id',\n            ['id' => $coupon->getId()]\n        );\n\n        $coupon->setUsed($newUsed);\n    }\n\n    /** @return int Number of affected rows */\n    private function doExecuteStatement(string $sql, array $params): int\n    {\n        if (method_exists($this->connection, 'executeStatement')) {\n            return $this->connection->executeStatement($sql, $params);\n        }\n\n        return $this->connection->executeUpdate($sql, $params);\n    }\n\n    /** @return mixed|false */\n    private function doFetchOne(string $sql, array $params)\n    {\n        if (method_exists($this->connection, 'fetchOne')) {\n            return $this->connection->fetchOne($sql, $params);\n        }\n\n        return $this->connection->fetchColumn($sql, $params);\n    }\n\n    /** @return array|false */\n    private function doFetchAssociative(string $sql, array $params)\n    {\n        if (method_exists($this->connection, 'fetchAssociative')) {\n            return $this->connection->fetchAssociative($sql, $params);\n        }\n\n        return $this->connection->fetchAssoc($sql, $params);\n    }\n\n    /** @return array[] */\n    private function doFetchAllAssociative(string $sql, array $params): array\n    {\n        if (method_exists($this->connection, 'fetchAllAssociative')) {\n            return $this->connection->fetchAllAssociative($sql, $params);\n        }\n\n        return $this->connection->fetchAll($sql, $params);\n    }\n}\n```\n\n#### Step 2. Register the service\n\n**Option A:** If your app uses autowiring and supports the `#[AsDecorator]` attribute, uncomment it in the class and no further configuration is necessary.\n\n**Option B:** Manually register the service in `config/services.yaml`:\n\n```yaml\nservices:\n    App\\Modifier\\AtomicOrderPromotionsUsageModifier:\n        decorates: 'sylius.promotion_usage_modifier'\n        arguments: ['@doctrine.dbal.default_connection']\n```\n\n#### Step 3. Update exception mapping (optional)\n\nCheck if your `api_platform` configuration maps `OptimisticLockException` to a code and update it if not:\n```yaml\napi_platform:\n    ...\n    exception_to_status:\n        ...\n        Doctrine\\ORM\\OptimisticLockException: 409\n```\n\n#### Step 4. Clear cache\n\n```bash\nbin/console cache:clear\n```\n\n### Reporters\n\nWe would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability:\n- Djibril Mounkoro (@whiteov3rflow)\n- Bartłomiej Nowiński (@bnBart)\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n- Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues)\n- Email us at [security@sylius.com](mailto:security@sylius.com)",
                    "title": "github - https://github.com/advisories/GHSA-7mp4-25j8-hp5q"
                },
                {
                    "category": "description",
                    "text": "### Impact\nA Time-of-Check To Time-of-Use (TOCTOU) race condition was discovered in the promotion usage limit enforcement. The same class of vulnerability affects three independent limits:\n\n1. **Promotion usage limit** - the global `used` counter on `Promotion` entities\n2. **Coupon usage limit** - the global `used` counter on `PromotionCoupon` entities\n3. **Coupon per-customer usage limit** - the per-customer redemption count on `PromotionCoupon` entities\n\nIn all three cases, the eligibility check reads the `used` counter (or order count) from an in-memory Doctrine entity during validation, while the actual usage increment in `OrderPromotionsUsageModifier` happens later during order completion — with no database-level locking or atomic operations between the two phases.\n\nBecause Doctrine flushes an absolute value (`SET used = 1`) rather than an atomic increment (`SET used = used + 1`), and because the affected entities lack optimistic locking, concurrent requests all read the same stale usage counts and pass the eligibility checks simultaneously.\n\nAn attacker can exploit this by preparing multiple carts with the same limited-use promotion or coupon and firing simultaneous `PATCH /api/v2/shop/orders/{token}/complete` requests. All requests pass the usage limit checks and complete successfully, allowing a single-use promotion or coupon to be redeemed an arbitrary number of times. The per-customer limit can be bypassed in the same way by a single customer completing multiple orders concurrently. No authentication is required to exploit this vulnerability.\n\nThis may lead to direct financial loss through unlimited redemption of limited-use promotions and discount coupons.\n\n### Patches\nThe issue is fixed in versions: 1.9.12, 1.10.16, 1.11.17, 1.12.23, 1.13.15, 1.14.18, 2.0.16, 2.1.12, 2.2.3 and above.\n\n### Workarounds\n\nDecoration of the `OrderPromotionsUsageModifier` service to use atomic operations based on actual database-synchronized values.\n\nThe decorated service id in Sylius >=2.0 is `sylius.modifier.promotion.order_usage`, while <2.0 it's `sylius.promotion_usage_modifier`; The following instruction uses the latter, but it needs to be changed depending on the Sylius version.\n\n#### Step 1. Create the decorator service\n\n`src/Modifier/AtomicOrderPromotionsUsageModifier.php`:\n\n```php\n<?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Modifier;\n\nuse Doctrine\\DBAL\\Connection;\nuse Doctrine\\ORM\\OptimisticLockException;\nuse Sylius\\Component\\Core\\Model\\OrderInterface;\nuse Sylius\\Component\\Core\\Model\\PromotionCouponInterface;\nuse Sylius\\Component\\Core\\Promotion\\Modifier\\OrderPromotionsUsageModifierInterface;\nuse Sylius\\Component\\Promotion\\Model\\PromotionInterface;\n// use Symfony\\Component\\DependencyInjection\\Attribute\\AsDecorator;\n\n// #[AsDecorator(decorates: 'sylius.promotion_usage_modifier')]\nfinal class AtomicOrderPromotionsUsageModifier implements OrderPromotionsUsageModifierInterface\n{\n    /** @var Connection */\n    private $connection;\n\n    public function __construct(Connection $connection)\n    {\n        $this->connection = $connection;\n    }\n\n    public function increment(OrderInterface $order): void\n    {\n        foreach ($order->getPromotions() as $promotion) {\n            $this->incrementPromotionUsage($promotion);\n        }\n\n        /** @var PromotionCouponInterface|null $coupon */\n        $coupon = $order->getPromotionCoupon();\n        if (null === $coupon) {\n            return;\n        }\n\n        $this->incrementCouponUsage($coupon, $order);\n    }\n\n    public function decrement(OrderInterface $order): void\n    {\n        foreach ($order->getPromotions() as $promotion) {\n            $this->decrementPromotionUsage($promotion);\n        }\n\n        /** @var PromotionCouponInterface|null $coupon */\n        $coupon = $order->getPromotionCoupon();\n        if (null === $coupon) {\n            return;\n        }\n\n        if (OrderInterface::STATE_CANCELLED === $order->getState() && !$coupon->isReusableFromCancelledOrders()) {\n            return;\n        }\n\n        $this->decrementCouponUsage($coupon);\n    }\n\n    private function incrementPromotionUsage(PromotionInterface $promotion): void\n    {\n        $affected = $this->doExecuteStatement(\n            'UPDATE sylius_promotion\n             SET used = used + 1\n             WHERE id = :id AND (usage_limit IS NULL OR used < usage_limit)',\n            ['id' => $promotion->getId()]\n        );\n\n        if (0 === $affected) {\n            throw new OptimisticLockException(sprintf('Promotion \"%s\" is no longer applicable.', $promotion->getCode()), $promotion);\n        }\n\n        $newUsed = (int) $this->doFetchOne(\n            'SELECT used FROM sylius_promotion WHERE id = :id',\n            ['id' => $promotion->getId()]\n        );\n\n        $promotion->setUsed($newUsed);\n    }\n\n    private function decrementPromotionUsage(PromotionInterface $promotion): void\n    {\n        $this->doExecuteStatement(\n            'UPDATE sylius_promotion SET used = GREATEST(used - 1, 0) WHERE id = :id',\n            ['id' => $promotion->getId()]\n        );\n\n        $newUsed = (int) $this->doFetchOne(\n            'SELECT used FROM sylius_promotion WHERE id = :id',\n            ['id' => $promotion->getId()]\n        );\n\n        $promotion->setUsed($newUsed);\n    }\n\n    private function incrementCouponUsage(PromotionCouponInterface $coupon, OrderInterface $order): void\n    {\n        $row = $this->doFetchAssociative(\n            'SELECT used, usage_limit, per_customer_usage_limit FROM sylius_promotion_coupon WHERE id = :id FOR UPDATE',\n            ['id' => $coupon->getId()]\n        );\n\n        if (false === $row) {\n            throw new OptimisticLockException(sprintf('Promotion coupon \"%s\" is no longer applicable.', $coupon->getCode()), $coupon);\n        }\n\n        if (null !== $row['usage_limit'] && (int) $row['used'] >= (int) $row['usage_limit']) {\n            throw new OptimisticLockException(sprintf('Promotion coupon \"%s\" is no longer applicable.', $coupon->getCode()), $coupon);\n        }\n\n        if (null !== $row['per_customer_usage_limit']) {\n            $this->assertPerCustomerCouponUsageLimitNotReached(\n                $coupon,\n                $order,\n                (int) $row['per_customer_usage_limit']\n            );\n        }\n\n        $this->doExecuteStatement(\n            'UPDATE sylius_promotion_coupon SET used = used + 1 WHERE id = :id',\n            ['id' => $coupon->getId()]\n        );\n\n        $coupon->setUsed((int) $row['used'] + 1);\n    }\n\n    private function assertPerCustomerCouponUsageLimitNotReached(\n        PromotionCouponInterface $coupon,\n        OrderInterface $order,\n        int $perCustomerUsageLimit\n    ): void {\n        $customer = $order->getCustomer();\n        if (null === $customer || null === $customer->getId()) {\n            return;\n        }\n\n        $sql = 'SELECT o.id FROM sylius_order o\n                WHERE o.customer_id = :customerId\n                AND o.promotion_coupon_id = :couponId\n                AND o.state != :stateCart';\n        $params = [\n            'customerId' => $customer->getId(),\n            'couponId' => $coupon->getId(),\n            'stateCart' => OrderInterface::STATE_CART,\n        ];\n\n        if ($coupon->isReusableFromCancelledOrders()) {\n            $sql .= ' AND o.state != :stateCancelled';\n            $params['stateCancelled'] = OrderInterface::STATE_CANCELLED;\n        }\n\n        $sql .= ' FOR UPDATE';\n\n        $count = count($this->doFetchAllAssociative($sql, $params));\n\n        if ($count >= $perCustomerUsageLimit) {\n            throw new OptimisticLockException(sprintf('Promotion coupon \"%s\" is no longer applicable.', $coupon->getCode()), $coupon);\n        }\n    }\n\n    private function decrementCouponUsage(PromotionCouponInterface $coupon): void\n    {\n        $this->doExecuteStatement(\n            'UPDATE sylius_promotion_coupon SET used = GREATEST(used - 1, 0) WHERE id = :id',\n            ['id' => $coupon->getId()]\n        );\n\n        $newUsed = (int) $this->doFetchOne(\n            'SELECT used FROM sylius_promotion_coupon WHERE id = :id',\n            ['id' => $coupon->getId()]\n        );\n\n        $coupon->setUsed($newUsed);\n    }\n\n    /** @return int Number of affected rows */\n    private function doExecuteStatement(string $sql, array $params): int\n    {\n        if (method_exists($this->connection, 'executeStatement')) {\n            return $this->connection->executeStatement($sql, $params);\n        }\n\n        return $this->connection->executeUpdate($sql, $params);\n    }\n\n    /** @return mixed|false */\n    private function doFetchOne(string $sql, array $params)\n    {\n        if (method_exists($this->connection, 'fetchOne')) {\n            return $this->connection->fetchOne($sql, $params);\n        }\n\n        return $this->connection->fetchColumn($sql, $params);\n    }\n\n    /** @return array|false */\n    private function doFetchAssociative(string $sql, array $params)\n    {\n        if (method_exists($this->connection, 'fetchAssociative')) {\n            return $this->connection->fetchAssociative($sql, $params);\n        }\n\n        return $this->connection->fetchAssoc($sql, $params);\n    }\n\n    /** @return array[] */\n    private function doFetchAllAssociative(string $sql, array $params): array\n    {\n        if (method_exists($this->connection, 'fetchAllAssociative')) {\n            return $this->connection->fetchAllAssociative($sql, $params);\n        }\n\n        return $this->connection->fetchAll($sql, $params);\n    }\n}\n```\n\n#### Step 2. Register the service\n\n**Option A:** If your app uses autowiring and supports the `#[AsDecorator]` attribute, uncomment it in the class and no further configuration is necessary.\n\n**Option B:** Manually register the service in `config/services.yaml`:\n\n```yaml\nservices:\n    App\\Modifier\\AtomicOrderPromotionsUsageModifier:\n        decorates: 'sylius.promotion_usage_modifier'\n        arguments: ['@doctrine.dbal.default_connection']\n```\n\n#### Step 3. Update exception mapping (optional)\n\nCheck if your `api_platform` configuration maps `OptimisticLockException` to a code and update it if not:\n```yaml\napi_platform:\n    ...\n    exception_to_status:\n        ...\n        Doctrine\\ORM\\OptimisticLockException: 409\n```\n\n#### Step 4. Clear cache\n\n```bash\nbin/console cache:clear\n```\n\n### Reporters\n\nWe would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability:\n- Djibril Mounkoro (@whiteov3rflow)\n- Bartłomiej Nowiński (@bnBart)\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n- Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues)\n- Email us at [security@sylius.com](mailto:security@sylius.com)",
                    "title": "github - https://api.github.com/advisories/GHSA-7mp4-25j8-hp5q"
                },
                {
                    "category": "other",
                    "text": "0.00051",
                    "title": "EPSS"
                },
                {
                    "category": "other",
                    "text": "4.8",
                    "title": "NCSC Score"
                },
                {
                    "category": "other",
                    "text": "There is product data available from source Nvd",
                    "title": "NCSC Score top increasing factors"
                },
                {
                    "category": "other",
                    "text": "Is related to (a version of) an uncommon product",
                    "title": "NCSC Score top decreasing factors"
                }
            ],
            "product_status": {
                "known_affected": [
                    "CSAFPID-5778700",
                    "CSAFPID-5778701",
                    "CSAFPID-5778702",
                    "CSAFPID-5778745",
                    "CSAFPID-5778746",
                    "CSAFPID-5778747",
                    "CSAFPID-5778748",
                    "CSAFPID-5778749",
                    "CSAFPID-5778750"
                ]
            },
            "references": [
                {
                    "category": "external",
                    "summary": "Source - nvd",
                    "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-31824"
                },
                {
                    "category": "external",
                    "summary": "Source raw - nvd",
                    "url": "https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2026-31824"
                },
                {
                    "category": "external",
                    "summary": "Source - cveprojectv5",
                    "url": "https://www.cve.org/CVERecord?id=CVE-2026-31824"
                },
                {
                    "category": "external",
                    "summary": "Source raw - cveprojectv5",
                    "url": "https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2026/31xxx/CVE-2026-31824.json"
                },
                {
                    "category": "external",
                    "summary": "Source - github",
                    "url": "https://github.com/advisories/GHSA-7mp4-25j8-hp5q"
                },
                {
                    "category": "external",
                    "summary": "Source raw - github",
                    "url": "https://api.github.com/advisories/GHSA-7mp4-25j8-hp5q"
                },
                {
                    "category": "external",
                    "summary": "Source - first",
                    "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-31824"
                },
                {
                    "category": "external",
                    "summary": "Source raw - first",
                    "url": "https://api.first.org/data/v1/epss?limit=10000&offset=0"
                },
                {
                    "category": "external",
                    "summary": "Source - github",
                    "url": "https://api.github.com/advisories/GHSA-7mp4-25j8-hp5q"
                },
                {
                    "category": "external",
                    "summary": "Source - first",
                    "url": "https://api.first.org/data/v1/epss?limit=10000&offset=0"
                },
                {
                    "category": "external",
                    "summary": "Reference - cveprojectv5; github; nvd",
                    "url": "https://github.com/Sylius/Sylius/security/advisories/GHSA-7mp4-25j8-hp5q"
                },
                {
                    "category": "external",
                    "summary": "Reference - github",
                    "url": "https://github.com/advisories/GHSA-7mp4-25j8-hp5q"
                },
                {
                    "category": "external",
                    "summary": "Reference - github",
                    "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-31824"
                }
            ],
            "scores": [
                {
                    "cvss_v3": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L",
                        "baseScore": 8.2,
                        "baseSeverity": "HIGH"
                    },
                    "products": [
                        "CSAFPID-5778700",
                        "CSAFPID-5778701",
                        "CSAFPID-5778702",
                        "CSAFPID-5778745",
                        "CSAFPID-5778746",
                        "CSAFPID-5778747",
                        "CSAFPID-5778748",
                        "CSAFPID-5778749",
                        "CSAFPID-5778750"
                    ]
                }
            ],
            "title": "CVE-2026-31824"
        }
    ]
}