passwordssap-commerce-cloudpassword-hashpassword-storage

How does hybris store password hashes


TLDR: What does Hybris do with password hashes before storing them in the database? Because values in the database field are NOT standard password hashes.


I had to add the TLDR above, because two users posted answers that are indicative that they didn't read (or understand) the question.

I'm working with Hybris 1905. When I set a user's password in backoffice, I can choose the type of hashing algorithm, including MD5, SHA-256 and a few others. Yet the password value stored in the database is clearly not a simple hash with the algorithm. For example, here are hashes of password test1234, with various hashing algorithms:

Clearly this is some sort of encoding that Hybris puts on top of the chosen hashing algorithm - but what is it? Is it encoding (i.e. can be decoded) or hashing?

I need to migrate a large database of users from another platform to this Hybris installation. I have existing usernames and corresponding hashed passwords, which I want to import. These are standard bcrypt hashes, so the same test1234 string would have hash $2y$16$mK9cm.pwOp8ve9oH0VqkT.123HGy/RHYLcd1GB.N5zEqBylV.22wm. Yet I am struggling to understand how to import this hash into Hybris users table.


Solution

  • What does Hybris do with password hashes before storing them in the database? Because values in the database field are NOT standard password hashes.

    Its because encodedPassword attribute declared with encrypted="true" modifier. Due to that hybris encrypt value before storing to DB. Read more about Transparent Attribute Encryption (TAE) and how it works in hybris.

     <attribute autocreate="true" qualifier="encodedPassword" type="java.lang.String">
                <persistence type="property" qualifier="Passwd">
                    <columntype>
                        <value>HYBRIS.LONG_STRING</value>
                    </columntype>
                </persistence>
                <modifiers read="true" write="true" search="true" optional="true" encrypted="true"/>
            </attribute>
    

    In your case, you probably need to create your own password encoder and set it to all migrated users, so that your system manages to authenticate migrated users with custom encoder, and then you can redirect the user to reset the password. In the reset password flow, you can update the password encoding with the new OOTB encoder so that new hash will be generated.

    other references 1, 2