Secure Java Apps on Linux using MD5 Crypt
An anonymous reader writes "If you are a security developer and need to interface a Java application with the local operating system user registry, what do you do? IBMDeveloperWorks gives you the answer: 'UNIX/Linux PAM (Pluggable Authentication Module)-compatible systems that use authentication based on the GNU MD5 extensions to the crypt() system call. It will describe these extensions and show you a Java implementation of MD5 crypt (using FreeBSD as my UNIX).'"
I am intrigued by your ideas and would like to subscribe to your newsletter.
<xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
This is a great idea. I'll patent it right away.
Blessed are the pessimists, for they have made backups. -- 0 1 My two bits
If you try to push a protocol in the IETF that depends on MD5, they won't let it through, because it's too risky. So this doesn't seem like very good advice. I'd suggest using SHA256 instead.
The article is not promoting the use of MD5, but rather how external Java apps can directly authenticate against existing crypt() -based hashes.
The original crypt() used DES, and GNU later improved it to use MD5. The fact that both of them are outdated and insecure by current standards is not relevant from TFA's point of view.
The article talks about accessing a particular OS function (local operating system user registry) which requires MD5s. Is that really so interesting that it needs to be posted here? Seems like a lot of people would assume the title suggests all security in Java is based on MD5.
e curity/AES/AES_v1.html
It's not.
For example, if you're interested in using AES in Java, here's an article from 2003:
http://java.sun.com/developer/technicalArticles/S
I don't understand why I would do this rather than just use JAAS (which has been part of the jdk since 1.4).
http://java.sun.com/products/jaas/
This already handles authentication against unix logins, or windows logins, or pretty much anything else!
The article finishes with:
A pure Java implementation of MD5 crypt can provide a simple interface that can be used by Web applications to authenticate against the local UNIX registry.
I have two things to say:
1. If your app server doesn't support authentication against local OS users (and this is what you want) get a new one.
2. It is big and clever to write your own authentication system for web apps in 2006.
MD5 is not the problem. The trouble with using a system like this is that if you can be fooled into trying to log in to the wrong server, then they can capture your password, because it has to be sent in a form the server understands and can verify against.
The right approach is something like SRP, which uses your password to negotiate a secure tunnel, in such a way that anyone who doesn't have the password, and doesn't guess it correctly during the negotiation phase, doesn't learn it and can't even take a new guess until next time there's a login attempt. This means that even relatively weak passwords gain a lot of security, because it's easy to limit the number of guesses the attacker is allowed.
If ssh used SRP, then you wouldn't have to worry about whether the remote host key is right, or whether it's changed - the fact that you manage to negotiate a proper session with them using your password means that they're a legit host.
Xenu loves you!
It's an open source project which deals with the exact problem you've mentioned above.
From time to time there are valid uses of this type of authentication, I used something similar a few months ago where JAAS can compliment the solution but JAAS itself isn't the solution.
I had a server on an external DMZ that is back-ended by Windows 2000 AD domain with external user accounts. I also had a requirement to authenticate internal AD users that are only accessible via the external domain and a one way trust. When using LDAP I correctly get a referral to the internal domain however I cannot contact the internal domain myself. I ended up writing a jBoss authentication module and windbind from Samba to make a usable solution.
The communications path is as follows
jboss auth-->local PAM-->Windows RPC using winbind to external AD-->windows RPC to internal AD
This problem had stumped the vendor of the package we are using a number of times, in the end it was Java/PAM to the rescue.
First of all, md5crypt() was invented by Poul Henning-Kemp from FreeBSD project and was released under "THE BEER-WARE LICENSE". Linux distributions adopted it later on.
a nymede/src/md5/MD5Crypt.java?rev=1.12&content-type =text/x-cvsweb-markup
Second, MD5 algorithm and md5crypt, while related, are 2 different things. While MD5 algorithm is broken (in academic world, not yet in real usage), I don't think md5crypt is broken. If that is not satisfactory, there is blowfish crypt from OpenBSD project.
Third, the first Java port of md5crypt I'm aware of was from Ganymede project (http://tools.arlut.utexas.edu/gash2/):
http://tools.arlut.utexas.edu/cvsweb/cvsweb.cgi/g
I was searching for Java port of md5crypt because I was on a project that uses tomcat, which doesn't really provide a satisfactory password hashing algorithm (they only provide MD5 hash). Fortunately, I found Ganymede's port. (Anyone can find a java port of blowfish crypt?)
Last, I think md5crypt() can be used in any situation where password authentication is required, not only when authenticating against UNIX/Linux system password.
gd