Lets get started, the scenario just said that we are looking for boxes in the 192.168.2.X range. Lets run nmap and see what hosts pop up
As you can see we 3 hosts identified. I already know the .154 is my box so we should take a look at the .100 and the .101 boxes
Thursday, April 7, 2011
Step 1 - Footprinting
De-Ice level 2
Now that I finished up the level 1 cd I decided to try the level 2 image. Heres the scenario for this one
Ill be using VMWare again to host my attacking box and the vulnerable image
SCENARIO
The scenario for this LiveCD is that you have been given an assignment to test a company's 192.168.2.xxx network to identify any vulnerabilities or exploits. The systems within this network are not critical systems and recent backups have been created and tested, so any damage you might cause is of little concern. The organization has had multiple system administrators manage the network over the last couple of years, and they are unsure of the competency previous (or current) staff2
Ill be using VMWare again to host my attacking box and the vulnerable image
Wednesday, March 30, 2011
Step 5 - Escalation; owning root
Now that we have a higher level account with aadams lets see if we can finally view the etc/shadow file
Hmm what did I do wrong? Oh, lets try to sudo first and see if that works
There it is. The password for root. Pretty clear isnt it? Wait, its encrypted. Of course. Lets take a look at the different fields in the shadow file, focusing just on root. Each field is separated by a colon :
Login name
Encrypted password
Days since Jan 1 1970 that the password was last changed
Days before password may be changed
Days after which password must be changed
Days before password is to expire that the user is warned
Days after password expires that the account is disabled
Days since Jan 1 1970 that account disabled
A reserve field
Now I copied the entire field for root and pasted it into Kate. Im sure you could download the shadow file to your attacking pc, but this was easier
Now that I have the encrypted password for root I needed a way to decrypt it. I used John for this
And there we go. We now have the root password for our target machine
Hmm what did I do wrong? Oh, lets try to sudo first and see if that works
There it is. The password for root. Pretty clear isnt it? Wait, its encrypted. Of course. Lets take a look at the different fields in the shadow file, focusing just on root. Each field is separated by a colon :
Login name
Encrypted password
Days since Jan 1 1970 that the password was last changed
Days before password may be changed
Days after which password must be changed
Days before password is to expire that the user is warned
Days after password expires that the account is disabled
Days since Jan 1 1970 that account disabled
A reserve field
Now I copied the entire field for root and pasted it into Kate. Im sure you could download the shadow file to your attacking pc, but this was easier
Now that I have the encrypted password for root I needed a way to decrypt it. I used John for this
And there we go. We now have the root password for our target machine
Step 5 - Escalation
Now that we have a user name and password we can begin working on getting root access
The first step I took was checking out the /etc/passwd file. I wanted to see what other usernames were valid and to see what other information I could gather. Lets take a look at the file
We can see that the user accounts of aadams, bbanter and ccoffee all exist on this server. The passwd file might look a little intimidating at first but its pretty easy to break down. The first field contains the username followed by the password field. This is ually just a * as the passwords are encrypted and stored in the shadow file. The next field is a number which represents the User-ID. In our case bbanter has a UID of 1001
Next is the Group-ID. We see that bbanter and ccoffee both have a GID of 100. Notice the aadams account has a GID of 10.
After the group ID is the GECOS field which stores various user info followed by their home directory information.
Lets try to gain access to aadams account
The first tool I used was BruteSSH
I let BruteSSH run for awhile but I was impatient so I killed the process and tried to use THC-Hydra
When I ran hydra I had a strange output saying it couldn't connect to port 22. I later found out that hydra was running too fast and I needed to add the -T switch and specify the number of login attempts to 8 at a time or less
I then ran into another issue with Hydra. It always quit before going through the entire wordlist and never found the password. After some research I found that Hydra version 5.9 was having a problem with its SSH module. I had to download version 6.1 to get it to work.
After installing and running version 6.1 hydra found the password in under 10 minutes
The first step I took was checking out the /etc/passwd file. I wanted to see what other usernames were valid and to see what other information I could gather. Lets take a look at the file
We can see that the user accounts of aadams, bbanter and ccoffee all exist on this server. The passwd file might look a little intimidating at first but its pretty easy to break down. The first field contains the username followed by the password field. This is ually just a * as the passwords are encrypted and stored in the shadow file. The next field is a number which represents the User-ID. In our case bbanter has a UID of 1001
Next is the Group-ID. We see that bbanter and ccoffee both have a GID of 100. Notice the aadams account has a GID of 10.
After the group ID is the GECOS field which stores various user info followed by their home directory information.
Lets try to gain access to aadams account
The first tool I used was BruteSSH
I let BruteSSH run for awhile but I was impatient so I killed the process and tried to use THC-Hydra
When I ran hydra I had a strange output saying it couldn't connect to port 22. I later found out that hydra was running too fast and I needed to add the -T switch and specify the number of login attempts to 8 at a time or less
I then ran into another issue with Hydra. It always quit before going through the entire wordlist and never found the password. After some research I found that Hydra version 5.9 was having a problem with its SSH module. I had to download version 6.1 to get it to work.
After installing and running version 6.1 hydra found the password in under 10 minutes
Step 4 - Penetration
Now that we have some usernames lets see if we can bruteforce some passwords
I dont have much practice with basic shell scripting so I decided to see if I could write a basic script that would input the usernames for me and let me put in password guesses manually. Dont laugh too hard at my first attempt
Yeah, so that one didn't work so well. Actually it didn't work at all. Heres my second attempt
This one actually worked. Sure its ugly but it did what I wanted. Once the script was running I tried using the username as the password. Surprisingly the intern (go figure) had a weak password and used his login ID as his password
I dont have much practice with basic shell scripting so I decided to see if I could write a basic script that would input the usernames for me and let me put in password guesses manually. Dont laugh too hard at my first attempt
Yeah, so that one didn't work so well. Actually it didn't work at all. Heres my second attempt
This one actually worked. Sure its ugly but it did what I wanted. Once the script was running I tried using the username as the password. Surprisingly the intern (go figure) had a weak password and used his login ID as his password
Step 3 - Enumeration continued
We have already identified the host operating system, services and their version. What else can we find out about our target? We don't have any user names yet, how can we get those?
Lets see what web site is running on port 80
Wow, that page is ugly and hard to read. How else can we view it? Lets use wget to download the page locally then take a look at it
Lets take a look at that index2.php page
Hmm it looks like there are several email addresses in there. Lets try to parse them out so we can see it clearer

