User able to login with cleartext password and no salt

Bug #662424 reported by Eugene
258
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Eugene

Bug Description

There seems to be two issues here:
1 - When resetting a user's password (via 'Acount Settings' as Admin user), the password is saved in cleartext and with no salt in the usr table.
2 - User login is then also possible with a cleartext password and no salt!

I have tested this on the the following branches:
  1.0_STABLE
  1.1_STABLE
  1.2_STABLE
  1.3_STABLE
  master

The issue seems to be present in all of the above branches.

Relevant system specs:
Ubuntu 10.04
Postgres 8.4.5

Cheers and hope this helps ;),
Eugene.

Revision history for this message
Eugene (eugenev) wrote :

Here is a patch that will fix issue 1.

I have not attempted to fix issue 2, due to the following code that is present within the validate_password function in auth/internal/lib.php:

if ($salt == null) {
            // This allows "plaintext" passwords, which are eaiser for an admin to
            // create by hacking in the database directly. The application does not
            // create passwords in this form.
            // We don't allow empty passwords here to prevent anyone logging in to
            // user accounts that were created by some other passwordless auth
            // method and subsequently changed to internal.
            return $wehave != '' && $theysent == $wehave;
        }

Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

Hi Eugene,

Talked about this stuff with Francois on Friday & we agreed that it's not serious enough to have to keep it secret or fix on the stable branches. Users are not having their own passwords stored in plaintext, it can only happen for the admin-generated ones, so fixing this on master is fine.

For issue 1, that improved patch you showed me looked good, so you should push it to master if you're ready.

Francois convinced me we should fix issue 2 as well, especially to stop any more code/plugins from being tempted to set plaintext passwords in future. To do this we'd need an upgrade to go through the user table, set salt & hash the password on all records with a non-empty password and empty salt.

Issues 1a, 1b and 1c! We also need to fix up code that sets cleartext passwords in three other places in the admin section: /admin/users/add.php, /admin/users/bulkimport.php and /admin/users/uploadcsv.php (same fix as issue 1).

When that's done, the stuff in validate_password that allows users to log in with no salt can be removed.

Changed in mahara:
status: New → In Progress
importance: Undecided → Medium
milestone: none → 1.4.0
Eugene (eugenev)
Changed in mahara:
status: In Progress → Fix Committed
visibility: private → public
Changed in mahara:
assignee: nobody → Eugene (eugene-catalyst)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.