Where
-Infinity
0
Severity
8.7
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Sylius versions before 2.1.16 and 2.2.9 fail to validate payment amounts during cart recalculation, allowing unauthenticated attackers to modify order totals after gateway transaction initiation. Attackers can pay a small amount, enlarge the order after gateway capture, and have the system mark the inflated order as fully paid while the gateway captured only the original amount.

First published (updated )
Severity
8.7
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Sylius versions before 1.12.25, 1.13.17, 1.14.20, 2.1.16, and 2.2.9 fail to include firewall identification in JWT tokens issued by separate Admin and Shop API endpoints. Attackers can register a shop customer account using an administrator's email address and obtain a token that the Admin API resolves to that administrator, granting full administrative access.

First published (updated )
Severity
8.7
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Sylius versions before 1.12.25, 1.13.17, 1.14.20, 2.1.16, and 2.2.9 build administrator password-reset links using the request Host header without validation, allowing unauthenticated attackers to redirect reset tokens to attacker-controlled domains. Attackers can request password resets for known administrator email addresses with forged Host headers to intercept valid reset tokens and take over administrator accounts.

First published (updated )
Severity
8.2
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N

Sylius versions before 2.1.16 and 2.2.9 fail to restrict payment request actions in the Shop API endpoint, allowing customers to trigger refunds on completed orders. Attackers with order tokens can submit arbitrary payment actions like refunds that payment gateways execute while Sylius maintains order as paid, causing financial loss.

First published (updated )
Severity
5.3
EPSS
0.04%
SQL Injection
AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

Impact Sylius API filters ProductPriceOrderFilter and TranslationOrderNameAndLocaleFilter pass user-supplied order direction values directly to Doctrine's orderBy() without validation. An attacker can inject arbitrary DQL:

GET /api/v2/shop/products?order[price]=ASC,%20variant.code%20DESC

Patches 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.

Workarounds

An EventSubscriber that sanitizes order query parameters only on API routes before they reach the vulnerable filters.

The subscriber accepts an $apiRoute constructor parameter (default /api/v2) and skips non-API requests entirely — so there is zero overhead on shop/admin page requests.

This follows the same pattern used by Sylius's own KernelRequestEventSubscriber (src/Sylius/Bundle/ApiBundle/EventSubscriber/KernelRequestEventSubscriber.php), which also uses strcontains($pathInfo, $this->apiRoute) to scope logic to API routes.

---

Step 1 — Create the EventSubscriber

src/EventSubscriber/SanitizeOrderDirectionSubscriber.php:

php <?php

declare(stricttypes=1);

namespace App\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents;

final class SanitizeOrderDirectionSubscriber implements EventSubscriberInterface { private const ALLOWEDDIRECTIONS = ['asc', 'desc'];

public function construct( private string $apiRoute, ) { }

public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => ['sanitizeOrderParameters', 64], ]; }

public function sanitizeOrderParameters(RequestEvent $event): void { if (!strcontains($event->getRequest()->getPathInfo(), $this->apiRoute)) { return; }

$request = $event->getRequest();

/ @var mixed $order / $order = $request->query->all()['order'] ?? null; if (!isarray($order)) { return; }

$needsSanitization = false; $sanitized = []; foreach ($order as $field => $direction) { if (isstring($direction) && inarray(strtolower($direction), self::ALLOWEDDIRECTIONS, true)) { $sanitized[$field] = $direction; } else { $needsSanitization = true; } }

if (!$needsSanitization) { return; }

$all = $request->query->all(); $all['order'] = $sanitized; $request->query->replace($all);

$request->server->set('QUERYSTRING', httpbuildquery($all)); $request->attributes->set('apifilters', $all); } }

Step 2 — Register the service

Option A — If your config/services.yaml already has App\ autowiring (Symfony default):

yaml Nothing to do — autoconfigure picks up EventSubscriberInterface automatically. Optionally bind the API route prefix: services: App\EventSubscriber\SanitizeOrderDirectionSubscriber: arguments: $apiRoute: '%sylius.security.newapiroute%'

Option B — If there is no App\ autowiring:

yaml services: App\EventSubscriber\SanitizeOrderDirectionSubscriber: arguments: $apiRoute: '%sylius.security.newapiroute%' tags: ['kernel.eventsubscriber']

Using %sylius.security.newapiroute% ties the subscriber to the same prefix Sylius uses (/api/v2 by default). If the parameter is not available, hardcode '/api/v2' instead.

Step 3 — Clear cache

bash bin/console cache:clear

Reporters

We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability: - Chris Alupului (@Neosprings) - Bartłomiej Nowiński (@bnBart)

For more information If you have any questions or comments about this advisory:

- Open an issue in Sylius issues - Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
8.2
EPSS
0.05%
Race Condition
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L

Impact 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 three independent limits:

1. Promotion usage limit - the global used counter on Promotion entities 2. Coupon usage limit - the global used counter on PromotionCoupon entities 3. 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.

Patches 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.

Workarounds

Decoration of the OrderPromotionsUsageModifier service to use atomic operations based on actual database-synchronized values.

The decorated service id in Sylius >=2.0 is sylius.modifier.promotion.orderusage, while <2.0 it's sylius.promotionusagemodifier; The following instruction uses the latter, but it needs to be changed depending on the Sylius version.

Step 1. Create the decorator service

src/Modifier/AtomicOrderPromotionsUsageModifier.php:

php <?php

declare(stricttypes=1);

namespace App\Modifier;

use Doctrine\DBAL\Connection; use Doctrine\ORM\OptimisticLockException; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\PromotionCouponInterface; use Sylius\Component\Core\Promotion\Modifier\OrderPromotionsUsageModifierInterface; use Sylius\Component\Promotion\Model\PromotionInterface; // use Symfony\Component\DependencyInjection\Attribute\AsDecorator;

// #[AsDecorator(decorates: 'sylius.promotionusagemodifier')] final class AtomicOrderPromotionsUsageModifier implements OrderPromotionsUsageModifierInterface { / @var Connection / private $connection;

public function construct(Connection $connection) { $this->connection = $connection; }

public function increment(OrderInterface $order): void { foreach ($order->getPromotions() as $promotion) { $this->incrementPromotionUsage($promotion); }

/ @var PromotionCouponInterface|null $coupon / $coupon = $order->getPromotionCoupon(); if (null === $coupon) { return; }

$this->incrementCouponUsage($coupon, $order); }

public function decrement(OrderInterface $order): void { foreach ($order->getPromotions() as $promotion) { $this->decrementPromotionUsage($promotion); }

/ @var PromotionCouponInterface|null $coupon / $coupon = $order->getPromotionCoupon(); if (null === $coupon) { return; }

if (OrderInterface::STATECANCELLED === $order->getState() && !$coupon->isReusableFromCancelledOrders()) { return; }

$this->decrementCouponUsage($coupon); }

private function incrementPromotionUsage(PromotionInterface $promotion): void { $affected = $this->doExecuteStatement( 'UPDATE syliuspromotion SET used = used + 1 WHERE id = :id AND (usagelimit IS NULL OR used < usagelimit)', ['id' => $promotion->getId()] );

if (0 === $affected) { throw new OptimisticLockException(sprintf('Promotion "%s" is no longer applicable.', $promotion->getCode()), $promotion); }

$newUsed = (int) $this->doFetchOne( 'SELECT used FROM syliuspromotion WHERE id = :id', ['id' => $promotion->getId()] );

$promotion->setUsed($newUsed); }

private function decrementPromotionUsage(PromotionInterface $promotion): void { $this->doExecuteStatement( 'UPDATE syliuspromotion SET used = GREATEST(used - 1, 0) WHERE id = :id', ['id' => $promotion->getId()] );

$newUsed = (int) $this->doFetchOne( 'SELECT used FROM syliuspromotion WHERE id = :id', ['id' => $promotion->getId()] );

$promotion->setUsed($newUsed); }

private function incrementCouponUsage(PromotionCouponInterface $coupon, OrderInterface $order): void { $row = $this->doFetchAssociative( 'SELECT used, usagelimit, percustomerusagelimit FROM syliuspromotioncoupon WHERE id = :id FOR UPDATE', ['id' => $coupon->getId()] );

if (false === $row) { throw new OptimisticLockException(sprintf('Promotion coupon "%s" is no longer applicable.', $coupon->getCode()), $coupon); }

if (null !== $row['usagelimit'] && (int) $row['used'] >= (int) $row['usagelimit']) { throw new OptimisticLockException(sprintf('Promotion coupon "%s" is no longer applicable.', $coupon->getCode()), $coupon); }

if (null !== $row['percustomerusagelimit']) { $this->assertPerCustomerCouponUsageLimitNotReached( $coupon, $order, (int) $row['percustomerusagelimit'] ); }

$this->doExecuteStatement( 'UPDATE syliuspromotioncoupon SET used = used + 1 WHERE id = :id', ['id' => $coupon->getId()] );

$coupon->setUsed((int) $row['used'] + 1); }

private function assertPerCustomerCouponUsageLimitNotReached( PromotionCouponInterface $coupon, OrderInterface $order, int $perCustomerUsageLimit ): void { $customer = $order->getCustomer(); if (null === $customer || null === $customer->getId()) { return; }

$sql = 'SELECT o.id FROM syliusorder o WHERE o.customerid = :customerId AND o.promotioncouponid = :couponId AND o.state != :stateCart'; $params = [ 'customerId' => $customer->getId(), 'couponId' => $coupon->getId(), 'stateCart' => OrderInterface::STATECART, ];

if ($coupon->isReusableFromCancelledOrders()) { $sql .= ' AND o.state != :stateCancelled'; $params['stateCancelled'] = OrderInterface::STATECANCELLED; }

$sql .= ' FOR UPDATE';

$count = count($this->doFetchAllAssociative($sql, $params));

if ($count >= $perCustomerUsageLimit) { throw new OptimisticLockException(sprintf('Promotion coupon "%s" is no longer applicable.', $coupon->getCode()), $coupon); } }

