CVE-2024-31464 (published 2024-04-10T19:15Z)

XWiki Platform is a generic wiki platform. Starting in version 5.0-rc-1 and prior to versions 14.10.19, 15.5.4, and 15.9-rc-1, it is possible to access the hash of a password by using the diff feature of the history whenever the object storing the password is deleted. Using that vulnerability it's possible for an attacker to have access to the hash password of a user if they have rights to edit the users' page.  With the default right scheme in XWiki this vulnerability is normally prevented on user profiles, except by users with Admin rights. Note that this vulnerability also impacts any extensions that might use passwords stored in xobjects: for those usecases it depends on the right of those pages. There is currently no way to be 100% sure that this vulnerability has been exploited, as an attacker with enough privilege could have deleted the revision where the xobject was deleted after rolling-back the deletion. But again, this operation requires high privileges on the target page (Admin right). A page with a user password xobject which have in its history a revision where the object has been deleted should be considered at risk and the password should be changed there. a diff, to ensure it's not coming from a password field. As another mitigation, admins should ensure that the user pages are properly protected: the edit right shouldn't be allowed for other users than Admin and owner of the profile (which is the default right). There is not much workaround possible for a privileged user other than upgrading XWiki.


Weakness information:
cwe_id: NVD-CWE-noinfo
cwe_name: Insufficient Information
description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
extended_description: Insufficient Information

Fix information:
repo_url: https://github.com/xwiki/xwiki-platform
commit_details: repo_url: https://github.com/xwiki/xwiki-platform
author: Simon Urli
author_date: 2023-10-16 10:50:00+02:00
msg: XWIKI-19948: Bad diff information when xobject is deleted (#2439)

  * Ensure to retrieve the xclass even when the xobject has been deleted
  * Ensure the BaseObject contains an XClass reference when creating it
    in XWikiDocument#getObjectDiff
repository: repo_url: https://github.com/xwiki/xwiki-platform
repo_name: xwiki/xwiki-platform
description: The XWiki platform
repo_language: Java
owner: xwiki
file_changes: filename: XWikiDocument.java
change_type: ModificationType.MODIFY
diff: @@ -7131,7 +7131,10 @@ public List<List<ObjectDiff>> getObjectDiff(XWikiDocument fromDoc, XWikiDocument
                     List<ObjectDiff> dlist;
                     if (newObj == null) {
                         // The object was deleted.
-                        dlist = new BaseObject().getDiff(originalObj, context);
+                        newObj = new BaseObject();
+                        // We want the xclass reference to be set so that it can resolve the xclass properties.
+                        newObj.setXClassReference(originalObj.getXClassReference());
+                        dlist = newObj.getDiff(originalObj, context);
                         ObjectDiff deleteMarker =
                             new ObjectDiff(originalObj.getXClassReference(), originalObj.getNumber(),
                                 originalObj.getGuid(), ObjectDiff.ACTION_OBJECTREMOVED, "", "", "", "");

programming_language: Java
filename: BaseObject.java
change_type: ModificationType.MODIFY
diff: @@ -308,6 +308,12 @@ public List<ObjectDiff> getDiff(Object oldEntity, XWikiContext context)
             BaseProperty newProperty = (BaseProperty) this.getField(propertyName);
             BaseProperty oldProperty = (BaseProperty) oldObject.getField(propertyName);
             BaseClass bclass = getXClass(context);
+            // Bulletproofing: in theory the BaseObject is defined with a xclass reference allowing to resolve it
+            // however, it's possible that the reference is not set, in which case we might still find the info
+            // in the old object.
+            if (bclass == null) {
+                bclass = oldObject.getXClass(context);
+            }
             PropertyClass pclass = (PropertyClass) ((bclass == null) ? null : bclass.getField(propertyName));
             String propertyType = (pclass == null) ? "" : pclass.getClassType();
 

programming_language: Java