GHSA-x2f4-8wxf-w3vf: Zendframework/zendframework SQL Injection Vulnerability

HIGH
CVSS 8.8
CWE-89
Published
Advisory Summary

GHSA-x2f4-8wxf-w3vf is a HIGH (CVSS 8.8) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Zendframework/zendframework libraries in the Packagist ecosystem. The issue involves zendframework sql injection due to execution of platform-specific sql containing interpolations. Remediation is available by upgrading affected packages to version 2.0.8, 2.1.4.

GHSA-x2f4-8wxf-w3vf at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-x2f4-8wxf-w3vf
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Zendframework/zendframework
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.8

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

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

How to Fix GHSA-x2f4-8wxf-w3vf

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

zendframework/zendframework fixed: 2.0.8
Upgrade zendframework/zendframework to 2.0.8
zendframework/zendframework fixed: 2.1.4
Upgrade zendframework/zendframework to 2.1.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 zendframework/zendframework

How to Check if You Are Affected

To determine whether your application is affected by GHSA-x2f4-8wxf-w3vf, inspect your project dependencies for Zendframework/zendframework:

inspect dependencies for zendframework/zendframework

Analyze the terminal output to locate any version of Zendframework/zendframework in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.8), 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 Zendframework/zendframework, 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

The `Zend\Db` component in Zend Framework 2 provides platform abstraction, which is used in particular for SQL abstraction. Two methods defined in the platform interface, `quoteValue()` and `quoteValueList()`, allow users to manually quote values for creating SQL statements; these are in turn consumed by aspects of the SQL abstraction platform, including `Zend\Db\Sql\Sql::getSqlStringForSqlObject()`, and the `getSqlString()` method provided in a number of classes in the Zend\Db\Sql namespace. While these methods are primarily intended for debugging and logging purposes, developers can use them to produce SQL that is then passed to the driver to execute. Due to a flaw in how the `quoteValue()` and `quoteValueList()` methods were written, this can lead to potential SQL injection. The offending code is located in any of the `Zend\Db\Adapter\Platform*` objects, particularly the quoteValue() and `quoteValueList()` methods. These methods did not take into account most of the possible escapable characters that would need to be escaped when attempting to create a quoted value for interpolation into a SQL string. Moreover, these methods did value quoting without extension level coordination which, when available, takes character-sets into account when quoting.

GHSA-x2f4-8wxf-w3vf Affected Zendframework/zendframework Versions

2 component(s)
Fixed Versions:
2.0.82.1.4
Product / Package Ecosystem Affected Versions Fixed Version
zendframework/zendframework
Packagist
≥ 2.0.0
< 2.0.8
2.0.8
zendframework/zendframework
Packagist
≥ 2.1.0
< 2.1.4
2.1.4

References

Frequently Asked Questions

What is GHSA-x2f4-8wxf-w3vf?
GHSA-x2f4-8wxf-w3vf is a security vulnerability in Zendframework/zendframework involving ZendFramework SQL injection due to execution of platform-specific SQL containing interpolations under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Zendframework/zendframework versions are affected?
Affected versions include releases prior to 2.0.8, 2.1.4 across affected packages: zendframework/zendframework.
What version fixes GHSA-x2f4-8wxf-w3vf?
Upgrading to 2.0.8, 2.1.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is zendframework/zendframework affected?
Yes, zendframework/zendframework is affected in releases prior to 2.0.8, 2.1.4. Upgrade your dependency to 2.0.8, 2.1.4 or later.
What is the CVSS score of GHSA-x2f4-8wxf-w3vf?
GHSA-x2f4-8wxf-w3vf has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with GHSA-x2f4-8wxf-w3vf?
GHSA-x2f4-8wxf-w3vf 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 GHSA-x2f4-8wxf-w3vf?
Run the dependency tree command: 'inspect dependencies for zendframework/zendframework'. 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-x2f4-8wxf-w3vf",
  "modified" : "2024-06-07T20:35:15Z",
  "published" : "2024-06-07T20:35:15Z",
  "aliases" : [ ],
  "summary" : "ZendFramework SQL injection due to execution of platform-specific SQL containing interpolations",
  "details" : "The `Zend\\Db` component in Zend Framework 2 provides platform abstraction, which is used in particular for SQL abstraction. Two methods defined in the platform interface, `quoteValue()` and `quoteValueList()`, allow users to manually quote values for creating SQL statements; these are in turn consumed by aspects of the SQL abstraction platform, including `Zend\\Db\\Sql\\Sql::getSqlStringForSqlObject()`, and the `getSqlString()` method provided in a number of classes in the Zend\\Db\\Sql namespace.\n\nWhile these methods are primarily intended for debugging and logging purposes, developers can use them to produce SQL that is then passed to the driver to execute. Due to a flaw in how the `quoteValue()` and `quoteValueList()` methods were written, this can lead to potential SQL injection.\n\nThe offending code is located in any of the `Zend\\Db\\Adapter\\Platform*` objects, particularly the quoteValue() and `quoteValueList()` methods. These methods did not take into account most of the possible escapable characters that would need to be escaped when attempting to create a quoted value for interpolation into a SQL string. Moreover, these methods did value quoting without extension level coordination which, when available, takes character-sets into account when quoting.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "zendframework/zendframework"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.0.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "zendframework/zendframework"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.1.0"
      }, {
        "fixed" : "2.1.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/zendframework/zendframework/commit/0ef63e7db5fa30a79a58eb7c6466c6ab5c0618c5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/zendframework/zendframework/commit/546074660e6e10b9191bf0dc62b524d99f71a5cd"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/zendframework/zendframework/commit/6d83777786b8e6171d82191ef917afd09fcb6601"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/zendframework/zendframework/commit/870741d0c01a24ff23f9e209c8d393bd3a4115e3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/zendframework/zendframework/commit/95c88c236e80b475141d227bdf7866ca40287dd1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/zendframework/zendframework/commit/d1f259b9d6dbd7c3828360afcfdd3658f2163ea0"
  }, {
    "type" : "WEB",
    "url" : "https://framework.zend.com/security/advisory/ZF2013-03"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/zendframework/zendframework/ZF2013-03.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/zendframework/zendframework"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-07T20:35:15Z",
    "nvd_published_at" : null
  }
}