private function decrementCouponUsage(PromotionCouponInterface $coupon): void { $this->doExecuteStatement( 'UPDATE syliuspromotioncoupon SET used = GREATEST(used - 1, 0) WHERE id = :id', ['id' => $coupon->getId()] );

$newUsed = (int) $this->doFetchOne( 'SELECT used FROM syliuspromotioncoupon WHERE id = :id', ['id' => $coupon->getId()] );

$coupon->setUsed($newUsed); }

/ @return int Number of affected rows / private function doExecuteStatement(string $sql, array $params): int { if (methodexists($this->connection, 'executeStatement')) { return $this->connection->executeStatement($sql, $params); }

return $this->connection->executeUpdate($sql, $params); }

/ @return mixed|false / private function doFetchOne(string $sql, array $params) { if (methodexists($this->connection, 'fetchOne')) { return $this->connection->fetchOne($sql, $params); }

return $this->connection->fetchColumn($sql, $params); }

/ @return array|false / private function doFetchAssociative(string $sql, array $params) { if (methodexists($this->connection, 'fetchAssociative')) { return $this->connection->fetchAssociative($sql, $params); }

return $this->connection->fetchAssoc($sql, $params); }

/ @return array[] / private function doFetchAllAssociative(string $sql, array $params): array { if (methodexists($this->connection, 'fetchAllAssociative')) { return $this->connection->fetchAllAssociative($sql, $params); }

return $this->connection->fetchAll($sql, $params); } }

Step 2. Register the service

Option A: If your app uses autowiring and supports the #[AsDecorator] attribute, uncomment it in the class and no further configuration is necessary.

Option B: Manually register the service in config/services.yaml:

yaml services: App\Modifier\AtomicOrderPromotionsUsageModifier: decorates: 'sylius.promotionusagemodifier' arguments: ['@doctrine.dbal.defaultconnection']

Step 3. Update exception mapping (optional)

Check if your apiplatform configuration maps OptimisticLockException to a code and update it if not: yaml apiplatform: ... exceptiontostatus: ... Doctrine\ORM\OptimisticLockException: 409

Step 4. Clear cache

bash bin/console cache:clear

Reporters

We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability: - Djibril Mounkoro (@whiteov3rflow) - Bartłomiej Nowiński (@bnBart)

For more information

If you have any questions or comments about this advisory:

- Open an issue in Sylius issues - Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
4.8
EPSS
0.03%
XSS
AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N

Impact

An authenticated stored cross-site scripting (XSS) vulnerability exists in multiple places across the shop frontend and admin panel due to unsanitized entity names being rendered as raw HTML.

Shop breadcrumbs (shared/breadcrumbs.html.twig): The breadcrumbs macro uses the Twig |raw filter on label values. Since taxon names, product names, and ancestor names flow directly into these labels, a malicious taxon name like <img src=x onerror=alert('XSS')> is rendered and executed as JavaScript on the storefront.

Admin product taxon picker (ProductTaxonTreeController.js): The rowRenderer method interpolates ${name} directly into a template literal building HTML, allowing script injection through taxon names in the admin panel.

Admin autocomplete fields (Tom Select): Dropdown items and options render entity names as raw HTML without escaping, allowing XSS through any autocomplete field displaying entity names.

An authenticated administrator can inject arbitrary HTML or JavaScript via entity names (e.g. taxon name) that is persistently rendered for all users.

Patches

The issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3 and above.

Workarounds

Override vulnerable templates and JavaScript controllers at the project level.

---

Step 1 — Override shop breadcrumbs template

templates/bundles/SyliusShopBundle/shared/breadcrumbs.html.twig:

twig {% macro breadcrumbs(items) %} <ol class="breadcrumb" aria-label="breadcrumbs"> {% for item in items %} <li class="breadcrumb-item fw-normal{{ item.active is defined and item.active ? ' active' }}"> {% if item.path is defined %} <a class="link-reset" href="{{ item.path }}" {{ item.testattribute is defined ? syliustesthtmlattribute(item.testattribute) }}>{{ item.label }}</a> {% else %} <span class="text-body-tertiary text-break" {{ item.testattribute is defined ? syliustesthtmlattribute(item.testattribute) }}>{{ item.label }}</span> {% endif %} </li> {% endfor %} </ol> {% endmacro %}

Step 2 — Override order breadcrumbs template

templates/bundles/SyliusShopBundle/account/order/show/content/breadcrumbs.html.twig:

twig {% from '@SyliusShop/shared/breadcrumbs.html.twig' import breadcrumbs as breadcrumbs %}

{% set order = hookablemetadata.context.order %}

<div class="col-12"> {{ breadcrumbs([ { label: 'sylius.ui.home'|trans, path: path('syliusshophomepage')}, { label: 'sylius.ui.myaccount'|trans, path: path('syliusshopaccountdashboard')}, { label: 'sylius.ui.orderhistory'|trans, path: path('syliusshopaccountorderindex')}, { label: '#'~order.number, active: true, testattribute: 'order-number' } ]) }} </div>

Step 3 — Override ProductTaxonTreeController.js

Disable the vendor controller in assets/admin/controllers.json:

diff "product-taxon-tree": { - "enabled": true, + "enabled": false, "fetch": "lazy" },

Create assets/admin/controllers/producttaxontreecontroller.js — copy the original from vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/Resources/assets/controllers/ProductTaxonTreeController.js and apply the following change:

diff + const escapeHtml = (str) => { + const div = document.createElement('div'); + div.textContent = str; + return div.innerHTML; + };

// in rowRenderer: - <span class="infinite-tree-title">${name}</span> + <span class="infinite-tree-title">${escapeHtml(name)}</span>

Register the patched controller in assets/admin/bootstrap.js:

js import ProductTaxonTreeController from './controllers/producttaxontreecontroller'; app.register('sylius--admin-bundle--product-taxon-tree', ProductTaxonTreeController);

Step 4 — Add autocomplete XSS protection

assets/admin/scripts/autocomplete-xss-protection.js:

js const escapeHtml = (str) => { if (typeof str !== 'string') return str; const div = document.createElement('div'); div.textContent = str; return div.innerHTML; };

document.addEventListener('autocomplete:pre-connect', (event) => { const options = event.detail.options; if (!options.render) return;

const labelField = options.labelField || 'text'; const wrapRenderer = (renderer) => { if (!renderer) return renderer; return (data, escape) => { const escaped = { ...data }; if (escaped[labelField]) { escaped[labelField] = escapeHtml(escaped[labelField]); } return renderer(escaped, escape); }; };

if (options.render.item) options.render.item = wrapRenderer(options.render.item); if (options.render.option) options.render.option = wrapRenderer(options.render.option); });

Import in assets/admin/entrypoint.js before bootstrap:

diff + import './scripts/autocomplete-xss-protection'; import './bootstrap.js';

Step 5 — Rebuild assets

bash yarn encore dev # or: yarn encore production

Reporters

We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability: - Djibril Mounkoro (@whiteov3rflow) - Bartłomiej Nowiński (@bnBart)

For more information

If you have any questions or comments about this advisory:

- Open an issue in Sylius issues - Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
5.3
EPSS
0.04%
XSS
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Impact

A cross-site scripting (XSS) vulnerability exists in the shop checkout login form handled by the ApiLoginController Stimulus controller.

When a login attempt fails, AuthenticationFailureHandler returns a JSON response whose message field is rendered into the DOM using innerHTML, allowing any HTML or JavaScript in that value to be parsed and executed by the browser.

The message value originates from AuthenticationException::getMessageKey() passed through Symfony's translator (security domain, using the request locale). In the default Sylius installation, this returns a hardcoded translation key (e.g. "Invalid credentials."), which is not directly user-controlled. However, using innerHTML with server-derived data violates defense-in-depth principles, and the risk escalates significantly under realistic scenarios: - Customized authentication handlers — if a project overrides AuthenticationFailureHandler to include user-supplied data in the message (e.g. "No account found for <username>"), an attacker can inject arbitrary JavaScript directly via the login form without any privileged access. - Translation injection — if translation files are sourced from an untrusted database or CMS and contain HTML, the message could carry a malicious payload. - Man-in-the-Middle — if the response is intercepted (e.g. on HTTP or via a compromised proxy), an attacker can inject arbitrary HTML/JS into the message field. - Server-side injection — if any middleware, reverse proxy, or error handler modifies the JSON response body, malicious content could be injected into the message field.

Exploitation could lead to session hijacking, credential theft, cart/order manipulation, or phishing within the trusted shop domain.

The vulnerability affects all Sylius installations that use the default shop checkout login form with the bundled ApiLoginController.js.

Patches The issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3 and above.

Workarounds Override the vulnerable JavaScript controller at the project level. Note: Step 2 differs between Sylius 2.0 and up

Step 1. Override JavaScript controller handling login Patch ApiLoginController.js

Copy the original from vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/assets/controllers/ApiLoginController.js to assets/shop/controllers/ApiLoginController.js and apply: diff ... .then(response => { if (response.success) { window.location.reload(); } else { const errorElement = this.errorPrototypeTarget.cloneNode(true); - errorElement.innerHtml = response.message; + errorElement.textContent = response.message; this.errorTarget.innerHTML = errorElement.outerHTML; } }) ...

Step 2. Register the patched controller Sylius 2.1+ (Stimulus Bridge with controllers.json)

