Advisory

GHSA-2x36-qhx3-7m5f

Also known as: None

Summary

ZendFramework1 Potential SQL injection in the ORDER implementation of Zend_Db_Select

Details

The implementation of the ORDER BY SQL statement in Zend_Db_Select of Zend Framework 1 contains a potential SQL injection when the query string passed contains parentheses.

For instance, the following code is affected by this issue:

$db     = Zend_Db::factory( /* options here */ );
$select = $db->select()
    ->from(array('p' => 'products'))
    ->order('MD5(1); drop table products');
echo $select;

This code produce the string:

SELECT "p".* FROM "products" AS "p" ORDER BY MD5(1);drop table products ASC

instead of the correct one:

SELECT "p".* FROM "products" AS "p" ORDER BY "MD5(1);drop table products" ASC

The SQL injection occurs because we create a new Zend_Db_Expr() object, in presence of parentheses, passing directly the value without any filter on the string.

Severity

Critical Basis: The source's own band: CRITICAL

Dates

Published
2024-06-07 22:24 UTC
Modified
2024-12-04 05:39 UTC

Affected packages and fixes

zendframework/zendframework1

Packagist · All systems

Affected

  • introduced 1.12.0, fixed 1.12.7 (ecosystem)

Fixed versions

1.12.7

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences