You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Eric Esposito <ep...@silvertech.net> on 2001/03/03 16:29:02 UTC

general/7352: crypt() function returns null, crashes ap_cpystrn

>Number:         7352
>Category:       general
>Synopsis:       crypt() function returns null, crashes ap_cpystrn
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Sat Mar 03 07:30:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     epe@silvertech.net
>Release:        1.3.19
>Organization:
apache
>Environment:
distribution: Slackware 7.1
uname -a: Linux ns1 2.2.18 #1 Mon Jan 29 14:10:43 EST 2001 i686 unknown
gcc -v: gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Apache was compiled from the tarball off of the main apache FTP server.
>Description:
On my system, the DES addon to glibc-crypt has been removed, which results in crypt() not supporting DES passwords which are generated with the old-style salts. When called without $1$ prefixed to the salt, crypt() returns null.  This null is then passed straight to ap_cpystrn(), which dereferences the null pointer.

This problem crashes both htpasswd and the daemon servicing the request which results in a .htaccess file being read.

On my system, the following C code generates the following output

#include <unistd.h>
#include <stdio.h>

main()
{
        printf("%s\n", crypt("password", "D3PtJ1FI"));
        printf("%s\n", crypt("password", "$1$D3PtJ1FI"));
}

output:
(null)
$1$D3PtJ1FI$sqMXDq4BWC7G0XPBzQ3Xd1
>How-To-Repeat:
Compile and execute the above code.  I am willing to provide an account with ssh access on my system, if needed.
>Fix:
Pass the $1$ into crypt(), or add a configure option which would do that.
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]