{"id":"CVE-2022-24752","aliases":["CVE-2022-24752","GHSA-2xmm-g482-4439"],"related":[],"kind":"vulnerability","state":"published","title":"SQL Injection through sorting parameters in SyliusGridBundle","summary":"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 the`Sylius\\Component\\Grid\\Sorting\\Sorter.php` class and register it in the container. More information about this workaround is available in the GitHub Security Advisory.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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 the`Sylius\\Component\\Grid\\Sorting\\Sorter.php` class and register it in the container. More information about this workaround is available in the GitHub Security Advisory.","source":"cvelist"},{"lang":"en","text":"### Impact\nValues added at the end of query sorting were passed directly to the DB. We don't know, if it could lead to direct SQL injections, however, we should not allow for easy injection of values there anyway.\n\n### Patches\nThe issue is fixed in version 1.10.1 and in 1.11-rc.1\n\n### Workarounds\n\nYou have to overwrite your `Sylius\\Component\\Grid\\Sorting\\Sorter.php` class:\n\n```php\n<?php\n\n// src/App/Sorting/Sorter.php\n\ndeclare(strict_types=1);\n\nnamespace App\\Sorting;\n\nuse Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException;\nuse Sylius\\Component\\Grid\\Data\\DataSourceInterface;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\Sorting\\SorterInterface;\n\nfinal class Sorter implements SorterInterface\n{\n    public function sort(DataSourceInterface $dataSource, Grid $grid, Parameters $parameters): void\n    {\n        $enabledFields = $grid->getFields();\n        $expressionBuilder = $dataSource->getExpressionBuilder();\n\n        $sorting = $parameters->get('sorting', $grid->getSorting());\n        $this->validateSortingParams($sorting, $enabledFields);\n\n        foreach ($sorting as $field => $order) {\n            $this->validateFieldNames($field, $enabledFields);\n\n            $gridField = $grid->getField($field);\n            $property = $gridField->getSortable();\n\n            if (null !== $property) {\n                $expressionBuilder->addOrderBy($property, $order);\n            }\n        }\n    }\n\n    private function validateSortingParams(array $sorting, array $enabledFields): void\n    {\n        foreach (array_keys($enabledFields) as $key) {\n            if (array_key_exists($key, $sorting) && !in_array($sorting[$key], ['asc', 'desc'])) {\n                throw new BadRequestHttpException(sprintf('%s is not valid, use asc or desc instead.', $sorting[$key]));\n            }\n        }\n    }\n\n    private function validateFieldNames(string $fieldName, array $enabledFields): void\n    {\n        $enabledFieldsNames = array_keys($enabledFields);\n\n        if (!in_array($fieldName, $enabledFieldsNames, true)) {\n            throw new BadRequestHttpException(sprintf('%s is not valid field, did you mean one of these: %s?', $fieldName, implode(', ', $enabledFieldsNames)));\n        }\n    }\n}\n```\nand register it in your container: \n\n```yaml\n# config/services.yaml\nservices:\n    # ...\n    sylius.grid.sorter:\n        class: App\\Sorting\\Sorter\n```\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [Sylius issues](https://github.com/Sylius/Sylius/issues)\n* Email us at [security@sylius.com](mailto:security@sylius.com)","format":"markdown","source":"ghsa"},{"lang":"es","text":"SyliusGridBundle es un paquete de grids de datos genéricos para aplicaciones Symfony.En versiones anteriores a 1.10.1 y 1.11-rc2, los valores añadidos al final de la ordenación de la consulta eran pasados directamente a la base de datos. Los mantenedores no saben si esto podría conllevar a inyecciones SQL directas, pero tomaron medidas para remediar la vulnerabilidad. El problema ha sido corregido en versiones 1.10.1 y 1.11-rc2. Como medida de mitigación, sobrescriba la clase \"Sylius\\Component\\Sorting\\Sorter.php\" y regístrela en el contenedor. Se presenta más información sobre esta mitigación en el aviso de seguridad de GitHub","source":"nvd"}],"published":"2022-03-15T14:40:13.000Z","modified":"2026-06-17T04:32:26.380Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","score":7.5,"rating":"HIGH"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":"< 1.10.1","status":"affected"},{"version":"1.11-alpha, <= 1.11-rc","status":"affected"}],"vendor":"Sylius","product":"SyliusGridBundle","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.10.1"}],"ecosystem":"Packagist","package":"sylius/grid-bundle","purl":"pkg:composer/sylius/grid-bundle","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.10.1"},{"status":"affected","version":"1.11.0"},{"status":"affected","version":"1.11.0"},{"status":"affected","version":"1.11.0"},{"status":"affected","version":"1.11.0"}],"vendor":"sylius","product":"syliusgridbundle","cpe":"cpe:2.3:a:sylius:syliusgridbundle:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/Sylius/SyliusGridBundle/security/advisories/GHSA-2xmm-g482-4439","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Sylius/SyliusGridBundle/pull/222","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Sylius/SyliusGridBundle/commit/73d0791d0575f955e830a3da4c3345f420d2f784","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Sylius/SyliusGridBundle/releases/tag/v1.10.1","tags":["release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Sylius/SyliusGridBundle/releases/tag/v1.11.0-RC.2","tags":["release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24752","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/Sylius/SyliusGridBundle","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"total","date":"2025-04-23T15:50:16.970Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-24752","url":"https://www.cve.org/CVERecord?id=CVE-2022-24752","licence":"CVE Terms of Use","modified":"2025-04-23T18:53:49.773Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-2xmm-g482-4439","url":"https://github.com/advisories/GHSA-2xmm-g482-4439","licence":"CC-BY-4.0","modified":"2023-11-08T04:08:35.185Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-24752","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24752","licence":"Public domain","modified":"2026-06-17T04:32:26.380Z"}],"updatedAt":"2026-11-25T22:58:10.104Z","epss":{"score":0.01392,"percentile":0.73146,"date":"2026-12-01T12:00:22.000Z"}}