|
|||||||||||
|
Re: A "straw man" vulnerability auditing checklist
From: Antonomasia <ant(at)notatla.demon.co.uk>
Date: Thu Dec 05 2002 - 19:03:49 EST
> This list is quite incomplete, as reflected in the version number and
It's quite handy but could do with an example in each section. Some faults could be categorised in a number of ways and it's hard to be sure the same fault doesn't appear twice under a different title. Also the list of titles may not help much - does "3e. Missing/repeated/extra separator or delimiter" mean things like a PGP 2 fingerprint having different interpretations depending on key size ? 3. Syntax/grammar violation Inadequate recognition of side-effects. IFS, LD_*, MALLOC_CHECK_ ... odd resource limits, CWD - perhaps aimed at the large subject of Unchecked Return Codes resource-related failures like process slots/E2BIG => execve() failed but program proceeds in incorrect state
> 19. Information Leak
unknown usernames being logged
> 54. Insufficient Randomness
entropy doses added to a pool are too small > 24a. Signal handler race condition
TOCTOU - signal sent to wrong process because of termination and PID reuse. What I'd like to see is one of:
The best I know how to do now is:
Code for this is shown - what do people think ? #!/usr/bin/perl -w
use IO::Handle;
# This is a wrapper to apply to services where termination # is to be delegated to other users. # # The service starts and writes a file to $startfile. It # treats the presence of a file with the same name in the # $stop_signs directory as an indication it should stop. # Write permission to that directory can easily be given to # a number of user accounts without the need for setuid code # to run kill(2) or the opportunity to kill processes outside # this scheme. # # I envisage the filemodes like this. # drwxr-xr-x 5 donut donut 3072 Nov 12 08:48 /opt/donut # drwxr-xr-x 2 donut donut 3072 Nov 12 08:48 /opt/donut/are_go # drwxrwxr-x 2 donut donut 3072 Nov 12 08:48 /opt/donut/stop_signs # The donut account will clear out old files from these periodically # by other means such as cron. # # This is vulnerable to disruptive behaviour by the users who have write # permission to the $stop_signs directory. You might combine this with # logging via a setgid program that writes the entries to $stop_signs.
# definitions of control directories
$appdir="/opt/donut";
$are_go="$appdir/are_go";
$stop_signs="$appdir/stop_signs";
$tmpfile=sprintf("%d_%04d_%d", scalar time, rand(1000), $$);
$startfile=sprintf("%s/%s", $are_go, $tmpfile);
$stopfile=sprintf("%s/%s", $stop_signs, $tmpfile);
# create a file to enroll the process in this scheme
#
or die("open $startfile $!");
$ppid=$$;
# parent # This parent will quit if the (only) child has quit. # Might be expanded to start (and count) multiple child processes.local $SIG{CHLD}=sub{exit(0)}; # if (0==kill(0,$pid)) {
# child dead already ?
exit(0);
} $signum=15; for (;;) {
if (-f "$stopfile") {
kill($signum,$pid);
$signum=9; # in case we loop again
}
sleep(10);
} } else { die("fork !$") if ($$ == $ppid); # Writing the PID to the file helps users who know the PID they want # to kill (perhaps from ps) and want to find the name of the right # control file. printf(FH "%d\n", $$); close(FH); # or whatever service you want to run .... exec("sar","5"); die("exec $!"); } -- ############################################################## # Antonomasia ant notatla.demon.co.uk # # See http://www.notatla.demon.co.uk/ # ##############################################################Received on Fri Dec 6 13:18:02 2002 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:44 EDT |
||||||||||
|
|||||||||||