CVE-2021-3850: Authentication Bypass in ADOdb/ADOdb

Published Jan 25, 2022
·
Updated

Impact

An attacker can inject values into a PostgreSQL connection string by providing a parameter surrounded by single quotes.

Depending on how the library is used in the client software, this may allow an attacker to bypass the login process, gain access to the server's IP address, etc.

Patches

The vulnerability is fixed in ADOdb versions 5.20.21 (952de6c4273d9b1e91c2b838044f8c2111150c29) and 5.21.4 or later (b4d5ce70034c5aac3a1d51d317d93c037a0938d2).

The simplest patch is to delete line 29 in drivers/adodb-postgres64.inc.php:

php diff --git a/drivers/adodb-postgres64.inc.php b/drivers/adodb-postgres64.inc.php index d04b7f67..729d7141 100644 --- a/drivers/adodb-postgres64.inc.php +++ b/drivers/adodb-postgres64.inc.php @@ -26,7 +26,6 @@ function adodbaddslashes($s) { $len = strlen($s); if ($len == 0) return "''"; - if (strncmp($s,"'",1) === 0 && substr($s,$len-1) == "'") return $s; // already quoted return "'".addslashes($s)."'"; }

Workarounds

Ensure the parameters passed to ADOConnection::connect() or related functions (nConnect(), pConnect()) are not surrounded by single quotes.

Credits

Thanks to Emmet Leahy (@meme-lord) of Sorcery Ltd for reporting this vulnerability, and to the huntr team for their support.

References

- Original issue report https://huntr.dev/bounties/bdf5f216-4499-4225-a737-b28bc6f5801c/ - ADOdb reference issue #793

For more information

If you have any questions or comments about this advisory: Add a note in issue #793 Contact the maintainers on Gitter

Other sources

Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.

— Ubuntu

Affected Software

12 affected componentsFixes available
debian/libphp-adodb
5.20.14-1+deb10u15.20.19-1+deb11u15.21.4-1
ubuntu/libphp-adodb<5.20.9-1ubuntu0.1~
5.20.9-1ubuntu0.1~
ubuntu/libphp-adodb<5.20.16-1ubuntu0.1~
5.20.16-1ubuntu0.1~
ubuntu/libphp-adodb<5.20.19-1ubuntu0.1
5.20.19-1ubuntu0.1
ubuntu/libphp-adodb<5.21.0-1
5.21.0-1
ubuntu/libphp-adodb<5.20.3-1ubuntu1+
5.20.3-1ubuntu1+
Adodb Project Adodb<=5.20.21
Debian Debian Linux=9.0
composer/adodb/adodb-php>=5.21.0, <=5.21.3
composer/adodb/adodb-php<=5.20.20
composer/adodb/adodb-php>=5.21.0<=5.21.3
5.21.4
composer/adodb/adodb-php<=5.20.20
5.20.21

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/libphp-adodb to a version that resolves this vulnerability.

    Fixed in 5.20.14-1+deb10u1Fixed in 5.20.19-1+deb11u1Fixed in 5.21.4-1
  2. Upgrade

    Upgrade ubuntu/libphp-adodb to a version that resolves this vulnerability.

    Fixed in 5.20.9-1ubuntu0.1~
  3. Upgrade

    Upgrade ubuntu/libphp-adodb to a version that resolves this vulnerability.

    Fixed in 5.20.16-1ubuntu0.1~
  4. Upgrade

    Upgrade ubuntu/libphp-adodb to a version that resolves this vulnerability.

    Fixed in 5.20.19-1ubuntu0.1
  5. Upgrade

    Upgrade ubuntu/libphp-adodb to a version that resolves this vulnerability.

    Fixed in 5.21.0-1
  6. Upgrade

    Upgrade ubuntu/libphp-adodb to a version that resolves this vulnerability.

    Fixed in 5.20.3-1ubuntu1+
  7. Upgrade

    Upgrade composer/adodb/adodb-php to a version that resolves this vulnerability.

    Fixed in 5.21.4
  8. Upgrade

    Upgrade composer/adodb/adodb-php to a version that resolves this vulnerability.

    Fixed in 5.20.21
  9. Upgrade

    Upgrade ADOdb to a version that resolves this vulnerability.

    Fixed in 5.20.21
  10. Upgrade

    Upgrade ADOdb to a version that resolves this vulnerability.

    Fixed in 5.21.4
  11. Compensating control

    Ensure parameters passed to ADOConnection::connect(), _nConnect(), or _pConnect() are not surrounded by single quotes.

Event History

Jan 25, 2022
CVE Published
via Ubuntu·12:00 AM
CVE Published
via MITRE·02:20 PM
Data Sourced
via MITRE·02:20 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jan 26, 2022
Data Sourced
08:45 AM
SeverityAffected Software
Jan 27, 2022
Advisory Published
via GitHub·03:23 PM
Data Sourced
via GitHub·03:23 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·03:23 PM
DescriptionSeverityAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is the severity of CVE-2021-3850?

CVE-2021-3850 has been classified as a critical vulnerability due to an authentication bypass flaw.

2

How do I fix CVE-2021-3850?

To remediate CVE-2021-3850, upgrade to libphp-adodb version 5.20.21 or later.

3

What software is affected by CVE-2021-3850?

CVE-2021-3850 affects the ADOdb library in versions prior to 5.20.21.

4

What types of systems are vulnerable to CVE-2021-3850?

Systems that use the affected versions of libphp-adodb on Debian or Ubuntu are susceptible to CVE-2021-3850.

5

Is CVE-2021-3850 a known issue in the software community?

Yes, CVE-2021-3850 is a reported vulnerability that has been documented in the software community.

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