Meanwhile, the following method can be used.
The implied challenge string consists of the client's IP address and the current date and time (or a partial date and time). The password is added to the end of the challenge, and the MD5 digest of the resulting string is calculated, as 32 lower-case hex digits. The MD5 digest is sent in place of the actual password, in the browser's username/password dialog box. This is transparent to the browser.
The server, which knows the correct MUSIC/SP password, calculates its own MD5. If it matches the MD5 from the client, access is allowed. If not, it assumes the password is the actual password (not an MD5 digest) and checks it normally. The password itself is never sent over the network. If the MD5 is intercepted by an attacker, it would be very difficult to determine the password from it (assuming the password is not short and not a common word), even if the attacker knows the exact challenge. Since the MD5 includes the client's IP address, an attacker can't replay it from some other IP address. Also, including the date and time limits how far into the future the MD5 digest will be acceptable to the server.
The format of the implied challenge string is, in longest form:
n1.n2.n3.n4-yyyymmddhhmm
where n1.n2.n3.n4 is the client's IP address. The client can leave off up to 6 characters from the end of the date/time, to control how long the MD5 digest will be valid: from about 1 minute up to the remainder of the current month. The server tries each of the 7 possible challenges (based on the server's current date and time) and allows access if any of the resulting MD5 digests matches the MD5 from the client. (The server only has to do this if the password looks like an MD5 digest i.e. is 32 hex digits.)
c:\data>md5pw 132.206.25.10-2006020310 Calculates MD5 digest of Challenge + password Using challenge string: 132.206.25.10-2006020310 Enter password: ******* MD5 digest in hex: e8510d9ac44044b80f9c0d66a09edf11
The user enters the MD5 digest, by copy-and-paste, into the password field in the browser's username/password dialog box. The server does the same MD5 calculation, using each of the 7 variations of the challenge string:
132.206.25.10-200602031030 132.206.25.10-20060203103 132.206.25.10-2006020310 132.206.25.10-200602031 132.206.25.10-20060203 132.206.25.10-2006020 132.206.25.10-200602
The 3rd one matches, so access is allowed. The browser automatically sends the same MD5 for future HTTP requests, and it works until 11:00 i.e. until the hour changes, at which point authentication fails and the browser displays the username/password dialog box again.
To make life easier for the user, and to help in cases where the user's IP address varies or is not known to the user, MUSIC/SP can provide a web page CGI program that echoes the client's IP address and displays the possible challenge strings (as ready-made md5pw commands) for the current date and time. You can try such a web page now at http://musicm.mcgill.ca/echoip. The underlying CGI program $tcp:echoip.rex is distributed, along with the new httpd, in the misc9.arc update to the MUSIC/SP Demo system. For instructions on how to set up the echoip CGI on your system, see the comments in $tcp:echoip.rex.
Notes:
For more info about access control and authentication in MUSIC/SP's web server, see webaccess.htm. Some of the features described there do not work exactly as advertised in earlier versions of httpd, so you should apply the misc9.arc update (which fixes several minor problems) before experimenting on your Demo system, or use version 6.2 of the Demo system.
- Dave Edwards, Feb 4, 2006