GitHub Advisoryadvisory · npm

GHSA-9r25-rp3p-h2w4 crud-query-parser SQL Injection vulnerability

HIGH Published 2025-04-09 Modified 2025-04-09 Official page ↗
Aliases
CVE-2025-32020
Ecosystem
npm
Packages
crud-query-parser
Severity
High
CVSS vector
CVSS:4.0/AV:A/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
Weaknesses
CWE-89
Reviewed
2025-04-09

Affected packages

• npm crud-query-parser: < 0.1.0 → fixed in 0.1.0

Description

Impact Improper neutralization of the `order`/`sort` parameter in the TypeORM adapter, which allows SQL injection. You are impacted by this vulnerability if you are using the TypeORM adapter, ordering is enabled and you have not set-up a property filter. Versions 0.0.1, 0.0.2 and 0.0.3 are affected by this vulnerability. Patches This vulnerability has been fixed in version 0.1.0 and newer, which introduces TypeORM field validation (enabled by default). Workarounds Add an allowlist of fields List all valid fields and use the `filterProperties` function to filter out invalid fields before passing the crudRequest to the `TypeOrmQueryAdapter`. Here's an example: ```ts crudRequest = filterProperties(crudRequest, ['id', 'title', 'category.name']); ``` Disable ordering Cleanup the `order` field just before passing it to the `TypeOrmQueryAdapter`. Here's an example: ```ts crudRequest.order = []; ```

Related

Alias · CVE (1)

  • CVE-2025-32020 The crud-query-parser library parses query parameters from HTTP requests and converts them to database queries. vulnerability

Weakness · CWE (1)

  • CWE-89 Improper Neutralization of Special Elements used in an SQL Command weakness

References