Skip to content

Commit 09d2b7e

Browse files
khushboovashiakshay-joshi
authored andcommitted
1) Fixed LDAP authentication flow vulnerable to TLS certificate verification bypass (CVE-2025-12765). #9324
2) Fixed LDAP injection vulnerability in LDAP authentication flow (CVE-2025-12764). #9325
1 parent e374edc commit 09d2b7e

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

docs/en_US/ldap.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ There are 3 ways to configure LDAP:
8787
"LDAP_KEY_FILE","Specifies the path to the server private key file. This parameter
8888
is applicable only if you are using *ldaps* as connection protocol or you have
8989
set *LDAP_USE_STARTTLS* parameter to *True*."
90+
"LDAP_CERT_VALIDATE", "Set this parameter to *False* if you want to bypass
91+
the TLS certificate validation. By default it is set to True."
9092
"LDAP_IGNORE_MALFORMED_SCHEMA", "Some flaky LDAP servers returns malformed schema.
9193
If this parameter set to *True*, no exception will be raised and schema is thrown away
9294
but authentication will be done. This parameter should remain False, as recommended."

docs/en_US/release_notes_9_10.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ Bug fixes
4242
| `Issue #9281 <https://github.com/pgadmin-org/pgadmin4/issues/9281>`_ - Fixed an issue where the last used storage directory was reset to blank, leading to access denied errors during backup or restore operations.
4343
| `Issue #9304 <https://github.com/pgadmin-org/pgadmin4/issues/9304>`_ - Fixed an issue that prevented assigning multiple users to an RLS policy.
4444
| `Issue #9320 <https://github.com/pgadmin-org/pgadmin4/issues/9320>`_ - Fixed remote code execution vulnerability when restoring PLAIN-format SQL dumps in server mode (CVE-2025-12762).
45-
| `Issue #9323 <https://github.com/pgadmin-org/pgadmin4/issues/9323>`_ - Fixed Command injection vulnerability allowing arbitrary command execution on Windows (CVE-2025-12763).
45+
| `Issue #9323 <https://github.com/pgadmin-org/pgadmin4/issues/9323>`_ - Fixed Command injection vulnerability allowing arbitrary command execution on Windows (CVE-2025-12763).
46+
| `Issue #9324 <https://github.com/pgadmin-org/pgadmin4/issues/9324>`_ - Fixed LDAP authentication flow vulnerable to TLS certificate verification bypass (CVE-2025-12765).
47+
| `Issue #9325 <https://github.com/pgadmin-org/pgadmin4/issues/9325>`_ - Fixed LDAP injection vulnerability in LDAP authentication flow (CVE-2025-12764).

web/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,9 @@
754754
LDAP_CERT_FILE = ''
755755
LDAP_KEY_FILE = ''
756756

757+
# TLS/SSL certificate Validation (True/False),
758+
# Make it false if certificate validation is not required.
759+
LDAP_CERT_VALIDATE = True
757760
##########################################################################
758761

759762
# Some flaky LDAP servers returns malformed schema. If True, no exception

web/pgadmin/authenticate/ldap.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from ldap3.core.exceptions import LDAPSocketOpenError, LDAPBindError,\
1717
LDAPInvalidScopeError, LDAPAttributeError, LDAPInvalidFilterError,\
1818
LDAPStartTLSError, LDAPSSLConfigurationError
19+
from ldap3.utils.conv import escape_filter_chars
1920
from flask_babel import gettext
2021
from urllib.parse import urlparse
2122

@@ -212,10 +213,8 @@ def __configure_tls(self):
212213
ca_cert_file = getattr(config, 'LDAP_CA_CERT_FILE', None)
213214
cert_file = getattr(config, 'LDAP_CERT_FILE', None)
214215
key_file = getattr(config, 'LDAP_KEY_FILE', None)
215-
cert_validate = ssl.CERT_NONE
216-
217-
if ca_cert_file and cert_file and key_file:
218-
cert_validate = ssl.CERT_REQUIRED
216+
cert_required = getattr(config, 'LDAP_CERT_VALIDATE', True)
217+
cert_validate = ssl.CERT_REQUIRED if cert_required else ssl.CERT_NONE
219218

220219
try:
221220
tls = Tls(
@@ -278,8 +277,10 @@ def search_ldap_user(self):
278277
elif not search_base_dn or search_base_dn == '<Search-Base-DN>':
279278
search_base_dn = config.LDAP_BASE_DN
280279

281-
search_filter = "({0}={1})".format(config.LDAP_USERNAME_ATTRIBUTE,
282-
self.username)
280+
search_filter = "({0}={1})".format(
281+
config.LDAP_USERNAME_ATTRIBUTE,
282+
escape_filter_chars(self.username)
283+
)
283284
if config.LDAP_SEARCH_FILTER:
284285
search_filter = "(&{0}{1})".format(search_filter,
285286
config.LDAP_SEARCH_FILTER)

0 commit comments

Comments
 (0)