Authentication Bypass in ADOdb/ADOdb
Published 27 Jan 2022 · Updated 8 Nov 2023
Is your project on an affected adodb/adodb-php?
Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- <5.20.21
- Fixed in
- 5.20.21
composer require adodb/adodb-php:^5.20.21- Affected
- >=5.21.0 <5.21.4
- Fixed in
- 5.21.4
composer require adodb/adodb-php:^5.21.4Details
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
Is GHSA-65mj-7c86-79jf in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected adodb/adodb-php, and gives you the command that fixes it.
More advisories for adodb/adodb-php
- CriticalCVE-2025-54119The ADOdb sqlite3 driver allows SQL injection · 4 Aug 2025
- CriticalCVE-2025-46337SQL injection in ADOdb PostgreSQL driver pg_insert_id() method · 1 May 2025
- CriticalGHSA-h63c-xvpf-264jADOdb SQL injection vulnerability · 15 May 2024
- MediumCVE-2016-4855ADOdb Cross-site scripting vulnerability in old test script · 17 May 2022
- CriticalCVE-2016-7405ADOdb Library SQL Injection · 17 May 2022
References
- Linkgithub.com/ADOdb/ADOdb/security/advisories/GHSA-65mj-7c86-79jf
- Advisorynvd.nist.gov/vuln/detail/CVE-2021-3850
- Linkgithub.com/ADOdb/ADOdb/issues/793
- Linkgithub.com/ADOdb/ADOdb/commit/952de6c4273d9b1e91c2b838044f8c2111150c29
- Linkgithub.com/ADOdb/ADOdb/commit/b4d5ce70034c5aac3a1d51d317d93c037a0938d2
- Packagegithub.com/ADOdb/ADOdb
- Linkhuntr.dev/bounties/bdf5f216-4499-4225-a737-b28bc6f5801c
- Linklists.debian.org/debian-lts-announce/2022/02/msg00006.html
- Linkwww.debian.org/security/2022/dsa-5101
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.