You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "Janne Jalkanen (JIRA)" <ji...@apache.org> on 2007/11/04 20:37:50 UTC

[jira] Created: (JSPWIKI-20) Password hash should be salted

Password hash should be salted
------------------------------

                 Key: JSPWIKI-20
                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
             Project: JSPWiki
          Issue Type: Improvement
          Components: Security
    Affects Versions: 2.5.139-beta
            Reporter: Janne Jalkanen


The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Jaquith resolved JSPWIKI-20.
-----------------------------------

    Resolution: Fixed
      Assignee: Andrew Jaquith  (was: Janne Jalkanen)

Fixed in 2.7.0-svn-24. The change notes:

* Passwords are now salted and hashed per RFC 2307. Every password is salted with a 8-byte random salt.

* The sort-of-secret "share container user accounts with JDBCUserDatabase" option has been permanently removed, and will not be replaced. This was previously added to make it easier for users to add themselves to JDBC-based container realms. However, the switch to salted passwords precludes the continued use of this option. So it's gone and won't come back.

* Added a new class CryptoUtil that allows admins to generate SSHA password hashes (and verify an existing password given a supplied hash) at the command line. See the Javadoc for com.ecyrd.jspwiki.util.CryptoUtil for details.



> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Andrew Jaquith
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596082#action_12596082 ] 

Andrew Jaquith commented on JSPWIKI-20:
---------------------------------------

Ugh. A massive brain cramp today caused me to write that last comment. Please forgive. The salts, of course, are included as part of the password string..... never mind the keystore gibberish. 

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595923#action_12595923 ] 

Janne Jalkanen commented on JSPWIKI-20:
---------------------------------------

I would like to get this in somehow pretty soon.  Andrew, opinions?

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546125 ] 

Andrew Jaquith commented on JSPWIKI-20:
---------------------------------------

I should have said, "it raises the workfactor for an attacker by many many orders of magnitude." The additional /developer/ workfactor is pretty low. :) 

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Jaquith closed JSPWIKI-20.
---------------------------------


> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Andrew Jaquith
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596081#action_12596081 ] 

Andrew Jaquith commented on JSPWIKI-20:
---------------------------------------

Note to self -- I think I will also implement a "generate password hash" command-line utility while I'm at it...

With respect to the password salt, I think this should be randomly generated and put into the same keystore we will use for (in the future) for encrypting authentication cookies. 

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546141 ] 

Janne Jalkanen commented on JSPWIKI-20:
---------------------------------------

The reason why I wanted to use the comma is because it would allow changing the salt length transparently (and is more future-proof anyway).

We could easily add a "do not salt the password upon save" -feature in case the passwords are shared with container.  To which property we should bind it?

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596080#action_12596080 ] 

Andrew Jaquith commented on JSPWIKI-20:
---------------------------------------

I'm going to take a whack at this in the very short term. This is probably also a good time to remove the hack-y "share logins with container" feature.

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546123 ] 

Andrew Jaquith commented on JSPWIKI-20:
---------------------------------------

128 bits ought to be plenty... it raises the workfactor by many many orders of magnitude. It's not overkill, because the extra time needed to generate the longer salt doesn't really cost us more than a few milliseconds. 

Your patch, coincidentally, appears to be pretty similar to what was proposed for WordPress:
http://trac.wordpress.org/attachment/ticket/2394/2394-phpass.patch

Three comments on the patch itself:
1) We ought to modify the validatePassword() function so that the user's hash is automatically upgraded to the salted version at the time of password check, rather than just at password save/update time. That would allow for a nice, easy, transparent migration.
2) It seems pretty common-place, based on the WordPress example and some other examples I've seen, simply to prepend the salt to the password hash rather than delimit it with a comma.
3) Salting the hash will absolutely break the "share logins with the container" feature, which has been around since ~2.3,60 I think. I'm not wedded to that feature, but it is kind of nice to have. (I may be the only person who uses it...)

Reason #3, in particular suggests that it might be better to wait on fixing this until 2.8. That way, we could deprecate the "share logins with container feature" NOW (in 2.6) and remove it entirely in 2.8.


> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587279#action_12587279 ] 

Janne Jalkanen commented on JSPWIKI-20:
---------------------------------------

So, what shall we do with this?

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596923#action_12596923 ] 

Andrew Jaquith commented on JSPWIKI-20:
---------------------------------------

One thing I should have added in the Javadoc is that hashes are updated transparently whenever the password is changed, OR upon successful login. Otherwise, if the hash is still in the old format, we keep it that way. It's quite transparent to the user and admin.

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Andrew Jaquith
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588313#action_12588313 ] 

Janne Jalkanen commented on JSPWIKI-20:
---------------------------------------

I don't quite understand how LDAP is supposed to figure out what the salt is - from the examples it looks like the salt is just simply appended to SSHA, but there is no indication in how long the salt is.  Or am I missing something?

I am also worried about this: 
{quote}
Note: use of RFC 2307 Experimental passwords violates the Standard Track specification, RFC 2256, for user passwords and may lead to interoperability problems. 
{quote}

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543372 ] 

Janne Jalkanen commented on JSPWIKI-20:
---------------------------------------

Folks; should we fix this in 2.6 already, or should we wait?  Whenever it is fixed, it *will* break the existing password databases.

One option would of course be to add the hash to the password itself (like old UNIX passwords).  That way new passwords would be salted, but old passwords could still be read.  E.g.

{SHA1}foobar,4389028409328042021093801923

where "foobar" is the salt.

The other possibility is to have a known, fixed, hard-coded salt value; or user-settable salt value.

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Security
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-20) Password hash should be salted

Posted by "Andrew Jaquith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588300#action_12588300 ] 

Andrew Jaquith commented on JSPWIKI-20:
---------------------------------------

There appears to be a salted-SHA1 variant that is supported by OpenLDAP and Tomcat 5.5 that would be suitable for our purposes (RFC 2307). 

http://www.openldap.org/faq/data/cache/347.html

Will check this out in more detail...

> Password hash should be salted
> ------------------------------
>
>                 Key: JSPWIKI-20
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-20
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Authentication&Authorization
>    Affects Versions: 2.5.139-beta
>            Reporter: Janne Jalkanen
>            Assignee: Janne Jalkanen
>             Fix For: 2.8
>
>         Attachments: jspwiki-20.patch
>
>
> The password hash is calculated as a direct SHA1-digest of the password.  Unfortunately this means that it's vulnerable to brute-force attacks - there are many web sites which store SHA1 hashes of common passwords.  The key space in most languages is pretty small... So the password should really be properly salted with preferably a long, random string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.