[Walkthrough] De-ICE S1.100 05-23-2013, 11:55 PM
#1
Information
Objective:
Perform penetration test on company server
Scenario:
The scenario for this LiveCD is that a CEO of a small company has been pressured by the Board of Directors to have a penetration test done within the company.
The CEO, believing his company is secure, feels this is a huge waste of money, especially since he already has a company scan their network for vulnerabilities
(using nessus). To make the BoD happy, he decides to hire you for a 5-day job; and because he really doesn't believe the company is insecure, he has contracted
you to look at only one server - a old system that only has a web-based list of the company's contact information.
The CEO expects you to prove that the admins of the box follow all proper accepted security practices, and that you will not be able to obtain access to the box.
Prove to him that a full penetration test of their entire corporation would be the best way to ensure his company is actually following best security practices.
Tools and methods used:
Step 1: Regular nmap and basic reconnaissance
Before we can play, we need to know what toys we have. So for this I started off with the most basic nmap scan, just to see what services that was running.
Since http is available I went to look at their website. I didn't expect much information since it sais in the scenario that it only served a single static page.
But any info is better than no info. So I launched my browser and navigated over there.
![[Image: main_index.png]](http://s12.postimg.org/ctqr79d8t/main_index.png)
The first thing that I saw was just some general info about the De-ICE. At the bottom there was a large CLICK HERE link that lead me to the challenge website.
![[Image: comapny_index.png]](http://s12.postimg.org/pmev76oul/comapny_index.png)
As expected there wasn't much there. Just a funny story related to the company and some other stuff. But there was some employee names and their email
addresses. What could I possibly do with this info? I wrote a script in Python not long ago actually, which generates possible usernames based on real names.
Well, that's at least what it was intended for
Get the script here: http://www.hackcommunity.com/Thread-Gene...-usernames
It generated a decent sized list of possible usernames, and I made sure Adam Adams, Bob Banter and Chad Coffee was the first usernames to try since these
were listed as administrators.
With this I moved on to the next step.
Step 2: Brute force ssh with hydra
In the nmap output I also saw that ssh was open and decided to use hydra and try to brute force my way in.
I have a decent amount of word lists and rockyou is one of my favorites. First off, it's not sorted alphabetically and second it's enormous. About 14.5 million words if I recall correctly.
Since bruteforcing through that many words for a single account is not very efficient I have used a script I've made for splitting large files into smaller pieces.
Get the scrpit here: http://www.hackcommunity.com/Thread-Spli...ller-files
I've created a rockyou collection that holds 50k lines per file. So I started at 001.
I use terminator as my terminal because of its native split functionality, so I split the screen and started hydra in one ...
... and then I was tailing the hydra-result.txt in the other ...
At this point, I launched my PS3 and played some rounds of Black Ops 2, and since it was kind of late already and the kids were gonna wake up early anyway I went to bed
When I woke up I got my son ready for kindergarden, and when I got home I checked my computer it had successfully brute forced Adam Adams' credentials
[spoiler='Credentials. Do you really want to cheat?
']Username: aadams
Password: nostradamus[/spoiler]
At this point I stopped hydra, removed everything related to Adam Adams from the list, moved the username combinations that were equal to Adam's to the top,
and started hydra again with the same wordlist and rearranged username list.
Why? Because if Adam changes his password I might still be able to use another account as the entry point.
That being said, it's time to log in
Step 3: Log in and privilege escalation
After logging in through ssh it was time for some reconnaissance work again. There was a couple of things I wanted to know before I continued.
1. What kernel version is this?
2. What permissions does this Adam guy actually have?
After having the kernel version I went to Google and I did find an exploit. I was a happy camper until I tried wget (failed), vi/nano/pico (failed).
Then for some reason I decided to check it gcc would work at all... Which it of course didn't.
Time to think.. What can I use that will help me getting root access?
I decided to give unshadow+john a go. To get this to work I needed the content of both /etc/passwd and /etc/shadow.
So I changed directory to /etc and then cat to get the content.
I saved the the content in files with the same names, and .txt extension. Next I runned unshadow on them
And then I used unshadow.txt with john
It didn't take long to get credentials for Bob Banter, and after a little bit of waiting it also got the credentials for root
I could now easily log in as root through Adam's account using the su command and enter the password.
Step 4: More reconnaissance
After gaining root access I decided to check the /home directory. I started on top and worked my way down looking for anything of interest.
There was nothing until I came to the ftp account.
It contained a sub folder /incoming, which had a file named salary_dec2003.csv.enc. This I had to investigate further. So I outputted its content
It turned out to be encrypted. So it was time to pay google another visit
Step 5: Decrypting the file
First I decided that I wanted to get the file over to my own computer and did this by moving the file to the web root ...
... then downloaded the file to my computer
I could now analyze the file. I started by opening the file in my text editor and noticed that it said Salted__ at the top of the file. So I searched for
"salted__ header" in Google and found that this header is created by openssl. So, now it was time to try and decrypt it, but the only thing I knew
about the encryption was that is was created using openssl.
Time to pay Google another visit. I found some documentation and figured that the first thing I had to know was what type of cipher algorithms does
it have to offer.. So I made openssl print out the list for me using the following command
And wow, this is going to take some time. Another thing was the key... I could of course try to brute force it, which meant I would learn how to write
a script for that as well.. While searching Google for how to execute shell commands in Python I recalled something I had seen early in the process.The passwd
file had a weird message in it..
Could it be this easy? Could it be that the root password was the encryption key? I decided to give it a shot, and manually work my way down the list
of cipher algorithms.
So I started with the first one which was AES-128-CBC
No error or confirming messages... I looked at the files in my folder and I saw salary.txt and decided to check it out
Success. The content had been decrypted and written to salary.txt.
I opened my browser and opened the level.php file which gives you hints and other info about the tasks.. The disclosed info is white text on white background,
so I highlighted the OTHER HINTS and it verified that all tasks had been solved.
Game Over
I hope you enjoyed this walk through. This was a really fun challenge since I had no clue about the tasks beforehand
Objective:
Perform penetration test on company server
Scenario:
The scenario for this LiveCD is that a CEO of a small company has been pressured by the Board of Directors to have a penetration test done within the company.
The CEO, believing his company is secure, feels this is a huge waste of money, especially since he already has a company scan their network for vulnerabilities
(using nessus). To make the BoD happy, he decides to hire you for a 5-day job; and because he really doesn't believe the company is insecure, he has contracted
you to look at only one server - a old system that only has a web-based list of the company's contact information.
The CEO expects you to prove that the admins of the box follow all proper accepted security practices, and that you will not be able to obtain access to the box.
Prove to him that a full penetration test of their entire corporation would be the best way to ensure his company is actually following best security practices.
Tools and methods used:
- nmap
- browser
- custom script (generate usernames)
- hydra
- openssl
- manual brute force
Step 1: Regular nmap and basic reconnaissance
Before we can play, we need to know what toys we have. So for this I started off with the most basic nmap scan, just to see what services that was running.
Code:
# nmap 192.168.56.103
Starting Nmap 6.25 ( http://nmap.org ) at 2013-05-23 21:05 CEST
Nmap scan report for 192.168.56.103
Host is up (0.00044s latency).
Not shown: 992 filtered ports
PORT STATE SERVICE
20/tcp closed ftp-data
21/tcp open ftp
22/tcp open ssh
25/tcp open smtp
80/tcp open http
110/tcp open pop3
143/tcp open imap
443/tcp closed httpsSince http is available I went to look at their website. I didn't expect much information since it sais in the scenario that it only served a single static page.
But any info is better than no info. So I launched my browser and navigated over there.
Spoiler:
![[Image: main_index.png]](http://s12.postimg.org/ctqr79d8t/main_index.png)
The first thing that I saw was just some general info about the De-ICE. At the bottom there was a large CLICK HERE link that lead me to the challenge website.
Spoiler:
![[Image: comapny_index.png]](http://s12.postimg.org/pmev76oul/comapny_index.png)
As expected there wasn't much there. Just a funny story related to the company and some other stuff. But there was some employee names and their email
addresses. What could I possibly do with this info? I wrote a script in Python not long ago actually, which generates possible usernames based on real names.
Well, that's at least what it was intended for

Get the script here: http://www.hackcommunity.com/Thread-Gene...-usernames
It generated a decent sized list of possible usernames, and I made sure Adam Adams, Bob Banter and Chad Coffee was the first usernames to try since these
were listed as administrators.
With this I moved on to the next step.
Step 2: Brute force ssh with hydra
In the nmap output I also saw that ssh was open and decided to use hydra and try to brute force my way in.
I have a decent amount of word lists and rockyou is one of my favorites. First off, it's not sorted alphabetically and second it's enormous. About 14.5 million words if I recall correctly.
Since bruteforcing through that many words for a single account is not very efficient I have used a script I've made for splitting large files into smaller pieces.
Get the scrpit here: http://www.hackcommunity.com/Thread-Spli...ller-files
I've created a rockyou collection that holds 50k lines per file. So I started at 001.
I use terminator as my terminal because of its native split functionality, so I split the screen and started hydra in one ...
Code:
hydra -s 22 -V -t 70 -e nsr -o hydra-result.txt -L usernames.txt -P /root/pentest/tools/wordlists/misc/rockyou/50k/rockyou-001 192.168.56.103 ssh... and then I was tailing the hydra-result.txt in the other ...
Code:
tail -f hydra-result.txtAt this point, I launched my PS3 and played some rounds of Black Ops 2, and since it was kind of late already and the kids were gonna wake up early anyway I went to bed

When I woke up I got my son ready for kindergarden, and when I got home I checked my computer it had successfully brute forced Adam Adams' credentials

[spoiler='Credentials. Do you really want to cheat?
']Username: aadamsPassword: nostradamus[/spoiler]
At this point I stopped hydra, removed everything related to Adam Adams from the list, moved the username combinations that were equal to Adam's to the top,
and started hydra again with the same wordlist and rearranged username list.
Why? Because if Adam changes his password I might still be able to use another account as the entry point.
That being said, it's time to log in

Step 3: Log in and privilege escalation
After logging in through ssh it was time for some reconnaissance work again. There was a couple of things I wanted to know before I continued.
1. What kernel version is this?
Code:
uname -a2. What permissions does this Adam guy actually have?
Code:
sudo -lAfter having the kernel version I went to Google and I did find an exploit. I was a happy camper until I tried wget (failed), vi/nano/pico (failed).
Then for some reason I decided to check it gcc would work at all... Which it of course didn't.
Time to think.. What can I use that will help me getting root access?
I decided to give unshadow+john a go. To get this to work I needed the content of both /etc/passwd and /etc/shadow.
So I changed directory to /etc and then cat to get the content.
Code:
# cd /etc/
# sudo cat passwd
# sudo cat shadowI saved the the content in files with the same names, and .txt extension. Next I runned unshadow on them
Code:
# unshadow passwd.txt shadow.txt > unshadow.txtAnd then I used unshadow.txt with john
Code:
# john unshadow.txtIt didn't take long to get credentials for Bob Banter, and after a little bit of waiting it also got the credentials for root
Spoiler: Credentials
Bob Banter: bbanter / bbanter
Root: root / tarot
Root: root / tarot
I could now easily log in as root through Adam's account using the su command and enter the password.
Step 4: More reconnaissance
After gaining root access I decided to check the /home directory. I started on top and worked my way down looking for anything of interest.
There was nothing until I came to the ftp account.
It contained a sub folder /incoming, which had a file named salary_dec2003.csv.enc. This I had to investigate further. So I outputted its content
Code:
# cat salary_dec2003.csv.encIt turned out to be encrypted. So it was time to pay google another visit
Step 5: Decrypting the file
First I decided that I wanted to get the file over to my own computer and did this by moving the file to the web root ...
Code:
# mv salary_dec2003.csv.enc /var/www/htdocs... then downloaded the file to my computer
Code:
# wget http://192.168.56.103/salary_dec2003.csv.encI could now analyze the file. I started by opening the file in my text editor and noticed that it said Salted__ at the top of the file. So I searched for
"salted__ header" in Google and found that this header is created by openssl. So, now it was time to try and decrypt it, but the only thing I knew
about the encryption was that is was created using openssl.
Time to pay Google another visit. I found some documentation and figured that the first thing I had to know was what type of cipher algorithms does
it have to offer.. So I made openssl print out the list for me using the following command
Code:
# openssl list-cipher-algorithmsAnd wow, this is going to take some time. Another thing was the key... I could of course try to brute force it, which meant I would learn how to write
a script for that as well.. While searching Google for how to execute shell commands in Python I recalled something I had seen early in the process.The passwd
file had a weird message in it..
Code:
root:x:0:0:DO NOT CHANGE PASSWORD - WILL BREAK FTP ENCRYPTION:/root:/Could it be this easy? Could it be that the root password was the encryption key? I decided to give it a shot, and manually work my way down the list
of cipher algorithms.
So I started with the first one which was AES-128-CBC
Code:
# openssl aes-128-cbc -d in salary_dec2003.csv.enc -out salary.txt
enter aes-128-cbc decryption password: [root password]No error or confirming messages... I looked at the files in my folder and I saw salary.txt and decided to check it out
Code:
# head salary.txtSuccess. The content had been decrypted and written to salary.txt.
I opened my browser and opened the level.php file which gives you hints and other info about the tasks.. The disclosed info is white text on white background,
so I highlighted the OTHER HINTS and it verified that all tasks had been solved.
Spoiler: Task list
- Interns tend to know nothing of security
- The ftp server is broken; it's supposed to be
- Even though the ftp server is broken, there may be residual files of interest; read the /etc/passwd file first, though
- If you get the CEO's bank account information, you've defeated this challenge. Congratulations!
- The ftp server is broken; it's supposed to be
- Even though the ftp server is broken, there may be residual files of interest; read the /etc/passwd file first, though
- If you get the CEO's bank account information, you've defeated this challenge. Congratulations!
Game Over
I hope you enjoyed this walk through. This was a really fun challenge since I had no clue about the tasks beforehand
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)
I'm working on the next De-ICE, but I'm stuck :headbash: Never penetrated through an anonymous ftp user before :wacko: 