GHSA-x2f4-8wxf-w3vf ZendFramework SQL injection due to execution of platform-specific SQL containing interpolations

Not scored Published

Attackers can execute arbitrary SQL commands via flawed value quoting in Zend Framework's database abstraction layer, potentially reading or modifying data.

Exploited in the wild
Not known
Login needed
Not stated
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is GHSA-x2f4-8wxf-w3vf?

GHSA-x2f4-8wxf-w3vf is a SQL injection vulnerability in zendframework/zendframework, published on 7 Jun 2024. It can be exploited over the network, with no action from the victim.

Official description

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.

Which versions are affected by GHSA-x2f4-8wxf-w3vf?

4 open source packages ship an affected version, including zendframework/zendframework.

PackageAffectedFixed in
zendframework/zendframework PackagistFrom 2.0.02.0.8
zendframework/zendframework PackagistFrom 2.0.02.0.8
zendframework/zendframework PackagistFrom 2.1.02.1.4
zendframework/zendframework PackagistFrom 2.1.02.1.4

How do I fix GHSA-x2f4-8wxf-w3vf?

Upgrade zendframework/zendframework to a fixed version for your release line: 2.0.8 or 2.1.4.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is GHSA-x2f4-8wxf-w3vf being exploited?

There is no known exploitation of GHSA-x2f4-8wxf-w3vf in the wild and no public exploit code.

Sources

Is GHSA-x2f4-8wxf-w3vf in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free