GHSA-2XMM-G482-4439
Vulnerability from github – Published: 2022-03-15 19:09 – Updated: 2022-03-15 19:09Impact
Values 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.
Patches
The issue is fixed in version 1.10.1 and in 1.11-rc.1
Workarounds
You have to overwrite your Sylius\Component\Grid\Sorting\Sorter.php class:
<?php
// src/App/Sorting/Sorter.php
declare(strict_types=1);
namespace App\Sorting;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Sylius\Component\Grid\Data\DataSourceInterface;
use Sylius\Component\Grid\Definition\Grid;
use Sylius\Component\Grid\Parameters;
use Sylius\Component\Grid\Sorting\SorterInterface;
final class Sorter implements SorterInterface
{
public function sort(DataSourceInterface $dataSource, Grid $grid, Parameters $parameters): void
{
$enabledFields = $grid->getFields();
$expressionBuilder = $dataSource->getExpressionBuilder();
$sorting = $parameters->get('sorting', $grid->getSorting());
$this->validateSortingParams($sorting, $enabledFields);
foreach ($sorting as $field => $order) {
$this->validateFieldNames($field, $enabledFields);
$gridField = $grid->getField($field);
$property = $gridField->getSortable();
if (null !== $property) {
$expressionBuilder->addOrderBy($property, $order);
}
}
}
private function validateSortingParams(array $sorting, array $enabledFields): void
{
foreach (array_keys($enabledFields) as $key) {
if (array_key_exists($key, $sorting) && !in_array($sorting[$key], ['asc', 'desc'])) {
throw new BadRequestHttpException(sprintf('%s is not valid, use asc or desc instead.', $sorting[$key]));
}
}
}
private function validateFieldNames(string $fieldName, array $enabledFields): void
{
$enabledFieldsNames = array_keys($enabledFields);
if (!in_array($fieldName, $enabledFieldsNames, true)) {
throw new BadRequestHttpException(sprintf('%s is not valid field, did you mean one of these: %s?', $fieldName, implode(', ', $enabledFieldsNames)));
}
}
}
and register it in your container:
# config/services.yaml
services:
# ...
sylius.grid.sorter:
class: App\Sorting\Sorter
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
{
"affected": [
{
"package": {
"ecosystem": "Packagist",
"name": "sylius/grid-bundle"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.10.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2022-24752"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": true,
"github_reviewed_at": "2022-03-15T19:09:16Z",
"nvd_published_at": "2022-03-15T15:15:00Z",
"severity": "CRITICAL"
},
"details": "### Impact\nValues added at the end of query sorting were passed directly to the DB. We don\u0027t 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\u003c?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-\u003egetFields();\n $expressionBuilder = $dataSource-\u003egetExpressionBuilder();\n\n $sorting = $parameters-\u003eget(\u0027sorting\u0027, $grid-\u003egetSorting());\n $this-\u003evalidateSortingParams($sorting, $enabledFields);\n\n foreach ($sorting as $field =\u003e $order) {\n $this-\u003evalidateFieldNames($field, $enabledFields);\n\n $gridField = $grid-\u003egetField($field);\n $property = $gridField-\u003egetSortable();\n\n if (null !== $property) {\n $expressionBuilder-\u003eaddOrderBy($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) \u0026\u0026 !in_array($sorting[$key], [\u0027asc\u0027, \u0027desc\u0027])) {\n throw new BadRequestHttpException(sprintf(\u0027%s is not valid, use asc or desc instead.\u0027, $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(\u0027%s is not valid field, did you mean one of these: %s?\u0027, $fieldName, implode(\u0027, \u0027, $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)",
"id": "GHSA-2xmm-g482-4439",
"modified": "2022-03-15T19:09:16Z",
"published": "2022-03-15T19:09:16Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/Sylius/SyliusGridBundle/security/advisories/GHSA-2xmm-g482-4439"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-24752"
},
{
"type": "WEB",
"url": "https://github.com/Sylius/SyliusGridBundle/pull/222"
},
{
"type": "WEB",
"url": "https://github.com/Sylius/SyliusGridBundle/commit/73d0791d0575f955e830a3da4c3345f420d2f784"
},
{
"type": "PACKAGE",
"url": "https://github.com/Sylius/SyliusGridBundle"
},
{
"type": "WEB",
"url": "https://github.com/Sylius/SyliusGridBundle/releases/tag/v1.10.1"
},
{
"type": "WEB",
"url": "https://github.com/Sylius/SyliusGridBundle/releases/tag/v1.11.0-RC.2"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "DQL injection through sorting parameters blocked"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.