You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2026/09/26 12:45:00 UTC

[jira] [Commented] (OFBIZ-13615) HashCrypt compares non-PBKDF2 password hashes with variable-time String.equals()

    [ https://issues.apache.org/jira/browse/OFBIZ-13615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18119640#comment-18119640 ] 

ASF subversion and git services commented on OFBIZ-13615:
---------------------------------------------------------

Commit b40ed9a861e20ef6f37555d3e8f4fb6225e7e8d9 in ofbiz-framework's branch refs/heads/trunk from Mridul Pathak
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=b40ed9a861 ]

Fixed: HashCrypt compares non-PBKDF2 password hashes with variable-time String.equals() (OFBIZ-13615)

doCompareTypePrefix(), doComparePosix() and doCompareBare() compared the computed hash to the stored hash with String.equals(), which returns at the first differing character. They now use MessageDigest.isEqual() through a small helper, matching the constant-time comparison already used by doComparePbkdf2(). The result of every comparison is unchanged.


> HashCrypt compares non-PBKDF2 password hashes with variable-time String.equals()
> --------------------------------------------------------------------------------
>
>                 Key: OFBIZ-13615
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13615
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework/base
>    Affects Versions: Upcoming Branch, 24.09.07
>            Reporter: Mridul Pathak
>            Assignee: Mridul Pathak
>            Priority: Minor
>
> {{HashCrypt.doComparePbkdf2()}} compares password hashes in constant time, but the other three comparison helpers ({{doCompareTypePrefix()}}, {{doComparePosix()}}, {{doCompareBare()}}) use {{String.equals()}}. That call returns at the first character that differs (CWE-208). {{doComparePosix()}} handles the default {{password.encrypt.hash.type=SHA}} format, so this path runs on every stock login.
> Proposed fix: replace {{String.equals()}} with {{MessageDigest.isEqual()}} in all three helpers, so that every comparison path uses the same constant-time discipline as PBKDF2. The result for any input stays the same.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)