CVE-2022-31631: PDO::quote() may return unquoted string

Published Jan 5, 2023
·
Updated

CVE-2022-31631 php: PDO::quote() may return unquoted string

https://www.php.net/ChangeLog-8.php#8.0.27 https://bugs.php.net/bug.php?id=81740 https://github.com/php/php-src/commit/921b6813da3237a83e908998483f46ae3d8bacba

Other sources

Fixed bug (PDO::quote() may return unquoted string). (CVE-2022-31631)

— PHP

In PHP versions 8.0. before 8.0.27, 8.1. before 8.1.15, 8.2. before 8.2.2 when using PDO::quote() function to quote user-supplied data for SQLite, supplying an overly long string may cause the driver to incorrectly quote the data, which may further lead to SQL injection vulnerabilities.

— MITRE

Affected Software

17 affected componentsFixes available
PHP PHP<8.0.27
8.0.27
All of the following
Any of the following
PHP PHP>=8.0.0<8.0.27
PHP PHP>=8.1.0<8.1.15
PHP PHP>=8.2.0<8.2.2
SQLite SQLite>=3.39.2
debian/php8.2<8.2.1-1
8.2.1-1
debian/php8.2
8.2.32-1~deb12u18.2.35-1~deb12u1
alpine/php8<8.0.27-r0
8.0.27-r0
alpine/php81<8.1.14-r0
8.1.14-r0
alpine/php81<8.1.14-r0
8.1.14-r0
alpine/php81<8.1.14-r0
8.1.14-r0
alpine/php81<8.1.14-r0
8.1.14-r0
alpine/php82<8.2.1-r0
8.2.1-r0
alpine/php82<8.2.1-r0
8.2.1-r0
alpine/php82<8.2.1-r0
8.2.1-r0
alpine/php82<8.2.1-r0
8.2.1-r0
alpine/php82<8.2.1-r0
8.2.1-r0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 8.0.27
  2. Upgrade

    Upgrade debian/php8.2 to a version that resolves this vulnerability.

    Fixed in 8.2.32-1~deb12u1Fixed in 8.2.35-1~deb12u1
  3. Upgrade

    Upgrade alpine/php8 to a version that resolves this vulnerability.

    Fixed in 8.0.27-r0
  4. Upgrade

    Upgrade alpine/php81 to a version that resolves this vulnerability.

    Fixed in 8.1.14-r0
  5. Upgrade

    Upgrade alpine/php82 to a version that resolves this vulnerability.

    Fixed in 8.2.1-r0
  6. Upgrade

    Upgrade debian/php8.2 to a version that resolves this vulnerability.

    Fixed in 8.2.1-1
  7. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 8.1.15
  8. Upgrade

    Upgrade PHP to a version that resolves this vulnerability.

    Fixed in 8.2.2

Event History

Jan 5, 2023
CVE Published
via PHP·12:00 AM
Jan 6, 2023
Data Sourced
via Red Hat·03:53 PM
DescriptionSeverityAffected Software
Feb 12, 2025
CVE Published
via MITRE·10:10 PM
Data Sourced
via MITRE·10:10 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:15 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·10:15 PM
DescriptionSeverityAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is CVE-2022-31631?

CVE-2022-31631 is a vulnerability in PHP which allows PDO::quote() to return an unquoted string.

2

How does CVE-2022-31631 affect PHP?

CVE-2022-31631 affects PHP versions up to and including 8.0.27.

3

Is there a fix available for CVE-2022-31631?

Yes, the vulnerability has been fixed in PHP version 8.0.27.

4

What is PDO::quote()?

PDO::quote() is a PHP function used to quote a string for use in a query.

5

How can I find more information about CVE-2022-31631?

You can find more information about CVE-2022-31631 in the PHP ChangeLog for version 8.0.27.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203