# CVE-2019-7164: SQLAlchemy vulnerable to SQL Injection via order_by parameter

Source: https://junglewise.ai/threats/cve-2019-7164-sqlalchemy-vulnerable-to-sql-injection-via-order-by-parameter  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2019-04-16. Updated: 2026-05-11  
License: CC BY 4.0 with a link back

CVE-2019-7164 · Severity: critical · CVSS 9.8 · Published 2019-04-16

SQLAlchemy before 1.3.0b3 allows SQL Injection via the order_by parameter. The fix (commit 30307c4) was applied only to the main branch and was never backported to the 1.2.x release line; all 1.2.x versions remain vulnerable.

Technologies: [SQLAlchemy (PyPI)](https://junglewise.ai/threats/technologies/sqlalchemy). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2019-7164 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2019-7164 being exploited in the wild.

**How severe is CVE-2019-7164?** Critical severity, with a CVSS score of 9.8, published 16 April 2019.

**Which products and versions are affected?** SQLAlchemy (PyPI) < 1.3.0b3, ECOSYSTEM:introduced=0,fixed=1.3.0b3.

**Is there a fix for CVE-2019-7164?** Yes. SQLAlchemy (PyPI): upgrade to 1.3.0b3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**Am I affected by CVE-2019-7164?** Check whether you run SQLAlchemy (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- SQLAlchemy (PyPI): upgrade to 1.3.0b3 or later

  ```sh
  pip install "SQLAlchemy>=1.3.0b3"
  ```


## Affected products

- SQLAlchemy (PyPI) < 1.3.0b3, ECOSYSTEM:introduced=0,fixed=1.3.0b3

## Identifiers

- CVE-2019-7164
- GHSA-887w-45rq-vxgf
- PYSEC-2019-123

## References

- [https://api.github.com/users/DEVSOG12](https://api.github.com/users/DEVSOG12)
- [https://github.com/DEVSOG12](https://github.com/DEVSOG12)
- [https://api.github.com/users/DEVSOG12/gists%7B/gist_id%7D](https://api.github.com/users/DEVSOG12/gists%7B/gist_id%7D)
- [https://api.github.com/users/DEVSOG12/repos](https://api.github.com/users/DEVSOG12/repos)
- [https://avatars.githubusercontent.com/u/54543298?v=4](https://avatars.githubusercontent.com/u/54543298?v=4)
- [https://api.github.com/users/DEVSOG12/events%7B/privacy%7D](https://api.github.com/users/DEVSOG12/events%7B/privacy%7D)

## Related threats

- [PYSEC-2019-53 - SQLAlchemy through 1.2.17 and 1.3.x through 1.3.0b2 allows SQL Injection via the order_by parameter.](https://junglewise.ai/threats/pysec-2019-53-sqlalchemy-through-1-2-17-and-1-3-x-through-1-3-0b2-6bad9589)
- [PYSEC-2019-124 - SQLAlchemy 1.2.17 has SQL Injection when the group_by parameter can be controlled.](https://junglewise.ai/threats/cve-2019-7548-sqlalchemy-sql-injection-in-group-by-parameter)
- [PYSEC-2019-54 - SQLAlchemy 1.2.17 has SQL Injection when the group_by parameter can be controlled.](https://junglewise.ai/threats/pysec-2019-54-sqlalchemy-1-2-17-has-sql-injection-when-the-group-by-c13f4d60)
- [SQLAlchemy vulnerable to SQL injection](https://junglewise.ai/threats/cve-2012-0805-sqlalchemy-vulnerable-to-sql-injection)