Disable the vendor controller in assets/shop/controllers.json: diff ... "api-login": { - "enabled": true, + "enabled": false, "fetch": "lazy" } ... Register the overwritten controller in assets/shop/bootstrap.js js import ApiLoginController from './controllers/ApiLoginController'

app.register('sylius--shop-bundle--api-login', ApiLoginController); --- Sylius 2.0 (explicit imports in vendor app.js)

Use Webpack's NormalModuleReplacementPlugin to swap the controller at build time. In webpack.config.js, after shopConfig is created:

diff + const webpack = require('webpack'); ... // Shop config const shopConfig = SyliusShop.getWebpackConfig(path.resolve(dirname)); + shopConfig.plugins.push( + new webpack.NormalModuleReplacementPlugin( + /\/controllers\/ApiLoginController\.js$/, + path.resolve(dirname, 'assets/shop/controllers/ApiLoginController.js') + ) + ); ...

Step 3. Rebuild assets

bash yarn encore dev # or: yarn encore production

Reporters

We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability: - Bartłomiej Nowiński (@bnBart)

For more information

If you have any questions or comments about this advisory:

- Open an issue in Sylius issues - Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
6.9
EPSS
0.07%
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Impact 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.

POST /api/v2/shop/orders/{tokenValue}/items

Other 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.

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), potentially leaking:

- Customer email address - Cart contents (products, quantities, prices) - Address data (billing and shipping if set) - Payment and shipment IDs - Order totals and tax breakdown - Checkout state

Patches The issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3, and above.

Workarounds Add an ownership check in AddItemToCartHandler by injecting UserContextInterface and verifying the current user matches the cart owner before adding items.

Step 1. Patch the handler

Create new src/CommandHandler/Cart/AddItemToCartHandler.php:

php <?php

declare(stricttypes=1);

namespace App\CommandHandler\Cart;

use Sylius\Bundle\ApiBundle\Command\Cart\AddItemToCart; use Sylius\Bundle\ApiBundle\Context\UserContextInterface; use Sylius\Component\Core\Factory\CartItemFactoryInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\OrderItemInterface; use Sylius\Component\Core\Model\ProductVariantInterface; use Sylius\Component\Core\Model\ShopUserInterface; use Sylius\Component\Core\Repository\OrderRepositoryInterface; use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface; use Sylius\Component\Order\Modifier\OrderItemQuantityModifierInterface; use Sylius\Component\Order\Modifier\OrderModifierInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler] final readonly class AddItemToCartHandler { public function construct( private OrderRepositoryInterface $orderRepository, private ProductVariantRepositoryInterface $productVariantRepository, private OrderModifierInterface $orderModifier, private CartItemFactoryInterface $cartItemFactory, private OrderItemQuantityModifierInterface $orderItemQuantityModifier, private UserContextInterface $userContext, ) { }

public function invoke(AddItemToCart $addItemToCart): OrderInterface { / @var ProductVariantInterface|null $productVariant / $productVariant = $this->productVariantRepository->findOneBy(['code' => $addItemToCart->productVariantCode]);

if ($productVariant === null) { throw new \InvalidArgumentException('Product variant with given code has not been found.'); }

/ @var OrderInterface|null $cart / $cart = $this->orderRepository->findCartByTokenValue($addItemToCart->orderTokenValue);

if ($cart === null) { throw new \InvalidArgumentException('Cart with given token has not been found.'); }

$this->assertCartAccessible($cart);

/ @var OrderItemInterface $cartItem / $cartItem = $this->cartItemFactory->createNew(); $cartItem->setVariant($productVariant);

$this->orderItemQuantityModifier->modify($cartItem, $addItemToCart->quantity); $this->orderModifier->addToOrder($cart, $cartItem);

return $cart; }

private function assertCartAccessible(OrderInterface $cart): void { if ($cart->isCreatedByGuest()) { return; }

$cartCustomer = $cart->getCustomer();

if (null === $cartCustomer || null === $cartCustomer->getUser()) { return; }

$currentUser = $this->userContext->getUser();

if ( $currentUser instanceof ShopUserInterface && $currentUser->getCustomer()?->getId() === $cartCustomer->getId() ) { return; }

throw new NotFoundHttpException('Cart not found.'); } }

Step 2. Override the service

diff config/services.yaml

services: App\: resource: '../src/' - exclude: '../src/{Entity,Kernel.php}' + exclude: '../src/{Entity,Kernel.php,CommandHandler}'

syliusapi.commandhandler.cart.additemtocart: class: App\CommandHandler\Cart\AddItemToCartHandler arguments: $orderRepository: '@sylius.repository.order' $productVariantRepository: '@sylius.repository.productvariant' $orderModifier: '@sylius.modifier.order' $cartItemFactory: '@sylius.factory.orderitem' $orderItemQuantityModifier: '@sylius.modifier.orderitemquantity' $userContext: '@Sylius\Bundle\ApiBundle\Context\UserContextInterface' tags: - { name: messenger.messagehandler, bus: sylius.commandbus }

Step 3. Clear cache

bash bin/console cache:clear

Reporters

We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability: - @rokorolov

For more information If you have any questions or comments about this advisory:

- Open an issue in Sylius issues - Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
7.1
EPSS
0.03%
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Impact An authenticated Insecure Direct Object Reference (IDOR) vulnerability exists in multiple shop LiveComponents due to unvalidated resource IDs accepted via #[LiveArg] parameters. Unlike props, which are protected by LiveComponent's @checksum, args are fully user-controlled - any action that accepts a resource ID via #[LiveArg] and loads it with ->find() without ownership validation is vulnerable.

Checkout address FormComponent (addressFieldUpdated action): Accepts an addressId via #[LiveArg] and loads it without verifying ownership, exposing another user's first name, last name, company, phone number, street, city, postcode, and country.

Cart WidgetComponent (refreshCart action): Accepts a cartId via #[LiveArg] and loads any order directly from the repository, exposing order total and item count.

Cart SummaryComponent (refreshCart action): Accepts a cartId via #[LiveArg] and loads any order directly from the repository, exposing subtotal, discount, shipping cost, taxes (excluded and included), and order total.

Since syliusorder contains both active carts (state=cart) and completed orders (state=new/fulfilled) in the same ID space, the cart IDOR exposes data from all orders, not just active carts.

Patches The issue is fixed in versions: 2.0.16, 2.1.12, 2.2.3 and above.

Workarounds

Override vulnerable LiveComponent classes at the project level to add authorization checks to #[LiveArg] parameters.

Step 1. Exclude component overrides from default autowiring

In config/services.yaml, add Twig/Component to the exclude list to prevent duplicate service registration:

yaml App\: resource: '../src/' exclude: '../src/{Entity,Kernel.php,Twig/Components}'

Step 2. Override checkout address FormComponent

Create src/Twig/Components/Checkout/Address/FormComponent.php:

php <?php

declare(stricttypes=1);

namespace App\Twig\Components\Checkout\Address;

use Sylius\Bundle\ShopBundle\Twig\Component\Checkout\Address\AddressBookComponent; use Sylius\Bundle\UiBundle\Twig\Component\ResourceFormComponentTrait; use Sylius\Bundle\UiBundle\Twig\Component\TemplatePropTrait; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\ShopUserInterface; use Sylius\Component\Core\Repository\AddressRepositoryInterface; use Sylius\Component\Core\Repository\OrderRepositoryInterface; use Sylius\Component\Customer\Context\CustomerContextInterface; use Sylius\Component\User\Repository\UserRepositoryInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\UX\LiveComponent\Attribute\AsLiveComponent; use Symfony\UX\LiveComponent\Attribute\LiveArg; use Symfony\UX\LiveComponent\Attribute\LiveListener; use Symfony\UX\LiveComponent\Attribute\LiveProp; use Symfony\UX\LiveComponent\Attribute\PreReRender;

#[AsLiveComponent] class FormComponent { / @use ResourceFormComponentTrait<OrderInterface> / use ResourceFormComponentTrait; use TemplatePropTrait;

#[LiveProp] public bool $emailExists = false;

/ @param OrderRepositoryInterface<OrderInterface> $repository @param UserRepositoryInterface<ShopUserInterface> $shopUserRepository / public function construct( OrderRepositoryInterface $repository, FormFactoryInterface $formFactory, string $resourceClass, string $formClass, protected readonly CustomerContextInterface $customerContext, protected readonly UserRepositoryInterface $shopUserRepository, protected readonly AddressRepositoryInterface $addressRepository, ) { $this->initialize($repository, $formFactory, $resourceClass, $formClass); }

#[PreReRender(priority: -100)] public function checkEmailExist(): void { $email = $this->formValues['customer']['email'] ?? null; if (null !== $email) { $this->emailExists = $this->shopUserRepository->findOneByEmail($email) !== null; } }

#[LiveListener(AddressBookComponent::SYLIUSSHOPADDRESSUPDATED)] public function addressFieldUpdated(#[LiveArg] mixed $addressId, #[LiveArg] string $field): void { $customer = $this->customerContext->getCustomer(); if (null === $customer) { return; }

// Fix: findOneByCustomer instead of find — validates ownership $address = $this->addressRepository->findOneByCustomer((string) $addressId, $customer); if (null === $address) { return; }

$newAddress = []; $newAddress['firstName'] = $address->getFirstName(); $newAddress['lastName'] = $address->getLastName(); $newAddress['phoneNumber'] = $address->getPhoneNumber(); $newAddress['company'] = $address->getCompany(); $newAddress['countryCode'] = $address->getCountryCode(); if ($address->getProvinceCode() !== null) { $newAddress['provinceCode'] = $address->getProvinceCode(); } if ($address->getProvinceName() !== null) { $newAddress['provinceName'] = $address->getProvinceName(); } $newAddress['street'] = $address->getStreet(); $newAddress['city'] = $address->getCity(); $newAddress['postcode'] = $address->getPostcode();

