Issue Details (XML | Word | Printable)

Key: DIRSERVER-582
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Emmanuel Lecharny
Reporter: Emmanuel Lecharny
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

<potential bug in password comparison

Created: 21/Feb/06 08:24 AM   Updated: 16/Aug/06 09:13 PM
Return to search
Component/s: None
Affects Version/s: 1.0-RC2
Fix Version/s: None

Time Tracking:
Not Specified

Resolution Date: 16/Aug/06 09:13 PM


 Description  « Hide
While stepping throgh the Bind code base, I saw that the password is compared using its byte[] representation :

userPassword = ( ( String ) userPassword ).getBytes();
...
credentialsMatch = ArrayUtils.isEquals( creds, userPassword );

in SimpleAuthenticator class. The problem is that ( ( String ) userPassword ).getBytes() may returns a wrong string if the password contains UTF-8 chars but the local encoding is not UTF-8 (W$ users, mainly, who use ISO-8859-1)

This line should be : userPassword = StringTools.getBytesUtf8( ( String ) userPassword );

Of course, the password *must* be contained in a UTF-8 file (server.xml must be declared as UTF-8 encoded)

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Emmanuel Lecharny added a comment - 21/Feb/06 08:28 AM
We have the same probelm in getAlgorithmForHashedPassword method :
sPassword = new String( ( byte[] ) password ); is wrong, it should be
sPassword = StringTools.utf8ToString( ( byte[] ) password );

Emmanuel Lecharny made changes - 16/Aug/06 06:04 PM
Field Original Value New Value
Assignee Emmanuel Lecharny [ elecharny ]
Repository Revision Date User Message
ASF #432037 Wed Aug 16 21:10:10 UTC 2006 elecharny Fix the potential bug DIRSERVER-582
Files Changed
MODIFY /directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java

Emmanuel Lecharny added a comment - 16/Aug/06 09:13 PM
Fixed in 1.0-trunks and in 1.1-truks : revision 432037 & 432038

Emmanuel Lecharny made changes - 16/Aug/06 09:13 PM
Status Open [ 1 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Repository Revision Date User Message
ASF #432038 Wed Aug 16 21:15:53 UTC 2006 elecharny Fixed the potential bug DIRSERVER-582
Files Changed
MODIFY /directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java