DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=31975>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=31975 httpd-1.3.33: buffer overflow in htpasswd if called with long arguments Summary: httpd-1.3.33: buffer overflow in htpasswd if called with long arguments Product: Apache httpd-1.3 Version: HEAD Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Other AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] Luiz Fernando wrote an article in the Full-Disclosure Mailing List (see: http://archives.neohapsis.com/archives/fulldisclosure/2004-09/0547.html), publishing a PoC how to crash htpasswd. This could become a problem, if htpasswd is run suid root with user supplied arguments at the command line. Larry Cashdollar <[EMAIL PROTECTED]> replied to this message via BUQTRAQ, giving a patch, which replaces all calls to strcpy() with calls to strncpy(). Looking at the code, I found that this wasn't neccessary, because the strcpy()-calls in the original are protected by if-statements. Well, almost all strcpy()-calls are protected. At one place the protecting if-statement slipped into another one, becoming useless in some situations. So I created this little patch against src/support/htpasswd.c shipped with apache-1.3.33.tar.gz: --- cut --- cut --- cut --- --- src/support/htpasswd.c.orig Fri Feb 20 23:02:24 2004 +++ src/support/htpasswd.c Fri Oct 29 21:13:36 2004 @@ -411,11 +411,11 @@ return ERR_OVERFLOW; } strcpy(pwfilename, argv[i]); - if (strlen(argv[i + 1]) > (sizeof(user) - 1)) { - fprintf(stderr, "%s: username too long (>%lu)\n", argv[0], - (unsigned long)(sizeof(user) - 1)); - return ERR_OVERFLOW; - } + } + if (strlen(argv[i + 1]) > (sizeof(user) - 1)) { + fprintf(stderr, "%s: username too long (>%lu)\n", argv[0], + (unsigned long)(sizeof(user) - 1)); + return ERR_OVERFLOW; } strcpy(user, argv[i + 1]); if ((arg = strchr(user, ':')) != NULL) { --- cut --- cut --- cut --- Larry told us, that there is a nessus plugin which recognizes this buffer overflow and recommends an update to apache httpd 1.3.32. But I couldn't find a corresponding entry in the bug database. :-( Comparing the versions 1.3.31, 1.3.32 and 1.3.33, I found no differences between the files. ... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