$this->formValues[$field] = $newAddress; }

protected function instantiateForm(): FormInterface { return $this->formFactory->create( $this->formClass, $this->resource, ['customer' => $this->customerContext->getCustomer()], ); } }

Step 3. Override cart WidgetComponent

Create src/Twig/Components/Cart/WidgetComponent.php:

php <?php

declare(stricttypes=1);

namespace App\Twig\Components\Cart;

use Sylius\Bundle\ShopBundle\Twig\Component\Cart\FormComponent; use Sylius\Bundle\UiBundle\Twig\Component\ResourceLivePropTrait; use Sylius\Bundle\UiBundle\Twig\Component\TemplatePropTrait; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Repository\OrderRepositoryInterface; use Sylius\Component\Order\Context\CartContextInterface; use Sylius\Component\Order\Context\CartNotFoundException; use Sylius\Resource\Model\ResourceInterface; use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait; use Symfony\UX\LiveComponent\Attribute\AsLiveComponent; use Symfony\UX\LiveComponent\Attribute\LiveArg; use Symfony\UX\LiveComponent\Attribute\LiveListener; use Symfony\UX\LiveComponent\Attribute\LiveProp; use Symfony\UX\LiveComponent\DefaultActionTrait; use Symfony\UX\TwigComponent\Attribute\PreMount;

#[AsLiveComponent] class WidgetComponent { use DefaultActionTrait; use HookableLiveComponentTrait; use TemplatePropTrait;

/ @use ResourceLivePropTrait<OrderInterface> / use ResourceLivePropTrait;

#[LiveProp(hydrateWith: 'hydrateResource', dehydrateWith: 'dehydrateResource')] public ?ResourceInterface $cart = null;

public function construct( protected readonly CartContextInterface $cartContext, OrderRepositoryInterface $orderRepository, ) { $this->initialize($orderRepository); }

#[PreMount] public function initializeCart(): void { $this->cart = $this->getCart(); }

#[LiveListener(FormComponent::SYLIUSSHOPCARTCHANGED)] #[LiveListener(FormComponent::SYLIUSSHOPCARTCLEARED)] public function refreshCart(#[LiveArg] mixed $cartId = null): void { // Fix: ignore user-supplied cartId, always load from session $this->cart = $this->getCart(); }

private function getCart(): ?OrderInterface { try { return $this->cartContext->getCart(); } catch (CartNotFoundException) { return null; }

return $cart; } }

Step 4. Override cart SummaryComponent

Create src/Twig/Components/Cart/SummaryComponent.php:

php <?php

declare(stricttypes=1);

namespace App\Twig\Components\Cart;

use Sylius\Bundle\ShopBundle\Twig\Component\Cart\FormComponent; use Sylius\Bundle\UiBundle\Twig\Component\ResourceLivePropTrait; use Sylius\Bundle\UiBundle\Twig\Component\TemplatePropTrait; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Repository\OrderRepositoryInterface; use Sylius\Resource\Model\ResourceInterface; use Sylius\TwigHooks\LiveComponent\HookableLiveComponentTrait; use Symfony\UX\LiveComponent\Attribute\AsLiveComponent; use Symfony\UX\LiveComponent\Attribute\LiveArg; use Symfony\UX\LiveComponent\Attribute\LiveListener; use Symfony\UX\LiveComponent\Attribute\LiveProp; use Symfony\UX\LiveComponent\DefaultActionTrait;

#[AsLiveComponent] class SummaryComponent { use DefaultActionTrait; use HookableLiveComponentTrait;

/ @use ResourceLivePropTrait<OrderInterface> / use ResourceLivePropTrait; use TemplatePropTrait;

#[LiveProp(hydrateWith: 'hydrateResource', dehydrateWith: 'dehydrateResource')] public ?ResourceInterface $cart = null;

/ @param OrderRepositoryInterface<OrderInterface> $orderRepository / public function construct(OrderRepositoryInterface $orderRepository) { $this->initialize($orderRepository); }

#[LiveListener(FormComponent::SYLIUSSHOPCARTCHANGED)] public function refreshCart(#[LiveArg] mixed $cartId): void { // Fix: ignore user-supplied cartId, reload from checksummed cart prop if ($this->cart === null) { return; }

$this->cart = $this->hydrateResource($this->cart->getId()); } }

Step 5. Register overridden services

In config/services.yaml, add:

yaml syliusshop.twig.component.checkout.address.form: class: App\Twig\Components\Checkout\Address\FormComponent arguments: $repository: '@sylius.repository.order' $formFactory: '@form.factory' $resourceClass: '%sylius.model.order.class%' $formClass: 'Sylius\Bundle\ShopBundle\Form\Type\Checkout\AddressType' $customerContext: '@sylius.context.customer' $shopUserRepository: '@sylius.repository.shopuser' $addressRepository: '@sylius.repository.address' tags: - { name: 'sylius.livecomponent.shop', key: 'syliusshop:checkout:address:form' }

syliusshop.twig.component.cart.widget: class: App\Twig\Components\Cart\WidgetComponent arguments: $cartContext: '@sylius.context.cart.composite' $orderRepository: '@sylius.repository.order' tags: - { name: 'sylius.livecomponent.shop', key: 'syliusshop:cart:widget' }

syliusshop.twig.component.cart.summary: class: App\Twig\Components\Cart\SummaryComponent arguments: $orderRepository: '@sylius.repository.order' tags: - { name: 'sylius.livecomponent.shop', key: 'syliusshop:cart:summary' }

Step 6. Clear cache

bash php bin/console cache:clear

Reporters

We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability: - Peter Stöckli (@p-) - Man Yue Mo (@m-y-mo) - The GitHub Security Lab team

For more information If you have any questions or comments about this advisory:

- Open an issue in Sylius issues - Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
6.9
EPSS
0.04%
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:L/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Impact CurrencySwitchController::switchAction(), ImpersonateUserController::impersonateAction() and StorageBasedLocaleSwitcher::handle() use the HTTP Referer header directly when redirecting.

The attack requires the victim to click a legitimate application link placed on an attacker-controlled page. The browser automatically sends the attacker's site as the Referer, and the application redirects back to it. This can be used for phishing or credential theft, as the redirect originates from a trusted domain.

The severity varies by endpoint; public endpoints require no authentication and are trivially exploitable, while admin-only endpoints require an authenticated session but remain vulnerable if an admin follows a link from an external source such as email or chat.

Affected classes: - CurrencySwitchController::switchAction() - public - StorageBasedLocaleSwitcher::handle() - public, used in locale switching without having locale in the url - ImpersonateUserController::impersonateAction() - admin-only

Patches 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.

Workarounds If you cannot update Sylius immediately, copy the affected classes from vendor to your project's src/ directory, apply the fix, and override the service definitions.

Step 1 - CurrencySwitchController

Copy from vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Controller/CurrencySwitchController.php to src/Controller/CurrencySwitchController.php and apply the following changes:

diff -namespace Sylius\Bundle\ShopBundle\Controller; +namespace App\Controller;

use Sylius\Component\Channel\Context\ChannelContextInterface; use Sylius\Component\Core\Currency\CurrencyStorageInterface; use Sylius\Component\Core\Model\ChannelInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\RouterInterface;

