This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -814,6 +814,10 @@ public function bind($username = null, $password = null)
814
814
{
815
815
$ moreCreds = true ;
816
816
817
+ // Security check: remove null bytes in password
818
+ // @see https://net.educause.edu/ir/library/pdf/csd4875.pdf
819
+ $ password = str_replace ("\0" , '' , $ password );
820
+
817
821
if ($ username === null ) {
818
822
$ username = $ this ->_getUsername ();
819
823
$ password = $ this ->_getPassword ();
Original file line number Diff line number Diff line change @@ -260,4 +260,14 @@ public function testResourceIsAlwaysReturned()
260
260
$ this ->assertTrue (is_resource ($ ldap ->getResource ()));
261
261
$ this ->assertEquals (TESTS_ZEND_LDAP_USERNAME , $ ldap ->getBoundUser ());
262
262
}
263
+
264
+ /**
265
+ * @see https://net.educause.edu/ir/library/pdf/csd4875.pdf
266
+ */
267
+ public function testBindWithNullPassword ()
268
+ {
269
+ $ ldap = new Zend_Ldap ($ this ->_options );
270
+ $ this ->setExpectedException ('Zend_Ldap_Exception ' , 'Invalid credentials ' );
271
+ $ ldap ->bind ($ this ->_altUsername , "\0invalidpassword " );
272
+ }
263
273
}
You can’t perform that action at this time.
0 commit comments