CVE-2026-31825: Sylius has a DQL Injection via API Order Filters

Published Mar 10, 2026
·
Updated

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

Other sources

Sylius is an Open Source eCommerce Framework on Symfony. 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. 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.

— MITRE

Affected Software

19 affected componentsFixes available
sylius/sylius<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
composer/sylius/sylius>=2.2.0<=2.2.2
2.2.3
composer/sylius/sylius>=2.1.0<=2.1.11
2.1.12
composer/sylius/sylius>=2.0.0<=2.0.15
2.0.16
composer/sylius/sylius>=1.14.0<=1.14.17
1.14.18
composer/sylius/sylius>=1.13.0<=1.13.14
1.13.15
composer/sylius/sylius>=1.12.0<=1.12.22
1.12.23
composer/sylius/sylius>=1.11.0<=1.11.16
1.11.17
composer/sylius/sylius>=1.10.0<=1.10.15
1.10.16
composer/sylius/sylius<=1.9.11
1.9.12
Sylius Sylius<1.9.12
Sylius Sylius>=1.10.0<1.10.16
Sylius Sylius>=1.11.0<1.11.17
Sylius Sylius>=1.12.0<1.12.23
Sylius Sylius>=1.13.0<1.13.15
Sylius Sylius>=1.14.0<1.14.18
Sylius Sylius>=2.0.0<2.0.16
Sylius Sylius>=2.1.0<2.1.12
Sylius Sylius>=2.2.0<2.2.3

Event History

Mar 10, 2026
CVE Published
via MITRE·09:33 PM
Data Sourced
via MITRE·09:33 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:16 PM
Affected Software
Mar 11, 2026
Advisory Published
via GitHub·12:13 AM
Data Sourced
via GitHub·12:13 AM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-31825?

CVE-2026-31825 has been classified as a critical vulnerability due to the potential for DQL Injection.

2

How do I fix CVE-2026-31825?

To fix CVE-2026-31825, update Sylius to version 1.9.12 or later, as earlier versions are vulnerable.

3

What are the affected versions in CVE-2026-31825?

CVE-2026-31825 affects Sylius versions up to 1.9.12, 1.10.16, 1.11.17, 1.12.23, 1.13.15, 1.14.18, 2.0.16, 2.1.12, and 2.2.3.

4

What kind of attack can be executed using CVE-2026-31825?

An attacker can exploit CVE-2026-31825 to execute DQL Injection attacks through the API Order Filters.

5

Is CVE-2026-31825 related to specific Sylius components?

Yes, CVE-2026-31825 specifically affects the ProductPriceOrderFilter and TranslationOrderNameAndLocaleFilter in Sylius.

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