final class CurrencySwitchController { public function construct( private Environment $templatingEngine, // for 1.x version private CurrencyStorageInterface $currencyStorage, private ChannelContextInterface $channelContext, + private RouterInterface $router, ) { }

public function switchAction(Request $request, string $code): Response { / @var ChannelInterface $channel / $channel = $this->channelContext->getChannel();

$this->currencyStorage->set($channel, $code);

- return new RedirectResponse($request->headers->get('referer', $request->getSchemeAndHttpHost())); + return new RedirectResponse($this->router->generate('syliusshophomepage')); } }

Step 2 - ImpersonateUserController

Copy from vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/Controller/ImpersonateUserController.php to src/Controller/Admin/ImpersonateUserController.php and apply the following changes:

diff -namespace Sylius\Bundle\AdminBundle\Controller; +namespace App\Controller\Admin;

// ... (keep all existing use statements)

public function impersonateAction(Request $request, string $username): Response { // ... (keep authorization check and impersonation logic)

$this->addFlash($request, $username);

- $redirectUrl = $request->headers->get( - 'referer', + return new RedirectResponse( $this->router->generate('syliusadmincustomershow', ['id' => $user->getId()]) ); - - return new RedirectResponse($redirectUrl); }

Step 3 - StorageBasedLocaleSwitcher (only if you use localeswitcher: storage)

Note: Skip this step if you use the default localeswitcher: url mode.

Copy from vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Locale/StorageBasedLocaleSwitcher.php to src/Locale/StorageBasedLocaleSwitcher.php and apply the following changes:

For Sylius 1.9 – 2.1.2:

diff -namespace Sylius\Bundle\ShopBundle\Locale; +namespace App\Locale;

use Sylius\Bundle\ShopBundle\Locale\LocaleSwitcherInterface; use Sylius\Component\Channel\Context\ChannelContextInterface; use Sylius\Component\Core\Locale\LocaleStorageInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\RouterInterface;

final class StorageBasedLocaleSwitcher implements LocaleSwitcherInterface { public function construct( private LocaleStorageInterface $localeStorage, private ChannelContextInterface $channelContext, + private RouterInterface $router, ) { }

public function handle(Request $request, string $localeCode): RedirectResponse { $this->localeStorage->set($this->channelContext->getChannel(), $localeCode);

- return new RedirectResponse($request->headers->get('referer', $request->getSchemeAndHttpHost())); + return new RedirectResponse($this->router->generate('syliusshophomepage')); } }

For Sylius 2.1.3 and later:

In Sylius 2.1.3 the class was refactored to use UrlMatcherInterface. While this adds partial validation, it still passes the full referer URL to RedirectResponse, so the open redirect remains exploitable.

diff -namespace Sylius\Bundle\ShopBundle\Locale; +namespace App\Locale;

use Sylius\Bundle\ShopBundle\Locale\LocaleSwitcherInterface; use Sylius\Component\Channel\Context\ChannelContextInterface; use Sylius\Component\Core\Locale\LocaleStorageInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; +use Symfony\Component\Routing\RouterInterface;

final class StorageBasedLocaleSwitcher implements LocaleSwitcherInterface { public function construct( private LocaleStorageInterface $localeStorage, private ChannelContextInterface $channelContext, - private ?UrlMatcherInterface $urlMatcher = null, + private RouterInterface $router, ) { - if (null === $this->urlMatcher) { - triggerdeprecation( - 'sylius/shop-bundle', - '2.1', - 'Not passing a "%s" to "%s" is deprecated and will be required in Sylius 3.0.', - UrlMatcherInterface::class, - self::class, - ); - } }

public function handle(Request $request, string $localeCode): RedirectResponse { $this->localeStorage->set($this->channelContext->getChannel(), $localeCode); - $url = $request->headers->get('referer', $request->getSchemeAndHttpHost()); - - if ($this->urlMatcher) { - try { - $this->urlMatcher->match($url); - } catch (ResourceNotFoundException) { - return new RedirectResponse($request->getSchemeAndHttpHost()); - } - } - - return new RedirectResponse($url); + return new RedirectResponse($this->router->generate('syliusshophomepage')); } }

Step 4 - Override the services

Add to config/services.yaml.

Sylius 1.x (1.9 – 1.14):

yaml services: # ... your existing services ...

sylius.controller.shop.currencyswitch: class: App\Controller\CurrencySwitchController public: true arguments: $templatingEngine: '@twig' $currencyStorage: '@sylius.storage.currency' $channelContext: '@sylius.context.channel' $router: '@router'

sylius.controller.shop.impersonateuser: class: App\Controller\Admin\ImpersonateUserController public: true arguments: $impersonator: '@sylius.admin.security.userimpersonator' $authorizationChecker: '@security.authorizationchecker' $userProvider: '@sylius.adminuserprovider.emailornamebased' $router: '@router' $authorizationRole: 'ROLEADMINISTRATIONACCESS'

# Only if you use localeswitcher: storage sylius.shop.localeswitcher: class: App\Locale\StorageBasedLocaleSwitcher public: false arguments: $localeStorage: '@sylius.storage.locale' $channelContext: '@sylius.context.channel' $router: '@router'

Sylius 2.x (2.0 – 2.1):

yaml services: # ... your existing services ...

syliusshop.controller.currencyswitch: class: App\Controller\CurrencySwitchController public: true arguments: $currencyStorage: '@sylius.storage.currency' $channelContext: '@sylius.context.channel' $router: '@router'

syliusadmin.controller.impersonateuser: class: App\Controller\Admin\ImpersonateUserController public: true arguments: $impersonator: '@syliusadmin.security.shopuserimpersonator' $authorizationChecker: '@security.authorizationchecker' $userProvider: '@sylius.shopuserprovider.emailornamebased' $router: '@router' $authorizationRole: 'ROLEADMINISTRATIONACCESS'

# Only if you use localeswitcher: storage syliusshop.localeswitcher: class: App\Locale\StorageBasedLocaleSwitcher public: false arguments: $localeStorage: '@sylius.storage.locale' $channelContext: '@sylius.context.channel' $router: '@router'

Step 5 - Clear cache

bash bin/console cache:clear

---

Customizing the redirect target

If you need a different redirect target, override the route definition with the sylius.redirect attribute:

yaml config/routes/syliusshop.yaml (AFTER the syliusshop resource import) syliusshopswitchcurrency: path: /{locale}/switch-currency/{code} methods: [GET] defaults: controller: sylius.controller.shop.currencyswitch:switchAction sylius: redirect: syliusshopproductindex # or any route name

Reporters

We would like to extend our gratitude to the following individuals for their detailed reporting and responsible disclosure of this vulnerability: - Bartłomiej Nowiński (@bnBart)

For more information

If you have any questions or comments about this advisory:

- Open an issue in Sylius issues - Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
6.5
EPSS
0.03%
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N

A discovered vulnerability allows users to modify their shopping cart after completing the PayPal Checkout process and payment authorization. If a user initiates a PayPal transaction from a product page or the cart page and then returns to the order summary page, they can still manipulate the cart contents before finalizing the order. As a result, the order amount in Sylius may be higher than the amount actually captured by PayPal, leading to a scenario where merchants deliver products or services without full payment.

Impact

- Users can exploit this flaw to receive products/services without paying the full amount. - Merchants may suffer financial losses due to underpaid orders. - Trust in the integrity of the payment process is compromised.

Patches

The issue is fixed in versions: 1.6.2, 1.7.2, 2.0.2 and above.

Workarounds

To resolve the problem in the end application without updating to the newest patches, there is a need to overwrite PayPalOrderCompleteProcessor with modified logic:

php <?php

declare(stricttypes=1);

namespace App\Processor;

use Sylius\Bundle\PayumBundle\Model\GatewayConfigInterface; use Sylius\Component\Core\Model\OrderInterface; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface;

final class PayPalOrderCompleteProcessor { public function construct(private readonly PaymentStateManagerInterface $paymentStateManager) { }

public function completePayPalOrder(OrderInterface $order): void { $payment = $order->getLastPayment(PaymentInterface::STATEPROCESSING); if ($payment === null) { return; }

/ @var PaymentMethodInterface $paymentMethod / $paymentMethod = $payment->getMethod(); / @var GatewayConfigInterface $gatewayConfig / $gatewayConfig = $paymentMethod->getGatewayConfig();

if ($gatewayConfig->getFactoryName() !== 'sylius.paypal') { return; }

try { $this->verify($payment); } catch (\Exception) { $this->paymentStateManager->cancel($payment);

return; }

$this->paymentStateManager->complete($payment); }

private function verify(PaymentInterface $payment): void { $totalAmount = $this->getTotalPaymentAmountFromPaypal($payment);

if ($payment->getOrder()->getTotal() !== $totalAmount) { throw new \Exception(); } }

private function getTotalPaymentAmountFromPaypal(PaymentInterface $payment): int { $details = $payment->getDetails();

return $details['paymentamount'] ?? 0; } }

IMPORTANT

For PayPalPlugin 2.x change: php $gatewayConfig->getFactoryName() !== 'sylius.paypal' to php $gatewayConfig->getFactoryName() !== SyliusPayPalExtension::PAYPALFACTORYNAME

Also there is a need to overwrite CompletePayPalOrderListener with modified logic:

php <?php

declare(stricttypes=1);

namespace App\EventListener\Workflow;

use App\Processor\PayPalOrderCompleteProcessor; use Sylius\Component\Core\Model\OrderInterface; use Symfony\Component\Workflow\Event\CompletedEvent; use Webmozart\Assert\Assert;

final class CompletePayPalOrderListener { public function construct(private readonly PayPalOrderCompleteProcessor $completeProcessor) { }

public function invoke(CompletedEvent $event): void { / @var OrderInterface $order / $order = $event->getSubject(); Assert::isInstanceOf($order, OrderInterface::class);

$this->completeProcessor->completePayPalOrder($order); } }

And to overwrite CaptureAction with modified logic (if you didn't have it already):

php <?php

declare(stricttypes=1);

namespace App\Payum\Action;

use Payum\Core\Action\ActionInterface; use Payum\Core\Exception\RequestNotSupportedException; use Payum\Core\Request\Capture; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface; use Sylius\PayPalPlugin\Api\CreateOrderApiInterface; use Sylius\PayPalPlugin\Payum\Action\StatusAction; use Sylius\PayPalPlugin\Provider\UuidProviderInterface;

final class CaptureAction implements ActionInterface { public function construct( private CacheAuthorizeClientApiInterface $authorizeClientApi, private CreateOrderApiInterface $createOrderApi, private UuidProviderInterface $uuidProvider, ) { }

/ @param Capture $request / public function execute($request): void { RequestNotSupportedException::assertSupports($this, $request);

/ @var PaymentInterface $payment / $payment = $request->getModel(); / @var PaymentMethodInterface $paymentMethod / $paymentMethod = $payment->getMethod();

$token = $this->authorizeClientApi->authorize($paymentMethod);

$referenceId = $this->uuidProvider->provide(); $content = $this->createOrderApi->create($token, $payment, $referenceId);

if ($content['status'] === 'CREATED') { $payment->setDetails([ 'status' => StatusAction::STATUSCAPTURED, 'paypalorderid' => $content['id'], 'referenceid' => $referenceId, 'paymentamount' => $payment->getAmount(), ]); } }

public function supports($request): bool { return $request instanceof Capture && $request->getModel() instanceof PaymentInterface ; } }

After that, register services in the container when using PayPal 1.x:

yaml Sylius\PayPalPlugin\EventListener\Workflow\CompletePayPalOrderListener: class: App\EventListener\Workflow\CompletePayPalOrderListener public: true arguments: - '@Sylius\PayPalPlugin\Processor\PayPalOrderCompleteProcessor' tags: - { name: 'kernel.eventlistener', event: 'workflow.syliusordercheckout.completed.complete', priority: 100 } Sylius\PayPalPlugin\Processor\PayPalOrderCompleteProcessor: class: App\Processor\PayPalOrderCompleteProcessor public: true arguments: - '@Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface'

Sylius\PayPalPlugin\Payum\Action\CaptureAction: class: App\Payum\Action\CaptureAction public: true arguments: - '@Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface' - '@Sylius\PayPalPlugin\Api\CreateOrderApiInterface' - '@Sylius\PayPalPlugin\Provider\UuidProviderInterface' tags: - { name: 'payum.action', factory: 'sylius.paypal', alias: 'payum.action.capture' }

or when using PayPal 2.x:

yaml syliuspaypal.listener.workflow.completepaypalorder: class: App\EventListener\Workflow\CompletePayPalOrderListener public: true arguments: - '@syliuspaypal.processor.paypalordercomplete' tags: - { name: 'kernel.eventlistener', event: 'workflow.syliusordercheckout.completed.complete', priority: 100 } syliuspaypal.processor.paypalordercomplete: class: App\Processor\PayPalOrderCompleteProcessor public: true arguments: - '@syliuspaypal.manager.paymentstate'

syliuspaypal.payum.action.capture: class: App\Payum\Action\CaptureAction public: true arguments: - '@syliuspaypal.api.cacheauthorizeclient' - '@syliuspaypal.api.createorder' - '@syliuspaypal.provider.uuid' tags: - { name: 'payum.action', factory: 'sylius.paypal', alias: 'payum.action.capture' }

For more information

If you have any questions or comments about this advisory: Open an issue in Sylius issues Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
6.5
EPSS
0.06%
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N

A vulnerability allows users to manipulate the final payment amount processed by PayPal. If a user modifies the item quantity in their shopping cart after initiating the PayPal Checkout process, PayPal will not receive the updated total amount. As a result, PayPal captures only the initially transmitted amount, while Sylius incorrectly considers the order fully paid based on the modified total. This flaw can be exploited both accidentally and intentionally, potentially enabling fraud by allowing customers to pay less than the actual order value.

Impact

- Attackers can intentionally pay less than the actual total order amount. - Business owners may suffer financial losses due to underpaid orders. - Integrity of payment processing is compromised.

Patches

The issue is fixed in versions: 1.6.1, 1.7.1, 2.0.1 and above.

Workarounds

To resolve the problem in the end application without updating to the newest patches, there is a need to overwrite ProcessPayPalOrderAction with modified logic:

php <?php

declare(stricttypes=1);

namespace App\Controller;

use Doctrine\Persistence\ObjectManager; use SM\Factory\FactoryInterface as StateMachineFactoryInterface; use Sylius\Abstraction\StateMachine\StateMachineInterface; use Sylius\Abstraction\StateMachine\WinzouStateMachineAdapter; use Sylius\Component\Core\Factory\AddressFactoryInterface; use Sylius\Component\Core\Model\CustomerInterface; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\Component\Core\OrderCheckoutTransitions; use Sylius\Component\Core\Repository\CustomerRepositoryInterface; use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface; use Sylius\PayPalPlugin\Api\OrderDetailsApiInterface; use Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface; use Sylius\PayPalPlugin\Provider\OrderProviderInterface; use Sylius\PayPalPlugin\Verifier\PaymentAmountVerifierInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response;

final class ProcessPayPalOrderAction { public function construct( private readonly CustomerRepositoryInterface $customerRepository, private readonly FactoryInterface $customerFactory, private readonly AddressFactoryInterface $addressFactory, private readonly ObjectManager $orderManager, private readonly StateMachineFactoryInterface|StateMachineInterface $stateMachineFactory, private readonly PaymentStateManagerInterface $paymentStateManager, private readonly CacheAuthorizeClientApiInterface $authorizeClientApi, private readonly OrderDetailsApiInterface $orderDetailsApi, private readonly OrderProviderInterface $orderProvider, ) { }

public function invoke(Request $request): Response { $orderId = $request->request->getInt('orderId'); $order = $this->orderProvider->provideOrderById($orderId); / @var PaymentInterface $payment / $payment = $order->getLastPayment(PaymentInterface::STATECART);

$data = $this->getOrderDetails((string) $request->request->get('payPalOrderId'), $payment);

/ @var CustomerInterface|null $customer / $customer = $order->getCustomer(); if ($customer === null) { $customer = $this->getOrderCustomer($data['payer']); $order->setCustomer($customer); }

$purchaseUnit = (array) $data['purchaseunits'][0];

$address = $this->addressFactory->createNew();

if ($order->isShippingRequired()) { $name = explode(' ', $purchaseUnit['shipping']['name']['fullname']); $address->setLastName(arraypop($name) ?? ''); $address->setFirstName(implode(' ', $name)); $address->setStreet($purchaseUnit['shipping']['address']['addressline1']); $address->setCity($purchaseUnit['shipping']['address']['adminarea2']); $address->setPostcode($purchaseUnit['shipping']['address']['postalcode']); $address->setCountryCode($purchaseUnit['shipping']['address']['countrycode']);

$this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONADDRESS); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONSELECTSHIPPING); } else { $address->setFirstName($customer->getFirstName()); $address->setLastName($customer->getLastName());

$defaultAddress = $customer->getDefaultAddress();

$address->setStreet($defaultAddress ? $defaultAddress->getStreet() : ''); $address->setCity($defaultAddress ? $defaultAddress->getCity() : ''); $address->setPostcode($defaultAddress ? $defaultAddress->getPostcode() : ''); $address->setCountryCode($data['payer']['address']['countrycode']);

$this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONADDRESS); }

$order->setShippingAddress(clone $address); $order->setBillingAddress(clone $address);

$this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONSELECTPAYMENT);

$this->orderManager->flush();

try { $this->verify($payment, $data); } catch (\Exception) { $this->paymentStateManager->cancel($payment);

return new JsonResponse(['orderID' => $order->getId()]); }

$this->paymentStateManager->create($payment); $this->paymentStateManager->process($payment);

return new JsonResponse(['orderID' => $order->getId()]); }

