Mungkin masih ada yang belum tahu bahwa metasploit saat ini mendukung cukup banyak feature, salah satunya adalah wmap. WMAP merupakan web application framework yang digunakan untuk proses scanning suatu website dengan memanfaatkan metasploit framework. WMAP sendiri masih terbilang baru sehingga masih banyak hal-hal yang belum ditambahkan, proses scanning pun masih dilakukan dengan cara sederhana namun konsepnya cukup baik sehingga kita dapat ikut melakukan kustomisasi terhadap modul-moudul yang akan digunakan.
Dokumentasi mengenai WMAP dapat ditemukan pada paket Metasploit, atau bisa dilihat langsung secara online disini. Dan seperti biasa, kita akan mulai pembahasan dari konsep hingga implementasi.
Bagi kalian yang terbiasa melakukan audit ataupun scanning terhadap suatu aplikasi web pasti sudah terbiasa dengan istilah spider. Web scanner umumnya memiliki kemampuan untuk mengumpulkan informasi sebanyak-banyaknya dari target melalui seluruh link yang ditemukan mulai dari halaman index hingga halaman-halaman terdalam lainnya. Web scanner tersebut akan melakukan audit terhadap link-link yang ditemukan dan dicocokan hasilnya dengan informasi vulnerability dalam database tools tersebut. WMAP pada metasploit bekerja dengan metode yang mirip namun memanfaatkan aplikasi-aplikasi opensource.
WMAP merupakan salah satu plugin (yup, salah satu, masih ada beberapa plugin lainnya) metasploit yang dapat di load pada msfconsole dimana melalui msfconsole tersebut user dapat berinteraksi dengan metasploit framework. Berikut ini konsep WMAP pada metasploit:
1. RatProxy
Metasploit memanfaatkan RatProxy sebagai proxy yang akan menangkap seluruh data request-response antara web client dengan web server. Informasi tersebut akan dimasukan ke suatu database (sqlite3) untuk kemudian digunakan oleh modul-modul WMAP. RatProxy sendiri merupakan hasil karya hacker Michal Zalewski yang merupakan opensource tools untuk audit web application. RatProxy tidak memiliki dukungan terhadap penyimpanan data kedalam bentuk database, oleh karena itu sebelum dapat digunakan oleh WMAP maka RatProxy harus di-patch terlebih dahulu. Patch bisa didapatkan dari bundle metasploit: external/ratproxy/ratproxy_wmap.diff
2. SQLite3
SQLite merupakan produk database yang diklaim small, fast, reliable. SQLite umumnya digunakan oleh aplikasi-aplikasi yang membutuhkan database sebagai tempat penyimpanan dan pemrosesan data yang sederhana. Contoh penggunaannya adalah pada iPhone dimana sqlite digunakan untuk menyimpan data SMS. Metasploit sendiri memiliki driver yang dapat berkomunikasi dengan 3 produk database, MySQL, PostgreSQL, dan SQlite3. Implementasi WMAP memanfaatkan SQLite3.
3. WMAP
WMAP merupakan plugin metasploit untuk web application framework audit. Saat tulisan ini dibuat versi stable metasploit adalah 3.2, dan modul-modul yang dapat digunakan oleh WMAP antara lain: WMAPScanServer, WMAPScanDir, WMAPScanUniqueQuery, dll.
Jika kalian menggunakan Backtrack 3 final, maka support terhadap metasploit sudah sangat baik. Requirement yang dibutuhkan oleh metasploit telah terpenuhi dan plugin-pluginnya dapat di-load dengan mudah. Namun beberapa sistem operasi lain umumnya membutuhkan beragam metode sebelum dapat memanfaatkan feature-feature pada metasploit framework. Untuk plugin WMAP ini, seperti yang telah disebutkan diatas, dibutuhkan RatProxy dan SQlite3 berjalan dengan baik sebelum me-load WMAP. Pada contoh dibawah ini saya menggunakan sistem operasi OS X yang membutuhkan beberapa data tambahan untuk memuaskan persayaratan yang dibutuhkan oleh WMAP, diantaranya yang terpenting dibutuhkan flare khusus (bukan bawaan dari RatProxy) yang kompatibel dengan MacOSX. Flare merupakan tools yang digunakan untuk proses decompiler action script flash.
(1). Buat database wmap_test.db melalui plugin database metasploit
msf > db_create /Users/staff/wmap_test.db
[*] Creating a new database instance...
[*] Successfully connected to the database
[*] File: /Users/staff/wmap_test.db
(2). Bagi kalian yang memiliki rasa penasaran tinggi tentu ingin melihat seperti apa bentuk database yang dibuat oleh plugin database metasploit tersebut. Database yang telah dibuat dapat kita lihat schema-nya secara langsung menggunakan SQLite.
k-elektronik:~ staff$ sqlite3 wmap_test.db
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .tables
hosts refs requests targets vulns_refs
notes reports services vulns
sqlite> .schema requests
CREATE TABLE requests (
'host' VARCHAR(20),
'port' INTEGER,
'ssl' INTEGER,
'meth' VARCHAR(20),
'path' BLOB,
'headers' BLOB,
'query' BLOB,
'body' BLOB,
'respcode' VARCHAR(5),
'resphead' BLOB,
'response' BLOB,
'created' TIMESTAMP
);
(3). Setelah urusan database selesai, maka selanjutnya menjalankan aplikasi RatProxy yang sebelumnya telah di-patch agar dapat menyimpan seluruh data request-response ke database wmap_test.db
k-elektronik:ratproxy staff$ ./ratproxy -v /Users/staff/ -b wmap_test.db -d detik.com -xtifkgmjscael2XCr
ratproxy version 1.51-beta by
[*] Proxy configured successfully. Have fun, and please do not be evil.
WARNING: Disruptive tests enabled. use with care.
[+] Accepting connections on port 8080/tcp (any source)...
(4). RatProxy diatas menggunakan port default, yaitu 8080. Yang berarti pada mesin tersebut dibuka port 8080 dan akan bertindak sebagai proxy server. Sisanya adalah kita melakukan browsing secara manual ataupun menggunakan automatic tools dengan memanfaatkan port 8080 itu sebagai proxy server. Hasil dari browsing seluruhnya akan di log oleh RatProxy kedalam database wmap_test.db
(5). Sekali lagi, bagi yang penasaran apakah RatProxy benar-benar menyimpan hasilnya pada database yang telah kita buat sebelumnya, dapat memanfaatkan sqlite3.
sqlite> select host,meth,headers from requests;
202.158.66.94|GET|User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Cookie: __utma=146380193.1809118446.1213005860.1213005860.1213005860.1
Connection: keep-alive
Proxy-Connection: keep-alive
Host: detik.com
202.158.66.94|GET|User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1
Referer: http://detik.com/
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Cookie: __utma=146380193.1809118446.1213005860.1213005860.1213005860.1
Connection: keep-alive
Proxy-Connection: keep-alive
Host: detik.com
(6). Berikutnya kita akan melihat bagaimana wmap bekerja. Pada langkah pertama tadi kita telah membuat database wmap_test.db melalui msfconsole sekaligus connect ke database tersebut secara otomatis menggunakan plugin db_sqlite3. Maka selanjutnya yang dibutuhkan adalah load plugin wmap untuk kemudian membaca database wmap_test.db tersebut.
msf > load db_wmap
[*] =[ WMAP v0.3 - ET LoWNOISE
[*] Successfully loaded plugin: db_wmap
msf > wmap_targets -p
[*] Id. Host Port SSL
[*] Done.
msf > wmap_targets -r <<< Ini salah satu langkah penting, sebelum print target, harus reload terlebih dahulu.
[*] Added. 202.158.66.94 80 0
[*] Added. 202.158.66.164 80 0
[*] Added. 202.158.66.86 80 0
[*] Added. 202.158.66.20 80 0
[*] Added. 202.158.66.190 80 0
[*] Added. 202.158.66.54 80 0
[*] Added. 202.158.66.24 80 0
[*] Added. 64.233.183.127 80 0
msf > wmap_targets -p << target berikut ini hasil browsing via web browser ke situs detik.com
[*] Id. Host Port SSL
[*] 1. 202.158.66.94 80
[*] 2. 202.158.66.164 80
[*] 3. 202.158.66.86 80
[*] 4. 202.158.66.20 80
[*] 5. 202.158.66.190 80
[*] 6. 202.158.66.54 80
[*] 7. 202.158.66.24 80
[*] 8. 64.233.183.127 80
[*] Done.
msf > wmap_targets -s 1
msf > wmap_targets -p
[*] Id. Host Port SSL
[*] => 1. 202.158.66.94 80
[*] 2. 202.158.66.164 80
[*] 3. 202.158.66.86 80
[*] 4. 202.158.66.20 80
[*] 5. 202.158.66.190 80
[*] 6. 202.158.66.54 80
[*] 7. 202.158.66.24 80
[*] 8. 64.233.183.127 80
[*] Done.
msf > wmap_website
[*] Website structure
[*] 202.158.66.94:80 SSL:0
ROOT_TREE
+------favicon.ico
| js
| +------swfobject.js
| +------openwin11.js
| +------etc.js
| +------expandbannerall.js.html
| +------contentslider.js
| +------tabcontent.js
| +------jquery-1.2.6.min.js
[*] Done.
msf > wmap_targets -s 2
msf > wmap_website
[*] Website structure
[*] 202.158.66.164:80 SSL:0
ROOT_TREE
| images
| +------telkomsel-280x175.gif
| +------banner-detik-rev-final.gif
| +------1x1.gif
| +------promocontinue_4.swf
| delivery
| +------spcjs.php
| +------lg.php
| +------spc.php
| +------fl.js
[*] Done.
msf > wmap_targets -s 3
msf > wmap_website
[*] Website structure
[*] 202.158.66.86:80 SSL:0
ROOT_TREE
| css
| +------allslider.css
| +------detikcom.css
| +------pollingsmsorange02.css
| +------alltabs.css
| images
| | content
| | | blog
| | | | -
| | | | +------20081219172849_blog.jpg
| | | | +------20081219115448_blog.jpg
| | | | +------20081219134455_blog.jpg
| | | 2008
| | | | 12
| | | | | 22
| | | | | | 71
| | | | | | +------SpallettiAFP-cov.jpg
| | | | | | +------ranieri-cov.jpg
| | | | | | 72
| | | | | | +------ArsenalPool-EddieKeogh200.jpg
| | | | | | 73
| | | | | | +------vandersar-cover.jpg
| | | | | | 75
| | | | | | +------Sevilla-Reuters200.jpg
| | | | | | +------BarcaDiegoTusonAFP-cov.jpg
| | | | | | 10
| | | | | | +------wir-cover.jpg
| | | | | 21
| | | | | | 648
| | | | | | +------toyota-depan.JPG
| | | | | | 288
| | | | | | +------RumahDurian.jpg
| | | | | | 157
| | | | | | +------coverpknu.jpg
| | | | | | +------coverateror.jpg
| | | | | | +------coverpolis.jpg
| | video
| | | 2008
| | | | 12
| | | | +------081221483.png
| image
| +------iring808.gif
| +------icn_jwb.gif
| +------arrow_up.gif
| +------ticketboxlogo.gif
| +------logodetikcomfooter.gif
| +------pollwpdetik.gif
| +------spacer.gif
| +------iconvideo.gif
| +------logodetikcom.gif
| +------Logo_25wht.gif
| +------song_icon.gif
| +------arrow_down.gif
| +------tvwp.swf
| +------iconphoto.gif
| +------rssfeed_s.gif
| +------panahforumwp.gif
| +------bgregional6a.gif
| +------bgticketbox.gif
| +------bgdetikmap.gif
| +------bgtapoff6a.gif
| +------radioplayer.gif
| +------bgpollsmsorange.gif
| +------bgtapon6a.gif
| +------pollingsmscenter.jpg
| +------rss.gif
| +------tanyasajalogo.gif
| +------bgmenuatas.gif
| +------tanya.gif
| +------detikpublishinglogo.gif
| +------bgmaplokasi.gif
| +------bgcontent.gif
[*] Done.
msf > wmap_targets -s 4
msf > wmap_website
[*] Website structure
[*] 202.158.66.20:80 SSL:0
ROOT_TREE
| content_image
| | 2008
| | | 12
| | | | 20
| | | | | 283
| | | | | +------20081220-andini-k.jpg
| | | | | 471
| | | | | +------wanita-k.jpg
[*] Done.
msf > wmap_targets -s 5
msf > wmap_website
[*] Website structure
[*] 202.158.66.190:80 SSL:0
ROOT_TREE
| images
| | content
| | | 2008
| | | | 12
| | | | | 18
| | | | | | 238
| | | | | | +------bantuan-luar.jpg
[*] Done.
msf > wmap_targets -s 6
msf > wmap_website
[*] Website structure
[*] 202.158.66.54:80 SSL:0
ROOT_TREE
| images
| | wp
| | +------Telkomsel-200x300.swf
| | +------alexa_200x300b.gif
| | +------BannerFLEXISPEEDY_300x250-01.swf
| | +------wp-detik-magicaccess2.swf
| | +------wp1-XLSolution-338x200.swf
| | +------StarTV-19-338x133.swf
| | +------StarTV-19-338x30.swf
| | +------BannerBudpar875x100-01.swf
| | +------Banner_Detik_Agustus_08.jpg
[*] Done.
msf > wmap_targets -s 7
msf > wmap_website
[*] Website structure
[*] 202.158.66.24:80 SSL:0
ROOT_TREE
| static
| | detikcom1
| | +------toppariwaradetikcom.php
[*] Done.
msf > wmap_run -t
[*] Loaded auxiliary/scanner/http/version ...
[*] Loaded auxiliary/scanner/http/wmap_ssl_vhost ...
[*] Loaded auxiliary/scanner/http/wmap_vhost_scanner ...
[*] Loaded auxiliary/scanner/http/frontpage_login ...
[*] Loaded auxiliary/scanner/http/frontpage ...
[*] Loaded auxiliary/scanner/http/wmap_file_same_name_dir ...
[*] Loaded auxiliary/scanner/http/wmap_dir_scanner ...
[*] Loaded auxiliary/scanner/http/wmap_prev_dir_same_name_file ...
[*] Loaded auxiliary/scanner/http/wmap_backup_file ...
[*] Loaded auxiliary/scanner/http/wmap_dir_listing ...
[*] Loaded auxiliary/scanner/http/wmap_replace_ext ...
[*] Loaded auxiliary/scanner/http/writable ...
[*] Loaded auxiliary/scanner/http/wmap_files_dir ...
[*] Loaded auxiliary/scanner/http/wmap_brute_dirs ...
[*] Loaded auxiliary/scanner/http/wmap_blind_sql_query ...
[*] Analysis completed in 1.00374484062195 seconds.
[*] Done.
msf > wmap_targets -s 3
msf > wmap_targets -p
[*] Id. Host Port SSL
[*] 1. 202.158.66.94 80
[*] 2. 202.158.66.164 80
[*] => 3. 202.158.66.86 80
[*] 4. 202.158.66.20 80
[*] 5. 202.158.66.190 80
[*] 6. 202.158.66.54 80
[*] 7. 202.158.66.24 80
[*] 8. 64.233.183.127 80
[*] Done.
msf > setg VHOST www.detik.com
VHOST => www.detik.com
msf > setg DOMAIN detik.com
DOMAIN => detik.com
msf > setg EXT .php
EXT => .php
msf > wmap_run -e
[*] Launching auxiliary/scanner/http/wmap_vhost_scanner WMAP_SERVER against 202.158.66.86:80
[*] Sending request with random domain LtELt.detik.com
[*] Vhost found admin.detik.com
[*] Vhost found services.detik.com
[*] Vhost found webmail.detik.com
[*] Vhost found console.detik.com
[*] Vhost found apps.detik.com
[*] Vhost found mail.detik.com
[*] Vhost found intranet.detik.com
[*] Vhost found intra.detik.com
[*] Vhost found corporate.detik.com
[*] Vhost found www.detik.com
[*] Vhost found web.detik.com
[*] Launching auxiliary/scanner/http/frontpage_login WMAP_SERVER against 202.158.66.86:80
[*] http://202.158.66.86:80/ may not support FrontPage Server Extensions
[*] Launching auxiliary/scanner/http/version WMAP_SERVER against 202.158.66.86:80
[*] 202.158.66.86 is running Apache/2.2.9 (Unix) DAV/2 PHP/5.1.6 ( Powered by PHP/5.1.6 )
[*] Launching auxiliary/scanner/http/frontpage WMAP_SERVER against 202.158.66.86:80
[*] http://202.158.66.86:80 is running Apache/2.2.4 (Unix) DAV/2 PHP/5.1.6
[*] FrontPage not found on http://202.158.66.86:80 [404 Not Found]
[*] Launching auxiliary/scanner/http/wmap_ssl_vhost WMAP_SERVER against 202.158.66.86:80
[*] Error: 202.158.66.86 unknown protocol
[*] Launching auxiliary/scanner/http/wmap_brute_dirs WMAP_DIR / against 202.158.66.86:80...
[*] Running..
[*] NOT Found http://202.158.66.86:/Aaa/ 404
[*] NOT Found http://202.158.66.86:/Aab/ 404
[*] NOT Found http://202.158.66.86:/Aac/ 404
...
...
...
msf > wmap_reports -p
[*] Id. Created Target (host,port,ssl)
19. Mon Dec 22 00:29:25 +0300 2008 202.158.66.86,,0
18. Mon Dec 22 00:29:19 +0300 2008 202.158.66.86,80,0
4. Mon Dec 22 00:22:31 +0300 2008 202.158.66.86,80,0
1. Mon Dec 22 00:00:21 +0300 2008 64.233.183.127,80,0
[*] Done.
msf > wmap_reports -s 19
WMAP REPORT: 202.158.66.86,,0 Metasploit WMAP Report [Mon Dec 22 00:29:25 +0300 2008]
VHOST NAME: admin.detik.com Vhost admin.detik.com found. [Mon Dec 22 00:29:25 +0300 2008]
VHOST NAME: services.detik.com Vhost services.detik.com found. [Mon Dec 22 00:29:27 +0300 2008]
VHOST NAME: webmail.detik.com Vhost webmail.detik.com found. [Mon Dec 22 00:29:31 +0300 2008]
VHOST NAME: console.detik.com Vhost console.detik.com found. [Mon Dec 22 00:29:32 +0300 2008]
VHOST NAME: apps.detik.com Vhost apps.detik.com found. [Mon Dec 22 00:29:34 +0300 2008]
VHOST NAME: mail.detik.com Vhost mail.detik.com found. [Mon Dec 22 00:29:38 +0300 2008]
VHOST NAME: intranet.detik.com Vhost intranet.detik.com found. [Mon Dec 22 00:29:39 +0300 2008]
VHOST NAME: intra.detik.com Vhost intra.detik.com found. [Mon Dec 22 00:29:41 +0300 2008]
VHOST NAME: corporate.detik.com Vhost corporate.detik.com found. [Mon Dec 22 00:29:42 +0300 2008]
VHOST NAME: www.detik.com Vhost www.detik.com found. [Mon Dec 22 00:29:45 +0300 2008]
VHOST NAME: web.detik.com Vhost web.detik.com found. [Mon Dec 22 00:29:46 +0300 2008]
[*] Done.
msf > wmap_reports -s 18
WMAP REPORT: 202.158.66.86,80,0 Metasploit WMAP Report [Mon Dec 22 00:29:19 +0300 2008]
WEB_SERVER TYPE: Apache/2.2.9 (Unix) DAV/2 PHP/5.1.6 ( Powered by PHP/5.1.6 ) [Mon Dec 22 00:29:57 +0300 2008]
[*] Done.
Itulah beberapa contoh penggunaan WMAP metasploit. Dan seperti biasa, metasploit bukanlah tools ajaib yang dengan konfigurasi standard (baca: donlot langsung pakai) dapat memuaskan para kiddies. Metasploit Framework adalah suatu framework yang memberikan lingkungan luar biasa bagi mereka-mereka yang dapat memanfaatkannya dengan sangat baik. Jangan heran jika banyak yang memiliki plugin-plugin ataupun exploit-exploit pribadi dengan metasploit framework mereka sendiri tanpa mem-publishnya kepada umum. WMAP saat ini merupakan project awal metasploit untuk penetrasi aplikasi web, dengan sifatnya yang opensource maka dalam beberapa waktu dapat kita ramalkan banyak modul-modul yang akan ditambahkan.
Untuk kalian yang hobi bermain-main dengan aplikasi web dan mencari tools yang dapat membantu proses tersebut secara otomatis serta dapat dikustomisasi maka WMAP metasploit adalah salah satu pilihan yang baik.
PS: ada yang memperhatikan bahwa detik.com memiliki struktur yang cukup unik dan menarik?
detik.com? hmmm…..sound good.
i do some research that’s interesting
mind to share here?
Now i still learn about metasploit plugin “byakugan”, still didn’t understand…
After i clear and finish to learn this plugin… I’ll share it. This thing are also interesting too, in their website they said it can use to cheating game and cracking… “For Now” i just can said “impossible” metasploit can do that but what can i say, just try and do some research. Maybe it’s true.
About detik.com i’ll share it later..Ok?