WebSite v1.1e for Windows NT & 95 buffer overflows

Description:Cool. Win95/NT Buffer overflows with WebSite v1.1e for Windows NT and '95.
Compromise:Run arbitrary commands remotely.
Vulnerable Systems:Systems running WebSite v1.1e for Windows NT and '95.
Date:6 January 1996

Date: Mon, 6 Jan 1997 20:56:21 -0500
To: Multiple recipients of list BUGTRAQ 
Actually, this message is about buffer overflows in Windows, in general.
But let me put some exploits in here first.
I just happened to check out WebSite v1.1e for Windows NT and '95. There're
some nice security holes there, in the CGI example programs (should I say -
"as usual"?).
The first thing that I noticed is about the scripts, they have the following
lines in cgi-dos/args.cmd (and some others):
> rem a query string of xxx&del+/s+c:\*.*  Your hard drive gets
> rem erased!! Same goes for args and extra path info!!!
and then some lines like this:
Obviously, just using the quotes is not enough. Why can't I close them, or
use a linefeed? The exploit can be:"&any+dos+command"
Well, the stuff I just told about might be too obvious, some sysadmins
I know already have all the example scripts removed. Now, let's get to the
interesting stuff.
There's also an example C program, compiled to cgi-shl/win-c-sample.exe,
with the source provided in cgi-src/win-c-sample/win-c-sample.c, and the
following line in there:
> char *argv[32]; // Max 32 command line args
That's a WinMain local variable, and is passed to SplitArgs(), which does
no bounds checking while filling it with the command line parameters. You
know what that means -- a nice buffer overflow.
Here are the exploits (I split the long URLs into several lines), you
can use any dos command in them (replace spaces with _'s):
-- WinNT (any version?):
-- Win95 (the release version only, will crash others!):
The example dos commands just copy the WebSite's readme.1st file, so you
can later check if the exploit worked by trying
Note that the server should respond to these exploits with an "Error: no
blank line separating header and data", because of the "1 file(s) copied"
message appearing without a blank line before it (which is required for
HTTP; if you need a command's output, you can redirect it to a file, and
get that file via HTTP with a separate request).
Finally, to the thing I'm writing this message for -- I mean the Win32
shellcode. I haven't seen any Win32 overflow exploits before (actually,
didn't look for them), so I had to code my own shellcode. This seems not
to be that simple as it would be for Win16, or as it is for most UNIX
systems. The problem is that normally Windows kernel calls require extra
relocation items, but the shellcode appears in an already loaded program.
The solution I used in the exploits above is doing a call to fixed kernel
offset. Actually, the WinNT exploit does pattern searches in the kernel
(due to the number of different kernel versions out there), while the Win95
one uses fixed offsets (I don't have Win95 myself, thanks must go to Lord
Byte for loading his WinIce and telling me the offsets). The two functions
I use are WinExec and ExitProcess.
Here're the two shellcodes in binary, uuencoded, so you can use them in
your own exploits if you wish.
begin 644 shell_nt.bin
begin 644 shell_95.bin
Note that I had to avoid using some codes (which the server didn't allow
me to use), that's why I do things like:
db 68h   ; push imm32
pop esi  ; \
pop eax  ; | - the value being pushed
jmp esi  ; /
call esp
instead of:
call $+5 ; would contain zeroes
pop esi
Have fun disassembling. I'll appreciate any suggestions on doing the kernel
calls a better way.
As for the holes -- the fix is obvious, just remove the examples after
you, the webmaster, have checked them out. Also, the holes will probably
get fixed in the next WebSite release (I wonder if they credit me;-). BTW,
they didn't even have the quotes in scripts I mentioned above, in some
earlier versions.
Solar Designer

More Exploits!

The master index of all exploits is available here (Very large file)
Or you can pick your favorite operating system:
All OS's Linux Solaris/SunOS Micro$oft
*BSD Macintosh AIX IRIX
ULTRIX/Digital UNIX HP/UX SCO Remote exploits

This page is part of Fyodor's exploit world. For a free program to automate scanning your network for vulnerable hosts and services, check out my network mapping tool, nmap. Or try these Insecure.Org resources: