GHSA-7vw7-qx38-37vr

Suggest an improvement
Source
https://github.com/advisories/GHSA-7vw7-qx38-37vr
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/05/GHSA-7vw7-qx38-37vr/GHSA-7vw7-qx38-37vr.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-7vw7-qx38-37vr
Published
2024-05-20T17:34:33Z
Modified
2024-12-05T05:32:18.600809Z
Severity
  • 9.8 (Critical) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
Propel2 SQL injection possible with limit() on MySQL
Details

The limit() query method is susceptible to catastrophic SQL injection with MySQL.

For example, given a model User for a table users:

UserQuery::create()->limit('1;DROP TABLE users')->find();

This will drop the users table!

The cause appears to be a lack of integer casting of the limit input in either Propel\Runtime\ActiveQuery\Criteria::setLimit() or in Propel\Runtime\Adapter\Pdo\MysqlAdapter::applyLimit(). The code comments there seem to imply that casting was avoided due to overflow issues with 32-bit integers.

This is surprising behavior since one of the primary purposes of an ORM is to prevent basic SQL injection.

This affects all versions of Propel: 1.x, 2.x, and 3.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-89"
    ],
    "severity": "CRITICAL",
    "github_reviewed": true,
    "github_reviewed_at": "2024-05-20T17:34:33Z"
}
References

Affected packages

Packagist / propel/propel

Package

Name
propel/propel
Purl
pkg:composer/propel/propel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
2.0.0-alpha1
Fixed
2.0.0-alpha8

Affected versions

2.*

2.0.0-alpha1
2.0.0-alpha2
2.0.0-alpha3
2.0.0-alpha4
2.0.0-alpha5
2.0.0-alpha6
2.0.0-alpha7

Database specific

{
    "last_known_affected_version_range": "<= 2.0.0-alpha7"
}