Tuesday, March 9, 2010

Solaris: Security Administration

TO DENY THE USE OF A COMMAND /usr/bin/write COMMAND TO USERS:

1. Considering 2 existing users named malcomx and scbose.
2. Login in as above mentioned users through telnet.


Note:
/usr/bin/write command will send only the message whilst the user is logged in.


login: malcomx
Password:
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
-bash-3.00$ id -a malcomx
uid=100(malcomx) gid=1(other) groups=1(other)
-bash-3.00$ write scbose
hi, good day



login: scbose
Password:
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
-bash-3.00$
Message from malcomx on sunvm1 (pts/5) [ Tue Mar 9 12:22:11 ] ...
hi, good day


Now we observe that the message from the user malcomx is sent to the user scbose.





Now perform the following activity as “root” user:


bash-3.00# ls -l /usr/bin | grep write
-r-xr-sr-x 1 root tty 14208 Jan 23 2005 write
bash-3.00# chmod o-x /usr/bin/write
Removing the execution permission to others.
bash-3.00# ls -l /usr/bin|grep write
-r-xr-sr-- 1 root tty 14208 Jan 23 2005 write



Now checking with the user malcomx
-bash-3.00$ write scbose
-bash: /usr/bin/write: Permission denied

The user is denied since the permission-ship had been changed.

Now assigning SUID and SGID to the /usr/bin/write command.

bash-3.00# chmod 4554 /usr/bin/write
bash-3.00# chmod g+s /usr/bin/write
bash-3.00# ls -l /usr/bin|grep write
-r-sr-sr-- 1 root tty 14208 Jan 23 2005 write


Create a group (here “test”), assign password to the group (here test) and change the group to the command /usr/bin/write as follows:

bash-3.00# chgrp test /usr/bin/write
bash-3.00# ls -l /usr/bin|grep write
-r-sr-sr-- 1 root test 14208 Jan 23 2005 write


Now as the user malcomx

-bash-3.00$ write scbose
-bash: /usr/bin/write: Permission denied

Now move the group “test” by issuing the password,
-bash-3.00$ newgrp test
newgrp: Password:
bash-3.00$ write scbose
scbose is logged on more than one place.
You are connected to "pts/7".
Other locations are:
pts/8
it's works... fabulous...!


Now as scbose, we observe that the message had been sent from the user malcomx.

-bash-3.00$ id
uid=101(scbose) gid=1(other)
-bash-3.00$
Message from malcomx on sunvm1 (pts/5) [ Tue Mar 9 12:30:40 ] ...
it's works... fabulous...!

1 comment:

  1. Thank you,very much.
    now i am cleared with ur work.
    I will try to implement and give feed back sir.

    ReplyDelete