private function getOrderCustomer(array $customerData): CustomerInterface { / @var CustomerInterface|null $existingCustomer / $existingCustomer = $this->customerRepository->findOneBy(['email' => $customerData['emailaddress']]); if ($existingCustomer !== null) { return $existingCustomer; }

/ @var CustomerInterface $customer / $customer = $this->customerFactory->createNew(); $customer->setEmail($customerData['emailaddress']); $customer->setFirstName($customerData['name']['givenname']); $customer->setLastName($customerData['name']['surname']);

return $customer; }

private function getOrderDetails(string $id, PaymentInterface $payment): array { / @var PaymentMethodInterface $paymentMethod / $paymentMethod = $payment->getMethod(); $token = $this->authorizeClientApi->authorize($paymentMethod);

return $this->orderDetailsApi->get($token, $id); }

private function getStateMachine(): StateMachineInterface { if ($this->stateMachineFactory instanceof StateMachineFactoryInterface) { return new WinzouStateMachineAdapter($this->stateMachineFactory); }

return $this->stateMachineFactory; }

private function verify(PaymentInterface $payment, array $paypalOrderDetails): void { $totalAmount = $this->getTotalPaymentAmountFromPaypal($paypalOrderDetails);

if ($payment->getAmount() !== $totalAmount) { throw new \Exception(); } }

private function getTotalPaymentAmountFromPaypal(array $paypalOrderDetails): int { if (!isset($paypalOrderDetails['purchaseunits']) || !isarray($paypalOrderDetails['purchaseunits'])) { return 0; }

$totalAmount = 0;

foreach ($paypalOrderDetails['purchaseunits'] as $unit) { $stringAmount = $unit['amount']['value'] ?? '0';

$totalAmount += (int) ($stringAmount 100); }

return $totalAmount; } }

Also there is a need to overwrite CompletePayPalOrderFromPaymentPageAction with modified logic:

php <?php

declare(stricttypes=1);

namespace App\Controller;

use Doctrine\Persistence\ObjectManager; use SM\Factory\FactoryInterface; use Sylius\Abstraction\StateMachine\StateMachineInterface; use Sylius\Abstraction\StateMachine\WinzouStateMachineAdapter; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\OrderCheckoutTransitions; use Sylius\Component\Order\Processor\OrderProcessorInterface; use Sylius\PayPalPlugin\Exception\PaymentAmountMismatchException; use Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface; use Sylius\PayPalPlugin\Provider\OrderProviderInterface; use Sylius\PayPalPlugin\Verifier\PaymentAmountVerifierInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

final class CompletePayPalOrderFromPaymentPageAction { public function construct( private readonly PaymentStateManagerInterface $paymentStateManager, private readonly UrlGeneratorInterface $router, private readonly OrderProviderInterface $orderProvider, private readonly FactoryInterface|StateMachineInterface $stateMachine, private readonly ObjectManager $orderManager, private readonly OrderProcessorInterface $orderProcessor, ) { }

public function invoke(Request $request): Response { $orderId = $request->attributes->getInt('id');

$order = $this->orderProvider->provideOrderById($orderId); / @var PaymentInterface $payment / $payment = $order->getLastPayment(PaymentInterface::STATEPROCESSING);

try { $this->verify($payment); } catch (\Exception) { $this->paymentStateManager->cancel($payment); $order->removePayment($payment);

$this->orderProcessor->process($order);

return new JsonResponse([ 'returnurl' => $this->router->generate('syliusshopcheckoutcomplete', [], UrlGeneratorInterface::ABSOLUTEURL), ]); }

$this->paymentStateManager->complete($payment);

$this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONSELECTPAYMENT); $this->getStateMachine()->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITIONCOMPLETE);

$this->orderManager->flush();

