GHSA-6q9v-4hq6-5m67 Doctrine SQL injection vulnerability

Not scored Published

Doctrine library allows SQL injection via uncast limit/offset parameters, enabling attackers to read or modify database contents.

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

What is GHSA-6q9v-4hq6-5m67?

GHSA-6q9v-4hq6-5m67 is a SQL injection vulnerability in doctrine/orm, published on 15 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Doctrine is prone to SQL injection vulnerability. Users of Doctrine 1.2 and 2 should update to the newly released versions of both libraries immediately. Both versions only include the security fix and no other changes to their previous versions 1.2.3 and 2.0.2.

Affected versions are:

  • 1.2.3 and earlier for PostgreSQL and DB2 Dialects
  • 2.0.2 and earlier

The security issue was found to affect the Doctrine\DBAL\Platforms\AbstractPlatform::modifyLimitQuery() function which does not cast input values for limit and offset to integer and allows malicious SQL to be executed if these parameters are passed into Doctrine 2 directly from request variables without previous cast to integer. Functionality building on top using limit queries in the ORM such as Doctrine\ORM\Query::setFirstResult() and Doctrine\ORM\Query::setMaxResults() are also affected by this security issue.

The fix for this security issue breaks backwards compatibility for developers that extend the Doctrine\DBAL\Platforms\AbstractPlatform::modifyLimitQuery() method, because it is now marked as final. Please overwrite the Doctrine\DBAL\Platforms\AbstractPlatform::doModifyLimitQuery() method instead.

Which versions are affected by GHSA-6q9v-4hq6-5m67?

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

PackageAffectedFixed in
doctrine/orm PackagistFrom 1.0.01.2.4
doctrine/orm PackagistFrom 1.0.01.2.4
doctrine/orm PackagistFrom 2.0.02.0.3
doctrine/orm PackagistFrom 2.0.02.0.3

How do I fix GHSA-6q9v-4hq6-5m67?

Upgrade doctrine/orm to a fixed version for your release line: 1.2.4 or 2.0.3.

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-6q9v-4hq6-5m67 being exploited?

There is no known exploitation of GHSA-6q9v-4hq6-5m67 in the wild and no public exploit code.

Sources

Is GHSA-6q9v-4hq6-5m67 in your software?

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

Check your SBOMs for free