home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume21 / cops / part03 < prev    next >
Encoding:
Internet Message Format  |  1990-03-21  |  48.1 KB

  1. Subject:  v21i025:  System ecurity analysis tool, Part03/05
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 710f82a3 6669115e 5420b587 fcebd8f4
  5.  
  6. Submitted-by: Dan Farmer <df@sei.cmu.edu>
  7. Posting-number: Volume 21, Issue 25
  8. Archive-name: cops/part03
  9.  
  10. #    This is a shell archive.
  11. #    Remove everything above and including the cut line.
  12. #    Then run the rest of the file through sh.
  13. #----cut here-----cut here-----cut here-----cut here----#
  14. #!/bin/sh
  15. mkdir cops 2>/dev/null
  16. mkdir cops/docs 2>/dev/null
  17. mkdir cops/src 2>/dev/null
  18. mkdir cops/extensions 2>/dev/null
  19. # shar:    Shell Archiver
  20. #    Run the following text with /bin/sh to create:
  21. #    cops/rc.chk
  22. #    cops/reconfig
  23. #    cops/root.chk
  24. #    cops/stop.sample
  25. #    cops/suid.chk
  26. #    cops/docs/COPS.report
  27. #    cops/docs/KUANG.README
  28. #    cops/docs/SUID.README
  29. # This archive created: Tue Jan 30 23:26:56 1990
  30. # By:    dan (Purdue University)
  31. echo shar: extracting cops/rc.chk '(1822 characters)'
  32. cat << \SHAR_EOF > cops/rc.chk
  33. #!/bin/sh
  34. #
  35. #  Usage: rc.chk
  36. #
  37. #  This checks pathnames and files inside the shell script files /etc/rc*
  38. # for writability.
  39. #
  40. #  Mechanism:  The commands inside the files /etc/rc* are executed when
  41. # the machine is booted.  This shell script greps for commands/paths that
  42. # are of these forms:
  43. #
  44. #    /path/command            # or whatever
  45. #        or
  46. #    PATH=:/bin:/usr/bin:.        # or whatever
  47. #        or
  48. #    MYVAR=`/path/command`        # or whatever
  49. #    
  50. #  It then takes each potential problem-string and uses the program
  51. # "is_writable" to determine if it is world writable.  All results are
  52. # echoed to standard output.
  53. #
  54. AWK=/bin/awk
  55. LS=/bin/ls
  56. TEST=/bin/test
  57. EGREP=/usr/bin/egrep
  58. ECHO=/bin/echo
  59. SORT=/usr/bin/sort
  60.  
  61.  
  62. # CHANGE THIS LINE OR PUT IN FILE NAMES IF/AS NEEDED!
  63. #    (for example: init_files="/etc/rc /etc/rc.local")
  64. #
  65. init_files=`$LS /etc/rc*`
  66.  
  67. #
  68. #  This should get all paths in /etc/rc* files; at least two types here.
  69. # First type starts with a "/", the second is either in the form :
  70. #
  71. #    PATH=:/bin:/usr/bin:.        # or whatever
  72. # or
  73. #    MYVAR=`/bin/echo "hello"`    # or whatever
  74. #
  75. #
  76. #   Notice also I strip out any references to /tmp, /usr/tmp,
  77. # /dev/*ty's, and /dev/null.
  78. first_pass=`$AWK '{for (i=1;i<=NF;i++) if ((index($i,"/")) && ((first=substr($i,1,1)!=">"))&& first!="#" && first!="$" && (last=substr($i,length($i),1))!="\"") print $i}' $init_files | $EGREP -v "/dev/.*ty|/tmp|/usr/tmp|/dev/null" | $SORT -u`
  79.  
  80. all_files=`$ECHO $first_pass| $SORT | $UNIQ`
  81.  
  82. #  First, get the ones starting with "/":
  83. #
  84. #   DANGER!  DANGER!  DANGER Will Robinson! Awk runs out of room ("bails
  85. # out") if too many files are here....
  86. all_files=`$ECHO $first_pass|$AWK 'BEGIN{RS=FS}{if(substr($0,1,1)=="/")print $0}'`
  87.  
  88. for i in $all_files
  89.     do
  90.     if ./is_writable $i
  91.         then
  92.         $ECHO "Warning!  File $i (in /etc/rc*) is _World_ writable!"
  93.     fi
  94.     done
  95.  
  96. # end of script
  97. SHAR_EOF
  98. echo shar: extracting cops/reconfig '(4535 characters)'
  99. cat << \SHAR_EOF > cops/reconfig
  100. #! /bin/sh
  101. #
  102. #  Usage: reconfig
  103. #
  104. #   This replaces the program paths (e.g. /bin/awk) in COPS with an
  105. # alternate path that is found in the file "file.paths".
  106. #   All programs are renamed "name.old", and the new version replaces
  107. # the original name.  It then uses sed to replace all occurances of
  108. # the target strings.
  109. #   Basically, the program looks through all directories listed in
  110. # $all_dirs for the list of programs in $all_commands and when it finds
  111. # them, puts them in a sed source file.  It then goes to all of the
  112. # shell files COPS uses ($shell_scripts) and replaces all occurances of
  113. # the variables found with the new value.  It goes through some
  114. # contortions trying to look for test (it has to find test without
  115. # using test), and does some other not so smart things, but it seems
  116. # to get the job done.
  117.  
  118. # shell is always here, isn't it?
  119. SH=/bin/sh
  120.  
  121. # need these later
  122. TEST=
  123. AWK=
  124. SED=
  125. STRINGS=
  126. YPCAT=
  127.  
  128. #  Potential directories to find commands:
  129. all_dirs='/bin /usr/bin /usr/ucb /usr/local/bin'
  130.  
  131. #   First things first; are test and echo built-in shell commands?
  132. # Theory.  If test is executed correctly and not found in the path
  133. # I set, then they should be built into the shell, right?
  134. PATH=/bin:/usr/bin
  135. for dir in $all_dirs
  136.     do
  137.     if test -f $dir/test
  138.         then
  139.         TEST=$dir/test
  140.         break
  141.     fi
  142.     done
  143. # if not set, then set to default
  144. if test -z "$TEST"
  145.     then
  146.     TEST=test
  147.     fi
  148.  
  149. for dir in $all_dirs
  150.     do
  151.     if $TEST -f $dir/echo
  152.         then
  153.         ECHO=$dir/echo
  154.         break
  155.     fi
  156.     done
  157.  
  158. # if not set, then set to default
  159. if $TEST -z "$ECHO"
  160.     then
  161.     ECHO=echo
  162.     fi
  163.  
  164. # The sed filter file
  165. location=./file.paths
  166.  
  167. #  Target shell scripts in question:
  168. shell_scripts="makefile chk_strings cops dev.chk dir.chk file.chk cron.chk group.chk passwd.chk rc.chk root.chk suid.chk kuang init_kuang"
  169.  
  170. #  Target commands in question, sans those checked above:
  171. all_commands='cc nroff mkdir awk sed sh cat chmod comm mv date egrep cp expr find grep ls mail rm sort uniq'
  172. rest_of_them=' echo test'
  173.  
  174. #  make sure everything is here:
  175. for i in $shell_scripts
  176.     do
  177.     if $TEST ! -s $i
  178.         then
  179.         $ECHO  ERROR -- Shell script $i not found!
  180.         exit
  181.     fi
  182. done
  183.  
  184. #   This finds the paths to any program used in COPS, then prints out
  185. # a sed filter to the file "file.paths" that is used by this shell
  186. # script to change all occurances of that command in the COPS system.
  187. #
  188. #   For example, if sed is in /usr/bin, it will create a line that looks
  189. # like this:
  190. #
  191. # s.AWK=*$.AWK=/usr/bin/sed.
  192. #
  193. #  This corresponds to the sed command substitute ("." is used as a
  194. # delineator instead of "/" because the strings will be containing
  195. # "/"'s) /usr/bin/sed in place of whatever was to the right of the
  196. # equal sign.  This works because all commands are accessed by the
  197. # variable "$XYZ", where "XYZ" corresponds to the lowercase command
  198. # "xyz".  And, of course, all command variables are set at the top
  199. # of each command file.
  200. #
  201.  
  202. # First we need awk and sed if this shell script will work....
  203. for dir in $all_dirs
  204.     do
  205.     if $TEST -f $dir/awk ; then
  206.         AWK=$dir/awk
  207.         fi
  208.     if $TEST -f $dir/sed ; then
  209.         SED=$dir/sed
  210.         fi
  211.     done
  212. if $TEST -z "$AWK" ; then
  213.     $ECHO "Cannot find awk; awk is needed to run this shell script"
  214.     exit 1
  215.     fi
  216.  
  217. if $TEST -z "$SED" ; then
  218.     $ECHO "Cannot find sed; sed is needed to run this shell script"
  219.     exit 1
  220.     fi
  221.  
  222. # zero out the file, then put in the real locations...
  223. $ECHO > $location
  224.  
  225. for command in $all_commands
  226.     do
  227.     found=false
  228.     for dir in $all_dirs
  229.         do
  230.         # if find the command in one of the directories, print string
  231.         if $TEST -f $dir/$command
  232.             then
  233.             # this converts to upper case
  234.             upper=`$ECHO $command | $AWK 'BEGIN{upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ";lower="abcdefghijklmnopqrstuvwxyz";} \
  235.             {out = ""; for(i=1;i <= length($1);i++) {
  236.                 if((cpos = index(lower,c = substr($1,i,1))) > 0)
  237.                     c = substr(upper,cpos,1); \
  238.                 out = out c; \
  239.                 } printf("%s",out)}'`
  240.  
  241.         $ECHO "s-^$upper=.*\$-$upper=$dir/$command-" >> $location
  242.             found=true
  243.             break
  244.             fi
  245.         done
  246.     if $TEST "$found" = "false"
  247.         then
  248.         $ECHO ERROR!  $command not found!  Change or delete command!
  249.         exit
  250.         fi
  251.     done
  252.  
  253. $ECHO "s-^ECHO=.*\$-ECHO=$ECHO-" >> $location
  254. $ECHO "s-^TEST=.*\$-TEST=$TEST-" >> $location
  255.  
  256. # almost forgot -- we need chmod, mv too:
  257. for dir in $all_dirs
  258.     do
  259.     if $TEST -f $dir/mv ; then
  260.         MV=$dir/mv
  261.         fi
  262.     if $TEST -f $dir/chmod ; then
  263.         CHMOD=$dir/chmod
  264.         fi
  265.     done
  266.  
  267. for i in $shell_scripts
  268.     do
  269.     $ECHO "Changing paths in $i..."
  270.     $SED -f $location $i > $i.new
  271.     $MV $i $i.old
  272.     $MV $i.new $i
  273.     # finally, make sure everything is back to executable status
  274.     $CHMOD 700 $i
  275.  
  276. done
  277. SHAR_EOF
  278. echo shar: extracting cops/root.chk '(3194 characters)'
  279. cat << \SHAR_EOF > cops/root.chk
  280. #!/bin/sh
  281. #
  282. #  Usage: root.chk
  283. #
  284. #  This shell script checks pathnames inside root's startup files for 
  285. # writability, improper umask settings (world writable), non-root
  286. # entries in /.rhosts, and to ensure that root is in /etc/ftpusers.
  287. # Also check for a single "+" in /etc/hosts.equiv (world is trusted).
  288. # Startup files are /.login /.cshrc /.profile
  289. #
  290. #  Mechanism:  These files contain paths and filenames that are stripped
  291. # out using "grep".  These strings are then processed by the "is_writable"
  292. # program to see if they are world writable.  Strings of the form:
  293. #
  294. #    path=(/bin /usr/bin .)
  295. #        and
  296. #    PATH=/bin:/usr/bin:.:
  297. #
  298. # are checked (using grep) to ensure that "." is not in the path.  All
  299. # results are echoed to standard output. 
  300. #  For umask stuff, simply grep for umask in startup files, and check
  301. # umask value.  For /etc/ftpuser, simple grep to check if root is in
  302. # the file.  For /etc/hosts.equiv, just check to see if "+" is alone
  303. # on a line by awking it.
  304. #
  305. #
  306. AWK=/bin/awk
  307. SED=/bin/sed
  308. TEST=/bin/test
  309. ECHO=/bin/echo
  310. GREP=/bin/grep
  311. SORT=/usr/bin/sort
  312. EXPR=/bin/expr
  313.  
  314. csh=/.cshrc
  315. sh=/.profile
  316. rhosts=/.rhosts
  317. big_files="/.login /.cshrc /.profile"
  318. ftp=/etc/ftpusers
  319. equiv=/etc/hosts.equiv
  320.  
  321. # parse into separate paths:
  322. for i in $big_files
  323.     do
  324.     if $TEST -s $i
  325.         then
  326.         ./chk_strings $i
  327.  
  328.         # check for umask stuff (thanks to Bruce Spence):
  329.         if umsk=`$GREP umask $i ` 2>/dev/null
  330.             then
  331.             mask=`$ECHO $umsk|$AWK '{if($2!=""){if(length($2)==1) print "00"$2; \
  332.                 else if (length($2)==2) print "0"$2; \
  333.                 else print $2} else print "000"}'`
  334. #            perm=`$EXPR substr $mask 3 1`
  335.             perm=`$ECHO $mask | $SED 's/[0-9][0-9]//'`
  336.             if $TEST "$perm" -lt 2 -o "$perm" = 4
  337.                 then
  338.                 if $TEST "$umsk"
  339.                     then
  340.                     $ECHO "Warning!  Root's umask set to $umsk in $i"
  341.                     fi
  342.                 fi
  343.             fi
  344.         fi
  345.     done
  346.  
  347. # check to see if root is in ftpusers file
  348. if $TEST -s $ftp
  349.     then
  350.     if test ! `$GREP "root" $ftp`
  351.         then
  352.         $ECHO Warning!  $ftp exists and root is not in it
  353.         fi
  354.     fi
  355.  
  356. # check for a "+" in hosts.equiv.  Bad.  Bad dog.
  357. if $TEST -f $equiv ; then
  358.     $AWK '{if (NF==1 && $1=="+") printf("Warning!  A \"+\" entry in %s!\n", "'$equiv'")}' $equiv
  359.     fi
  360.  
  361. # check for non-root entries in /.rhosts
  362. #$AWK '{if ((NF==1&&!($1=="localhost" || $1=="root"))||(NR!=1&&$2!="root")) printf("Warning!  Non root entry in %s! %s\n", $rhosts, $0)}' $rhosts
  363.  
  364.  
  365. # echo checking paths...
  366. {
  367. #
  368. # Get the root paths from $csh.
  369. if $TEST -f $csh; then
  370. $GREP path $csh | $AWK '{split($0,p1,"="); \
  371. for (i=1;i<=NF;i++) { \
  372.     if (substr($i,1,1)=="/") { \
  373.         if (substr($i,length($i),1)!=")"){ print $i} \
  374.         else {print substr($i,1,length($i)-1)} \
  375.         } \
  376.     else if ($i ~ /^path/) {split($i,p2,"(");if (substr(p2[2],1,1)=="/") { \
  377.         print p2[2]}}} \
  378.     }'
  379. fi
  380.  
  381. #
  382. # Get the root paths from $sh.
  383. if $TEST -f $sh; then
  384. $GREP PATH $sh | $SED 's/\(PATH=.*\);.*/\1/' |
  385.     $AWK -F= '{split($2,temp,":"); \
  386.         for (i in temp) \
  387.             if (temp[i] == "") print "."; \
  388.             else print temp[i]}'
  389. fi
  390. } |
  391.  $SORT -u |
  392.   while read i
  393.   do
  394.     # check to see if "." is in path
  395.     if $TEST "." = "$i"
  396.     then
  397.         $ECHO "Warning!  \".\" is in roots path!"
  398.     fi
  399.  
  400.     if ./is_writable $i
  401.     then
  402.         $ECHO "Warning!  Directory $i is _World_ writable!"
  403.     fi
  404.   done
  405.  
  406. # end of script
  407. SHAR_EOF
  408. echo shar: extracting cops/stop.sample '(644 characters)'
  409. cat << \SHAR_EOF > cops/stop.sample
  410. -rwsr-xr-x  1 root     bin         10240 Jun 13 13:13 /bin/chgrp
  411. -rwsr-xr-x  1 root     bin         12288 Jun 13 13:13 /bin/df
  412. -rws--s---  1 root     term        22528 Aug 13 13:13 /bin/login
  413. -rws------  1 root     bin         21504 Jun 13 13:13 /bin/login.old
  414. -rwsr-xr-x  1 root     bin         22528 Jun 13 13:13 /bin/mail
  415. -rwsr-xr-x  1 root     bin         14336 Jun 13 13:13 /bin/passwd
  416. -rwxr-sr-x  1 root     MEM         22528 Jun 13 13:13 /bin/ps
  417. -rwsr-xr-x  1 root     bin         16384 Jun 13 13:13 /bin/su
  418. -rwxr-sr-x  1 root     MEM         14336 Jun 13 13:13 /etc/dmesg
  419. -rwsr-x---  1 root     operator    29696 Jun 13 13:13 /etc/dump
  420. SHAR_EOF
  421. echo shar: extracting cops/suid.chk '(2063 characters)'
  422. cat << \SHAR_EOF > cops/suid.chk
  423. #!/bin/sh
  424. #
  425. #   Shell script intended to be run periodically by cron in order
  426. #   to spot changes in files with the suid or sgid bits set.
  427. #
  428. #    suid.chk    840919        Prentiss Riddle
  429. #
  430. #     This changes into the $SECURE directory first, then 
  431. #   uses find(1) to search the directories in $SEARCH for all
  432. #   files with the 4000 or 2000 permission bits set.  $STOP is a file
  433. #   containing "ls -lga" output for known setuid or setgid programs.
  434. #   Any additions or changes to this list represent potential security
  435. #   problems, so they are reported to the users named in $INFORM.
  436. #
  437. #  Modified 8/15/89, Dan Farmer:
  438. #    Just changed the program/doc names and some of the temp
  439. #  files to make it fit in with the rest of the programs....
  440. #
  441.  
  442. #  CHANGE THIS LINE!
  443. INFORM="foo@bar.edu"
  444. #
  445.  
  446. TEST=/bin/test
  447. ECHO=/bin/echo
  448. SH=/bin/sh
  449. LS=/bin/ls
  450. CAT=/bin/cat
  451. MAIL=/bin/mail
  452. CHMOD=/bin/chmod
  453. SORT=/usr/bin/sort
  454. COMM=/usr/bin/comm
  455. FIND=/usr/bin/find
  456. RM=/bin/rm
  457.  
  458. SECURE=.
  459. SEARCH=.
  460. STOP=./stop.sample
  461. TEMPOLD=./fsold$$
  462. TEMPCUR=./fscur$$
  463. TEMPNEW=./fsnew$$
  464. TEMPGON=./fsgon$$
  465. TEMPM=./fsm$$
  466.  
  467. umask 077
  468. OLDCWD=`pwd`
  469.  
  470. if $TEST ! -d "$SECURE"
  471.     then
  472.     $ECHO "Error -- Security directory $SECURE doesn't exist"
  473.     exit 1
  474. fi
  475.  
  476. $CHMOD 700 $SECURE
  477. cd $SECURE
  478.  
  479. # find the setuid programs and sort
  480. $FIND $SEARCH \( -perm -4000 -o -perm -2000 \) -exec $LS -lga {} \; | \
  481.     $SORT > $TEMPCUR
  482. # compare with the sorted stop list
  483. $SORT <$STOP >$TEMPOLD
  484. $COMM -13 $TEMPOLD $TEMPCUR | $SORT +8 >$TEMPNEW
  485. $COMM -23 $TEMPOLD $TEMPCUR | $SORT +8 >$TEMPGON
  486. # report changes
  487. if $TEST -s $TEMPNEW -o -s $TEMPGON; then
  488.     HOSTNAME=`$SH -c "/bin/uname -n || /usr/bin/uuname -l || /bin/hostname" 2>&-`
  489.     $ECHO '' >>$TEMPM
  490.     if $TEST -s $TEMPNEW; then
  491.         $ECHO 'These files are newly setuid/setgid:' >>$TEMPM
  492.         $ECHO '' >>$TEMPM
  493.         $CAT $TEMPNEW >>$TEMPM
  494.         $ECHO '' >>$TEMPM
  495.     fi
  496.     if $TEST -s $TEMPGON; then
  497.         $ECHO 'These files are no longer setuid/setgid:' >>$TEMPM
  498.         $ECHO '' >>$TEMPM
  499.         $CAT $TEMPGON >>$TEMPM
  500.     fi
  501.     $MAIL $INFORM <$TEMPM
  502.     $RM -f $TEMPM
  503. fi
  504. $RM -f $TEMPOLD $TEMPCUR $TEMPNEW $TEMPGON
  505.  
  506. #  end it all....
  507. exit 0
  508. SHAR_EOF
  509. echo shar: extracting cops/docs/COPS.report '(33839 characters)'
  510. cat << \SHAR_EOF > cops/docs/COPS.report
  511. .ps 12
  512. .vs 12
  513. .PH ````
  514. .pn
  515. .nr W 78
  516. .ce 2
  517. \fBCOPS and Robbers
  518. UN*X System Security\fP
  519. .sp
  520. .sp
  521. .PP
  522. In the last few years, computer security has received a great deal
  523. more attention than it has in the past.  Computerized break-ins and
  524. criminal activity, once merely the product of the imagination of
  525. science fiction writers,
  526. has became a fairly common occurence in both commercial and academic
  527. circles.  In this paper, I will go over the problems that face any
  528. multiuser computing system, then discuss how these problems apply to UNIX\**
  529. .FS
  530. Although originally designed and developed by Ken Thompson and
  531. Dennis Ritchie of AT&T, UNIX has grown far beyond its' original
  532. design and now numerous companies market their own \*Qflavor\*U of
  533. UNIX.  When I use the term UNIX in this paper, I don't mean merely
  534. AT&T's version, but instead I mean the majority of the most popular
  535. varieties, made by developers at Berkely, Sun, and a host of other
  536. manufacturers.  I believe UNIX is still a trademark of Bell
  537. Laboratories.
  538. .FE
  539. specifically, and finally present in detail a suite of programs that
  540. were developed in an attempt to address some of the main problems
  541. that could be solved via software.  UNIX, although considered to be
  542. a fairly secure operating system ([Wood 88], [Duff 89], etc), has the
  543. advantage of having many published works ([Grampp and Morris 84],
  544. [Bishop 83], etc) on the problems that a computing site can have with
  545. security, and in addition, on how a UNIX system administrator might
  546. make his/her system more secure by monitoring various aspects of his/her
  547. UNIX site.  This, combined with UNIX's popularity, make it an ideal
  548. target for a software security system to operate on.
  549. .PP
  550. In this report I am not going to discuss specific ways of breaking
  551. into a given UNIX machine (for a more detailed description on how to
  552. compromise UNIX security, see either [Baldwin88], [Bishop83],
  553. [Wood & Kochran 86], or [Grampp & Morris 84]) -- instead, I will
  554. concentrate on how to improve and strengthen the potentially good
  555. security of a generic UNIX system by means of a software toolkit
  556. that examines the weaker areas of UNIX that are either traditionally
  557. ignored (due to the time constraints or ignorance of the system
  558. administrators) or are simply reoccurring problems that need to be
  559. watched over.  In addition, this report is not meant for UNIX neophytes
  560. -- although a great deal of proficiency is not needed to read
  561. this report and use the programs described herein, a familiarity with
  562. basic UNIX features -- the file system and file permission modes for
  563. example -- and commands such as
  564. .ul
  565. awk, grep, sed
  566. as well as a working knowledge of shell and C programming are necessary
  567. to understand the internal workings of the security system described in
  568. this paper.
  569. .PP
  570. Although there is no reasonable way that all security problems can be
  571. solved (at least not with a software solution) on any arbitrary UNIX
  572. system, administrators and system programs can be assisted by a software
  573. security tool.  The Computer Oracle Password and Security system (COPS)
  574. that will be described in this paper is just such a device.  The COPS
  575. system is a collection of programs and shell scripts that attempt
  576. to address as many of these problems as possible in an efficient,
  577. portable, and above all in a reliable and safe way.  The main goal
  578. of COPS is one of prevention; it tries to anticipate and eliminate
  579. security problems by making sure people don't get a chance to
  580. compromise security in the first place.  Alerting the
  581. administrators of a potential intruder or that a virus has infected 
  582. the system is beyond the scope of the present system, although with 
  583. work with such capabilities could be added ([Bauer and Koblentz 88]
  584. and [Duff 89].)
  585. .PP
  586. To understand the reason COPS might check any specific problem, a
  587. look at computer security problems in general is in order.  The
  588. problems listed below are not meant to be inclusive, but they are
  589. indicative of the myriad types of dilemmas a typical computer multiuser
  590. system might encounter:
  591. .PP
  592. 1)  Administrators, system programmers, and computer operators.  The
  593. very people that (should) worry the most about security are sometimes
  594. the ones that are the
  595. least concerned.  Carelessness is one of the main culprits; a mistake by a user
  596. might cause little or no problem, but when someone with no
  597. restrictions (or almost none) on their computer activity makes a mistake,
  598. a security hole can result.  \*QI can trust my users\*U is a fine
  599. statement to make -- but can you trust your users' friends?  How about
  600. the users of computers that are networked to yours?
  601. New software, systems, or procedures
  602. can facilitate extra problems; a computing staff is often ill or
  603. completely non-trained on new techniques and software.
  604. Too often \*QRTFM\*U is the only training that they will ever receive.
  605. Programs that are created for in-house use are often ill-documented and
  606. not debugged thoroughly, and when users other than the author start to
  607. use/abuse the program, problems can result.  Especially misunderstood,
  608. even by experienced UNIX system programmers, is the SUID program or,
  609. worse yet, the SUID shell script ([Bishop 83].)
  610. When a user says that his/her password was forgotten (or any
  611. other account/security related problem), what checks are made to verify
  612. that the person is really the owner of that account?  Are users that are
  613. security problems kept track of, so that repeated abuses of the system will
  614. result in punitive action?  Does your site even have a security policy?
  615. And of course, the last straw is that most system administrators simply
  616. have too much other work to do than to constantly check
  617. the system for potential security flaws -- let alone to double-check that
  618. any work done by other system programmers has been done correctly.
  619. These are the actions that often get left unsaid and undone.
  620. .PP
  621. A UNIX environment has no special defenses against this kind of
  622. \*Qattack\*U.  Fortunately, a number of these potential problems (unless
  623. catastrophic in scope) are not only correctable, but are
  624. easy to detect with a software toolkit such as COPS.  Even the most
  625. careful UNIX guru will periodically make a mistake; COPS has been
  626. designed to aid in her/his never ending battle against the forces of
  627. darkness.
  628. .PP
  629. 2)  Physical security.  This is perhaps the most frustrating of all 
  630. possible problems because it effects all computer systems and is often the
  631. hardest to safeguard against.  Even if the software is secure, even if 
  632. the system administrators are alert to potential problems, what happens 
  633. if a user walks up to the root console and starts typing?  Does the night
  634. janitorial staff let anyone into the machine room without proper 
  635. identification? Who has access to the key that opens up the computing 
  636. center?  Are terminals that are logged on left unguarded or unlocked?
  637. Are passwords written on or near a users terminal or desk?
  638. No software in the world can help
  639. against human nature or carelessness.  Reiterating to your staff and users
  640. that terminals should not be left alone or unguarded and that passwords
  641. (especially root) should not be typed in front of unfriendly (and in
  642. this case, _everyone_ is your enemy) eyes would be a good start.  A
  643. simple analogy: since you would never give the keys to the company car
  644. away, why on earth would you give away the keys to your computer, which
  645. is certainly worth a hell of a lot more time and money (although it may
  646. not get as good mileage on the interstate.)  Common sense goes a long
  647. ways to help prevent this kind of risk.
  648. .PP
  649. 3)  Authentication.  What is authentication?  All modern computing
  650. systems that have capabilities for multiple users have a means of
  651. identifying who is
  652. using the computer at any given time.  A common means of identification
  653. is by using a password; and since the inception of this idea, poor
  654. passwords have been a perennial problem.  People have a tendency to
  655. use their own name, or their social security number, or some other
  656. common word, name, or phrase for a password.  The problem then arises
  657. when an unauthorized user wants to access clandestine information,
  658. he/she simply tries one of these simple passwords until a successful
  659. match is found.
  660. .PP
  661. Other problems with authentication?  What computer hosts are
  662. \*Qtrusted\*U and allow users to log in from other machines without 
  663. any further authentication?  Are incorrect login attempts kept and/or
  664. monitored so as to allow administrators to keep track of any unusual
  665. activity?  What about \*QTrojan horses\*U -- programs that can steal
  666. passwords and the privileges that a user owns -- is there a program or a
  667. administrative method that detects a potential 'horse?
  668. .PP
  669. Fortunately UNIX systems again have some fairly good tools to aid in
  670. this fight.  Although finding simple passwords is indeed a trivial
  671. task, forcing the users on a system to use passwords that are harder to
  672. guess is also
  673. trivial, by either modifying the mechanism that gets/gives the password
  674. to the user, and/or by having the system administrators run a simple
  675. password detector periodically, and notifying users if their password is
  676. deemed too obvious.  The
  677. .ul
  678. crypt
  679. command, although proven to be insecure for a knowledgeable and
  680. resourceful attacker ([Reed and Weinberger 84], [Baldwin 86]), does
  681. offer an added shield against most unauthorized users.  Logs can be kept
  682. of incorrect login attempts, but as with most security measures, to be
  683. effective someone (usually the site administrator) must take the time to
  684. examine the evidence.
  685. .PP
  686. 4)  Bugs/Features.  Massive software designs (such as an operating system)
  687. are usually the result of a team or of teams of developers working together.
  688. It only takes one programmer to make a mistake, and it will almost always
  689. happen.  \*QBack doors\*U that allow unauthorized entrances are sometimes
  690. purposefully coded in -- for debugging, maintenance, or other reasons.
  691. And there are always 
  692. unexpected side effects when thousands of people using the system start
  693. doing strange (stupid?) things.  The best kind of defense against this
  694. is to report the problems to the developer as they are discovered, and
  695. if possible, to also report a way to fix the problem.  Unfortunately,
  696. in many cases the
  697. source code is needed to make a bug fix, and especially in non-academic
  698. areas, this is simply not available due to the prohibitive costs involved.
  699. Combining this with the reluctance of a (usually) commercial developer
  700. to admit any problems with their product, and the end result is a
  701. security hole that will not be mended unless some kind of financial loss
  702. or gain is at stake -- for the developer of the product, not yours!
  703. .PP
  704. 5)  Ignorance.  Users who don't know or care can be a problem as well.
  705. Even if
  706. someone doesn't care about their own security, they can unwittingly
  707. compromise the entire system -- especially if they are a user with
  708. high privileges.  Administrators and system operators are not immune to
  709. this either, but hopefully are better informed, or at least have access
  710. to a means of combating this dysfunction.  It may also be due to apathy,
  711. an unwillingness to learn a new system, a lack of time to explore all of
  712. the features of a large system, or simply not enough computer savvy to
  713. learn more about a very complex system, and no one willing to
  714. teach it to the user.  This problem is much like illiteracy; it is a
  715. never-ending battle that will never go completely away.  And while a 
  716. software toolkit such as COPS can help combat this problem by calling
  717. attention to neglected or misunderstood critical areas, by far and away
  718. the best weapon against this is education.  An educated user will simply
  719. not make as many mistakes; and while it may seem impractical to teach
  720. _all_ users about (even) the fundamentals of computer security, think of
  721. all the time and resources wasted tracking down the mistakes that keep
  722. recurring time and time again.
  723. .PP
  724. 6)  Unauthorized permissions or privileges.  Are users given _too much_
  725. freedom?  Do new computer accounts have any default security at all, or
  726. are the new users expected to know what to do to protect their programs,
  727. data, and other files.  System files, programs, and data are sometimes
  728. shipped with minimal or no protection when gotten straight from the
  729. manufacturer; someone at the installation site must have enough
  730. knowledge to \*Qtune\*U the system to be effective and safe.  Password,
  731. memory, and log files especially should all be carefully monitored,
  732. but unfortunately an experienced user can often still find out any information
  733. they want with perseverance and a little luck.  This is
  734. where a system such as COPS can really shine.  After a new system is
  735. configured, some basic flaws can be uncovered with just a small amount
  736. of effort.  New system problems that somehow slip through the cracks of
  737. the site installers can be caught and modified before any serious
  738. problems result.  The key here is to prevent your system users from
  739. getting a denial of computer service that they need and deserve.  Service
  740. could mean anything from CPU time, response time, file space, or any
  741. other commodity that a computer has to offer.
  742. .PP
  743. 7)  Crackers/Hackers/Evil twin brothers.  Not much is needed on this
  744. subject, save to say that they are often not the main problem.
  745. Professional evil-users are a rarity; often harmful acts are done 
  746. by users who \*Qjust wanted to see what would happen\*U or had no idea
  747. of the ramifications of their acts.  Someone who is truly experienced is 
  748. very difficult to stop, and is certainly outside the realm of any
  749. software security tool as discussed in this paper.  Fortunately, most
  750. evil-doers are fairly inexperienced and ignorant, and when they make a
  751. mistake, a watchful administrator can deal with a problem before it gets
  752. out of hand.  Sometimes they can even reveal security problems that 
  753. were previously undiscovered.  COPS can help here mostly by reducing an
  754. attacker's options; the less holes to exploit, the better.
  755. .PP
  756. The COPS system attempts to help protect as many of the above
  757. items as possible for a generic UNIX system.  In the proper UNIX spirit,
  758. instead of having a large program that attempts to solve every possible
  759. problem, it is composed of several small programs that each check one
  760. or more potential UNIX security holes.
  761. The COPS system uses a variety of these problems to see if there are any
  762. cracks in a given UNIX security wall.  These methods correspond to some
  763. of the problems discussed above; specifically to administrators, system
  764. programmers, and computer operators; authentication; ignorance;
  765. unauthorized permissions or privileges; and finally crackers/hackers/evil
  766. twin brothers (numbers 1,3,5, and 6.)  It is very difficult, almost a
  767. practical impossibility to give software assistance to problems in
  768. physical security, and finally bugs or features that are present in a
  769. given UNIX system are possible to detect, but are not covered in this
  770. system (yet).  The design of most of the the programs were at least
  771. described if not outlined from the following sources:
  772. .sp
  773. Aho, Kernighan, and Weinberger 88
  774. .sp
  775. Baldwin 87
  776. .sp
  777. Fiedler and Hunter 86
  778. .sp
  779. Grampp and Morris 84
  780. .sp
  781. Wood and Kochran 86
  782. .sp
  783. .PP
  784. Of course with all of the problems listed below, looking at the actual
  785. source code of the program is very instructive -- each numbered section
  786. lists the corresponding program that is used to perform the check:
  787. .PP
  788. 1)  COPS Checks \*Qvital\*U system directories to see if they are
  789. world-writable.  Directories listed as critical are in a configuration
  790. file and are initially:
  791. .sp
  792. / /etc /usr
  793. .sp
  794. /bin /Mail /usr/spool
  795. .sp
  796. /usr/adm /usr/etc /usr/lib
  797. .sp
  798. /usr/bin /usr/etc /usr/spool/mail
  799. .sp
  800. /usr/spool/uucp /usr/spool/at
  801. .PP
  802. The method COPS uses to detect problems -- read through a configuration
  803. file (dir.chklst) containing all of the potential danger spots, and
  804. then simply comparing each directory modes with a bit mask to see if it
  805. is world writable.  The program that performs this task is
  806. .ul
  807. dir.chk
  808. .PP
  809. 2)  Check \*Qvital\*U system files to see if they are world-writable.
  810. Files listed as critical are in a configuration file (file.chklst)
  811. and are initially:
  812. .sp
  813. /.*
  814. .sp
  815. /etc/*
  816. .sp
  817. /bin/*
  818. .sp
  819. /usr/etc/yp*
  820. .sp
  821. /usr/lib/crontab /usr/lib/aliases /usr/lib/sendmail
  822. .sp
  823. .sp
  824. The wildcards are used like in UNIX, so these would include (some of the
  825. more important files):
  826. .sp
  827. /.login /.profile /.cshrc /.crontab /.rhost
  828. .sp
  829. /etc/passwd /etc/group /etc/inittab /etc/rc
  830. .sp
  831. /etc/rc.local /etc/rc.boot /etc/hosts.equiv /etc/profile
  832. .sp
  833. /etc/syslog.conf /etc/export
  834. .sp
  835. As well as the executable command files (among others):
  836. .sp
  837. .ul
  838. sh, csh,
  839. and
  840. .ul
  841. ls.
  842. .sp
  843. .PP
  844. Method -- again read through a configuration file listing all of the
  845. files to be checked, comparing each in turn with a write mask.  The
  846. program that performs this task is
  847. .ul
  848. file.chk
  849. .PP
  850. 3)  Check \*Qvital\*U system files to see if they are world-readable,
  851. plus check for a NFS file system with no restriction.
  852. These critical files are:
  853. .sp
  854. /dev/kmem /dev/mem
  855. .sp
  856. All file systems found in /etc/fstab
  857. .sp
  858. Plus a small number of user selectable files -- initially set to
  859. include /.netrc, /usr/adm/sulog, and /etc/btmp.
  860. .sp
  861. Method -- checking each in turn against a read mask for their read status.
  862. The file system names are read from /etc/fstab, the selectable files are
  863. kept in a variable.  The program that
  864. performs this task is
  865. .ul
  866. dev.chk
  867. .PP
  868. 4)  Check all files in system for SUID status, notifying the COPS user
  869. of any changes in SUID status.
  870. .sp
  871. Method -- Use the "find" command on the root directory (this must be
  872. done by root to avoid missing any files unreadable but still dangerous.)
  873. The previous run will create a file that can be checked against the
  874. current run to keep track of changes in SUID status and any new SUID
  875. files.  The program that performs this task is
  876. .ul
  877. suid.chk
  878. and was written by Prentiss Riddle.
  879. .PP
  880. 5)  Check the /etc/passwd file (and the yellow pages password database, if
  881. applicable) for null passwords, improper # of fields, non-unique user-id's,
  882. non-numeric group id's, blank lines, and non-alphanumeric user-id's.
  883. .sp
  884. Method -- Read through password file, flag any differences with
  885. normal password file, as documented in \*Qman 5 passwd\*U.  Fortunately,
  886. the syntax of the password file is relatively simple and rigid. The program
  887. that performs this task is
  888. .ul
  889. passwd.chk
  890. .sp
  891. .PP
  892. 6)  Check the /etc/group file (and the yellow pages database, if
  893. applicable) for groups with passwords, improper # of fields,
  894. duplicate users in groups, blank lines, and non-unique group-id's.
  895. .sp
  896. Method -- Read through group file, flag any differences with
  897. normal group file as documented in \*Qman 5 group\*U.  Again, the syntax
  898. of this file is fairly simple.  The program that performs this task is
  899. .ul
  900. group.chk
  901. .PP
  902. 7)  Check passwords of users on system.
  903. .sp
  904. Method -- using the stock \*Qcrypt\*U command, compare the encrypted
  905. password found in the /etc/passwd file against the following
  906. (encrypted) guesses:
  907. .sp
  908. The login id (uid), information in the gecos field, and all single
  909. letter passwords.
  910. .sp
  911. The program that performs this task is
  912. .ul
  913. pass.chk
  914. and was written by Craig Leres and was modified by Seth Alford,
  915. Roger Southwick, Steve Dum, and Rick Lindsley.
  916. .PP
  917. 8)  Check the root path, umask, and if root is in /etc/ftpuser.
  918. .sp
  919. Method -- look inside the /.profile and /.cshrc files to ensure that
  920. all of the directories listed are not world writable, that \*Q.\*U
  921. isn't anywhere in the path, and that the umask is not set to create
  922. world writable files.  The program that performs this task is
  923. .ul
  924. root.chk
  925. .PP
  926. 9)  Examine the commands in /etc/rc* to ensure that none of the
  927. files or paths used are world-writable.
  928. .sp
  929. Method -- grep through the files and examine any strings that start with
  930. \*Q/\*U for writability.  The program that performs this task is
  931. .ul
  932. rc.chk
  933. .PP
  934. 10)  Examine the commands in /usr/lib/crontab to ensure that none of the
  935. files or paths used are world-writable.
  936. .sp
  937. Method -- grep through the crontab file and examine any strings after
  938. field five (first five are not files, but how crontab is to be
  939. run) that start with \*Q/\*U for writability.  The program that performs
  940. this task is
  941. .ul
  942. cron.chk
  943. 11)  Check all of the user home directories to ensure they are not
  944. world writable.
  945. .sp
  946. Method -- get all of the home directories using the system call
  947. .ul
  948. getpwent()
  949. and then for every home directory found, check the write permissions of
  950. of the home directory against a bit mask.  The program that performs
  951. this task is
  952. .ul
  953. home.chk
  954. and it was written by John Owens.
  955. .PP
  956. 12) Check important user files in user's home directories to ensure
  957. they are not world writable.  The files checked (all in the individual
  958. users' home directory, all with the prefix \*Q.\*U):
  959. .sp
  960. rhost profile login cshrc kshrc tcshr crhost
  961. .sp
  962. netrc forward dbxinit distfile exrc emacsrc
  963. .sp
  964. Method -- using the same system call as #10, determine user home
  965. directory.  Then simply check all of the above files against a bit mask.
  966. The program that performs this task is
  967. .ul
  968. user.chk
  969. .PP
  970. 13) Given a goal to compromise, such as user root, and a list of user
  971. and group id's that can be used in an attempt to achieve the goal, this
  972. security tool will search through the system until it verifies that the
  973. goal is compromisible or not.  The program that performs this tricky task
  974. is part of the
  975. .ul
  976. U-Kuang
  977. (rhymes with \*Qtwang\*U)
  978. system.  Robert Baldwin was kind enough to allow me to include this
  979. security checker (a fine security machine in it's own right)
  980. within this distribution.  For more information on this fascinating
  981. security checker, see kuang.man.ms and [Baldwin 87].  I have rewritten
  982. it in Bourne shell (it was in C-Shell) for further portability.
  983. .PP
  984. None of programs listed above certain cover all of the possible areas
  985. that can harm a system, but if run together they can aid an overworked
  986. administrator to locate some of the potential trouble spots.  The COPS
  987. system is not meant to be a panacea against all UNIX security woes,
  988. but an administrator who examines the security toolbox programs and 
  989. this research paper might reduce the danger of their UNIX system being
  990. compromised -- and that's all any security tool can ever hope to do.
  991. The COPS system could never replace a vigilant administration
  992. staffed with knowledgeable people, but hopefully, as administrators look
  993. into the package, more comprehensive programs will come into being,
  994. covering more of the problems that will continue as the latest versions
  995. of UNIX continue to grow.
  996. .PP
  997. Design Notes:
  998. .PP
  999. The programs that are described here were designed to address the
  1000. problems discussed above, but still be usable on as many UNIX
  1001. \*Qflavors\*U as possible.  Speed was sacrificed for
  1002. simplicity/portability; hopefully the tools here will either be
  1003. replaced or modified, as by no means are they the final word or
  1004. solution to _any_ of these problems; indeed, it is my hope that
  1005. after other programmers/administrators see this report, they will
  1006. create newer, better, and more general tools that can be
  1007. re-distributed periodically.  None of the programs need to be run by
  1008. root to be effective, with the exception of the SUID checker (to
  1009. ensure that all files are checked.) Some of the tools were written by
  1010. myself, the others were written by other programmers on the network
  1011. and (with their permission) presented here.  All of the programs in
  1012. this report are in the public domain, with the exception of Robert
  1013. Baldwin's U-Kuang system; they all exist solely to be used and
  1014. modified to fit your needs.  If they are re-distributed, please 
  1015. keep them in their original form unless it is clearly stated that
  1016. they were modified.  Any improvements (that might not be too hard :-),
  1017. suggestions, or other security programs that
  1018. you would like to see get further distribution can be sent to:
  1019. .PP
  1020. df@medusa.cs.purdue.edu
  1021. .PP
  1022. (That's me)
  1023. .PP
  1024. or
  1025. .PP
  1026. spaf@uther.cs.purdue.edu
  1027. .PP
  1028. (Dr. Eugene Spafford)
  1029. .PP
  1030. Note that the COPS system is still in an infancy
  1031. stage -- although it has been tested on a variety of computers at
  1032. Purdue, it has not undergone any serious trials.
  1033. .PP
  1034. Enhancements I envision include:
  1035. .sp
  1036. i) Improved speed and portability without sacrificing functionality
  1037. (pretty obvious, I guess....)
  1038. .sp
  1039. ii) A level of severity assigned to each warning; anything that could 
  1040. compromise root instantly (root having no password, for example) might
  1041. have a level 0 priority, while simply having a user with a writable home
  1042. directory might only be level 3.  This way the system could be run at
  1043. a certain threshold level, or simply have the set of warnings
  1044. prioritized for a less sophisticated administrator.
  1045. .sp
  1046. iii) Better handling of SUID programs.
  1047. The current program needs more work to be done on it to be run effectively
  1048. by most people; many will not be willing to put the time needed to go
  1049. through the list of SUID files by hand to decide if they are needed or
  1050. not.
  1051. Perhaps also an alarm would sound if a shell script is SUID; doubly so if
  1052. root owned.
  1053. .sp
  1054. iv) A CRC checker that would check a file system (possibly just the most
  1055. important programs (such as this :-)) and report if any of the
  1056. executable files were changed -- possibly signalling a viral infection.
  1057. .sp
  1058. v) The eradication of any design flaws or coding errors that are in
  1059. the COPS system.
  1060. .PP
  1061. The main purpose of creating the COPS system was twofold; the first was
  1062. to foster an understanding of the security problems common to most UNIX
  1063. systems, and the second was to try to create and apply software tools
  1064. that, when run, will inform system administrators of potential problems
  1065. present in their system.  No attempt is made by the tools to correct any
  1066. problems because a potential security problem at one site may be
  1067. standard policy/practice at another.  An emphasis on furthering
  1068. education and knowledge about UNIX in general is the key to good
  1069. security practices, not following blindly what an unintelligent tool
  1070. might say.
  1071. .PP
  1072. Some of the advantages to using a system such as COPS are:
  1073. .sp
  1074. i) Nearly Continuous monitoring of traditional problem areas.
  1075. .sp
  1076. ii) A new system can be checked before being put into production.
  1077. .sp
  1078. iii) New or inexperienced administrators can not only stop some of their
  1079. problems in security they may have, but can also raise their
  1080. consciousness about the potential for security dilemmas.
  1081. .PP
  1082. And a couple of disadvantages:
  1083. .sp
  1084. i) An administrator could get a false sense of security from running
  1085. these programs.  Caveat emptor (ok, they are free, but still beware.)
  1086. .sp
  1087. ii) A specific path to the elimination of the problem is not presented.
  1088. This could also be construed as an advantage, when considering the third
  1089. point.
  1090. .sp
  1091. iii) Badguys can get these tools.  You know -- the guys with black hats.
  1092. What happens when they get a copy of this package?  With any sensitive
  1093. subject like security, knowledge is zealously guarded.  People are
  1094. afraid that absolute knowledge corrupts -- who knows, they may be right.
  1095. But I staunchly stand by the tree of knowledge.  Let the bad guys taste
  1096. the fruit, and they may see the light, so to speak.  In addition, the
  1097. system does not say how to exploit the hole, just that it exists.
  1098. .PP
  1099. .ul
  1100. Results of Running COPS:
  1101. .PP
  1102. Not surprisingly, the results when COPS was run varied significantly
  1103. depending on what system and site it was run on.  Here at Purdue, it was
  1104. run on a Sequent Symmetry running DYNIX 3.0.12, on a pair of Suns (a
  1105. 3/280 and 3/50) running UNIX 4.2 release 3.4, a VAX 11/780 running 4.3
  1106. BSD UNIX, a VAX 8600 running Ultrix 2.2, and finally a NeXT machine
  1107. running their 0.9 O/S version of UNIX.  The results of the COPS
  1108. system showed a reasonable amount of security concern on all of the
  1109. machines; the faculty only machines showed the weakest security, followed
  1110. by the machines used by the graduate students, and finally the undergraduate
  1111. machines had the strongest security (our administrators _know_ that you
  1112. can't trust those (us?) young folks.)  Whether this was showing that
  1113. Purdue has a good administration, or that the UNIX vendors have a fairly
  1114. good grasp on potential security problems, or if it was merely 
  1115. showcasing the shortcomings of this system wasn't clear to me from the
  1116. results.
  1117. .PP
  1118. The security results probably will vary significantly from machine to
  1119. machine -- this
  1120. is not a fault of UNIX; merely having the same machine and software
  1121. does not mean that two sites will not have completely different security
  1122. concerns.  In addition, different vendors and administrators have
  1123. significantly varying opinions on how a machine should be set up.  There
  1124. is no fundamental reason why any system cannot pass all or nearly all of
  1125. these tests, but what is standard policy at one sites may be an
  1126. unthinkable risk at another, depending upon the nature of the work being
  1127. done, the information stored on the computer, and the users of the
  1128. system.
  1129. .PP
  1130. When I first started researching this report, I thought it would be a
  1131. fairly easy task.  Go to a few computing sites, read some theoretical
  1132. papers, gather all the programs everyone had written, and write a
  1133. brief summary paper.  But what I found was an
  1134. tremendous lack of communication and concerted effort towards the
  1135. subject of security.  AT&T had written a couple of programs ([Kaplilow
  1136. and Cherepov 88], as had Hewlett Packard ([Spence 89]), but they were
  1137. proprietary.  I heard rumors that the
  1138. government was either working on or had such a security system, but they
  1139. certainly weren't going to give it to me.
  1140. The one book devoted to UNIX security ([Kochran and Wood 86]) was good,
  1141. but the programs that they presented were not expansive enough for what
  1142. I had in mind, plus the fact that they had written their programs
  1143. mostly based on System V.  And while most system administrators I talked
  1144. to had written at least a shell script or two that performed a minor
  1145. security task (SUID programs seemed the most popular), no one seemed to
  1146. exchange ideas or any
  1147. their problems with other sites -- possibly afraid that the admission of
  1148. a weakness in their site might be an invitation to disaster.  There is
  1149. an excellent security discussion group on the network ([Various Authors
  1150. 84-]), from which I received some excellent ideas for this project, but
  1151. it is very restrictive to whom it allows to participate.  I hope that
  1152. with the release of this security system it will not only help stamp
  1153. out problems with UNIX security, but would encourage people to exchange
  1154. ideas, programs, problems and solutions to the computer community at large.
  1155.  
  1156. Dan Farmer
  1157. September 29, 1989
  1158. .PP
  1159. .ul
  1160. Acknowledgements:
  1161. I would like to thank Eugene Spafford for his invaluable help in
  1162. the researching, planning, and development of this project.  Without
  1163. the writings and programs created by Robert Morris, Matt Bishop, and
  1164. other capable UNIX programmers, this project could never have gotten
  1165. off the ground.  Thanks also go to Brian Kernighan, Dennis Ritchie,
  1166. Donald Knuth, and Ken Thompson, for such inspirational computer work.
  1167. And of course without Peg, none of this would have come into being.
  1168. Thanks again to all of you.
  1169. .bp
  1170. .ce
  1171. .ul
  1172. BIBLIOGRAPHY
  1173.  
  1174. .sp
  1175. _, UNIX Programmers Manual, 4.2 Berkeley Software Distribution,
  1176. Computer Science Division, Department of Electrical
  1177. Engineering and Computer Science University of California,
  1178. Berkeley, CA, August 1983.
  1179. .sp
  1180. _, DYNIX(R) V3.0.12 System Manuals, Sequent Computer Systems, Inc., 1984.
  1181. .sp
  1182. Aho, Alfred V., Brian W. Kernighan, and Peter J. Weinberger, The
  1183. AWK Programming Language, Addison-Wesley Publishing Company, 1988.
  1184. .sp
  1185. Authors, Various, UNIX Security Mailing List/Security Digest,
  1186. December 1984 -.
  1187. .sp
  1188. Baldwin, Robert W., Crypt Breakers Workbench, Usenet, October
  1189. 1986.
  1190. .sp
  1191. Baldwin, Robert W., Rule Based Analysis of Computer Security,
  1192. Massachusetts Institute of Technology, June 1987.
  1193. .sp
  1194. Bauer, David S. and Michael E. Koblentz, NIDX - A Real-Time
  1195. Intrusion Detection Expert System, Proceedings of the Summer
  1196. 1988 USENIX Conference, Summer, 1988.
  1197. .sp
  1198. Bishop, Matt, Security Problems with the UNIX Operating System,
  1199. Department of Computer Sciences, Purdue University, January
  1200. 31, 1983.
  1201. .sp
  1202. Bishop, Matt, How to Write a Setuid Program, April 18, 1985.
  1203. .sp
  1204. Denning, Dorothy, Cryptography and Data Security, Addison-Wesley
  1205. Publishing Company, Inc, 1983.
  1206. .sp
  1207. Duff, Tom, Viral Attacks On UNIX System Security, Proceedings of
  1208. the Winter 1988 USENIX Conference, Winter, 1988.
  1209. .sp
  1210. Fiedler, David and Bruce Hunter, UNIX System Administration,
  1211. Hayden Book Company, 1986.
  1212. .sp
  1213. Grampp, F. T. and R. H. Morris, "UNIX Operating System Security,"
  1214. AT&T Bell Laboratories Technical Journal, October 1984.
  1215. .sp
  1216. Kaplilow, Sharon A. and Mikhail Cherepov, "Quest -- A Security
  1217. Auditing Tool," AT&T Bell Laboratories Technical Journal,
  1218. AT&T Bell Laboratories Technical Journal, May/June 1988.
  1219. .sp
  1220. Morris, Robert and Ken Thompson, "Password Security : A Case
  1221. History," Communications of the ACM, November 1979.
  1222. .sp
  1223. Reed, Brian, "Reflections on Some Recent Widespread Computer
  1224. Break-ins," Communications of the ACM, vol. Vol 30, No. 2,
  1225. February 1987.
  1226. .sp
  1227. Reed, J.A. and P.J. Weinberger, File Security and the UNIX System
  1228. Crypt Command, Vol 63, No. 8, AT&T Bell Laboratories
  1229. Technical Journal, October 1984.
  1230. .sp
  1231. Smith, Kirk, Tales of the Damned, UNIX Review, February 1988.
  1232. .sp
  1233. Spafford, Eugene H., The Internet Worm Program: An Analysis,
  1234. Purdue Technical Report CSD-TR-823, Nov 28, 1988.
  1235. .sp
  1236. Spafford, Eugene H., 1989.  Private Communications
  1237. .sp
  1238. Bruce Spence, spy: A UNIX File System Security Monitor, Workshop
  1239. Proceedings of the Large Installation Systems Administration III,
  1240. September, 1988.
  1241. .sp
  1242. Stoll, Clifford, Stalking the Wily Hacker, Volume 31, Number 5,
  1243. Communications of the ACM, May 1988.
  1244. .sp
  1245. Thompson, Ken, Reflections on Trusting Trust, Volume 27, Number
  1246. 8, Communications of the ACM, August 1984.
  1247. .sp
  1248. Wood, Patrick and Stephen Kochran, UNIX System Security, Hayden
  1249. Books, 1986.
  1250. .sp
  1251. Wood, Patrick, A Loss of Innocence, UNIX Review, February 1988.
  1252. SHAR_EOF
  1253. echo shar: extracting cops/docs/KUANG.README '(886 characters)'
  1254. cat << \SHAR_EOF > cops/docs/KUANG.README
  1255.  
  1256.   The U-Kuang system is currently setup in a minimum configuration; e.g.
  1257. it assumes only that world modes/permissions are to be used.  To fully
  1258. use the system, if the password checkers and the home-directory checker
  1259. come back with any positive results (i.e. with an account that can be
  1260. broken), modify the init_kuang file to reflect this.
  1261.   To use this system to it's full capabilities, be sure to read the
  1262. manual, kuang.man.ms.
  1263.  
  1264. This directory contains the various programs and shell scripts
  1265. that make up the Kuang security checking system.
  1266.  
  1267. The file, kuang.man.1, documents the system in the style of a UNIX
  1268. manual page.  The file, kuang.mss, is a draft of a paper on
  1269. this system.
  1270.  
  1271.  
  1272. To run the system:
  1273.  
  1274. 0. Execute 'make' to build the programs.
  1275. 1. Read kuang.man.1
  1276. 2. Modify the file, init_kuang, to set the initial set of privileges.
  1277. 3. Execute "sh kuang" (or run the COPS system.)
  1278.  
  1279. SHAR_EOF
  1280. echo shar: extracting cops/docs/SUID.README '(501 characters)'
  1281. cat << \SHAR_EOF > cops/docs/SUID.README
  1282. Findsuid is a little utility we dreamt up to watch for potential Trojan horse
  1283. programs by keeping an eye on our suid and sgid files and telling us when
  1284. they change unexpectedly.
  1285.  
  1286. We run it using the following line in crontab:
  1287.  
  1288.     40 3 * * * /etc/findsuid/findsuid >/etc/findsuid/fserror 2>&1
  1289.  
  1290. Included here is the findsuid shell script, a man page, a makefile, and a
  1291. sample "stop" file.
  1292.  
  1293. --- Prentiss Riddle ("Aprendiz de todo, maestro de nada.")
  1294. --- {ihnp4,harvard,seismo,gatech,ctvax}!ut-sally!riddle
  1295. SHAR_EOF
  1296. #    End of shell archive
  1297. exit 0
  1298.  
  1299.