{
    "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-31821",
        "tracking": {
            "current_release_date": "2026-03-20T09:32:51.010746Z",
            "generator": {
                "date": "2026-02-17T15:00:00Z",
                "engine": {
                    "name": "V.E.L.M.A",
                    "version": "1.7"
                }
            },
            "id": "CVE-2026-31821",
            "initial_release_date": "2026-03-10T21:40:01.486123Z",
            "revision_history": [
                {
                    "date": "2026-03-10T21:40:01.486123Z",
                    "number": "1",
                    "summary": "CVE created.| Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| Products connected (3).| References created (1).| CWES updated (1)."
                },
                {
                    "date": "2026-03-10T21:40:03.654019Z",
                    "number": "2",
                    "summary": "NCSC Score created."
                },
                {
                    "date": "2026-03-10T22:25:58.497082Z",
                    "number": "3",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| References created (1).| CWES updated (1)."
                },
                {
                    "date": "2026-03-10T22:26:01.174367Z",
                    "number": "4",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-11T00:53:23.146128Z",
                    "number": "5",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| References created (2).| CWES updated (1)."
                },
                {
                    "date": "2026-03-11T00:53:26.861994Z",
                    "number": "6",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-11T06:39:57.343752Z",
                    "number": "7",
                    "summary": "References created (1)."
                },
                {
                    "date": "2026-03-11T14:54:34.249259Z",
                    "number": "8",
                    "summary": "Source created.| CVE status created. (valid)| EPSS created."
                },
                {
                    "date": "2026-03-11T14:54:42.152178Z",
                    "number": "9",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-11T15:40:09.453453Z",
                    "number": "10",
                    "summary": "Unknown change."
                },
                {
                    "date": "2026-03-11T20:25:56.194564Z",
                    "number": "11",
                    "summary": "CVSS created.| Products connected (3).| Product Identifiers created (3)."
                },
                {
                    "date": "2026-03-11T20:26:02.433501Z",
                    "number": "12",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-13T06:30:46.546625Z",
                    "number": "13",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| Products created (34).| Product Identifiers created (31).| References created (2).| CWES updated (1)."
                },
                {
                    "date": "2026-03-13T06:30:53.142186Z",
                    "number": "14",
                    "summary": "NCSC Score updated."
                },
                {
                    "date": "2026-03-19T15:29:42.634860Z",
                    "number": "15",
                    "summary": "Source created.| CVE status created. (valid)| Description created for source.| CVSS created.| References created (3).| CWES updated (1)."
                },
                {
                    "date": "2026-03-20T09:32:48.271720Z",
                    "number": "16",
                    "summary": "Source connected.| CVE status created. (valid)| EPSS created."
                },
                {
                    "date": "2026-03-20T09:32:50.301879Z",
                    "number": "17",
                    "summary": "NCSC Score updated."
                }
            ],
            "status": "interim",
            "version": "17"
        }
    },
    "product_tree": {
        "branches": [
            {
                "branches": [
                    {
                        "branches": [
                            {
                                "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"
                    },
                    {
                        "branches": [
                            {
                                "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-5812419"
                                }
                            },
                            {
                                "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-5812432"
                                }
                            },
                            {
                                "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-5812436"
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.0",
                                "product": {
                                    "name": "vers:unknown/v2.0.0",
                                    "product_id": "CSAFPID-5812403",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.0"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.1",
                                "product": {
                                    "name": "vers:unknown/v2.0.1",
                                    "product_id": "CSAFPID-5812404",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.1"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.10",
                                "product": {
                                    "name": "vers:unknown/v2.0.10",
                                    "product_id": "CSAFPID-5812405",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.10"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.11",
                                "product": {
                                    "name": "vers:unknown/v2.0.11",
                                    "product_id": "CSAFPID-5812406",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.11"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.12",
                                "product": {
                                    "name": "vers:unknown/v2.0.12",
                                    "product_id": "CSAFPID-5812407",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.12"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.13",
                                "product": {
                                    "name": "vers:unknown/v2.0.13",
                                    "product_id": "CSAFPID-5812408",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.13"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.14",
                                "product": {
                                    "name": "vers:unknown/v2.0.14",
                                    "product_id": "CSAFPID-5812409",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.14"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.15",
                                "product": {
                                    "name": "vers:unknown/v2.0.15",
                                    "product_id": "CSAFPID-5812410",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.15"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.2",
                                "product": {
                                    "name": "vers:unknown/v2.0.2",
                                    "product_id": "CSAFPID-5812411",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.2"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.3",
                                "product": {
                                    "name": "vers:unknown/v2.0.3",
                                    "product_id": "CSAFPID-5812412",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.3"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.4",
                                "product": {
                                    "name": "vers:unknown/v2.0.4",
                                    "product_id": "CSAFPID-5812413",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.4"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.5",
                                "product": {
                                    "name": "vers:unknown/v2.0.5",
                                    "product_id": "CSAFPID-5812414",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.5"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.6",
                                "product": {
                                    "name": "vers:unknown/v2.0.6",
                                    "product_id": "CSAFPID-5812415",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.6"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.7",
                                "product": {
                                    "name": "vers:unknown/v2.0.7",
                                    "product_id": "CSAFPID-5812416",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.7"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.8",
                                "product": {
                                    "name": "vers:unknown/v2.0.8",
                                    "product_id": "CSAFPID-5812417",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.8"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.0.9",
                                "product": {
                                    "name": "vers:unknown/v2.0.9",
                                    "product_id": "CSAFPID-5812418",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.0.9"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.0",
                                "product": {
                                    "name": "vers:unknown/v2.1.0",
                                    "product_id": "CSAFPID-5812420",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.0"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.1",
                                "product": {
                                    "name": "vers:unknown/v2.1.1",
                                    "product_id": "CSAFPID-5812421",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.1"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.10",
                                "product": {
                                    "name": "vers:unknown/v2.1.10",
                                    "product_id": "CSAFPID-5812422",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.10"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.11",
                                "product": {
                                    "name": "vers:unknown/v2.1.11",
                                    "product_id": "CSAFPID-5812423",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.11"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.2",
                                "product": {
                                    "name": "vers:unknown/v2.1.2",
                                    "product_id": "CSAFPID-5812424",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.2"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.3",
                                "product": {
                                    "name": "vers:unknown/v2.1.3",
                                    "product_id": "CSAFPID-5812425",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.3"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.4",
                                "product": {
                                    "name": "vers:unknown/v2.1.4",
                                    "product_id": "CSAFPID-5812426",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.4"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.5",
                                "product": {
                                    "name": "vers:unknown/v2.1.5",
                                    "product_id": "CSAFPID-5812427",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.5"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.6",
                                "product": {
                                    "name": "vers:unknown/v2.1.6",
                                    "product_id": "CSAFPID-5812428",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.6"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.7",
                                "product": {
                                    "name": "vers:unknown/v2.1.7",
                                    "product_id": "CSAFPID-5812429",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.7"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.8",
                                "product": {
                                    "name": "vers:unknown/v2.1.8",
                                    "product_id": "CSAFPID-5812430",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.8"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.1.9",
                                "product": {
                                    "name": "vers:unknown/v2.1.9",
                                    "product_id": "CSAFPID-5812431",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.1.9"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.2.0",
                                "product": {
                                    "name": "vers:unknown/v2.2.0",
                                    "product_id": "CSAFPID-5812433",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.2.0"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.2.1",
                                "product": {
                                    "name": "vers:unknown/v2.2.1",
                                    "product_id": "CSAFPID-5812434",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.2.1"
                                    }
                                }
                            },
                            {
                                "category": "product_version_range",
                                "name": "vers:unknown/v2.2.2",
                                "product": {
                                    "name": "vers:unknown/v2.2.2",
                                    "product_id": "CSAFPID-5812435",
                                    "product_identification_helper": {
                                        "purl": "pkg:composer/sylius/sylius@v2.2.2"
                                    }
                                }
                            }
                        ],
                        "category": "product_name",
                        "name": "sylius"
                    }
                ],
                "category": "vendor",
                "name": "Sylius"
            }
        ]
    },
    "vulnerabilities": [
        {
            "cve": "CVE-2026-31821",
            "cwe": {
                "id": "CWE-862",
                "name": "Missing Authorization"
            },
            "notes": [
                {
                    "category": "description",
                    "text": "### Impact\nThe `POST /api/v2/shop/orders/{tokenValue}/items` endpoint does not verify cart ownership. An unauthenticated attacker can add items to other registered customers' carts by knowing the cart `tokenValue`.\n\n```\nPOST /api/v2/shop/orders/{tokenValue}/items\n```\n\nOther mutation endpoints (PUT, PATCH, DELETE) are **not affected**. API Platform loads the Order entity through the state provider for these operations, which triggers `VisitorBasedExtension` and returns 404 for unauthorized users.\n\nAn attacker who obtains a cart `tokenValue` can add arbitrary items to another customer's cart. The endpoint returns the full cart representation in the response (HTTP 201), potentially leaking:\n\n- Customer email address\n- Cart contents (products, quantities, prices)\n- Address data (billing and shipping if set)\n- Payment and shipment IDs\n- Order totals and tax breakdown\n- Checkout state\n\n### Patches\nThe issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3, and above.\n\n### Workarounds\nAdd an ownership check in `AddItemToCartHandler` by injecting `UserContextInterface` and verifying the current user matches the cart owner before adding items.\n\n#### Step 1. Patch the handler\n\nCreate new  `src/CommandHandler/Cart/AddItemToCartHandler.php`:\n\n```php\n<?php\n\ndeclare(strict_types=1);\n\nnamespace App\\CommandHandler\\Cart;\n\nuse Sylius\\Bundle\\ApiBundle\\Command\\Cart\\AddItemToCart;\nuse Sylius\\Bundle\\ApiBundle\\Context\\UserContextInterface;\nuse Sylius\\Component\\Core\\Factory\\CartItemFactoryInterface;\nuse Sylius\\Component\\Core\\Model\\OrderInterface;\nuse Sylius\\Component\\Core\\Model\\OrderItemInterface;\nuse Sylius\\Component\\Core\\Model\\ProductVariantInterface;\nuse Sylius\\Component\\Core\\Model\\ShopUserInterface;\nuse Sylius\\Component\\Core\\Repository\\OrderRepositoryInterface;\nuse Sylius\\Component\\Core\\Repository\\ProductVariantRepositoryInterface;\nuse Sylius\\Component\\Order\\Modifier\\OrderItemQuantityModifierInterface;\nuse Sylius\\Component\\Order\\Modifier\\OrderModifierInterface;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\nuse Symfony\\Component\\Messenger\\Attribute\\AsMessageHandler;\n\n#[AsMessageHandler]\nfinal readonly class AddItemToCartHandler\n{\n    public function __construct(\n        private OrderRepositoryInterface $orderRepository,\n        private ProductVariantRepositoryInterface $productVariantRepository,\n        private OrderModifierInterface $orderModifier,\n        private CartItemFactoryInterface $cartItemFactory,\n        private OrderItemQuantityModifierInterface $orderItemQuantityModifier,\n        private UserContextInterface $userContext,\n    ) {\n    }\n\n    public function __invoke(AddItemToCart $addItemToCart): OrderInterface\n    {\n        /** @var ProductVariantInterface|null $productVariant */\n        $productVariant = $this->productVariantRepository->findOneBy(['code' => $addItemToCart->productVariantCode]);\n\n        if ($productVariant === null) {\n            throw new \\InvalidArgumentException('Product variant with given code has not been found.');\n        }\n\n        /** @var OrderInterface|null $cart */\n        $cart = $this->orderRepository->findCartByTokenValue($addItemToCart->orderTokenValue);\n\n        if ($cart === null) {\n            throw new \\InvalidArgumentException('Cart with given token has not been found.');\n        }\n\n        $this->assertCartAccessible($cart);\n\n        /** @var OrderItemInterface $cartItem */\n        $cartItem = $this->cartItemFactory->createNew();\n        $cartItem->setVariant($productVariant);\n\n        $this->orderItemQuantityModifier->modify($cartItem, $addItemToCart->quantity);\n        $this->orderModifier->addToOrder($cart, $cartItem);\n\n        return $cart;\n    }\n\n    private function assertCartAccessible(OrderInterface $cart): void\n    {\n        if ($cart->isCreatedByGuest()) {\n            return;\n        }\n\n        $cartCustomer = $cart->getCustomer();\n\n        if (null === $cartCustomer || null === $cartCustomer->getUser()) {\n            return;\n        }\n\n        $currentUser = $this->userContext->getUser();\n\n        if (\n            $currentUser instanceof ShopUserInterface\n            && $currentUser->getCustomer()?->getId() === $cartCustomer->getId()\n        ) {\n            return;\n        }\n\n        throw new NotFoundHttpException('Cart not found.');\n    }\n}\n```\n\n#### Step 2. Override the service\n\n```diff\n# config/services.yaml\n\nservices:\n    App\\:\n        resource: '../src/*'\n-       exclude: '../src/{Entity,Kernel.php}'                                                                         \n+       exclude: '../src/{Entity,Kernel.php,CommandHandler}'\n\n    sylius_api.command_handler.cart.add_item_to_cart:\n        class: App\\CommandHandler\\Cart\\AddItemToCartHandler\n        arguments:\n            $orderRepository: '@sylius.repository.order'\n            $productVariantRepository: '@sylius.repository.product_variant'\n            $orderModifier: '@sylius.modifier.order'\n            $cartItemFactory: '@sylius.factory.order_item'\n            $orderItemQuantityModifier: '@sylius.modifier.order_item_quantity'\n            $userContext: '@Sylius\\Bundle\\ApiBundle\\Context\\UserContextInterface'\n        tags:\n            - { name: messenger.message_handler, bus: sylius.command_bus }\n```\n\n#### Step 3. 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- @rokorolov\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n- Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen)\n- Email us at [security@sylius.com](mailto:security@sylius.com)",
                    "title": "github - https://api.github.com/advisories/GHSA-wjmg-4cq5-m8hg"
                },
                {
                    "category": "description",
                    "text": "Sylius is an Open Source eCommerce Framework on Symfony. The POST /api/v2/shop/orders/{tokenValue}/items endpoint does not verify cart ownership. An unauthenticated attacker can add items to other registered customers' carts by knowing the cart tokenValue. An attacker who obtains a cart tokenValue can add arbitrary items to another customer's cart. The endpoint returns the full cart representation in the response (HTTP 201). The issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3 and above.",
                    "title": "cveprojectv5 - https://www.cve.org/CVERecord?id=CVE-2026-31821"
                },
                {
                    "category": "description",
                    "text": "Sylius is an Open Source eCommerce Framework on Symfony. The POST /api/v2/shop/orders/{tokenValue}/items endpoint does not verify cart ownership. An unauthenticated attacker can add items to other registered customers' carts by knowing the cart tokenValue. An attacker who obtains a cart tokenValue can add arbitrary items to another customer's cart. The endpoint returns the full cart representation in the response (HTTP 201). The issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3 and above.",
                    "title": "nvd - https://nvd.nist.gov/vuln/detail/CVE-2026-31821"
                },
                {
                    "category": "description",
                    "text": "### Impact\nThe `POST /api/v2/shop/orders/{tokenValue}/items` endpoint does not verify cart ownership. An unauthenticated attacker can add items to other registered customers' carts by knowing the cart `tokenValue`.\n\n```\nPOST /api/v2/shop/orders/{tokenValue}/items\n```\n\nOther mutation endpoints (PUT, PATCH, DELETE) are **not affected**. API Platform loads the Order entity through the state provider for these operations, which triggers `VisitorBasedExtension` and returns 404 for unauthorized users.\n\nAn attacker who obtains a cart `tokenValue` can add arbitrary items to another customer's cart. The endpoint returns the full cart representation in the response (HTTP 201), potentially leaking:\n\n- Customer email address\n- Cart contents (products, quantities, prices)\n- Address data (billing and shipping if set)\n- Payment and shipment IDs\n- Order totals and tax breakdown\n- Checkout state\n\n### Patches\nThe issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3, and above.\n\n### Workarounds\nAdd an ownership check in `AddItemToCartHandler` by injecting `UserContextInterface` and verifying the current user matches the cart owner before adding items.\n\n#### Step 1. Patch the handler\n\nCreate new  `src/CommandHandler/Cart/AddItemToCartHandler.php`:\n\n```php\n<?php\n\ndeclare(strict_types=1);\n\nnamespace App\\CommandHandler\\Cart;\n\nuse Sylius\\Bundle\\ApiBundle\\Command\\Cart\\AddItemToCart;\nuse Sylius\\Bundle\\ApiBundle\\Context\\UserContextInterface;\nuse Sylius\\Component\\Core\\Factory\\CartItemFactoryInterface;\nuse Sylius\\Component\\Core\\Model\\OrderInterface;\nuse Sylius\\Component\\Core\\Model\\OrderItemInterface;\nuse Sylius\\Component\\Core\\Model\\ProductVariantInterface;\nuse Sylius\\Component\\Core\\Model\\ShopUserInterface;\nuse Sylius\\Component\\Core\\Repository\\OrderRepositoryInterface;\nuse Sylius\\Component\\Core\\Repository\\ProductVariantRepositoryInterface;\nuse Sylius\\Component\\Order\\Modifier\\OrderItemQuantityModifierInterface;\nuse Sylius\\Component\\Order\\Modifier\\OrderModifierInterface;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\nuse Symfony\\Component\\Messenger\\Attribute\\AsMessageHandler;\n\n#[AsMessageHandler]\nfinal readonly class AddItemToCartHandler\n{\n    public function __construct(\n        private OrderRepositoryInterface $orderRepository,\n        private ProductVariantRepositoryInterface $productVariantRepository,\n        private OrderModifierInterface $orderModifier,\n        private CartItemFactoryInterface $cartItemFactory,\n        private OrderItemQuantityModifierInterface $orderItemQuantityModifier,\n        private UserContextInterface $userContext,\n    ) {\n    }\n\n    public function __invoke(AddItemToCart $addItemToCart): OrderInterface\n    {\n        /** @var ProductVariantInterface|null $productVariant */\n        $productVariant = $this->productVariantRepository->findOneBy(['code' => $addItemToCart->productVariantCode]);\n\n        if ($productVariant === null) {\n            throw new \\InvalidArgumentException('Product variant with given code has not been found.');\n        }\n\n        /** @var OrderInterface|null $cart */\n        $cart = $this->orderRepository->findCartByTokenValue($addItemToCart->orderTokenValue);\n\n        if ($cart === null) {\n            throw new \\InvalidArgumentException('Cart with given token has not been found.');\n        }\n\n        $this->assertCartAccessible($cart);\n\n        /** @var OrderItemInterface $cartItem */\n        $cartItem = $this->cartItemFactory->createNew();\n        $cartItem->setVariant($productVariant);\n\n        $this->orderItemQuantityModifier->modify($cartItem, $addItemToCart->quantity);\n        $this->orderModifier->addToOrder($cart, $cartItem);\n\n        return $cart;\n    }\n\n    private function assertCartAccessible(OrderInterface $cart): void\n    {\n        if ($cart->isCreatedByGuest()) {\n            return;\n        }\n\n        $cartCustomer = $cart->getCustomer();\n\n        if (null === $cartCustomer || null === $cartCustomer->getUser()) {\n            return;\n        }\n\n        $currentUser = $this->userContext->getUser();\n\n        if (\n            $currentUser instanceof ShopUserInterface\n            && $currentUser->getCustomer()?->getId() === $cartCustomer->getId()\n        ) {\n            return;\n        }\n\n        throw new NotFoundHttpException('Cart not found.');\n    }\n}\n```\n\n#### Step 2. Override the service\n\n```diff\n# config/services.yaml\n\nservices:\n    App\\:\n        resource: '../src/*'\n-       exclude: '../src/{Entity,Kernel.php}'                                                                         \n+       exclude: '../src/{Entity,Kernel.php,CommandHandler}'\n\n    sylius_api.command_handler.cart.add_item_to_cart:\n        class: App\\CommandHandler\\Cart\\AddItemToCartHandler\n        arguments:\n            $orderRepository: '@sylius.repository.order'\n            $productVariantRepository: '@sylius.repository.product_variant'\n            $orderModifier: '@sylius.modifier.order'\n            $cartItemFactory: '@sylius.factory.order_item'\n            $orderItemQuantityModifier: '@sylius.modifier.order_item_quantity'\n            $userContext: '@Sylius\\Bundle\\ApiBundle\\Context\\UserContextInterface'\n        tags:\n            - { name: messenger.message_handler, bus: sylius.command_bus }\n```\n\n#### Step 3. 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- @rokorolov\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n- Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen)\n- Email us at [security@sylius.com](mailto:security@sylius.com)",
                    "title": "github - https://github.com/advisories/GHSA-wjmg-4cq5-m8hg"
                },
                {
                    "category": "description",
                    "text": "### Impact\nThe `POST /api/v2/shop/orders/{tokenValue}/items` endpoint does not verify cart ownership. An unauthenticated attacker can add items to other registered customers' carts by knowing the cart `tokenValue`.\n\n```\nPOST /api/v2/shop/orders/{tokenValue}/items\n```\n\nOther mutation endpoints (PUT, PATCH, DELETE) are **not affected**. API Platform loads the Order entity through the state provider for these operations, which triggers `VisitorBasedExtension` and returns 404 for unauthorized users.\n\nAn attacker who obtains a cart `tokenValue` can add arbitrary items to another customer's cart. The endpoint returns the full cart representation in the response (HTTP 201), potentially leaking:\n\n- Customer email address\n- Cart contents (products, quantities, prices)\n- Address data (billing and shipping if set)\n- Payment and shipment IDs\n- Order totals and tax breakdown\n- Checkout state\n\n### Patches\nThe issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3, and above.\n\n### Workarounds\nAdd an ownership check in `AddItemToCartHandler` by injecting `UserContextInterface` and verifying the current user matches the cart owner before adding items.\n\n#### Step 1. Patch the handler\n\nCreate new  `src/CommandHandler/Cart/AddItemToCartHandler.php`:\n\n```php\n<?php\n\ndeclare(strict_types=1);\n\nnamespace App\\CommandHandler\\Cart;\n\nuse Sylius\\Bundle\\ApiBundle\\Command\\Cart\\AddItemToCart;\nuse Sylius\\Bundle\\ApiBundle\\Context\\UserContextInterface;\nuse Sylius\\Component\\Core\\Factory\\CartItemFactoryInterface;\nuse Sylius\\Component\\Core\\Model\\OrderInterface;\nuse Sylius\\Component\\Core\\Model\\OrderItemInterface;\nuse Sylius\\Component\\Core\\Model\\ProductVariantInterface;\nuse Sylius\\Component\\Core\\Model\\ShopUserInterface;\nuse Sylius\\Component\\Core\\Repository\\OrderRepositoryInterface;\nuse Sylius\\Component\\Core\\Repository\\ProductVariantRepositoryInterface;\nuse Sylius\\Component\\Order\\Modifier\\OrderItemQuantityModifierInterface;\nuse Sylius\\Component\\Order\\Modifier\\OrderModifierInterface;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\nuse Symfony\\Component\\Messenger\\Attribute\\AsMessageHandler;\n\n#[AsMessageHandler]\nfinal readonly class AddItemToCartHandler\n{\n    public function __construct(\n        private OrderRepositoryInterface $orderRepository,\n        private ProductVariantRepositoryInterface $productVariantRepository,\n        private OrderModifierInterface $orderModifier,\n        private CartItemFactoryInterface $cartItemFactory,\n        private OrderItemQuantityModifierInterface $orderItemQuantityModifier,\n        private UserContextInterface $userContext,\n    ) {\n    }\n\n    public function __invoke(AddItemToCart $addItemToCart): OrderInterface\n    {\n        /** @var ProductVariantInterface|null $productVariant */\n        $productVariant = $this->productVariantRepository->findOneBy(['code' => $addItemToCart->productVariantCode]);\n\n        if ($productVariant === null) {\n            throw new \\InvalidArgumentException('Product variant with given code has not been found.');\n        }\n\n        /** @var OrderInterface|null $cart */\n        $cart = $this->orderRepository->findCartByTokenValue($addItemToCart->orderTokenValue);\n\n        if ($cart === null) {\n            throw new \\InvalidArgumentException('Cart with given token has not been found.');\n        }\n\n        $this->assertCartAccessible($cart);\n\n        /** @var OrderItemInterface $cartItem */\n        $cartItem = $this->cartItemFactory->createNew();\n        $cartItem->setVariant($productVariant);\n\n        $this->orderItemQuantityModifier->modify($cartItem, $addItemToCart->quantity);\n        $this->orderModifier->addToOrder($cart, $cartItem);\n\n        return $cart;\n    }\n\n    private function assertCartAccessible(OrderInterface $cart): void\n    {\n        if ($cart->isCreatedByGuest()) {\n            return;\n        }\n\n        $cartCustomer = $cart->getCustomer();\n\n        if (null === $cartCustomer || null === $cartCustomer->getUser()) {\n            return;\n        }\n\n        $currentUser = $this->userContext->getUser();\n\n        if (\n            $currentUser instanceof ShopUserInterface\n            && $currentUser->getCustomer()?->getId() === $cartCustomer->getId()\n        ) {\n            return;\n        }\n\n        throw new NotFoundHttpException('Cart not found.');\n    }\n}\n```\n\n#### Step 2. Override the service\n\n```diff\n# config/services.yaml\n\nservices:\n    App\\:\n        resource: '../src/*'\n-       exclude: '../src/{Entity,Kernel.php}'                                                                         \n+       exclude: '../src/{Entity,Kernel.php,CommandHandler}'\n\n    sylius_api.command_handler.cart.add_item_to_cart:\n        class: App\\CommandHandler\\Cart\\AddItemToCartHandler\n        arguments:\n            $orderRepository: '@sylius.repository.order'\n            $productVariantRepository: '@sylius.repository.product_variant'\n            $orderModifier: '@sylius.modifier.order'\n            $cartItemFactory: '@sylius.factory.order_item'\n            $orderItemQuantityModifier: '@sylius.modifier.order_item_quantity'\n            $userContext: '@Sylius\\Bundle\\ApiBundle\\Context\\UserContextInterface'\n        tags:\n            - { name: messenger.message_handler, bus: sylius.command_bus }\n```\n\n#### Step 3. 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- @rokorolov\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n- Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen)\n- Email us at [security@sylius.com](mailto:security@sylius.com)",
                    "title": "osv - https://www.googleapis.com/download/storage/v1/b/osv-vulnerabilities/o/Packagist%2FGHSA-wjmg-4cq5-m8hg.json?alt=media"
                },
                {
                    "category": "other",
                    "text": "0.00074",
                    "title": "EPSS"
                },
                {
                    "category": "other",
                    "text": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N",
                    "title": "CVSSV4"
                },
                {
                    "category": "other",
                    "text": "6.9",
                    "title": "CVSSV4 base score"
                },
                {
                    "category": "other",
                    "text": "4.3",
                    "title": "NCSC Score"
                },
                {
                    "category": "other",
                    "text": "The value of the most recent CVSS (V3) score, The value of the most recent EPSS score, 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-5812403",
                    "CSAFPID-5812404",
                    "CSAFPID-5812405",
                    "CSAFPID-5812406",
                    "CSAFPID-5812407",
                    "CSAFPID-5812408",
                    "CSAFPID-5812409",
                    "CSAFPID-5812410",
                    "CSAFPID-5812411",
                    "CSAFPID-5812412",
                    "CSAFPID-5812413",
                    "CSAFPID-5812414",
                    "CSAFPID-5812415",
                    "CSAFPID-5812416",
                    "CSAFPID-5812417",
                    "CSAFPID-5812418",
                    "CSAFPID-5812419",
                    "CSAFPID-5812420",
                    "CSAFPID-5812421",
                    "CSAFPID-5812422",
                    "CSAFPID-5812423",
                    "CSAFPID-5812424",
                    "CSAFPID-5812425",
                    "CSAFPID-5812426",
                    "CSAFPID-5812427",
                    "CSAFPID-5812428",
                    "CSAFPID-5812429",
                    "CSAFPID-5812430",
                    "CSAFPID-5812431",
                    "CSAFPID-5812432",
                    "CSAFPID-5812433",
                    "CSAFPID-5812434",
                    "CSAFPID-5812435",
                    "CSAFPID-5812436"
                ]
            },
            "references": [
                {
                    "category": "external",
                    "summary": "Source - cveprojectv5",
                    "url": "https://www.cve.org/CVERecord?id=CVE-2026-31821"
                },
                {
                    "category": "external",
                    "summary": "Source raw - cveprojectv5",
                    "url": "https://raw.githubusercontent.com/CVEProject/cvelistV5/main/cves/2026/31xxx/CVE-2026-31821.json"
                },
                {
                    "category": "external",
                    "summary": "Source - nvd",
                    "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-31821"
                },
                {
                    "category": "external",
                    "summary": "Source raw - nvd",
                    "url": "https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2026-31821"
                },
                {
                    "category": "external",
                    "summary": "Source - github",
                    "url": "https://github.com/advisories/GHSA-wjmg-4cq5-m8hg"
                },
                {
                    "category": "external",
                    "summary": "Source raw - github",
                    "url": "https://api.github.com/advisories/GHSA-wjmg-4cq5-m8hg"
                },
                {
                    "category": "external",
                    "summary": "Source - first",
                    "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-31821"
                },
                {
                    "category": "external",
                    "summary": "Source raw - first",
                    "url": "https://api.first.org/data/v1/epss?limit=10000&offset=0"
                },
                {
                    "category": "external",
                    "summary": "Source - osv",
                    "url": "https://www.googleapis.com/download/storage/v1/b/osv-vulnerabilities/o/Packagist%2FGHSA-wjmg-4cq5-m8hg.json?alt=media"
                },
                {
                    "category": "external",
                    "summary": "Source - github",
                    "url": "https://api.github.com/advisories/GHSA-wjmg-4cq5-m8hg"
                },
                {
                    "category": "external",
                    "summary": "Source - first",
                    "url": "https://api.first.org/data/v1/epss?limit=10000&offset=0"
                },
                {
                    "category": "external",
                    "summary": "Reference - cveprojectv5; github; nvd; osv",
                    "url": "https://github.com/Sylius/Sylius/security/advisories/GHSA-wjmg-4cq5-m8hg"
                },
                {
                    "category": "external",
                    "summary": "Reference - github",
                    "url": "https://github.com/advisories/GHSA-wjmg-4cq5-m8hg"
                },
                {
                    "category": "external",
                    "summary": "Reference - github; osv",
                    "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-31821"
                }
            ],
            "scores": [
                {
                    "cvss_v3": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N",
                        "baseScore": 5.3,
                        "baseSeverity": "MEDIUM"
                    },
                    "products": [
                        "CSAFPID-5778700",
                        "CSAFPID-5778701",
                        "CSAFPID-5778702",
                        "CSAFPID-5812403",
                        "CSAFPID-5812404",
                        "CSAFPID-5812405",
                        "CSAFPID-5812406",
                        "CSAFPID-5812407",
                        "CSAFPID-5812408",
                        "CSAFPID-5812409",
                        "CSAFPID-5812410",
                        "CSAFPID-5812411",
                        "CSAFPID-5812412",
                        "CSAFPID-5812413",
                        "CSAFPID-5812414",
                        "CSAFPID-5812415",
                        "CSAFPID-5812416",
                        "CSAFPID-5812417",
                        "CSAFPID-5812418",
                        "CSAFPID-5812419",
                        "CSAFPID-5812420",
                        "CSAFPID-5812421",
                        "CSAFPID-5812422",
                        "CSAFPID-5812423",
                        "CSAFPID-5812424",
                        "CSAFPID-5812425",
                        "CSAFPID-5812426",
                        "CSAFPID-5812427",
                        "CSAFPID-5812428",
                        "CSAFPID-5812429",
                        "CSAFPID-5812430",
                        "CSAFPID-5812431",
                        "CSAFPID-5812432",
                        "CSAFPID-5812433",
                        "CSAFPID-5812434",
                        "CSAFPID-5812435",
                        "CSAFPID-5812436"
                    ]
                }
            ],
            "title": "CVE-2026-31821"
        }
    ]
}