summaryrefslogtreecommitdiffstats
path: root/Core/Authentication
diff options
context:
space:
mode:
authorCharles Sarrazin <charles.sarrazin@sensiolabs.com>2016-02-18 12:25:21 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2016-05-09 14:32:30 -0500
commit41bd59c6e04c433c9d0bcd53d8524226fb3aeb3a (patch)
tree53a3db8ca9a4b9c80cd72ecb390fde1af47c6895 /Core/Authentication
parent069e08a5fa994d2b855fa050fdc1dace50c32113 (diff)
downloadsymfony-security-41bd59c6e04c433c9d0bcd53d8524226fb3aeb3a.zip
symfony-security-41bd59c6e04c433c9d0bcd53d8524226fb3aeb3a.tar.gz
symfony-security-41bd59c6e04c433c9d0bcd53d8524226fb3aeb3a.tar.bz2
Fixed issue with blank password with Ldap
The bind operation of LDAP, as described in RFC 4513, provides a method which allows for authentication of users. For the Simple Authentication Method a user may use the anonymous authentication mechanism, the unauthenticated authentication mechanism, or the name/password authentication mechanism. The unauthenticated authentication mechanism is used when a client who desires to establish an anonymous authorization state passes a non-zero length distinguished name and a zero length password. Most LDAP servers either can be configured to allow this mechanism or allow it by default. _Web-based applications which perform the simple bind operation with the client's credentials are at risk when an anonymous authorization state is established. This can occur when the web-based application passes a distinguished name and a zero length password to the LDAP server._ Thus, misconfiguring a server with simple bind can trick Symfony into thinking the username/password tuple as valid, potentially leading to unauthorized access.
Diffstat (limited to 'Core/Authentication')
-rw-r--r--Core/Authentication/Provider/LdapBindAuthenticationProvider.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/Core/Authentication/Provider/LdapBindAuthenticationProvider.php b/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
index adc42ef..e887f99 100644
--- a/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
+++ b/Core/Authentication/Provider/LdapBindAuthenticationProvider.php
@@ -73,6 +73,10 @@ class LdapBindAuthenticationProvider extends UserAuthenticationProvider
$username = $token->getUsername();
$password = $token->getCredentials();
+ if ('' === $password) {
+ throw new BadCredentialsException('The presented password must not be empty.');
+ }
+
try {
$username = $this->ldap->escape($username, '', LDAP_ESCAPE_DN);
$dn = str_replace('{username}', $username, $this->dnString);