CVE-2021-3850
Authentication Bypass by Primary Weakness in adodb/adodb
Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
9.1
Authentication Bypass by Primary Weakness in adodb/adodb
Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.
- Record
CVE-2021-3850- CVSS 3.0
- 9.1 Critical
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - Weakness
- CWE-305
- Updated
- 2026-11-02
EUVDEUVD-2022-0478
9.1
Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.
- Record
EUVD-2022-0478- CVSS 3.0
- 9.1 Critical
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-65mj-7c86-79jf
9.1
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:
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 adodb_addslashes($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
- Record
GHSA-65mj-7c86-79jf- CVSS 3.1
- 9.1 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - Weakness
- CWE-287, CWE-305
- Updated
- 2026-11-02
NVD
9.1
Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.
- Record
CVE-2021-3850- CVSS 3.1
- 9.1 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - CVSS 3.0
- 9.1 Critical
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - CVSS 2.0
- 6.4 Medium
AV:N/AC:L/Au:N/C:P/I:P/A:N - Weakness
- CWE-305, CWE-287
- Updated
- 2026-11-02
OSV
9.1
Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.
- Record
CVE-2021-3850- CVSS 3.1
- 9.1 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-3850
9.1
Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.
- Record
DEBIAN-CVE-2021-3850- CVSS 3.1
- 9.1 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
Show 4 moreShow less
OSVGHSA-65mj-7c86-79jf
9.1
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:
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 adodb_addslashes($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
- Record
GHSA-65mj-7c86-79jf- CVSS 3.1
- 9.1 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - Weakness
- CWE-287, CWE-305
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-3850
9.1
Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.
- Record
UBUNTU-CVE-2021-3850- CVSS 3.1
- 9.1 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - CVSS 3.0
- 9.1 Critical
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N - Updated
- 2026-11-02
OSVMGASA-2022-0056 No score
Updated php-adodb packages fix security vulnerability
Security hotfix release addressing a critical vulnerability in PostgreSQL connections (CVE-2021-3850)
Additional fixes: Fix usage of get_magic_* functions #619 #657 Fix PHP warning in _rs2rs() function #679 pdo: Fix Fatal error in _query() #666 pdo: Fix undefined variable #678 pgsql: Fix Fatal error in _close() method (PHP8) #666 pgsql: fix deprecated function aliases (PHP8) #667 text: fix Cannot pass parameter by reference #668 Add support for persistent connections in PDO driver #650 Connect to SQL Server database on a specified port. #624 DSN database connection with password containing # fails #651 Metacolumns returns wrong type for integer fields in Mysql 8 #642 Uninitialized Variable access in mssqlnative ErrorNo() method #637
- Record
MGASA-2022-0056- Updated
- 2026-11-02
OSVUSN-6825-1 No score
libphp-adodb vulnerabilities
It was discovered that the PDO driver in ADOdb was incorrectly handling string quotes. A remote attacker could possibly use this issue to perform SQL injection attacks. This issue only affected Ubuntu 16.04 LTS. (CVE-2016-7405)
It was discovered that ADOdb was incorrectly handling GET parameters in test.php. A remote attacker could possibly use this issue to execute cross-site scripting (XSS) attacks. This issue only affected Ubuntu 16.04 LTS. (CVE-2016-4855)
Emmet Leahy discovered that ADOdb was incorrectly handling string quotes in PostgreSQL connections. A remote attacker could possibly use this issue to bypass authentication. (CVE-2021-3850)
- Record
USN-6825-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
adodb/adodb-phpPackagist |
through 5.20.20 | 5.20.21 |
adodb/adodb-phpPackagist |
5.21.0 to 5.21.3 | 5.21.4 |
libphp-adodbDebian:12 |
before 5.21.4-1 | 5.21.4-1 |
libphp-adodbDebian:13 |
before 5.21.4-1 | 5.21.4-1 |
libphp-adodbDebian:14 |
before 5.21.4-1 | 5.21.4-1 |
libphp-adodbDebian:9 |
before 5.20.9-1+deb9u1, plus listed versions 5.20.9-1 |
5.20.9-1+deb9u1 |
libphp-adodbDebian:10 |
before 5.20.14-1+deb10u1, plus listed versions 5.20.14-1 |
5.20.14-1+deb10u1 |
libphp-adodbDebian:11 |
before 5.20.19-1+deb11u1, plus listed versions 5.20.19-1 |
5.20.19-1+deb11u1 |
adodb/adodb-phpPackagist |
before 5.20.21, plus listed versions v5.19v5.20.0v5.20.1v5.20.10v5.20.11 Show 17 moreShow lessv5.20.12v5.20.13v5.20.14v5.20.15v5.20.16v5.20.17v5.20.18v5.20.19v5.20.2v5.20.20v5.20.3v5.20.4v5.20.5v5.20.6v5.20.7v5.20.8v5.20.9 |
5.20.21 |
adodb/adodb-phpPackagist |
5.21.0 up to 5.21.4, plus listed versions v5.21.0v5.21.1v5.21.2v5.21.3 |
5.21.4 |
Show 9 moreShow less
| Package | Affected | Fixed |
|---|---|---|
php-adodbMageia:8 |
before 5.20.21-1.mga8 | 5.20.21-1.mga8 |
libphp-adodbUbuntu:Pro:16.04:LTS |
before 5.20.3-1ubuntu1+esm1, plus listed versions 5.18a-15.20.1-15.20.2-15.20.2-25.20.3-15.20.3-1ubuntu1 |
5.20.3-1ubuntu1+esm1 |
libphp-adodbUbuntu:Pro:18.04:LTS |
before 5.20.9-1ubuntu0.1~esm1, plus listed versions 5.20.9-1 |
5.20.9-1ubuntu0.1~esm1 |
libphp-adodbUbuntu:Pro:20.04:LTS |
before 5.20.16-1ubuntu0.1~esm1, plus listed versions 5.20.14-15.20.15-15.20.16-1 |
5.20.16-1ubuntu0.1~esm1 |
libphp-adodbUbuntu:22.04:LTS |
before 5.20.19-1ubuntu0.1, plus listed versions 5.20.19-1 |
5.20.19-1ubuntu0.1 |
libphp-adodbUbuntu:Pro:16.04:LTS From an advisory covering 3 CVEs |
before 5.20.3-1ubuntu1+esm1, plus listed versions 5.18a-15.20.1-15.20.2-15.20.2-25.20.3-15.20.3-1ubuntu1 |
5.20.3-1ubuntu1+esm1 |
libphp-adodbUbuntu:Pro:18.04:LTS From an advisory covering 3 CVEs |
before 5.20.9-1ubuntu0.1~esm1, plus listed versions 5.20.9-1 |
5.20.9-1ubuntu0.1~esm1 |
libphp-adodbUbuntu:Pro:20.04:LTS From an advisory covering 3 CVEs |
before 5.20.16-1ubuntu0.1~esm1, plus listed versions 5.20.14-15.20.15-15.20.16-1 |
5.20.16-1ubuntu0.1~esm1 |
libphp-adodbUbuntu:22.04:LTS From an advisory covering 3 CVEs |
before 5.20.19-1ubuntu0.1, plus listed versions 5.20.19-1 |
5.20.19-1ubuntu0.1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-3850 is a critical vulnerability (CVSS 9.1) in Adodb Adodb/adodb, published January 25, 2022. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 2.17%, the 82nd percentile. Fixed in adodb/adodb-php 5.20.21.
References
huntr.dev/bounties/bdf5f216-4499-4225-a737-b28bc6f5801c
github.com/adodb/adodb/commit/952de6c4273d9b1e91c2b838044f8c2111150c29
lists.debian.org/debian-lts-announce/2022/02/msg00006.html
debian.org/security/2022/dsa-5101
github.com/ADOdb/ADOdb/security/advisories/GHSA-65mj-7c86-79jf
github.com/ADOdb/ADOdb/issues/793
Show 14 moreShow less
github.com/ADOdb/ADOdb/commit/952de6c4273d9b1e91c2b838044f8c2111150c29
github.com/ADOdb/ADOdb/commit/b4d5ce70034c5aac3a1d51d317d93c037a0938d2
nvd.nist.gov/vuln/detail/CVE-2021-3850
github.com/advisories/GHSA-65mj-7c86-79jf
security-tracker.debian.org/tracker/CVE-2021-3850
github.com/ADOdb/ADOdb
advisories.mageia.org/MGASA-2022-0056.html
bugs.mageia.org/show_bug.cgi?id=30008
github.com/ADOdb/ADOdb/releases/tag/v5.20.21
ubuntu.com/security/CVE-2021-3850
cve.org/CVERecord?id=CVE-2021-3850
ubuntu.com/security/notices/USN-6825-1
ubuntu.com/security/CVE-2016-4855
ubuntu.com/security/CVE-2016-7405