Great, we can see that we have emails for the system admin and other users. Lets see if we can further refine that list to just display the emails with no names or titles.
Thats looking good. Lets output the results of our cut to a new txt file for the email id's
Great, now lets cut this file and eliminate everything after the @ sign so we can get some user names
Next I opened this file with Kate and added the user names so the initial is first (example banterb I added bbanter)
Now we have some user names we can use to attempt a brute force attack on our target.
Lets see what web site is running on port 80
Wow, that page is ugly and hard to read. How else can we view it? Lets use wget to download the page locally then take a look at it
Lets take a look at that index2.php page
Hmm it looks like there are several email addresses in there. Lets try to parse them out so we can see it clearer

Great, we can see that we have emails for the system admin and other users. Lets see if we can further refine that list to just display the emails with no names or titles.
Thats looking good. Lets output the results of our cut to a new txt file for the email id's
Great, now lets cut this file and eliminate everything after the @ sign so we can get some user names
Next I opened this file with Kate and added the user names so the initial is first (example banterb I added bbanter)
Now we have some user names we can use to attempt a brute force attack on our target.
Step 3 - Enumeration
The next step in our pentest process is enumeration. During this phase we try to determine the host OS, services running and what version they are.
We already did a little bit of enumeration in my previous post using the Nmap -sV and -O options
Here are those results again
Another great tool we can use is Netcat
Lets use netcat to connect to the apache web server running on port 80
To do this we type nc -vv TARGET PORT
After we have a connection lets pull down the HTTP header to verify the apache server info
Once connected type HEAD / HTTP/1.0 then hit the return key 2x
We already did a little bit of enumeration in my previous post using the Nmap -sV and -O options
Here are those results again
Another great tool we can use is Netcat
Lets use netcat to connect to the apache web server running on port 80
To do this we type nc -vv TARGET PORT
After we have a connection lets pull down the HTTP header to verify the apache server info
Once connected type HEAD / HTTP/1.0 then hit the return key 2x
The results confirm that this server is running Apache version 2.055
Netcat has a ton of other useful features that we will go into later
Subscribe to:
Posts (Atom)




















