-----BEGIN PGP SIGNED MESSAGE----- =============================================================================== Security Advisory CERT-NL =============================================================================== Author/Source : Teun Nijssen Index : S-97-80 Distribution : World Page : 1 Classification: External Version: 1 Subject : Buffer overrun in Count.cgi Date : 5-Nov-97 =============================================================================== By courtesy of AUSCERT we received information on a vulnerability in the cgi program count. CERT-NL recommends to run the current version of this cgi script ============================================================================== The Australian Computer Emergency Response Team (AUSCERT) has received information that a buffer overrun vulnerability exists in the Count.cgi cgi-bin program. A new version of Count.cgi has been released addressing this vulnerability. AUSCERT recommends that sites that have the Count.cgi cgi-bin program installed take the steps outlined in Section 3 as soon as possible. --------------------------------------------------------------------------- 1. Description AUSCERT has received information that a vulnerability exists in the Count.cgi cgi-bin program. The Count.cgi cgi-bin program is used to record and display the number of times a WWW page has been accessed. Due to insufficient bounds checking on arguments which are supplied by users, it is possible to overwrite the internal stack space of the Count.cgi program while it is executing. By supplying a carefully designed argument to the Count.cgi program, intruders may be able to force Count.cgi to execute arbitrary commands with the privileges of the httpd process. The Count.cgi program is extremely widely used. Sites are encouraged to check for its existence and its possible exploitation. To check whether exploitation of this vulnerability has been attempted at your site, search for accesses to the Count.cgi program in your access logs. An example of how to do this is: # grep -i 'Count.cgi' {WWW_HOME}/logs/access_log Where, {WWW_HOME} is the base directory for your web server. If this command returns anything, further investigation is necessary. Specifically, look for accesses to Count.cgi that contain long strings of nonsensical characters. If sites find any evidence showing that they have been probed using this vulnerability, they are encouraged to report the incident to AUSCERT or their local incident response team. Reports of all attacks help AUSCERT gain a better overview of intruder activity within the constituency. 2. Impact Remote user may be able to execute arbitrary commands with the privileges of the httpd process which answers HTTP requests. This may be used to compromise the http server and under certain configurations gain privileged access. 3. Workarounds/Solution AUSCERT recommends that sites upgrade to the current version of Count.cgi (Section 3.1). For sites that can not immediately install the current version of Count.cgi, it is recommended that the workaround described in Section 3.2 be applied. 3.1 Upgrade to the current Count.cgi version The author of Count.cgi has recently released version 2.4 which addresses the vulnerability described in this advisory. AUSCERT recommends that sites upgrade to the latest version as soon as possible. The current version is available from: http://www.fccc.edu/users/muquit/Count.html 3.2 Remove execute permissions To prevent the exploitation of the vulnerability described in this advisory, AUSCERT recommends that the execute permissions be removed from Count.cgi immediately. Note that this will have the side effect of preventing the page hit counter from being incremented and displayed on web pages using Count.cgi. The remainder of such web pages should still display. 4. Additional measures It is important to note that attacks similar to this may succeed against any CGI program which has not been written with due consideration for security. Sites using HTTP servers, and in particular CGI applications, are encouraged to develop an understanding of the security issues involved. Sites should consider taking this opportunity to examine their httpd configuration and web servers. In particular, all CGI programs that are not required should be removed, and all those remaining should be examined for possible security vulnerabilities. It is also important to ensure that all child processes of httpd are running as a non-privileged user. This is often a configurable option. See the documentation for your httpd distribution for more details. Numerous resources relating to WWW security are available. The following pages may provide a useful starting point. They include links describing general WWW security, secure httpd setup and secure CGI programming. The World Wide Web Security FAQ: http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html NSCA's "Security Concerns on the Web" Page: http://hoohoo.ncsa.uiuc.edu/security/ The following books contain useful information including sections on secure programming techniques. "Web Security Sourcebook", Aviel Rubin, Daniel Geer and Marcus Ranum, John Wiley & Sons, Inc., 1997. "Practical Unix & Internet Security", Simson Garfinkel and Gene Spafford, 2nd edition, O'Reilly and Associates, 1996. Please note that the URLs and books referenced in this advisory are not under AUSCERT's control and therefore AUSCERT cannot be responsible for their availability or content. AUSCERT thanks Muhammad Muquit for his assistance in the preparation of this advisory. ============================================================================== CERT-NL is the Computer Emergency Response Team for SURFnet customers. SURFnet is the Dutch network for educational, research and related institutes. CERT-NL is a member of the Forum of Incident Response and Security Teams (FIRST). All CERT-NL material is available under: http://www.surfnet.nl/surfnet/security/cert-nl.html ftp://ftp.surfnet.nl/surfnet/net-security In case of computer or network security problems please contact your local CERT/security-team or CERT-NL (if your institute is NOT a SURFnet customer please address the appropriate (local) CERT/security-team). CERT-NL is one/two hour(s) ahead of UTC (GMT) in winter/summer, i.e. UTC+0100 in winter and UT C+0200 in summer (DST). Email: cert-nl@surfnet.nl ATTENDED REGULARLY ALL DAYS Phone: +31 302 305 305 BUSINESS HOURS ONLY Fax: +31 302 305 329 BUSINESS HOURS ONLY Snailmail: SURFnet bv Attn. CERT-NL P.O. Box 19035 NL - 3501 DA UTRECHT The Netherlands NOODGEVALLEN: 06 52 87 92 82 ALTIJD BEREIKBAAR EMERGENCIES : +31 6 52 87 92 82 ATTENDED AT ALL TIMES CERT-NL'S EMERGENCY PHONENUMBER IS ONLY TO BE USED IN CASE OF EMERGENCIES: THE SURFNET HELPDESK OPERATING THE EMERGENCY NUMBER HAS A *FIXED* PROCEDURE FOR DEALING WITH YOUR ALERT AND WILL IN REGULAR CASES RELAY IT TO CERT-NL IN AN APPROPRIATE MANNER. CERT-NL WILL THEN CONTACT YOU. ============================================================================== -----BEGIN PGP SIGNATURE----- Version: 2.6.3i Charset: cp850 iQCVAgUBNGDOwkU5nQkWIq1FAQFheAP/ftmq0MIISHXi6UztpnNM9jXqfYJuOeRF qCImjPjCQhjDUUPJxGCZ+6jkM0qqeiuTAhSsHhK7/nxbPb9ik0AkQIrXIqLCvVNP F+lL40Nmq63iX3/dxzpU1+x6qtRbgZc5UQPwPbPjTdup9q9TdafT5IettZathinb 0m4bVDAXuC0= =VsMx -----END PGP SIGNATURE-----