{"id":"CVE-2021-3850","aliases":["DEBIAN-CVE-2021-3850","DLA-2912-1","DSA-5101-1","EUVD-2022-0478","GHSA-65mj-7c86-79jf","MGASA-2022-0056","UBUNTU-CVE-2021-3850","USN-6825-1"],"status":"published","title":"Authentication Bypass by Primary Weakness in adodb/adodb","description":"Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.","severity":{"version":"3.0","score":9.1,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.0217,"percentile":0.82426,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-287","CWE-305"],"published":"2022-01-25T14:20:11Z","modified":"2026-10-23T18:02:12Z","fixes":[{"ecosystem":"Packagist","package":"adodb/adodb-php","fixed_in":["5.20.21","5.21.4"],"sources":["ghsa","osv"]},{"ecosystem":"Debian:12","package":"libphp-adodb","fixed_in":["5.21.4-1"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"libphp-adodb","fixed_in":["5.21.4-1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"libphp-adodb","fixed_in":["5.21.4-1"],"sources":["osv"]},{"ecosystem":"Debian:9","package":"libphp-adodb","fixed_in":["5.20.9-1+deb9u1"],"sources":["osv"]},{"ecosystem":"Debian:10","package":"libphp-adodb","fixed_in":["5.20.14-1+deb10u1"],"sources":["osv"]},{"ecosystem":"Debian:11","package":"libphp-adodb","fixed_in":["5.20.19-1+deb11u1"],"sources":["osv"]},{"ecosystem":"Mageia:8","package":"php-adodb","fixed_in":["5.20.21-1.mga8"],"sources":["osv"]},{"ecosystem":"Ubuntu:Pro:16.04:LTS","package":"libphp-adodb","fixed_in":["5.20.3-1ubuntu1+esm1"],"sources":["osv"]},{"ecosystem":"Ubuntu:Pro:18.04:LTS","package":"libphp-adodb","fixed_in":["5.20.9-1ubuntu0.1~esm1"],"sources":["osv"]},{"ecosystem":"Ubuntu:Pro:20.04:LTS","package":"libphp-adodb","fixed_in":["5.20.16-1ubuntu0.1~esm1"],"sources":["osv"]},{"ecosystem":"Ubuntu:22.04:LTS","package":"libphp-adodb","fixed_in":["5.20.19-1ubuntu0.1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"Packagist","package":"adodb/adodb-php","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"5.20.20"},{"fixed":"5.20.21"}]}]},{"source":"ghsa","ecosystem":"Packagist","package":"adodb/adodb-php","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.21.0"},{"last_affected":"5.21.3"},{"fixed":"5.21.4"}]}]},{"source":"osv","ecosystem":"Debian:12","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.21.4-1"}]}]},{"source":"osv","ecosystem":"Debian:13","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.21.4-1"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.21.4-1"}]}]},{"source":"osv","ecosystem":"Debian:9","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.9-1+deb9u1"}]}],"versions":["5.20.9-1"]},{"source":"osv","ecosystem":"Debian:10","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.14-1+deb10u1"}]}],"versions":["5.20.14-1"]},{"source":"osv","ecosystem":"Debian:11","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.19-1+deb11u1"}]}],"versions":["5.20.19-1"]},{"source":"osv","ecosystem":"Packagist","package":"adodb/adodb-php","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.21"}]}],"versions":["v5.19","v5.20.0","v5.20.1","v5.20.10","v5.20.11","v5.20.12","v5.20.13","v5.20.14","v5.20.15","v5.20.16","v5.20.17","v5.20.18","v5.20.19","v5.20.2","v5.20.20","v5.20.3","v5.20.4","v5.20.5","v5.20.6","v5.20.7","v5.20.8","v5.20.9"]},{"source":"osv","ecosystem":"Packagist","package":"adodb/adodb-php","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.21.0"},{"fixed":"5.21.4"}]}],"versions":["v5.21.0","v5.21.1","v5.21.2","v5.21.3"]},{"source":"osv","ecosystem":"Mageia:8","package":"php-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.21-1.mga8"}]}]},{"source":"osv","ecosystem":"Ubuntu:Pro:16.04:LTS","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.3-1ubuntu1+esm1"}]}],"versions":["5.18a-1","5.20.1-1","5.20.2-1","5.20.2-2","5.20.3-1","5.20.3-1ubuntu1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:18.04:LTS","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.9-1ubuntu0.1~esm1"}]}],"versions":["5.20.9-1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.16-1ubuntu0.1~esm1"}]}],"versions":["5.20.14-1","5.20.15-1","5.20.16-1"]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.19-1ubuntu0.1"}]}],"versions":["5.20.19-1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:16.04:LTS","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.3-1ubuntu1+esm1"}]}],"versions":["5.18a-1","5.20.1-1","5.20.2-1","5.20.2-2","5.20.3-1","5.20.3-1ubuntu1"],"bundled":3},{"source":"osv","ecosystem":"Ubuntu:Pro:18.04:LTS","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.9-1ubuntu0.1~esm1"}]}],"versions":["5.20.9-1"],"bundled":3},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.16-1ubuntu0.1~esm1"}]}],"versions":["5.20.14-1","5.20.15-1","5.20.16-1"],"bundled":3},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"libphp-adodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.20.19-1ubuntu0.1"}]}],"versions":["5.20.19-1"],"bundled":3}],"products":[{"vendor":"adodb","product":"adodb/adodb"},{"vendor":"adodb_project","product":"adodb"},{"vendor":"debian","product":"debian_linux"}],"references":[{"url":"https://huntr.dev/bounties/bdf5f216-4499-4225-a737-b28bc6f5801c","tags":["x_refsource_CONFIRM","x_transferred","Exploit","Issue Tracking","Patch","Third Party Advisory","fix","web","report"]},{"url":"https://github.com/adodb/adodb/commit/952de6c4273d9b1e91c2b838044f8c2111150c29","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","fix","report"]},{"url":"https://lists.debian.org/debian-lts-announce/2022/02/msg00006.html","tags":["mailing-list","x_refsource_MLIST","x_transferred","Mailing List","Third Party Advisory","advisory","web"]},{"url":"https://www.debian.org/security/2022/dsa-5101","tags":["vendor-advisory","x_refsource_DEBIAN","x_transferred","Third Party Advisory","advisory","web"]},{"url":"https://github.com/ADOdb/ADOdb/security/advisories/GHSA-65mj-7c86-79jf","tags":["web"]},{"url":"https://github.com/ADOdb/ADOdb/issues/793","tags":["web","report"]},{"url":"https://github.com/ADOdb/ADOdb/commit/952de6c4273d9b1e91c2b838044f8c2111150c29","tags":["web"]},{"url":"https://github.com/ADOdb/ADOdb/commit/b4d5ce70034c5aac3a1d51d317d93c037a0938d2","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-3850","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-65mj-7c86-79jf"},{"url":"https://security-tracker.debian.org/tracker/CVE-2021-3850","tags":["advisory"]},{"url":"https://github.com/ADOdb/ADOdb","tags":["package"]},{"url":"https://advisories.mageia.org/MGASA-2022-0056.html","tags":["advisory"]},{"url":"https://bugs.mageia.org/show_bug.cgi?id=30008","tags":["report"]},{"url":"https://github.com/ADOdb/ADOdb/releases/tag/v5.20.21","tags":["web"]},{"url":"https://ubuntu.com/security/CVE-2021-3850","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2021-3850","tags":["report"]},{"url":"https://ubuntu.com/security/notices/USN-6825-1","tags":["advisory"]},{"url":"https://ubuntu.com/security/CVE-2016-4855","tags":["report"]},{"url":"https://ubuntu.com/security/CVE-2016-7405","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2021-3850","title":"Authentication Bypass by Primary Weakness in adodb/adodb","description":"Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.","status":"published","published":"2022-01-25T14:20:11Z","modified":"2024-08-03T17:09:09.599Z","cvss":[{"version":"3.0","score":9.1,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical","assessor":"cna"}],"cwes":["CWE-305"],"updated_at":"2026-11-02T14:33:04.020035Z"}],"euvd":[{"id":"EUVD-2022-0478","description":"Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.","status":"published","published":"2022-01-25T14:20:11Z","modified":"2024-08-03T17:09:09Z","cvss":[{"version":"3.0","score":9.1,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical"}],"updated_at":"2026-11-03T03:25:11.376657Z"}],"ghsa":[{"id":"GHSA-65mj-7c86-79jf","title":"Authentication Bypass in ADOdb/ADOdb","description":"### Impact\n\nAn attacker can inject values into a PostgreSQL connection string by providing a parameter surrounded by single quotes.\n\nDepending 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.\n\n### Patches\n\nThe vulnerability is fixed in ADOdb versions 5.20.21 (952de6c4273d9b1e91c2b838044f8c2111150c29) and 5.21.4 or later (b4d5ce70034c5aac3a1d51d317d93c037a0938d2).\n\nThe simplest patch is to delete line 29 in `drivers/adodb-postgres64.inc.php`:\n\n```php\ndiff --git a/drivers/adodb-postgres64.inc.php b/drivers/adodb-postgres64.inc.php\nindex d04b7f67..729d7141 100644\n--- a/drivers/adodb-postgres64.inc.php\n+++ b/drivers/adodb-postgres64.inc.php\n@@ -26,7 +26,6 @@ function adodb_addslashes($s)\n {\n    $len = strlen($s);\n    if ($len == 0) return \"''\";\n-   if (strncmp($s,\"'\",1) === 0 \u0026\u0026 substr($s,$len-1) == \"'\") return $s; // already quoted\n \n    return \"'\".addslashes($s).\"'\";\n }\n```\n\n### Workarounds\n\nEnsure the parameters passed to *ADOConnection::connect()* or related functions (_nConnect()_, _pConnect()_) are not surrounded by single quotes.\n\n### Credits\n\nThanks to **Emmet Leahy** (@meme-lord) of Sorcery Ltd for reporting this vulnerability, and to the [huntr](https://huntr.dev/) team for their support.\n\n### References\n\n- Original issue report https://huntr.dev/bounties/bdf5f216-4499-4225-a737-b28bc6f5801c/\n- ADOdb reference issue #793 \n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Add a note in issue #793\n* Contact the maintainers on [Gitter](https://gitter.im/adodb/adodb)\n","status":"published","published":"2022-01-27T15:23:19Z","modified":"2023-02-03T05:04:55Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical"}],"cwes":["CWE-287","CWE-305"],"updated_at":"2026-11-02T14:36:42.703723Z"}],"nvd":[{"id":"CVE-2021-3850","description":"Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.","status":"published","published":"2022-01-25T15:15:08.013Z","modified":"2026-06-17T04:05:53.547Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical","assessor":"primary"},{"version":"3.0","score":9.1,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical","assessor":"secondary"},{"version":"2.0","score":6.4,"vector":"AV:N/AC:L/Au:N/C:P/I:P/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-305","CWE-287"],"updated_at":"2026-11-02T14:07:03.821385Z"}],"osv":[{"id":"CVE-2021-3850","description":"Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.","status":"published","published":"2022-01-25T15:15:08.013Z","modified":"2026-10-20T10:54:51.642378949Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical"}],"updated_at":"2026-11-02T15:44:20.843843Z"},{"id":"DEBIAN-CVE-2021-3850","description":"Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.","status":"published","published":"2022-01-25T15:15:08.013Z","modified":"2026-10-23T18:02:12.941815461Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical"}],"updated_at":"2026-11-02T15:45:35.521549Z"},{"id":"GHSA-65mj-7c86-79jf","title":"Authentication Bypass in ADOdb/ADOdb","description":"### Impact\n\nAn attacker can inject values into a PostgreSQL connection string by providing a parameter surrounded by single quotes.\n\nDepending 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.\n\n### Patches\n\nThe vulnerability is fixed in ADOdb versions 5.20.21 (952de6c4273d9b1e91c2b838044f8c2111150c29) and 5.21.4 or later (b4d5ce70034c5aac3a1d51d317d93c037a0938d2).\n\nThe simplest patch is to delete line 29 in `drivers/adodb-postgres64.inc.php`:\n\n```php\ndiff --git a/drivers/adodb-postgres64.inc.php b/drivers/adodb-postgres64.inc.php\nindex d04b7f67..729d7141 100644\n--- a/drivers/adodb-postgres64.inc.php\n+++ b/drivers/adodb-postgres64.inc.php\n@@ -26,7 +26,6 @@ function adodb_addslashes($s)\n {\n    $len = strlen($s);\n    if ($len == 0) return \"''\";\n-   if (strncmp($s,\"'\",1) === 0 \u0026\u0026 substr($s,$len-1) == \"'\") return $s; // already quoted\n \n    return \"'\".addslashes($s).\"'\";\n }\n```\n\n### Workarounds\n\nEnsure the parameters passed to *ADOConnection::connect()* or related functions (_nConnect()_, _pConnect()_) are not surrounded by single quotes.\n\n### Credits\n\nThanks to **Emmet Leahy** (@meme-lord) of Sorcery Ltd for reporting this vulnerability, and to the [huntr](https://huntr.dev/) team for their support.\n\n### References\n\n- Original issue report https://huntr.dev/bounties/bdf5f216-4499-4225-a737-b28bc6f5801c/\n- ADOdb reference issue #793 \n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Add a note in issue #793\n* Contact the maintainers on [Gitter](https://gitter.im/adodb/adodb)\n","status":"published","published":"2022-01-27T15:23:19Z","modified":"2023-11-08T04:06:27.757791Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical"}],"cwes":["CWE-287","CWE-305"],"updated_at":"2026-11-02T15:46:39.266402Z"},{"id":"UBUNTU-CVE-2021-3850","description":"Authentication Bypass by Primary Weakness in GitHub repository adodb/adodb prior to 5.20.21.","status":"published","published":"2022-01-25T15:15:00Z","modified":"2026-02-04T02:18:38.419752Z","cvss":[{"version":"3.0","score":9.1,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical"},{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","level":"critical"}],"updated_at":"2026-11-02T15:54:28.526929Z"},{"id":"DLA-2912-1","title":"libphp-adodb - security update","status":"published","published":"2022-02-06T00:00:00Z","modified":"2026-03-09T01:18:24.238023Z","updated_at":"2026-11-02T15:46:11.189256Z"},{"id":"DSA-5101-1","title":"libphp-adodb - security update","status":"published","published":"2022-03-13T00:00:00Z","modified":"2026-03-09T02:08:48.935658Z","updated_at":"2026-11-02T15:46:17.543497Z"},{"id":"MGASA-2022-0056","title":"Updated php-adodb packages fix security vulnerability","description":"Security hotfix release addressing a critical vulnerability in PostgreSQL\nconnections (CVE-2021-3850)\n\nAdditional fixes:\nFix usage of get_magic_* functions #619 #657\nFix PHP warning in _rs2rs() function #679\npdo: Fix Fatal error in _query() #666\npdo: Fix undefined variable #678\npgsql: Fix Fatal error in _close() method (PHP8) #666\npgsql: fix deprecated function aliases (PHP8) #667\ntext: fix Cannot pass parameter by reference #668\nAdd support for persistent connections in PDO driver #650\nConnect to SQL Server database on a specified port. #624\nDSN database connection with password containing # fails #651\nMetacolumns returns wrong type for integer fields in Mysql 8 #642\nUninitialized Variable access in mssqlnative ErrorNo() method #637\n","status":"published","published":"2022-02-12T17:31:35Z","modified":"2026-04-16T04:40:59.195367547Z","updated_at":"2026-11-02T15:49:41.849028Z"},{"id":"USN-6825-1","title":"libphp-adodb vulnerabilities","description":"It was discovered that the PDO driver in ADOdb was incorrectly handling\nstring quotes. A remote attacker could possibly use this issue to \nperform SQL injection attacks. This issue only affected Ubuntu 16.04 LTS.\n(CVE-2016-7405)\n\nIt was discovered that ADOdb was incorrectly handling GET parameters in \ntest.php. A remote attacker could possibly use this issue to execute \ncross-site scripting (XSS) attacks. This issue only affected Ubuntu \n16.04 LTS. (CVE-2016-4855)\n\nEmmet Leahy discovered that ADOdb was incorrectly handling string quotes\nin PostgreSQL connections. A remote attacker could possibly use this issue\nto bypass authentication. (CVE-2021-3850)\n","status":"published","published":"2024-06-10T20:41:56Z","modified":"2026-06-25T13:30:34.62610008Z","updated_at":"2026-11-02T16:58:17.914523Z"}]}}
