Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 1def582

Browse files
committed
Merge branch 'security/zf2014-05'
ZF2014-05 patch
2 parents d516863 + 98701c9 commit 1def582

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ Released on MMMMM DD, YYYY.
1313
IMPORTANT FIXES FOR 1.12.9
1414
--------------------------
1515

16+
**This release contains security updates:**
17+
18+
- **ZF2014-05:** Due to an issue that existed in PHP's LDAP extension, it is
19+
possible to perform an unauthenticated simple bind against a LDAP server by
20+
using a null byte for the password, regardless of whether or not the user
21+
normally requires a password. We have provided a patch in order to protect
22+
users of unpatched PHP versions (PHP 5.5 <= 5.5.11, PHP 5.4 <= 5.4.27, all
23+
versions of PHP 5.3 and below). If you use `Zend_Ldap` and are on an affected
24+
version of PHP, we recommend upgrading immediately.
25+
1626
See http://framework.zend.com/changelog for full details.
1727

1828
NEW FEATURES

library/Zend/Ldap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,10 @@ public function bind($username = null, $password = null)
814814
{
815815
$moreCreds = true;
816816

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+
817821
if ($username === null) {
818822
$username = $this->_getUsername();
819823
$password = $this->_getPassword();

tests/Zend/Ldap/BindTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,14 @@ public function testResourceIsAlwaysReturned()
260260
$this->assertTrue(is_resource($ldap->getResource()));
261261
$this->assertEquals(TESTS_ZEND_LDAP_USERNAME, $ldap->getBoundUser());
262262
}
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+
}
263273
}

0 commit comments

Comments
 (0)