home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume21 / cops.pch next >
Encoding:
Internet Message Format  |  1990-06-14  |  19.1 KB

  1. Path: wuarchive!zaphod.mps.ohio-state.edu!slug!samsung!uunet!papaya.bbn.com!rsalz
  2. From: rsalz@uunet.uu.net (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v22i106:  System security analysis tool, patch1
  5. Message-ID: <2646@litchi.bbn.com>
  6. Date: 8 Jun 90 13:13:41 GMT
  7. Lines: 635
  8. Approved: rsalz@uunet.UU.NET
  9. X-Checksum-Snefru: 68b838ea d39df88f 01a3fe9e bcce4158
  10.  
  11. Submitted-by: Dan Farmer <df@cert.sei.cmu.edu>
  12. Posting-number: Volume 22, Issue 106
  13. Archive-name: cops.pch
  14. Patch-To: volume21/cops
  15.  
  16.  
  17. Here's the first patch for COPS.  Pretty minor stuff on the whole, but I'd
  18. appreciate it if you would get it out to the world for me.  This one fixes
  19. some bugs and minor doc stuff; I'll be putting out another patch later
  20. this year that should add features and all that good stuff (hopefully it
  21. won't be repairing problems with this patch :-)).
  22.  
  23.  thanks,
  24.  
  25.   -- dan
  26.  
  27. ---------------  Cut here for patch -------------------------
  28.  
  29. Patch #: 1
  30. Priority: MEDIUM
  31.  
  32.   This is the first patch for COPS.  This shar file includes three files; the
  33. original csh version of kuang (actually, another shar file), a patch file,
  34. and a "patchlevel.h" file.
  35.  
  36. o  The csh version of kuang was meant to be included in the original release,
  37.  but somehow got lost along the way.  It should be functionally equivalent to
  38.  the version I ported to bourne shell for wider portability, but is a little
  39.  cleaner design, since I had to do some strange things to get it to work in
  40.  bourne.
  41. o  Perhaps the biggest problem was with the password guessing program; turned
  42.  out there was a bug that someone added while adding features through the
  43.  years (it was originally written in 1983, and the bug was not in the original
  44.  version, looking at my archives.)  The problem was that once a dictionary
  45.  passwd was guessed, a variable wasn't reset.  The original author also added
  46.  some comments about the design and intent of the program.
  47. o  /bin/rm -f in rc* files (pretty common stuff) are now ignored.
  48. o  findsuid now uses "ls -ldga" instead of "ls -lga" to find files.
  49. o  A couple of error messages and docs were slightly changed, and a couple
  50.    of miscellaneous "'"'s were added to improve robustness; minor nits.
  51.  
  52.  
  53.   Enjoy!  If you have any problems, drop me a line at:
  54.  
  55.  df@sei.cmu.edu
  56.    or
  57.  (412) 268 7197
  58.  
  59.  
  60.   P.S.  To apply the patch, merely type:
  61.  
  62.   patch < cops.patch.1
  63.  
  64.      If you don't have the patch program, apply the patch by hand,
  65.      or get patch (I highly recommend it -- great program!  It can
  66.      be gotten from uunet.uu.net, via anonymous ftp)
  67.  
  68.      After patching, type "make", and all should be well again....
  69.  
  70.   The original COPS toolkit (as well as the "patch" program) can be gotten
  71. via anonymous ftp from uunet.uu.net (192.48.96.2), or wherever fine software
  72. is archived :-)
  73.  
  74. --------------------------------------------------------------------------------
  75.  
  76. #! /bin/sh
  77. # This is a shell archive.  Remove anything before this line, then unpack
  78. # it by saving it into a file and typing "sh file".  To overwrite existing
  79. # files, type "sh file -c".  You can also feed this as standard input via
  80. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  81. # will see the following message at the end:
  82. #        "End of shell archive."
  83. # Contents:  cops.patch.1 kuang.orig patchlevel.h
  84. #
  85. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  86. if test -f 'cops.patch.1' -a "${1}" != "-c" ; then 
  87.   echo shar: Will not clobber existing file \"'cops.patch.1'\"
  88. else
  89. echo shar: Extracting \"'cops.patch.1'\" \(6595 characters\)
  90. sed "s/^X//" >'cops.patch.1' <<'END_OF_FILE'
  91. XIndex: MANIFEST
  92. X17a18
  93. X> kuang.orig
  94. X
  95. XIndex: README
  96. X123c123
  97. X<    -- Next, change lines 36 and 37 in the "cops" shell file from:
  98. X---
  99. X>    -- Next, change lines 37 and 38 in the "cops" shell file from:
  100. X129c129
  101. X<    -- Set "MAIL=NO" in the "cops" shell file (line 22).  This will prevent
  102. X---
  103. X>    -- Set "MAIL=NO" in the "cops" shell file (line 23).  This will prevent
  104. X140c140
  105. X<    -- You may wish to comment out the password checker (line 72 in the
  106. X---
  107. X>    -- You may wish to comment out the password checker (line 73 in the
  108. X187c187
  109. X< groups in their respective target lines (below lines 21 and 27,
  110. X---
  111. X> groups in their respective target lines (below lines 20 and 27,
  112. X
  113. XIndex: XTRA_CREDIT
  114. X9,10c9,10
  115. X< Craig Leres, Seth Alford, Roger Southwick, Steve Dum, and Rick Lindsley
  116. X< all get credit for the password guessing program.
  117. X---
  118. X> Craig Leres, Jef Poskanzer, Seth Alford, Roger Southwick, Steve Dum,
  119. X> and Rick Lindsley all get credit for the password guessing program.
  120. X24c24,28
  121. X< implementation ideas at LISA II.
  122. X---
  123. X> implementation ideas at LISA III.
  124. X> 
  125. X>   In round II (the first patch), Mark Plumbly fixed rc.chk so it would
  126. X> work like I said it would, as well as pointing out a few problems with
  127. X> the password guesser.
  128. X
  129. XIndex: group.chk
  130. X75,76c75,77
  131. X<         if ("'$C2'" != "TRUE")
  132. X<             printf("Warning!  Group file, line %d, group has password: %s\n", NR, $0)
  133. X---
  134. X>         if ("'$C2'" != "TRUE") {
  135. X>             if (length($2) == 13)
  136. X>                 printf("Warning!  Group file, line %d, group has password: %s\n", NR, $0) }
  137. X127c128,129
  138. X<         printf("Warning!  YGroup file, line %d, group has password: %s\n", NR, $0) } \
  139. X---
  140. X>         if (if (length($2) == 13))
  141. X>             printf("Warning!  YGroup file, line %d, group has password: %s\n", NR, $0) } \
  142. X
  143. XIndex: kuang
  144. X0a1
  145. X> #!/bin/sh
  146. XOnly in cops.src: kuang.orig
  147. X
  148. XIndex: makefile
  149. X28a29
  150. X> RM=/bin/rm
  151. X32a34,36
  152. X> 
  153. X> clean:
  154. X>     $(RM) $(EXECUTABLE)
  155. X
  156. XIndex: passwd.chk
  157. X88,89c88,92
  158. X<     if ($3 !~ /[0-9]/) {
  159. X<         printf("Warning!  Password file, line %d, nonnumeric user id: \n\t%s\n", NR, $0) } \
  160. X---
  161. X>     if ($3 !~ /^[0-9]/) {
  162. X>         if ($3 < 0) {
  163. X>             printf("Warning!  Password file, line %d, negative user id: \n\t%s\n", NR, $0) } \
  164. X>         else {
  165. X>         printf("Warning!  Password file, line %d, nonnumeric user id: \n\t%s\n", NR, $0) }} \
  166. X117,118c120,124
  167. X<         if ($3 !~ /[0-9]/ && $3 != "-2") {
  168. X<             printf("Warning!  YPassword file, line %d, nonnumeric user id: \n\t%s\n", NR, $0) } \
  169. X---
  170. X>         if ($3 !~ /^[0-9]/) {
  171. X>             if ($3 < 0) {
  172. X>             printf("Warning!  YPassword file, line %d, negative user id: \n\t%s\n", NR, $0) } \
  173. X>             else {
  174. X>             printf("Warning!  YPassword file, line %d, nonnumeric user id: \n\t%s\n", NR, $0) }} \
  175. X121c127
  176. X<         if ($4 !~ /[0-9]/ && $4 != "-2") {
  177. X---
  178. X>         if ($4 !~ /[0-9]/) {
  179. XOnly in cops.src: patch.1
  180. X
  181. XIndex: rc.chk
  182. X21a22,27
  183. X> # 12 Apr 90, Mark Plumbly made it ignore lines starting with rm -f
  184. X> # (popular in rc files) and fixed my code so it would ignore everything
  185. X> # after a ">".
  186. X> #
  187. X> SED=/bin/sed
  188. X> CAT=/bin/cat
  189. X43d48
  190. X< #
  191. X46c51,70
  192. X< 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`
  193. X---
  194. X> #
  195. X> # 12 Apr mdp:     Modified to remove "> file" as well as ">file"
  196. X> #        and remove "rm -f file" (this removes a few bogus ones).
  197. X> #        (i.e. things which are written to or removed only are ignored).
  198. X> #
  199. X> first_pass=`${CAT} ${init_files}     |                \
  200. X> ${SED} -e 's/ *#.*$//'            |                \
  201. X> $AWK '
  202. X> {                                    \
  203. X>   for (i=1;i<=NF;i++) {                            \
  204. X>     if     ((index($i,"/")) &&                        \
  205. X>     ((first=substr($i,1,1)!=">")) &&                \
  206. X>     $(i-1)!=">" &&                             \
  207. X>     ( i<=2 || $(i-2)!="rm" || $(i-1)!="-f" ) &&            \
  208. X>     first!="#" &&                            \
  209. X>     first!="$" &&                            \
  210. X>     (last=substr($i,length($i),1))!="\"")                \
  211. X>     print $i                            \
  212. X>     }                                    \
  213. X> }' | $EGREP -v "/dev/.*ty|/tmp|/usr/tmp|/dev/null" | $SORT -u`
  214. X
  215. XIndex: root.chk
  216. X71c71
  217. X<     if test ! `$GREP "root" $ftp`
  218. X---
  219. X>     if $TEST ! "`$GREP "root" $ftp`"
  220. X91c91
  221. X< $GREP path $csh | $AWK '{split($0,p1,"="); \
  222. X---
  223. X> $GREP path $csh | $SED 's/#.*$//' | $AWK '{split($0,p1,"="); \
  224. X105c105
  225. X< $GREP PATH $sh | $SED 's/\(PATH=.*\);.*/\1/' |
  226. X---
  227. X> $GREP PATH $sh | $SED 's/#.*$//' | $SED 's/\(PATH=.*\);.*/\1/' |
  228. X118c118
  229. X<         $ECHO "Warning!  \".\" is in roots path!"
  230. X---
  231. X>         $ECHO "Warning!  \".\" (or current directory) is in roots path!"
  232. X123c123
  233. X<         $ECHO "Warning!  Directory $i is _World_ writable!"
  234. X---
  235. X>         $ECHO "Warning!  Directory $i is _World_ writable and in roots path!"
  236. X
  237. XIndex: suid.chk
  238. X37c37
  239. X< SEARCH=.
  240. X---
  241. X> SEARCH=/
  242. X58c58
  243. X< $FIND $SEARCH \( -perm -4000 -o -perm -2000 \) -exec $LS -lga {} \; | \
  244. X---
  245. X> $FIND $SEARCH \( -perm -4000 -o -perm -2000 \) -exec $LS -ldga {} \; | \
  246. X
  247. XIndex: docs/warnings
  248. X50c50
  249. X< 1)
  250. X---
  251. X> 0)
  252. X61c61
  253. X< 2)
  254. X---
  255. X> 1)
  256. X80c80
  257. X< 3)
  258. X---
  259. X> 2)
  260. X93a94,101
  261. X> 3)
  262. X> Directory foo_dir is _World_ writable and in roots path!
  263. X> 
  264. X>    This is the same as (2), but the directory was found to be in the
  265. X> path variable set either in /.login or /.profile.  This is a bad thing
  266. X> because if it is writable, a trojan horse can be placed there, and
  267. X> root will execute the command.  See also (23).
  268. X> 
  269. X198a207,214
  270. X> Password file, line xyz, negative user id: foo
  271. X> 
  272. X>    A user id is negative.  This is most common with user name "nobody",
  273. X> and with an id of "-2".  This can be dangerous, especially if you are running
  274. X> a Sun, with 4.xx SunOS.  It is uncertain if it is dangerous for other
  275. X> versions or machines.  Changing it to 32767 is the usual course of action.
  276. X> 
  277. X> 19)
  278. X204c220
  279. X< 19)
  280. X---
  281. X> 20)
  282. X206c222,223
  283. X<    To fix, delete all blank lines.
  284. X---
  285. X>    To fix, delete all blank lines.  This can be very bad, because a blank
  286. X> line can give a uid=0 account with no password.
  287. X208c225
  288. X< 20)
  289. X---
  290. X> 21)
  291. X214c231
  292. X< 21)
  293. X---
  294. X> 22)
  295. X220,221c237,238
  296. X< 22)
  297. X< "." is in roots path!
  298. X---
  299. X> 23)
  300. X> "." (or current directory) is in roots path!
  301. X229c246
  302. X< 23)
  303. X---
  304. X> 24)
  305. X238c255
  306. X< 24)
  307. X---
  308. X> 25)
  309. X
  310. XIndex: src/pass.c
  311. X15a16,27
  312. X> 
  313. X>     Insecure is something that Jef Poskanzer and I wrote to rid a
  314. X>     local system of an overly persistent ankle-biting adolescent.
  315. X>     It was a quick hack we whipped up in just a few minutes and was
  316. X>     never intended to be publically distributed. Unfortunately, I
  317. X>     made the mistake of giving a copy to an associate at UC
  318. X>     Berkeley. Apparently, he incorporated it in a security package
  319. X>     he later developed for use at Berkeley. Someone else
  320. X>     distributed it outside Berkeley which explains why it's been
  321. X>     publically distributed.
  322. X> 
  323. X> 
  324. X226c238
  325. X< #define ARB_CONST    80
  326. X---
  327. X> #define ARB_CONST    1024
  328. X275a288,289
  329. X> 
  330. X>         done = 0;
  331. X
  332. END_OF_FILE
  333. if test 6595 -ne `wc -c <'cops.patch.1'`; then
  334.     echo shar: \"'cops.patch.1'\" unpacked with wrong size!
  335. fi
  336. # end of 'cops.patch.1'
  337. fi
  338. if test -f 'kuang.orig' -a "${1}" != "-c" ; then 
  339.   echo shar: Will not clobber existing file \"'kuang.orig'\"
  340. else
  341. echo shar: Extracting \"'kuang.orig'\" \(7758 characters\)
  342. sed "s/^X//" >'kuang.orig' <<'END_OF_FILE'
  343. X#! /bin/sh
  344. X# This is a shell archive.  Remove anything before this line, then unpack
  345. X# it by saving it into a file and typing "sh file".  To overwrite existing
  346. X# files, type "sh file -c".  You can also feed this as standard input via
  347. X# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  348. X# will see the following message at the end:
  349. X#        "End of shell archive."
  350. X# Contents:  dofiles dogids douids init_kuang kuang.csh
  351. X#
  352. XPATH=/bin:/usr/bin:/usr/ucb ; export PATH
  353. Xif test -f 'dofiles' -a "${1}" != "-c" ; then 
  354. X  echo shar: Will not clobber existing file \"'dofiles'\"
  355. Xelse
  356. Xecho shar: Extracting \"'dofiles'\" \(1564 characters\)
  357. Xsed "s/^X//" >'dofiles' <<'END_OF_FILE'
  358. XX# /* Copyright 1985 Robert W. Baldwin */
  359. XX# /* Copyright 1986 Robert W. Baldwin */
  360. XXset notice85="Copyright 1985 Robert W. Baldwin"
  361. XXset notice86="Copyright 1986 Robert W. Baldwin"
  362. XX
  363. XX#
  364. XX# A list of file names is read from successive lines of stdin.
  365. XX# Each file is examined for ways to access it.
  366. XX# The input format is:
  367. XX#    <filename> <whitespace> <mode> <comments>
  368. XX# The <mode> is either "write" or "replace".
  369. XX#
  370. XXecho Called dofiles.                        #>/dev/tty
  371. XXwhile ( 1 )
  372. XX    set nextfile = ( `echo $<` )
  373. XX    if ( $#nextfile == 0 )  break;
  374. XX#
  375. XX    set file = $nextfile[1]
  376. XX    set mode = $nextfile[2]
  377. XX    echo "    File $file, mode $mode"            #>/dev/tty
  378. XX#
  379. XX# Rules converting filename goals into UserName or GroupName goals.
  380. XX#
  381. XX    set writers = ( `filewriters $file` )
  382. XX    if ( $#writers == 3 ) then
  383. XX        set owner = $writers[1]
  384. XX        set group = $writers[2]
  385. XX        set other = $writers[3]
  386. XX        echo "        Writers are $owner $group $other"    #>/dev/tty
  387. XX        addto uids $owner $mode $file $nextfile[3-]
  388. XX        if ( $group != "NONE" ) then
  389. XX            addto gids $group $mode $file $nextfile[3-]
  390. XX        endif
  391. XX        if ( $other != "NONE" ) then
  392. XX            addto uids $other $mode $file $nextfile[3-]
  393. XX        endif
  394. XX    else
  395. XX        echo "        $file does not exist"        #>/dev/tty
  396. XX        continue
  397. XX    endif
  398. XX#
  399. XX# Rules converting filename goals into other filename goals.
  400. XX#
  401. XX    if ($mode != "replace" ) then
  402. XX        continue
  403. XX    endif
  404. XX#
  405. XX    set parent = "$file:h"
  406. XX    set basename = "$file:t"
  407. XX#    echo -n "       " Parent directory is $parent        #>/dev/tty
  408. XX#    echo ", " basename is $basename                #>/dev/tty
  409. XX    if ( "$parent" != "" ) then
  410. XX        addto files $parent write replace $basename $nextfile[3-]
  411. XX    endif
  412. XXend
  413. XX
  414. XEND_OF_FILE
  415. Xif test 1564 -ne `wc -c <'dofiles'`; then
  416. X    echo shar: \"'dofiles'\" unpacked with wrong size!
  417. Xfi
  418. X# end of 'dofiles'
  419. Xfi
  420. Xif test -f 'dogids' -a "${1}" != "-c" ; then 
  421. X  echo shar: Will not clobber existing file \"'dogids'\"
  422. Xelse
  423. Xecho shar: Extracting \"'dogids'\" \(668 characters\)
  424. Xsed "s/^X//" >'dogids' <<'END_OF_FILE'
  425. XX# /* Copyright 1985 Robert W. Baldwin */
  426. XX# /* Copyright 1986 Robert W. Baldwin */
  427. XXset notice85="Copyright 1985 Robert W. Baldwin"
  428. XXset notice86="Copyright 1986 Robert W. Baldwin"
  429. XX
  430. XX#
  431. XX# Process a list of gids from stdin.
  432. XX# Usage: dogids
  433. XX#    Input format is:
  434. XX#    GroupName Comments
  435. XX#
  436. XXecho Called dogids                        #>/dev/tty
  437. XXwhile ( 1 )
  438. XX    set nextgid = ( `echo $<` )
  439. XX    if ( $#nextgid == 0 )  break;
  440. XX    set group = $nextgid[1]
  441. XX    echo "   " Group $group                    #>/dev/tty
  442. XX#
  443. XX# Rules mapping gids to uids.
  444. XX#
  445. XX    foreach user ( `members $group` )
  446. XX        addto uids $user grant $group $nextgid[2-]
  447. XX    end
  448. XX#
  449. XX# Rules mapping gids to files.
  450. XX#
  451. XX    addto files /etc/group replace grant $group $nextgid[2-]
  452. XXend
  453. XX
  454. XEND_OF_FILE
  455. Xif test 668 -ne `wc -c <'dogids'`; then
  456. X    echo shar: \"'dogids'\" unpacked with wrong size!
  457. Xfi
  458. X# end of 'dogids'
  459. Xfi
  460. Xif test -f 'douids' -a "${1}" != "-c" ; then 
  461. X  echo shar: Will not clobber existing file \"'douids'\"
  462. Xelse
  463. Xecho shar: Extracting \"'douids'\" \(1539 characters\)
  464. Xsed "s/^X//" >'douids' <<'END_OF_FILE'
  465. XX# /* Copyright 1985 Robert W. Baldwin */
  466. XX# /* Copyright 1986 Robert W. Baldwin */
  467. XXset notice85="Copyright 1985 Robert W. Baldwin"
  468. XXset notice86="Copyright 1986 Robert W. Baldwin"
  469. XX
  470. XX#
  471. XX# Process a list of uids from stdin.
  472. XX# Usage: douids username comments
  473. XX#
  474. XXecho Called douids                        #>/dev/tty
  475. XXwhile ( 1 )
  476. XX    set nextuid = ( `echo $<` )
  477. XX    if ( $#nextuid == 0 )  break;
  478. XX    set user = $nextuid[1]
  479. XX    echo "   " User $user                    #>/dev/tty
  480. XX#
  481. XX# Rules mapping uids to other uids.
  482. XX#
  483. XX
  484. XX#
  485. XX# Rules mapping uids to files.
  486. XX#
  487. XX    addto files /etc/passwd replace grant $user $nextuid[2-]
  488. XX    addto files /usr/lib/aliases replace trojan $user $nextuid[2-]
  489. XX
  490. XX    if ( -e ~${user}/.rhosts )  then
  491. XX        addto files ~${user}/.rhosts write grant $user $nextuid[2-]
  492. XX    endif
  493. XX
  494. XX    if (-e ~${user}/.login)  then
  495. XX        addto files ~${user}/.login replace trojan $user $nextuid[2-]
  496. XX    endif
  497. XX
  498. XX    if (-e ~${user}/.cshrc)  then
  499. XX        addto files ~${user}/.cshrc replace trojan $user $nextuid[2-]
  500. XX    endif
  501. XX
  502. XX    if (-e ~${user}/.profile)  then
  503. XX        addto files ~${user}/.profile replace trojan $user $nextuid[2-]
  504. XX    endif
  505. XX
  506. XX    if (${user} == "root")  then
  507. XX        addto files /usr/lib/crontab replace create supershell\
  508. XX                $nextuid[2-]
  509. XX        addto files /etc/rc replace trojan $user $nextuid[2-]
  510. XX        addto files /etc/rc.local replace trojan $user $nextuid[2-]
  511. XX    endif
  512. XX
  513. XX    if (${user} != "root")  then
  514. XX        addto files /etc/hosts.equiv replace allow rlogin $nextuid[2-]
  515. XX    endif
  516. XX
  517. XX    if ((${user} != "root") && (-e /etc/hosts.equiv) && \
  518. XX        !(-z /etc/hosts.equiv))  then
  519. XX        addto files /etc/hosts replace fake HostAddress $nextuid[2-]
  520. XX    endif
  521. XX
  522. XXend
  523. XX
  524. XEND_OF_FILE
  525. Xif test 1539 -ne `wc -c <'douids'`; then
  526. X    echo shar: \"'douids'\" unpacked with wrong size!
  527. Xfi
  528. X# end of 'douids'
  529. Xfi
  530. Xif test -f 'init_kuang' -a "${1}" != "-c" ; then 
  531. X  echo shar: Will not clobber existing file \"'init_kuang'\"
  532. Xelse
  533. Xecho shar: Extracting \"'init_kuang'\" \(836 characters\)
  534. Xsed "s/^X//" >'init_kuang' <<'END_OF_FILE'
  535. XX# /* Copyright 1985 Robert W. Baldwin */
  536. XX# /* Copyright 1986 Robert W. Baldwin */
  537. XXset notice85="Copyright 1985 Robert W. Baldwin"
  538. XXset notice86="Copyright 1986 Robert W. Baldwin"
  539. XX
  540. XX###############################################
  541. XX# Kuang: Rule based computer security checker.
  542. XX###############################################
  543. XX#
  544. XX#
  545. XX# Initialization.
  546. XX#
  547. XXclearfiles
  548. XX#
  549. XX# First setup what we have access to.
  550. XX# The uids.k file must include the user 'OTHER' meaning the world access bits.
  551. XX# Add any other UIDs accessible to the attacker (e.g., ftp, daemon).
  552. XX#
  553. XX# Directly accessible user IDs.
  554. XXcat >uids.k <<END
  555. XXOTHER
  556. XXEND
  557. XX#
  558. XX# Directly accessible group IDs.
  559. XX# This usually includes a group like 'users', which most users are in.
  560. XX#
  561. XXcat >gids.k <<END
  562. XXEND
  563. XX#
  564. XX# Setup the primary goal(s).
  565. XX#
  566. XXecho Setting up goal                        #>/dev/tty
  567. XXaddto uids root DO ANYTHING
  568. XX
  569. XEND_OF_FILE
  570. Xif test 836 -ne `wc -c <'init_kuang'`; then
  571. X    echo shar: \"'init_kuang'\" unpacked with wrong size!
  572. Xfi
  573. X# end of 'init_kuang'
  574. Xfi
  575. Xif test -f 'kuang.csh' -a "${1}" != "-c" ; then 
  576. X  echo shar: Will not clobber existing file \"'kuang.csh'\"
  577. Xelse
  578. Xecho shar: Extracting \"'kuang.csh'\" \(704 characters\)
  579. Xsed "s/^X//" >'kuang.csh' <<'END_OF_FILE'
  580. XX# /* Copyright 1985 Robert W. Baldwin */
  581. XX# /* Copyright 1986 Robert W. Baldwin */
  582. XXset notice85="Copyright 1985 Robert W. Baldwin"
  583. XXset notice86="Copyright 1986 Robert W. Baldwin"
  584. XX
  585. XX###############################################
  586. XX# Kuang: Rule based computer security checker.
  587. XX###############################################
  588. XX#
  589. XX#
  590. XX# Initialization.
  591. XX#
  592. XXcsh -f init_kuang
  593. XX#
  594. XX# Main loop
  595. XX#
  596. XXecho Starting main loop                        #>/dev/tty
  597. XXwhile ( -e uids.n || -e gids.n || -e files.n )
  598. XX    if ( -e uids.n ) then
  599. XX        mv uids.n uids.x
  600. XX        csh -f douids < uids.x
  601. XX        endif
  602. XX    if ( -e gids.n ) then
  603. XX        mv gids.n gids.x
  604. XX        csh -f dogids < gids.x
  605. XX        endif
  606. XX
  607. XX    if ( -e files.n ) then
  608. XX        mv files.n files.x
  609. XX        csh -f dofiles < files.x
  610. XX        endif
  611. XX    end
  612. XX
  613. XEND_OF_FILE
  614. Xif test 704 -ne `wc -c <'kuang.csh'`; then
  615. X    echo shar: \"'kuang.csh'\" unpacked with wrong size!
  616. Xfi
  617. X# end of 'kuang.csh'
  618. Xfi
  619. Xecho shar: End of shell archive.
  620. Xexit 0
  621. END_OF_FILE
  622. if test 7758 -ne `wc -c <'kuang.orig'`; then
  623.     echo shar: \"'kuang.orig'\" unpacked with wrong size!
  624. fi
  625. # end of 'kuang.orig'
  626. fi
  627. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  628.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  629. else
  630. echo shar: Extracting \"'patchlevel.h'\" \(21 characters\)
  631. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  632. X#define PATCHLEVEL 1
  633. END_OF_FILE
  634. if test 21 -ne `wc -c <'patchlevel.h'`; then
  635.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  636. fi
  637. # end of 'patchlevel.h'
  638. fi
  639. echo shar: End of shell archive.
  640. exit 0
  641.  
  642. exit 0 # Just in case...
  643. -- 
  644. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  645. Use a domain-based address or give alternate paths, or you may lose out.
  646.