CVE-2021-43822: Jackalope/jackalope doctrine dbal SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-ph98-v78f-jqrm
CVSS 8.5
CWE-89
Published
Advisory Summary

CVE-2021-43822 is a HIGH (CVSS 8.5) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Jackalope/jackalope doctrine dbal libraries in the Packagist ecosystem. The issue involves sql injection in jackalope/jackalope-doctrine-dbal. Remediation is available by upgrading affected packages to version 1.7.4.

CVE-2021-43822 at a Glance

CVE Identifier CVE-2021-43822
GHSA Identifier GHSA-ph98-v78f-jqrm
Severity HIGH
CVSS v3.1 Base Score 8.5
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Jackalope/jackalope doctrine dbal
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2021-43822

To remediate this vulnerability, upgrade all affected Jackalope/jackalope doctrine dbal dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

jackalope/jackalope-doctrine-dbal fixed: 1.7.4
Upgrade jackalope/jackalope-doctrine-dbal to 1.7.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for jackalope/jackalope-doctrine-dbal

How to Check if You Are Affected

To determine whether your application is affected by CVE-2021-43822, inspect your project dependencies for Jackalope/jackalope doctrine dbal:

inspect dependencies for jackalope/jackalope-doctrine-dbal

Analyze the terminal output to locate any version of Jackalope/jackalope doctrine dbal in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.7.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Jackalope/jackalope doctrine dbal, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Users can provoke SQL injections if they can specify a node name or query. ### Patches Upgrade to version 1.7.4 If that is not possible, you can escape all places where `$property` is used to filter `sv:name` in the class `Jackalope\Transport\DoctrineDBAL\Query\QOMWalker`: `XPath::escape($property)`. ### Workarounds Node names and xpaths can contain `"` or `;` according to the JCR specification. The jackalope component that translates the query object model into doctrine dbal queries does not properly escape the names and paths, so that a accordingly crafted node name can lead to an SQL injection. If queries are never done from user input, or if you validate the user input to not contain `;`, you are not affected. ### References No further references. ### For more information If you have any questions or comments about this advisory: * Open an issue in [jackalope/jackalope-doctrine-dbal repo](https://github.com/jackalope/jackalope-doctrine-dbal/issues)

CVE-2021-43822 Affected Jackalope/jackalope doctrine dbal Versions

1 component(s)
Fixed Versions:
1.7.4
Product / Package Ecosystem Affected Versions Fixed Version
jackalope/jackalope-doctrine-dbal
Packagist
< 1.7.4
1.7.4

References

Frequently Asked Questions

What is CVE-2021-43822?
CVE-2021-43822 is a security vulnerability in Jackalope/jackalope doctrine dbal involving SQL injection in jackalope/jackalope-doctrine-dbal under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Jackalope/jackalope doctrine dbal versions are affected?
Affected versions include releases prior to 1.7.4 across affected packages: jackalope/jackalope-doctrine-dbal.
What version fixes CVE-2021-43822?
Upgrading to 1.7.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jackalope/jackalope-doctrine-dbal affected?
Yes, jackalope/jackalope-doctrine-dbal is affected in releases prior to 1.7.4. Upgrade your dependency to 1.7.4 or later.
What is the CVSS score of CVE-2021-43822?
CVE-2021-43822 has a CVSS v3.1 base score of 8.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2021-43822?
CVE-2021-43822 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Packagist dependencies for CVE-2021-43822?
Run the dependency tree command: 'inspect dependencies for jackalope/jackalope-doctrine-dbal'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-ph98-v78f-jqrm",
  "modified" : "2021-12-14T15:25:41Z",
  "published" : "2021-12-14T21:08:13Z",
  "aliases" : [ "CVE-2021-43822" ],
  "summary" : "SQL injection in jackalope/jackalope-doctrine-dbal",
  "details" : "### Impact\n\nUsers can provoke SQL injections if they can specify a node name or query.\n\n### Patches\n\nUpgrade to version 1.7.4\n\nIf that is not possible, you can escape all places where `$property` is used to filter `sv:name` in the class `Jackalope\\Transport\\DoctrineDBAL\\Query\\QOMWalker`: `XPath::escape($property)`.\n\n### Workarounds\n\nNode names and xpaths can contain `\"` or `;` according to the JCR specification. The jackalope component that translates the query object model into doctrine dbal queries does not properly escape the names and paths, so that a accordingly crafted node name can lead to an SQL injection.\n\nIf queries are never done from user input, or if you validate the user input to not contain `;`, you are not affected. \n\n### References\n\nNo further references.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* Open an issue in [jackalope/jackalope-doctrine-dbal repo](https://github.com/jackalope/jackalope-doctrine-dbal/issues)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "jackalope/jackalope-doctrine-dbal"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.7.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jackalope/jackalope-doctrine-dbal/security/advisories/GHSA-ph98-v78f-jqrm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43822"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jackalope/jackalope-doctrine-dbal/commit/9d179a36d320330ddb303ea3a7c98d3a33d231db"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jackalope/jackalope-doctrine-dbal"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-12-14T15:25:41Z",
    "nvd_published_at" : "2021-12-13T20:15:00Z"
  }
}