CVE-2021-3850: Authentication Bypass in ADOdb/ADOdb
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
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/libphp-adodbto a version that resolves this vulnerability.Fixed in 5.20.14-1+deb10u1Fixed in 5.20.19-1+deb11u1Fixed in 5.21.4-1 - Upgrade
Upgrade
ubuntu/libphp-adodbto a version that resolves this vulnerability.Fixed in 5.20.9-1ubuntu0.1~ - Upgrade
Upgrade
ubuntu/libphp-adodbto a version that resolves this vulnerability.Fixed in 5.20.16-1ubuntu0.1~ - Upgrade
Upgrade
ubuntu/libphp-adodbto a version that resolves this vulnerability.Fixed in 5.20.19-1ubuntu0.1 - Upgrade
Upgrade
ubuntu/libphp-adodbto a version that resolves this vulnerability.Fixed in 5.21.0-1 - Upgrade
Upgrade
ubuntu/libphp-adodbto a version that resolves this vulnerability.Fixed in 5.20.3-1ubuntu1+ - Upgrade
Upgrade
composer/adodb/adodb-phpto a version that resolves this vulnerability.Fixed in 5.21.4 - Upgrade
Upgrade
composer/adodb/adodb-phpto a version that resolves this vulnerability.Fixed in 5.20.21 - Upgrade
Upgrade
ADOdbto a version that resolves this vulnerability.Fixed in 5.20.21 - Upgrade
Upgrade
ADOdbto a version that resolves this vulnerability.Fixed in 5.21.4 - Compensating control
Ensure parameters passed to ADOConnection::connect(), _nConnect(), or _pConnect() are not surrounded by single quotes.
Event History
Frequently Asked Questions
What is the severity of CVE-2021-3850?
CVE-2021-3850 has been classified as a critical vulnerability due to an authentication bypass flaw.
How do I fix CVE-2021-3850?
To remediate CVE-2021-3850, upgrade to libphp-adodb version 5.20.21 or later.
What software is affected by CVE-2021-3850?
CVE-2021-3850 affects the ADOdb library in versions prior to 5.20.21.
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.
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.