$request->getSession()->set('syliusorderid', $order->getId());

return new JsonResponse([ 'returnurl' => $this->router->generate('syliusshoporderthankyou', [], UrlGeneratorInterface::ABSOLUTEURL), ]); }

private function getStateMachine(): StateMachineInterface { if ($this->stateMachine instanceof FactoryInterface) { return new WinzouStateMachineAdapter($this->stateMachine); }

return $this->stateMachine; }

private function verify(PaymentInterface $payment): void { $totalAmount = $this->getTotalPaymentAmountFromPaypal($payment);

if ($payment->getOrder()->getTotal() !== $totalAmount) { throw new \Exception(); } }

private function getTotalPaymentAmountFromPaypal(PaymentInterface $payment): int { $details = $payment->getDetails();

return $details['paymentamount'] ?? 0; } }

And to overwrite CaptureAction with modified logic:

php <?php

declare(stricttypes=1);

namespace App\Payum\Action;

use Payum\Core\Action\ActionInterface; use Payum\Core\Exception\RequestNotSupportedException; use Payum\Core\Request\Capture; use Sylius\Component\Core\Model\PaymentInterface; use Sylius\Component\Core\Model\PaymentMethodInterface; use Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface; use Sylius\PayPalPlugin\Api\CreateOrderApiInterface; use Sylius\PayPalPlugin\Payum\Action\StatusAction; use Sylius\PayPalPlugin\Provider\UuidProviderInterface;

final class CaptureAction implements ActionInterface { public function construct( private CacheAuthorizeClientApiInterface $authorizeClientApi, private CreateOrderApiInterface $createOrderApi, private UuidProviderInterface $uuidProvider, ) { }

/ @param Capture $request / public function execute($request): void { RequestNotSupportedException::assertSupports($this, $request);

/ @var PaymentInterface $payment / $payment = $request->getModel(); / @var PaymentMethodInterface $paymentMethod / $paymentMethod = $payment->getMethod();

$token = $this->authorizeClientApi->authorize($paymentMethod);

$referenceId = $this->uuidProvider->provide(); $content = $this->createOrderApi->create($token, $payment, $referenceId);

if ($content['status'] === 'CREATED') { $payment->setDetails([ 'status' => StatusAction::STATUSCAPTURED, 'paypalorderid' => $content['id'], 'referenceid' => $referenceId, 'paymentamount' => $payment->getAmount(), ]); } }

public function supports($request): bool { return $request instanceof Capture && $request->getModel() instanceof PaymentInterface ; } }

After that, register services in the container when using PayPal 1.x:

yaml services: App\Controller\ProcessPayPalOrderAction: class: App\Controller\ProcessPayPalOrderAction public: true arguments: - '@sylius.repository.customer' - '@sylius.factory.customer' - '@sylius.factory.address' - '@sylius.manager.order' - '@syliusabstraction.statemachine' - '@Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface' - '@Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface' - '@Sylius\PayPalPlugin\Api\OrderDetailsApiInterface' - '@Sylius\PayPalPlugin\Provider\OrderProviderInterface'

Sylius\PayPalPlugin\Controller\ProcessPayPalOrderAction: alias: App\Controller\ProcessPayPalOrderAction

App\Controller\CompletePayPalOrderFromPaymentPageAction: class: App\Controller\CompletePayPalOrderFromPaymentPageAction public: true arguments: - '@Sylius\PayPalPlugin\Manager\PaymentStateManagerInterface' - '@router' - '@Sylius\PayPalPlugin\Provider\OrderProviderInterface' - '@syliusabstraction.statemachine' - '@sylius.manager.order' - '@sylius.orderprocessing.orderprocessor'

Sylius\PayPalPlugin\Controller\CompletePayPalOrderFromPaymentPageAction: alias: App\Controller\CompletePayPalOrderFromPaymentPageAction

Sylius\PayPalPlugin\Payum\Action\CaptureAction: class: App\Payum\Action\CaptureAction public: true arguments: - '@Sylius\PayPalPlugin\Api\CacheAuthorizeClientApiInterface' - '@Sylius\PayPalPlugin\Api\CreateOrderApiInterface' - '@Sylius\PayPalPlugin\Provider\UuidProviderInterface' tags: - { name: 'payum.action', factory: 'sylius.paypal', alias: 'payum.action.capture' }

or when using PayPal 2.x:

yaml services: App\Controller\ProcessPayPalOrderAction: class: App\Controller\ProcessPayPalOrderAction public: true arguments: - '@sylius.repository.customer' - '@sylius.factory.customer' - '@sylius.factory.address' - '@sylius.manager.order' - '@syliusabstraction.statemachine' - '@syliuspaypal.manager.paymentstate' - '@syliuspaypal.api.cacheauthorizeclient' - '@syliuspaypal.api.orderdetails' - '@syliuspaypal.provider.order'

syliuspaypal.controller.processpaypalorder: alias: App\Controller\ProcessPayPalOrderAction

App\Controller\CompletePayPalOrderFromPaymentPageAction: class: App\Controller\CompletePayPalOrderFromPaymentPageAction public: true arguments: - '@syliuspaypal.manager.paymentstate' - '@router' - '@syliuspaypal.provider.order' - '@syliusabstraction.statemachine' - '@sylius.manager.order' - '@sylius.orderprocessing.orderprocessor'

syliuspaypal.controller.completepaypalorderfrompaymentpage: alias: App\Controller\CompletePayPalOrderFromPaymentPageAction

syliuspaypal.payum.action.capture: class: App\Payum\Action\CaptureAction public: true arguments: - '@syliuspaypal.api.cacheauthorizeclient' - '@syliuspaypal.api.createorder' - '@syliuspaypal.provider.uuid' tags: - { name: 'payum.action', factory: 'sylius.paypal', alias: 'payum.action.capture' }

For more information

If you have any questions or comments about this advisory: Open an issue in Sylius issues Email us at security@sylius.com

1 / 2
Source: GitHub
First published (updated )
Severity
7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Withdrawn Advisory This advisory has been withdrawn because it is not a vulnerability in the Sylius framework. This link is maintained to preserve external references.

Original Description A rate limiting issue in Sylius v2.0.2 allows a remote attacker to perform unrestricted brute-force attacks on user accounts, significantly increasing the risk of account compromise and denial of service for legitimate users. The Supplier's position is that the Sylius core software is not intended to address brute-force attacks; instead, customers deploying a Sylius-based system are supposed to use "firewalls, rate-limiting middleware, or authentication providers" for that functionality.

1 / 2
Source: GitHub
First published (updated )
Severity
5.4
XSS
AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:L/A:L

sylius/sylius versions prior to 1.9.10, 1.10.11, and 1.11.2 are vulnerable to stored cross-site scripting (XSS) through SVG files. This vulnerability allows attackers to inject malicious scripts that can be executed in the context of the user's browser.

First published (updated )
Severity
6.4
EPSS
0.42%
XSS
AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Duplicate Advisory This advisory has been withdrawn because it is a duplicate of GHSA-7prj-9ccr-hr3q. This link is maintained to preserve external references.

Original Description Sylius 1.12.13 is vulnerable to Cross Site Scripting (XSS) via the "Province" field in Address Book.

1 / 3
Source: GitHub
First published (updated )
Severity
9.8
SQL Injection
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

SyliusGridBundle is a package of generic data grids for Symfony applications. Prior to versions 1.10.1 and 1.11-rc2, values added at the end of query sorting were passed directly to the database. The maintainers do not know if this could lead to direct SQL injections but took steps to remediate the vulnerability. The issue is fixed in versions 1.10.1 and 1.11-rc2. As a workaround, overwrite theSylius\Component\Grid\Sorting\Sorter.php class and register it in the container. More information about this workaround is available in the GitHub Security Advisory.

First published (updated )
Severity
6.1
Malicious File Upload, XSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Sylius is an open source eCommerce platform. In versions prior to 1.9.10, 1.10.11, and 1.11.2, it is possible to upload an SVG file containing cross-site scripting (XSS) code in the admin panel. In order to perform a XSS attack, the file itself has to be open in a new card or loaded outside of the IMG tag. The problem applies both to the files opened on the admin panel and shop pages. The issue is fixed in versions 1.9.10, 1.10.11, and 1.11.2. As a workaround, require a library that adds on-upload file sanitization and overwrite the service before writing the file to the filesystem. The GitHub Security Advisory contains more specific information about the workaround.

First published (updated )
Severity
8.2
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N

Sylius is an open source eCommerce platform. Prior to versions 1.10.11 and 1.11.2, the reset password token was not set to null after the password was changed. The same token could be used several times, which could result in leak of the existing token and unauthorized password change. The issue is fixed in versions 1.10.11 and 1.11.2. As a workaround, overwrite the Sylius\Bundle\ApiBundle\CommandHandler\ResetPasswordHandler class with code provided by the maintainers and register it in a container. More information about this workaround is available in the GitHub Security Advisory.

First published (updated )
Severity
5.5
Infoleak
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Sylius is an open source eCommerce platform. Prior to versions 1.9.10, 1.10.11, and 1.11.2, any other user can view the data if browser tab remains unclosed after log out. The issue is fixed in versions 1.9.10, 1.10.11, and 1.11.2. A workaround is available. The application must strictly redirect to login page even browser back button is pressed. Another possibility is to set more strict cache policies for restricted content.

First published (updated )
Severity
6.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Sylius is an open source eCommerce platform. Prior to versions 1.9.10, 1.10.11, and 1.11.2, it is possible for a page controlled by an attacker to load the website within an iframe. This will enable a clickjacking attack, in which the attacker's page overlays the target application's interface with a different interface provided by the attacker. The issue is fixed in versions 1.9.10, 1.10.11, and 1.11.2. A workaround is available. Every response from app should have an X-Frame-Options header set to: sameorigin. To achieve that, add a new subscriber in the app.

