# GHSA-2x36-qhx3-7m5f: ZendFramework1 Potential SQL injection in the ORDER implementation of Zend_Db_Select

- Severity: Critical 9.8 (CVSS:3.1, scored by GitHub) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2024-06-07T22:24:52.000Z
- Modified: 2024-12-04T05:39:35.461Z
- Weaknesses: CWE-89

## Description

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.

(As written by GitHub Advisory Database.)

## Affected

- zendframework/zendframework1 (Packagist): from 1.12.0 before 1.12.7

## References

- <https://framework.zend.com/security/advisory/ZF2014-04> (web)
- <https://github.com/FriendsOfPHP/security-advisories/blob/master/zendframework/zendframework1/ZF2014-04.yaml> (web)
- <https://github.com/zendframework/zf1> (package)

## Sources

- GitHub Advisory Database: [GHSA-2x36-qhx3-7m5f](https://github.com/advisories/GHSA-2x36-qhx3-7m5f), CC-BY-4.0, modified 2024-12-04

---

Page: https://cve.day/GHSA-2x36-qhx3-7m5f · Whole record: https://cve.day/GHSA-2x36-qhx3-7m5f.json · Rebuilt by cve.day 2026-11-25T22:56:30.805Z
