Tom Kelliher, CS 325
Sept. 28, 2011
Read 4.1-4.3.
Program security I.
Operating systems.
What do we mean? Malicious code written for a particular system, a particular application, and a particular purpose.
#!/usr/bin/perl -Tw # Copyright 2001, Thomas P. Kelliher, Goucher College. use strict; use CGI qw(:standard); ###################################################################### # Globals. # Path to mail client. my $MAILPATH = "/usr/bin/Mail"; ###################################################################### MAIN: { ... # Send the form data as an e-mail. if ($sender eq "") { open(MAIL, "|$MAILPATH -s \"$subj\" $recip"); } else { open(MAIL, "|$MAILPATH -s \"$subj\" -r \"$sender\"" . " $recip"); } for ($i = 0; $i < $numFlds; ++$i) { if ($fldn[$i] ne "") { print MAIL "$fldn[$i]:\n"; print MAIL "$fldv[$i]\n"; print MAIL "\n-----------------------------------"; print MAIL "-----------------------------------\n\n"; } } close(MAIL); ... exit(0); }
From the man page for Mail:
Tilde/Escapes Here is a summary of the tilde escapes, which are used when composing messages to perform special functions. Tilde escapes are only recognized at the beginning of lines. The name "tilde escape" is somewhat of a misnomer since the actual escape character can be set by the option escape. ~!command Execute the indicated shell command, then return to the message.
open_basedir
-- Default ``jail'' directory.
Trying to prevent jail breaks: disable_functions
(shell_exec
,
system
, etc.).
Generally, we have user=joe&password=foo
and user gets used in an
SQL statement as:
pg_send("SELECT password FROM users WHERE user = '$user';");Suppose the following is input in the user field:
' OR '' = ''; DROP TABLE users; --
DEBUG mode in sendmail.
No one notices!!!
Side-channel attacks:
Secure | Spy | |
/etc/shadow |
R | -- |
/tmp/scratch |
RW | R |
Possible covert threat -- theoretically, spy has access to
/etc/shadow
.
According to this, any Linux process running as root could be a covert channel.
How useful in analyzing inter-process communication?
Sep 25 18:32:16 phoenix su(pam_unix)[32298]: authentication failure; logname=olehmer uid=509 euid=0 tty=pts/3 ruser=olehmer rhost= user=root Sep 25 18:47:52 phoenix last message repeated 12 times