Pligg Security Vulnerability - Password Change Request

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-25-2007, 04:50 PM
Casual Pligger
 
Join Date: May 2007
Posts: 30
I just received the following in my email. Is this an issue known to the Pligg devs? Any way to fix it at this point or do I need to wait for a future version?

Last edited by AshDigg; 05-25-2007 at 05:19 PM.
Reply With Quote
  #2 (permalink)  
Old 05-25-2007, 05:07 PM
Constant Pligger
 
Join Date: Mar 2006
Posts: 537
This should be fixed pretty quickly!

Why not just create a completely random string, store it in a user db field, then check for a match once the rest url is clicked on. If a match is found, password reset, and the field is wiped clean until next time. That way, it should be a 1-off random string that can't be cracked.

Something like:

Code:
    if($_POST["processlogin"] == 3) { // if user requests forgotten password
        $username = trim($_POST['username']);
        if(strlen($username) == 0){
            $errorMsg = $main_smarty->get_config_vars("PLIGG_Visual_Login_Forgot_Error");
        } else {
            $user = $db->get_row("SELECT * FROM `" . table_users . "` where `user_login` = '".$username."'");
            if($user){
                $salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH);
                $confirm_code = md5($user->user_login . uniqid(rand(), true));
                $to = $user->user_email;
                $subject = $main_smarty->get_config_vars("PLIGG_PassEmail_Subject");
                $body = $main_smarty->get_config_vars("PLIGG_PassEmail_Body") . $my_base_url . $my_pligg_base . '/login.php?processlogin=4&username=' . $username . '&confirmationcode=' . $confirm_code;
                $headers = 'From: ' . $main_smarty->get_config_vars("PLIGG_PassEmail_From") . "\r\n";
                if(time() - strtotime($user->last_reset_request) > $main_smarty->get_config_vars("PLIGG_PassEmail_LimitPerSecond")){
                    if(mail($to, $subject, $body, $headers)) {
                        $main_smarty->assign('user_login', $user->user_login);
                        $main_smarty->assign('profile_url', getmyurl('profile'));
                        $main_smarty->assign('login_url', getmyurl('loginNoVar'));
                        $errorMsg = $main_smarty->get_config_vars("PLIGG_PassEmail_SendSuccess");
                        $db->query("UPDATE " . table_users . " SET last_reset_request=FROM_UNIXTIME(".time()."), user_confirm='$confirm_code' WHERE user_login='$username'");
                        define('pagename', 'login'); 
                        $main_smarty->assign('pagename', pagename);
                    } else {
                        $errorMsg = $main_smarty->get_config_vars('PLIGG_Visual_Login_Delivery_Failed');
                    }
                } else{
                    $errorMsg = $main_smarty->get_config_vars("PLIGG_PassEmail_LimitPerSecond_Message");
                }
            } else{
                $errorMsg = $main_smarty->get_config_vars('PLIGG_Visual_Login_Does_Not_Exist');
            }
        }
    }

    if($_GET["processlogin"] == 4) { // if user clicks on the forgotten password confirmation code
        $username = trim($_GET['username']);
        if(strlen($username) == 0){
            $errorMsg = $main_smarty->get_config_vars("PLIGG_Visual_Login_Forgot_Error");
        } else {
            $confirmationcode = strip_tags($_GET["confirmationcode"]);
            $user_confirm = $db->get_var("SELECT user_confirm FROM " . table_users . " WHERE user_login='$username'");
            if($user_confirm == $confirmationcode && $user_confirm != '') {
                $db->query("UPDATE " . table_users . " SET user_pass='033700e5a7759d0663e33b18d6ca0dc2b572c20031b575750', user_confirm='' WHERE user_login='$username'");
                $errorMsg = $main_smarty->get_config_vars('PLIGG_Visual_Login_Forgot_PassReset');
            } else {
                $errorMsg = $main_smarty->get_config_vars('PLIGG_Visual_Login_Forgot_ErrorBadCode');
            }
        }
    }
Then create a new field called user_confirm in the users table. Probably better ways to do it, but that's what I've done for now until devs come up with something more concrete.

Last edited by Simon; 05-25-2007 at 05:25 PM.
Reply With Quote
  #3 (permalink)  
