Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!

TUCoPS :: Web :: Servers :: bt1326.txt

sh-httpd `wildcard character' vulnerability

	INetCop Security Advisory #2003-0x82-019

* Title: sh-httpd `wildcard character' vulnerability

0x01. Description

sh-httpd is a shell script-based Web server that supports GET and HEAD methods, and a CGI 1.1 interface.
It's not real fast, and it's probably not real secure, but it is really small.
The Web server and it's configuration files are around 9,000 bytes total,
and that's with comments and pretty whitespace.
If you can run ash or bash, an inetd, and about 7 standard external commands on your system,
you can have a Web server with CGI support.
There's also a timeout counter that kills never-ending CGI programs, cleans up, and exits. 

More detailed information is:

Vulnerabilty happens '*' because don't filtering.
Through this character, can know existence of files to directory.

0x02. Vulnerable Packages

Vendor site:



0x03. Exploit

This is very easy.
Only, as using '*', can read file of web directory freely or execute CGI.

For example, is as following.

GET ../../../sh-httpd/p* 
GET /../../etc/s*
GET ../../root/.b*

You can read file path or contents, and if it is CGI, can execute. :-)

0x04. Patch

=== sh-httpd.patch ===

--- sh-httpd-0.4/sh-httpd       Mon Oct  9 11:28:05 2000
+++ sh-httpd.patch      Sat Jul 19 08:51:44 2003
@@ -31,7 +31,7 @@

 bname() {
        local IFS='/'
-       set -- $1
+       set -- "$1"
        eval rc="\$$#"
        [ "$rc" = "" ] && eval rc="\$$(($# - 1))"
        echo "$rc"
@@ -262,7 +262,7 @@

        # Split URI into base and query string at ?
-       set -- $URI
+       set -- "$URI"
@@ -292,7 +292,7 @@

        DIR="`dname $URL`"
-       FILE="`bname $URL`"
+       FILE="`bname "$URL"`"

        # Check for existance of directory
        if [ ! -d "$DOCROOT/$DIR" ]; then
=== eof ===

P.S: Sorry, for my poor english.

By "dong-houn yoU" (Xpl017Elz), in INetCop(c) Security.

MSN & E-mail: szoahc(at)hotmail(dot)com,

INetCop Security Home: (Korean hacking game)
             My World: &

GPG public key:

Get your free email from

Powered by Outblaze

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2015 AOH