First published (updated )
Severity
7.5
Infoleak
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

sylius/paypal-plugin is a paypal plugin for the Sylius development platform. In affected versions the URL to the payment page done after checkout was created with autoincremented payment id (/pay-with-paypal/{id}) and therefore it was easy to predict. The problem is that the Credit card form has prefilled "credit card holder" field with the Customer's first and last name and hence this can lead to personally identifiable information exposure. Additionally, the mentioned form did not require authentication. The problem has been patched in Sylius/PayPalPlugin 1.2.4 and 1.3.1. If users are unable to update they can override a syliuspaypalpluginpaywithpaypalform route and change its URL parameters to (for example) {orderToken}/{paymentId}, then override the Sylius\PayPalPlugin\Controller\PayWithPayPalFormAction service, to operate on the payment taken from the repository by these 2 values. It would also require usage of custom repository method. Additionally, one could override the @SyliusPayPalPlugin/payWithPaypal.html.twig template, to add contingencies: ['SCAALWAYS'] line in hostedFields.submit(...) function call (line 421). It would then have to be handled in the function callback.

First published (updated )
Severity
5.3
Infoleak
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

Sylius is an Open Source eCommerce platform on top of Symfony. In versions of Sylius prior to 1.9.5 and 1.10.0-RC.1, part of the details (order ID, order number, items total, and token value) of all placed orders were exposed to unauthorized users. If exploited properly, a few additional information like the number of items in the cart and the date of the shipping may be fetched as well. This data seems to not be crucial nor is personal data, however, could be used for sociotechnical attacks or may expose a few details about shop condition to the third parties. The data possible to aggregate are the number of processed orders or their value in the moment of time. The problem has been patched at Sylius 1.9.5 and 1.10.0-RC.1. There are a few workarounds for the vulnerability. The first possible solution is to hide the problematic endpoints behind the firewall from not logged in users. This would put only the order list under the firewall and allow only authorized users to access it. Once a user is authorized, it will have access to theirs orders only. The second possible solution is to decorate the \Sylius\Bundle\ApiBundle\Doctrine\QueryCollectionExtension\OrdersByLoggedInUserExtension and throw Symfony\Component\Security\Core\Exception\AccessDeniedException if the class is executed for unauthorized user.

First published (updated )
Severity
4.3
XSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N

Impact The user may register in a shop by email mail@example.com, verify it, change it to the mail another@domain.com and stay verified and enabled. This may lead to having accounts addressed to totally different emails, that were verified. Note, that this way one is not able to take over any existing account (guest or normal one).

Patches Patch has been provided for Sylius 1.6.x and newer - 1.6.9, 1.7.9, 1.8.3. Versions older than 1.6 are not covered by our security support anymore.

Workarounds If for whatever reason you are not able to upgrade your application version, you may resolve this issue on your own by creating a custom event listener, which will listen to the sylius.customer.preupdate event. You can determine that email has been changed if customer email and user username are different. They are synchronized later on. Pay attention, to email changing behavior for administrators. You may need to skip this logic for them. In order to achieve this, you should either check master request path info, if it does not contain /admin prefix or adjust event triggered during customer update in the shop. You can find more information on how to customize the event here.

Acknowledgements

This security issue has been reported by Mircea Silviu (@decemvre), thanks a lot!

For more information

If you have any questions or comments about this advisory: Email us at security@sylius.com

1 / 3
Source: GitHub
First published (updated )
Severity
8.8
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Impact

Request parameters injected inside an expression evaluated by symfony/expression-language package haven't been sanitized properly. This allows the attacker to access any public service by manipulating that request parameter, allowing for Remote Code Execution.

The vulnerable versions include: <=1.3.13 || >=1.4.0 <=1.4.6 || >=1.5.0 <=1.5.1 || >=1.6.0 <=1.6.3.

Example

yaml foo: path: /foo/{id} defaults: sylius: repository: method: findSome arguments: entity: "expr:service('repository').find($id)"

In this case, $id can be prepared in a way that calls other services.

If you visit /foo/"~service('doctrine').getManager().getConnection().executeQuery("DELETE FROM TABLE")~", it will result in a following expression expr:service('repository').find(""~service('doctrine').getManager().getConnection().executeQuery("DELETE FROM TABLE")~""), which will execute a query on the currently connected database.

To find a vulnerability in your application, look for any routing definition that uses request parameters inside expression language.

Patches

This issue has been patched for versions 1.3.14, 1.4.7, 1.5.2 and 1.6.4. Versions prior to 1.3 were not patched.

Workarounds

The fix requires adding addslashes in ParametersParser::parseRequestValueExpression to sanitize user input before evaluating it using the expression language.

php - return isstring($variable) ? sprintf('"%s"', $variable) : $variable; + return isstring($variable) ? sprintf('"%s"', addslashes($variable)) : $variable;

Acknowledgements

This security issue has been reported by Craig Blanchette (@isometriks), thanks a lot!

For more information

If you have any questions or comments about this advisory: Email us at security@sylius.com

1 / 3
Source: GitHub
First published (updated )
Severity
9.6
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Impact

Request parameters injected inside an expression evaluated by symfony/expression-language package haven't been sanitized properly. This allows the attacker to access any public service by manipulating that request parameter, allowing for Remote Code Execution.

The vulnerable versions include: <=1.3.13 || >=1.4.0 <=1.4.6 || >=1.5.0 <=1.5.1 || >=1.6.0 <=1.6.3.

Example

yaml syliusgrid: grids: foo: fields: bar: options: baz: "expr:service('sylius.repository.product').find($id)"

In this case, $id can be prepared in a way that calls other services.

If you visit /route?id="~service('doctrine').getManager().getConnection().executeQuery("DELETE FROM TABLE")~", it will result in a following expression expr:service('repository').find(""~service('doctrine').getManager().getConnection().executeQuery("DELETE FROM TABLE")~""), which will execute a query on the currently connected database.

To find a vulnerability in your application, look for any routing definition that uses request parameters inside expression language.

Patches

This issue has been patched for versions 1.3.14, 1.4.7, 1.5.2 and 1.6.4. Versions prior to 1.3 were not patched.

Workarounds

The fix requires adding addslashes in OptionsParser::parseOptionExpression to sanitize user input before evaluating it using the expression language.

php - return isstring($variable) ? sprintf('"%s"', $variable) : $variable; + return isstring($variable) ? sprintf('"%s"', addslashes($variable)) : $variable;

Acknowledgements

This security issue has been reported by Craig Blanchette (@isometriks), thanks a lot!

For more information

If you have any questions or comments about this advisory: Email us at security@sylius.com

1 / 3
Source: GitHub
First published (updated )
Severity
4.4
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N

Affected versions of Sylius give attackers the ability to switch channels via the channelcode GET parameter in production environments. This was meant to be enabled only when kernel.debug is set to true. However, if no syliuschannel.debug is set explicitly in the configuration, the default value which is kernel.debug will be not resolved and cast to boolean, enabling this debug feature even if that parameter is set to false. Patch has been provided for Sylius 1.3.x and newer - 1.3.16, 1.4.12, 1.5.9, 1.6.5. Versions older than 1.3 are not covered by our security support anymore.

First published (updated )
Severity
5.3
Infoleak
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

Impact

ResourceBundle accepts and uses any serialisation groups to be passed via a HTTP header. This might lead to data exposure by using an unintended serialisation group - for example it could make Shop API use a more permissive group from Admin API.

Anyone exposing an API with ResourceBundle's controller is affected. The vulnerable versions are: <1.3 || >=1.3.0 <=1.3.12 || >=1.4.0 <=1.4.5 || >=1.5.0 <=1.5.0 || >=1.6.0 <=1.6.2.

Patches

The patch is provided for ResourceBundle 1.3.13, 1.4.6, 1.5.1 and 1.6.3, but not for any versions below 1.3.

After it is applied, It allows to choose only the groups that are defined in serializationgroups or allowedserializationgroups route definition. Any group not defined in those will not be used.

This behaviour might be a BC break for those using custom groups via the HTTP header, please adjust allowedserializationgroups accordingly.

Workarounds

Service sylius.resourcecontroller.requestconfigurationfactory can be overridden with an implementation copied from \Sylius\Bundle\ResourceBundle\Controller\RequestConfigurationFactory where the part that handles custom serialisation groups is deleted.

1 / 3
Source: GitHub
First published (updated )
Severity
4.3
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N

In affected versions of Sylius, exception messages from internal exceptions (like database exception) are wrapped by \Symfony\Component\Security\Core\Exception\AuthenticationServiceException and propagated through the system to UI. Therefore, some internal system information may leak and be visible to the customer. A validation message with the exception details will be presented to the user when one will try to log into the shop. This has been patched in versions 1.3.14, 1.4.10, 1.5.7, and 1.6.3.

First published (updated )
Severity
4.8
XSS
AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N

An issue was discovered in Sylius products. Missing input sanitization in sylius/sylius 1.0.x through 1.0.18, 1.1.x through 1.1.17, 1.2.x through 1.2.16, 1.3.x through 1.3.11, and 1.4.x through 1.4.3 and sylius/grid 1.0.x through 1.0.18, 1.1.x through 1.1.18, 1.2.x through 1.2.17, 1.3.x through 1.3.12, 1.4.x through 1.4.4, and 1.5.0 allows an attacker (an admin in the sylius/sylius case) to perform XSS by injecting malicious code into a field displayed in a grid with the "string" field type. The contents are an object, with malicious code returned by the toString() method of that object.

1 / 3
First published (updated )

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203