Old 05-25-2007, 05:19 PM
AshDigg's Avatar
Mayor of PliggVille/Coder
 
Join Date: Dec 2005
Posts: 1,515
Yes I'm aware of it and working on it.
Reply With Quote
  #4 (permalink)  
Old 05-25-2007, 11:57 PM
tuxsoul's Avatar
New Pligger
 
Join Date: Apr 2007
Location: México
Posts: 2
Send a message via ICQ to tuxsoul Send a message via Skype™ to tuxsoul
Hi, i'm newbie but make one rule to mod_security 2, for stop the reset password while a fix is release

Code:
SecRule REQUEST_URI|ARGS|ARGS_NAMES "login.php\?processlogin=4\&username=[[:graph:]]+\&confirmationcode=[[:graph:]]+" \
        "capture,ctl:auditLogParts=+E,deny,log,auditlog,status:501,msg:'Pligg Reset Password Attack. Matched signature <%{TX.0}>',,id:'400001',severity:'2'"

¿do you like my comment?, gift me one bitcoin: http://bitcoin.org : 1266FWznbEW1uLNPsLU9ATBxGuM1U19thB
bitcoin pay forward project: http://bit.ly/cmpUs0 : 15pjRCNT2CpzVo7HQ6b6r4q18Vv4Da7y9K
twitter: http://twitter.com/tuxsoul
blog: http://blog.tuxsoul.com
Reply With Quote
  #5 (permalink)  
Old 05-26-2007, 12:30 AM
wwwSENSERELYcom's Avatar
Casual Pligger
 
Join Date: May 2007
Location: Tianjin, China
Posts: 67
could you guys be more specific, at least by PM? Because it's starting to worry me, I've just launched my first pligg site, what can happren with the password resetting? I use url2 but i don't understand the problem nor the solution!
Reply With Quote
  #6 (permalink)  
Old 05-26-2007, 01:56 AM
Yankidank's Avatar
Pligg Founder/Coder/Designer
Pligg Version: SVN
Pligg Template: Wistie
 
Join Date: Dec 2005
Location: Ocala, FL
Posts: 4,934
Send a message via AIM to Yankidank
AshDigg has created a patch and we are currently testing it.

The Twitter Module for Pligg CMS!
Register, Login, and Submit Stories with Twitter. An absolute MUST HAVE for all Pligg sites!
Reply With Quote
  #7 (permalink)  
Old 05-26-2007, 03:06 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
The first thing we do on any Pligg installations is to change the admin user_name to something other than God and use the god user only for administration and that user will not post/vote on stories, also we added a small additional query to remove the user for top users list (where user_id > 1) - this way there is less possibility that a hacker can predict and attach on any system.
Reply With Quote
  #8 (permalink)  
Old 05-26-2007, 11:24 PM
AshDigg's Avatar
Mayor of PliggVille/Coder
 
Join Date: Dec 2005
Posts: 1,515
The patch is here.
Reply With Quote
  #9 (permalink)  
Old 05-26-2007, 11:25 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Good to get it fix faster.
Reply With Quote
  #10 (permalink)  
Old 05-27-2007, 11:47 AM
Constant Pligger
 
Join Date: Oct 2006
Posts: 220
This is exactly what I've done in the past as well.

Quote:
Originally Posted by dollars5 View Post
The first thing we do on any Pligg installations is to change the admin user_name to something other than God and use the god user only for administration and that user will not post/vote on stories, also we added a small additional query to remove the user for top users list (where user_id > 1) - this way there is less possibility that a hacker can predict and attach on any system.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pligg Database User Name and Password... ReddyEye Questions and Comments 1 08-02-2009 11:24 AM
Security Question - Pligg Sumbitter / Auto Pligg MissDanni Questions and Comments 3 07-04-2009 11:34 AM
Pligg Donation Drive 2009 chuckroast Questions and Comments 0 03-23-2009 05:42 PM
Pligg 9.9 - Cannot Change Password - "There was a token error." sethc Questions and Comments 6 12-25-2008 11:14 AM
God cannot change his own password. vanlawrence Questions and Comments 3 04-08-2008 05:35 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development