This issue has been created
There are 4 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-e3f27fb9-9f79-4971-9f90-8c959ee15a77 XWIKI-25752 Open

A password stored in clear text can no longer be checked once its property uses the Hash storage type

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-c092fa51-c191-4c8f-98be-ba494c9360b3 Simon Urli created this issue on 13/Nov/26 12:01
 
Summary: A password stored in clear text can no longer be checked once its property uses the Hash storage type
Issue Type: cid:jira-generated-image-avatar-e3f27fb9-9f79-4971-9f90-8c959ee15a77 Bug
Affects Versions: 17.10.14, 18.4.5, 18.8.0-rc-1
Assignee: Unassigned
Components: Old Core
Created: 13/Nov/26 12:01
Labels: regression
Priority: cid:jira-generated-image-static-blocker-c687c5b7-d4d0-4412-b90b-b3c35182c00a Blocker
Reporter: Simon Urli
Description:

Problem

Since XWIKI-24357, a password value stored in clear text can no longer be checked when the password property it belongs to uses the Hash storage type. PasswordClass#arePasswordsMatching throws:

java.lang.IllegalArgumentException: The provided encoded password doesn't match any known hash encoded password format.

A property can hold clear values with the Hash storage type when it used the Clear storage type at the time the values were saved, and was switched to Hash afterwards (from the class editor, or by an extension changing the definition of its class). Switching the storage type doesn't change the values already stored.

Before XWIKI-24357, such a value was compared in clear, so it kept working: getEquivalentPassword returned the given password unchanged when the stored value didn't start with hash:. Now any feature checking it fails. For example, OIDC-334: the OIDC provider userinfo endpoint answers with an HTTP 500 error page containing this exception.

Steps to reproduce

  1. Create a class with a password property secret whose storage type is Clear.
  2. Add an object of that class to a page and set secret to mysecret.
  3. Edit the class and switch the storage type of secret to Hash.
  4. Check the stored value, e.g. with $doc.getObject('<class>').getXObject().isPasswordValueMatching('secret', 'mysecret') from a script with programming right.

Expected: true, as before XWIKI-24357.
Actual: IllegalArgumentException: The provided encoded password doesn't match any known hash encoded password format.

Proposed fix

When the storage type is Hash and the stored value doesn't look like a hash at all (no hash: prefix and no algorithm prefix between braces), compare it in clear and log a warning saying that the value should be hashed or reset. A value which looks like a hash but uses an unknown format keeps failing, so that a stored hash is never accepted as the password itself.

This only restores the possibility to check such values. Handling the existing values when the storage type of a property changes is a separate topic.

 
 

4 updates

 
cid:jira-generated-image-avatar-c092fa51-c191-4c8f-98be-ba494c9360b3 Changes by Simon Urli on 13/Nov/26 12:01
 
Fix Version: 18.4.9
Fix Version: 17.10.16
Fix Version: 18.10.0-rc-1
Assignee: Simon Urli