|
-----BEGIN PGP SIGNED MESSAGE----- ============================================================================= CERT(sm) Advisory CA-95:04 Original issue date: February 17, 1995 Last revised: August 7, 1996 Information previously in the README was inserted into the advisory. A complete revision history is at the end of this file. Topic: NCSA HTTP Daemon for UNIX Vulnerability - ----------------------------------------------------------------------------- The CERT Coordination Center has received reports that there is a vulnerability in the NCSA HTTP Daemon V.1.3 for UNIX. Because of this vulnerability, the daemon can be tricked into executing shell commands. If you have any questions regarding this vulnerability, please contact NCSA (Elizabeth Frank, efrank@ncsa.uiuc.edu). We will update this advisory as we receive additional information. Please check advisory files regularly for updates that relate to your site. - ----------------------------------------------------------------------------- I. Description A vulnerability in the NCSA HTTP Daemon allows it to be tricked into executing shell commands. II. Impact Remote users may gain unauthorized access to the account (uid) under which the httpd process is running. III. Solution Review the text provided by NSCA (#1 below) and install the patch provided under #2 below. 1. Read the following text, which was provided by the HTTPD Team at SDG at NCSA. This text replaces Step 1 in the original version of the advisory. The NCSA text can also be found at http://hoohoo.ncsa.uiuc.edu/docs/patch_desc.html Beginning of Text Provided by NCSA ============================================================================== NCSA httpd Patch for Buffer Overflow A vulnerability was recently discovered in the NCSA httpd. A program which will break into an HP system running the precompiled httpd has been published, along with step by step instructions. The program overflows a buffer into program space which then gets executed. If you are running a precompiled NCSA httpd, please ftp a new copy of the binary. If you have compiled your own source code, we recommend applying the following Patch to fix the vulnerability in the NCSA HTTP Daemon V.1.3 for UNIX. It modifies the strsubfirst subroutine in util.c. We believe that earlier versions of the server are vulnerable to a similar attack, and strsubfirst should be modified for all releases of the server. [The original version of] Cert Advisory CA-95:04 describes the problem and includes two suggested steps. We do not recommend taking step 1, which increases MAX_STRING_LEN to 8192. There are 154 occurrences of variables using MAX_STRING_LEN and changing them from 256 to 8192 bytes is going to expand the memory needed to run httpd tremendously! On top of that, httpd forks a new process (a complete copy of the parent) for each connection, which if your site gets hit a lot will use unnecessarily large amounts of memory. We have already had reports from admins who have made the change saying they are experiencing performance degradation due to swapping. Step 2, applying the patch to util.c, should be sufficient to fix the problem. There is significantly less forking in Release 1.4 of the NCSA HTTP Daemon which will be released soon. Detecting a Break-in If the access log contains control characters, there is a chance that someone has tried to break into your system. If your server has died recently, they failed at least one attempt. And, if your server has not crashed and there are control characters in the access log you should assume your system has been compromised. In this case, servers which currently use the User Directive to run the server as "nobody", have limited the potential damage of an intruder to those commands which "nobody" may execute. Control Characters in the Access Log You've discovered control characters in your access log. How do you tell if was an intruder? If the beginning of the line containing the control characters begins sensibly (eg. machine name, and date (the GET periodically gets clobbered)) and ends with a series of control characters, it is a break-in attempt. If the beginning of the line starts with control characters (often nulls), this is a symptom of a collision problem that occurs when two children try to write to the access log simultaneously. This problem has only been seen with moderately to heavily loaded servers. (We are working to fix this in Release 1.4.) Other ways to Make Your Server More Secure A tutorial about running a secure server is available. We also recommend that the User Directive be used to run the server as "nobody". Patched Source and Binaries The patched source and precompiled binaries are available. We will also be correcting the source for previous releases, but we will NOT be generating binaries for previous releases. Elizabeth Frank efrank@ncsa.uiuc.edu ============================================================================== End of Text Provided by NCSA 2. Install the following patch, which performs the functionality of strsubfirst (i.e., copy src followed by dest[start] into dest) without the use of a temporary buffer. - ----------------------------------cut here------------------------------------- *** util.c.bak Sat May 7 21:47:15 1994 - --- util.c Thu Feb 16 04:17:07 1995 *************** *** 158,168 **** void strsubfirst(int start,char *dest, char *src) { ! char tmp[MAX_STRING_LEN]; ! strcpy(tmp,&dest[start]); ! strcpy(dest,src); ! strcpy(&dest[strlen(src)],tmp); } /* - --- 158,174 ---- void strsubfirst(int start,char *dest, char *src) { ! int src_len, dest_len, i; ! if ((src_len=strlen(src))<start){ /** src "fits" in dest **/ ! for (i=0;dest[i]=src[i];i++); ! for (i=src_len;dest[i]=dest[i-src_len+start];i++); ! } ! else { /** src doesn't fit in dest **/ ! for (dest_len=strlen(dest),i=dest_len+src_len-start;i>=src_len;i--) ! dest[i] = dest[i-src_len+start]; ! for (i=0;i<src_len;i++) dest[i]=src[i]; ! } } /* - ---------------------------------cut here------------------------------------- After you apply this patch, recompile httpd, kill the current running process, and restart the new httpd. - --------------------------------------------------------------------------- The CERT Coordination Center thanks Steve Weeber, Carlos Varela, and Beth Frank for their support in responding to this problem. - --------------------------------------------------------------------------- If you believe that your system has been compromised, contact the CERT Coordination Center or your representative in Forum of Incident Response and Security Teams (FIRST). If you wish to send sensitive incident or vulnerability information to CERT staff by electronic mail, we strongly advise that the e-mail be encrypted. The CERT Coordination Center can support a shared DES key, PGP (public key available via anonymous FTP on info.cert.org), or PEM (contact CERT staff for details). Internet E-mail: cert@cert.org Telephone: +1 412-268-7090 (24-hour hotline) CERT personnel answer 8:30 a.m.-5:00 p.m. EST(GMT-5)/EDT(GMT-4), and are on call for emergencies during other hours. Fax: +1 412-268-6989 Postal address: CERT Coordination Center Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213-3890 USA CERT advisories and bulletins are posted on the USENET newsgroup comp.security.announce. If you would like to have future advisories and bulletins mailed to you or to a mail exploder at your site, please send mail to cert-advisory-request@cert.org. Past advisories, CERT bulletins, information about FIRST representatives, and other information related to computer security are available for anonymous FTP from info.cert.org. Copyright 1995, 1996 Carnegie Mellon University This material may be reproduced and distributed without permission provided it is used for noncommercial purposes and the copyright statement is included. CERT is a service mark of Carnegie Mellon University. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Revision history Aug. 07, 1996 Information previously in the README was inserted into the advisory. Mar. 15, 1995 Sec. III - Replaced original Step 1 with text from NCSA. Updated NCSA contact information. -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBMiSzrHVP+x0t4w7BAQGTAQQAl1wxiez9AmuHczSLa/5OcfiKUPs0zCjm rp4svG4ioB0GWNcqMtfrCcNhqCKJdxovMJSHCoyvLM5CP454HblmtDyD4CBMyvZW AFHEbD2WAwcKB/v9YGAYUSpN5bjD6veXt6HKz/dUKjCL+fqIi+u2zFkhNTGfRiIp aVrewDPIFjY= =Gxac -----END PGP SIGNATURE-----