FederationHax

How to Crack Passwords | by federation

Jun 9th, 2016
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.22 KB | None | 0 0
  1. How to crack passwords !
  2.  
  3. Cracking Passwords Version 1.1
  4.  
  5. This document is for people who want to learn to the how and why of password cracking. There is
  6. a lot of information being presented and you should READ IT ALL BEFORE you attempted
  7. doing anything documented here. I do my best to provide step by step instructions along with the
  8. reasons for doing it this way. Other times I will point to a particular website where you find the
  9. information. In those cases someone else has done what I attempting and did a good or great job
  10. and I did not want to steal their hard work. These instructions have several excerpts from a
  11. combination of posts from pureh@te, granger53, irongeek, PrairieFire, RaginRob, stasik, and
  12. Solar Designer. I would also like to thank each of them and others for the help they have provided
  13. me on the BackTrack forum.
  14. I will cover both getting the SAM from inside windows and from the BackTrack CD, DVD, or
  15. USB flash drive. The SAM is the Security Accounts Manager database where local usernames and
  16. passwords are stored. For legal purposes I am using my own system for this article. The first step
  17. is to get a copy of pwdump. You can choose one from http://en.wikipedia.org/wiki/Pwdump.
  18. Update: I used to use pwdump7 to dump my passwords, however I have come across a new utility
  19. called fgdump from http://www.foofus.net/fizzgig/fgdump/ This new utility will dump passwords
  20. from clients and Active Directory (Windows 2000 and 2003 for sure, not sure about Windows
  21. 2008) where pwdump7 only dumps client passwords. I have included a sample hash.txt that has
  22. simple passwords and should be cracked very easily. NOTE: Some anti-virus software packages
  23. flag pwdump* and fgdump as trojan horse programs or some other unwanted program. If
  24. necessary, you can add an exclusion for fgdump and/or pwdump to your anti-virus package so it
  25. won't flag them. However it is better for the community if you contact your anti-virus vendor and
  26. ask them to not flag the tool as a virus/malware/trojan horse.
  27. You can find the latest version of this document at http://www.backtrack-linux.org/
  28. Contents
  29. 1 LM vs. NTLM
  30. 2 Syskey
  31. 3 Cracking Windows Passwords
  32. 3.1 Extracting the hashes from the Windows SAM
  33. 3.1.1 Using BackTrack Tools
  34. 3.1.1.1 Using bkhive and samdump v1.1.1 (BT2 and BT3)
  35. 3.1.1.2 Using samdump2 v2.0.1 (BT4)
  36. 3.1.1.3 Cached Credentials
  37. 3.1.2 Using Windows Tools
  38. 3.1.2.1 Using fgdump
  39. 3.1.2.2 Using gsecdump
  40. Cracking Passwords Version 1.1 file:///D:/password10.html
  41. 1 of 45 2/15/2010 3:48 PM
  42. 3.1.2.3 Using pwdump7
  43. 3.1.2.4 Cached Credentials
  44. 3.2 Extracting the hashes from the Windows SAM remotely
  45. 3.2.1 Using BackTrack Tools
  46. 3.2.1.1 ettercap
  47. 3.2.2 Using Windows Tools
  48. 3.2.2.1 Using fgdump
  49. 3.3 Cracking Windows Passwords
  50. 3.3.1 Using BackTrack Tools
  51. 3.3.1.1 John the Ripper BT3 and BT4
  52. 3.3.1.1.1 Cracking the LM hash
  53. 3.3.1.1.2 Cracking the NTLM hash
  54. 3.3.1.1.3 Cracking the NTLM using the cracked LM hash
  55. 3.3.1.1.4 Cracking cached credentials
  56. 3.3.1.2 John the Ripper - current
  57. 3.3.1.2.1 Get and Compile
  58. 3.3.1.2.2 Cracking the LM hash
  59. 3.3.1.2.3 Cracking the LM hash using known letter(s) in known location(s) (knownforce)
  60. 3.3.1.2.4 Cracking the NTLM hash
  61. 3.3.1.2.5 Cracking the NTLM hash using the cracked LM hash (dumbforce)
  62. 3.3.1.2.6 Cracking cached credentials
  63. 3.3.1.3 Using MDCrack
  64. 3.3.1.3.1 Cracking the LM hash
  65. 3.3.1.3.2 Cracking the NTLM hash
  66. 3.3.1.3.3 Cracking the NTLM hash using the cracked LM hash
  67. 3.3.1.4 Using Ophcrack
  68. 3.3.1.4.1 Cracking the LM hash
  69. 3.3.1.4.2 Cracking the NTLM hash
  70. 3.3.1.4.3 Cracking the NTLM hash using the cracked LM hash
  71. 3.3.2 Using Windows Tools
  72. 3.3.2.1 John the Ripper
  73. 3.3.2.1.1 Cracking the LM hash
  74. 3.3.2.1.2 Cracking the NTLM hash
  75. 3.3.2.1.3 Cracking the NTLM hash using the cracked LM hash
  76. 3.3.2.1.4 Cracking cached credentials
  77. 3.3.2.2 Using MDCrack
  78. 3.3.2.2.1 Cracking the LM hash
  79. 3.3.2.2.2 Cracking the NTLM hash
  80. 3.3.2.2.3 Cracking the NTLM hash using the cracked LM hash
  81. 3.3.2.3 Using Ophcrack
  82. 3.3.2.3.1 Cracking the LM hash
  83. 3.3.2.3.2 Cracking the NTLM hash
  84. 3.3.2.3.3 Cracking the NTLM hash using the cracked LM hash
  85. 3.3.2.4 Using Cain and Abel
  86. 3.3.3 Using a Live CD
  87. 3.3.3.1 Ophcrack
  88. 4. Changing Windows Passwords
  89. 4.1 Changing Local User Passwords
  90. 4.1.1 Using BackTrack Tools
  91. 4.1.1.1 chntpw
  92. 4.1.2 Using a Live CD
  93. Cracking Passwords Version 1.1 file:///D:/password10.html
  94. 2 of 45 2/15/2010 3:48 PM
  95. 4.1.2.1 chntpw
  96. 4.1.2.2 System Rescue CD
  97. 4.2 Changing Active Directory Passwords
  98. 5 plain-text.info
  99. 6 Cracking Novell NetWare Passwords
  100. 7 Cracking Linux/Unix Passwords
  101. 8 Cracking networking equipment passwords
  102. 8.1 Using BackTrack tools
  103. 8.1.1 Using Hydra
  104. 8.1.2 Using Xhydra
  105. 8.1.3 Using Medusa
  106. 8.1.4 Using John the Ripper to crack a Cisco hash
  107. 8.2 Using Windows tools
  108. 8.2.1 Using Brutus
  109. 9 Cracking Applications
  110. 9.1 Cracking Oracle 11g (sha1)
  111. 9.2 Cracking Oracle passwords over the wire
  112. 9.3 Cracking Office passwords
  113. 9.4 Cracking tar passwords
  114. 9.5 Cracking zip passwords
  115. 9.6 Cracking pdf passwords
  116. 10 Wordlists aka Dictionary attack
  117. 10.1 Using John the Ripper to generate a wordlist
  118. 10.2 Configuring John the Ripper to use a wordlist
  119. 10.3 Using crunch to generate a wordlist
  120. 10.4 Generate a wordlist from a textfile or website
  121. 10.5 Using premade wordlists
  122. 10.6 Other wordlist generators
  123. 10.7 Manipulating your wordlist
  124. 11 Rainbow Tables
  125. 11.1 What are they?
  126. 11.2 Generating your own
  127. 11.2.1 rcrack - obsolete but works
  128. 11.2.2 rcracki
  129. 11.2.3 rcracki - boinc client
  130. 11.2.4 Generating a rainbow table
  131. 11.3 WEP cracking
  132. 11.4 WPA-PSK
  133. 11.4.1 airolib
  134. 11.4.2 pyrit
  135. 12 Distributed Password cracking
  136. 12.1 john
  137. 12.2 medussa (not a typo this is not medusa)
  138. 13 using a GPU
  139. 13.1 cuda - nvidia
  140. 13.2 stream - ati
  141. 14 example hash.txt
  142. 1 LM vs. NTLM
  143. The LM hash is the old style hash used in MS operating systems before NT 3.1. It converts the password to
  144. Cracking Passwords Version 1.1 file:///D:/password10.html
  145. 3 of 45 2/15/2010 3:48 PM
  146. uppercase, null-pads or truncates the password to 14 characters. The password is split into two 7 character
  147. halves and uses the DES algorithm. NT 3.1 to XP SP2 supports LM hashes for backward compatibility and is
  148. enabled by default. Vista supports LM hashes but is disabled by default. Given the weaknesses in the LM
  149. hash it is recommended to disable using LM hashes for all MS operating systems using the steps in
  150. http://support.microsoft.com/kb/299656
  151. NTLM was introduced in NT 3.1 and does not covert the password to uppercase, does not break the password
  152. apart, and supports password lengths greater than 14. There are two versions of NTLM v1 and v2. Do to a
  153. weakness in NTLM v1 is should not be used. Microsoft has included support for NTLM v2 for all of its
  154. operating systems either via service pack or the Directory Services client (for windows 9X). You enable
  155. NTLM v2 by following the instructions at http://support.microsoft.com/kb/239869. For maximum security
  156. you should set the LMCompatibility to 3 for Windows 9X and LMCompatibilityLevel to 5 for NT, 2000, XP,
  157. and 2003. Of course you should test these changes BEFORE you put them into a production environment.
  158. If LM hashes are disabled on your system the output of pwdump and/or the 127.0.0.1.pwdump text file will
  159. look like:
  160. Administrator:500:NO PASSWORD*********************:00AB1D1285F410C30A83B435F2CA798D:::
  161. Guest:501:NO PASSWORD*********************:31A6CAE0D36AD931B76C59D7E1C039C0:::
  162. HelpAssistant:1000:NO PASSWORD*********************:BF23C2595478A6279F7CB53EF76E601F:::
  163. SUPPORT_3845a0:1002:NO
  164. PASSWORD*********************:0C8D62E10A6240BACD910C8AB295BB79:::
  165. ASPNET:1005:9F07AE96CA4310752BDC083AAC960496:A99C1C3DB39E3C732EF5C2F63579AF96:::
  166. The first field is the username. The second field is the last four numbers of the SID for that username. The
  167. SID is a security identifier that is unique to each username. The third field is the LM hash. The forth field is
  168. the NTLM hash.
  169. If you do not have a ASPNET user account do not worry about it. If you do have a ASPNET user account do
  170. NOT change the password as I am told that will break something. What I did was delete the account and then
  171. recreate it using: systemroot%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe /i
  172. 2 Syskey
  173. To make it more difficult to crack your passwords, use syskey. For more information on syskey see
  174. http://support.microsoft.com/kb/310105. The short version is syskey encrypts the SAM. The weakest option
  175. but most convenient is to store a system generated password locally; locally means the registry. The up side is
  176. the SAM gets encrypted and you can reboot the server remotely without extra equipment. The next option is
  177. password startup. This is slightly more difficult to get around, but if you remotely reboot the server, it will
  178. stop and wait for someone to enter the password. You will need a KVM over IP or a serial port concentrator
  179. so you can enter the password remotely. The most secure option is the system generated password stored on a
  180. floppy disk. The downside to this option is floppy disks fail, you misplace the floppy disk, newer equipment
  181. does not have a floppy disk drive, no remote reboots, and you will probably leave the floppy in the drive so
  182. you can remote reboot and that defeats security. I use a system generated password stored locally, weak but
  183. better than not doing it. To disable syskey use chntpw and follow its instructions.
  184. 3 Cracking Windows Passwords
  185. 3.1 Extracting the hashes from the Windows SAM
  186. 3.1.1 Using BackTrack Tools
  187. Cracking Passwords Version 1.1 file:///D:/password10.html
  188. 4 of 45 2/15/2010 3:48 PM
  189. 3.1.1.1 Using bkhive and samdump2 v1.1.1 (BT2 and BT3)
  190. # mount /dev/hda1 /mnt/XXX
  191. mount your windows partition substituting hda1 for whatever your windows partition is
  192. 1.
  193. if the syskey password is stored locally you need to extract it from the registry so you can decrypt the
  194. SAM. If syskey is setup to prompt for a password or the password is on a floppy, stop now and read the
  195. syskey documentation in this document for more information about syskey. If you installed windows to
  196. something other C:\WINDOWS please substitute the correct path. WARNING the path is case
  197. sensitive. The filenames of sam, security, and system are case sensitive. On my system these files are
  198. lowercase. I have come across other XP systems where they are uppercase. On the Vista system I have
  199. used the filenames are uppercase.
  200. BackTrack 2 users use the following:
  201. # bkhive-linux /mnt/XXX/WINDOWS/system32/config/system syskey.txt
  202. BackTrack 3 users use the following:
  203. # bkhive /mnt/XXX/WINDOWS/system32/config/system syskey.txt
  204. 2.
  205. # samdump2 /mnt/XXX/WINDOWS/system32/config/sam syskey.txt >hash.txt
  206. samdump2 will dump the SAM to the screen and the > character redirects the output to a file called
  207. hash.txt
  208. you can also run samdump2 with the -o parameter to write the output to a file
  209. # samdump2 -o hash.txt /mnt/XXX/WINDOWS/system32/config/sam syskey.txt
  210. 3.
  211. 3.1.1.2 Using new samdump2 v2.0 (BT4)
  212. The current version is 2.0.1 and has the benefit of being able to extract the syskey on its own. This means
  213. dumping the hashes in now a 1 step process instead of two. To upgrade and run sampdump2 v2.0.1:
  214. 1. download the current sampdump2 from http://sourceforge.net/project/showfiles.php?group_id=133599
  215. 2. # tar -xjvf samdump2-2.0.1.tar.bz2
  216. 3. # cd samdump2-2.0.1
  217. 4. # make
  218. # cp samdump2 /usr/local/bin/samdump20
  219. this will keep the existing version. If you want to overwrite the existing version do:
  220. # cp samdump2 /usr/local/bin/
  221. 5.
  222. mount your windows partition substituting hda1 for whatever your windows partition is
  223. # mount /dev/hda1 /mnt/XXX
  224. 6.
  225. if the syskey password is stored locally samdump2 v2.0 will extract it from the registry so it can decrypt
  226. the SAM. If syskey is setup to prompt for a password or the password is on a floppy, stop now and read
  227. the syskey documentation in this document for more information about syskey. If you installed
  228. windows to something other C:\WINDOWS please substitute the correct path. WARNING the path is
  229. case sensitive. The filenames of sam, security, and system are case sensitive. On my system these files
  230. are lowercase. I have come across other XP systems where they are uppercase. On the Vista system I
  231. have used the filenames are uppercase.
  232. 7.
  233. # samdump2 /mnt/XXX/WINDOWS/system32/config/system /mnt/XXX/WINDOWS/system32
  234. /config/sam >hash.txt
  235. samdump2 will dump the SAM to the screen and the > character redirects the output to a file called
  236. hash.txt
  237. you can also run samdump2 with the -o parameter to write the output to a file
  238. # samdump2 -o hash.txt /mnt/XXX/WINDOWS/system32/config/sam syskey.txt
  239. 8.
  240. Cracking Passwords Version 1.1 file:///D:/password10.html
  241. 5 of 45 2/15/2010 3:48 PM
  242. 3.1.1.3 Cached Credentials
  243. The only Linux based application to dump cached credentials I found is creddump which can be found at
  244. http://code.google.com/p/creddump/. samdump v2.0.1 couldn't do this so I wrote the code to dump cached
  245. credentials. I have submitted it upstream so I hope to see this feature in the next version.
  246. 3.1.2 Using Windows Tools
  247. 3.1.2.1 Using fgdump
  248. To dump local passwords:
  249. Login to the system as an administrator and get to a command prompt (Start, Run, cmd). Since this my
  250. system I know administrator password. You could also try to use metasploit to attack your system to
  251. get to a command prompt.
  252. 1.
  253. Download one of the fgdump files from http://swamp.foofus.net/fizzgig/fgdump/downloads.htm and
  254. unzip it.
  255. 2.
  256. run the fgdump utility you downloaded
  257. C:\> fgdump -v
  258. 3.
  259. copy the 127.0.0.1.pwdump file to a floppy or USB thumb drive if you are going to use BackTrack to
  260. crack the hashes
  261. 4.
  262. You can dump passwords from remote systems but only if you know the remote local administrator password
  263. or have domain administrator privledges.
  264. Login to the system as an administrator and get to a command prompt (Start, Run, cmd). Since this my
  265. system I know administrator password. You could also try to use metasploit to attack your system to
  266. get to a command prompt.
  267. 1.
  268. Download one of the fgdump files from http://swamp.foofus.net/fizzgig/fgdump/downloads.htm and
  269. unzip it.
  270. 2.
  271. run the fgdump utility you downloaded
  272. C:\> fgdump -v -h hostname -u Username -p Password
  273. where hostname is the name or ip of the remote system you want to retreive the passwords from
  274. Username is the username of the account to connect to the remote system with; usually Administrator
  275. or Domain\Administrator or an account with Domain Administrator privledges.
  276. Password is the password of the above account
  277. NOTE: If you have a firewall installed on the remote system this will not work.
  278. 3.
  279. copy the 127.0.0.1.pwdump file to a floppy or USB thumb drive if you are going to use BackTrack to
  280. crack the hashes
  281. 4.
  282. 3.1.2.2 Using gsecdump
  283. Thanks to williamc for pointing out another password dumping tool. These instructions are based on the
  284. Exploitation part of his Intranet Exploitation tutorial.
  285. Login to the system as an administrator and get to a command prompt (Start, Run, cmd). Since this my
  286. system I know administrator password. You could also try to use metasploit to attack your system to
  287. get to a command prompt.
  288. 1.
  289. Download the gsecdump file from http://www.truesec.com/PublicStore/catalog
  290. /categoryinfo.aspx?cid=223. You have to click on the Hamta filen link to download it. Once
  291. downloaded, unzip it.
  292. 2.
  293. Cracking Passwords Version 1.1 file:///D:/password10.html
  294. 6 of 45 2/15/2010 3:48 PM
  295. Download the psexec tool from http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx and
  296. unzip it
  297. 3.
  298. run as follows:
  299. C:\> psexec \\hostname -u username -p password -s -f -c gsecdump.exe -s > hash.txt
  300. hostname is the name of the PC where you want psexec to run. AKA the target.
  301. username is the username to login to the remote PC.
  302. password is the password of the above username. If you don't put in it here you be prompted to enter it.
  303. If you are prompted the password won't be displayed.
  304. -s tells the process to runas the system account
  305. -f copies the program to the target pc even if it exists
  306. -c copies the program to the target pc
  307. gsecdump.exe is the utility you want to run
  308. -s tells gsecdump to dump the SAM/AD hashes
  309. the > character redirects the output to a file called hash.txt
  310. NOTE: If you have a firewall installed on the remote system this will not work.
  311. 4.
  312. copy the hash.txt file to a floppy or USB thumb drive if you are going to use BackTrack to crack the
  313. hashes
  314. 5.
  315. 3.1.2.3 Using pwdump
  316. 1. Download one of the pwdump files from http://en.wikipedia.org/wiki/Pwdump and unzip it.
  317. Login to the system as an administrator and get to a command prompt (Start, Run, cmd). Since this my
  318. system I know administrator password. You could also try to use metasploit to attack your system to
  319. get to a command prompt.
  320. 2.
  321. run the pwdump utility you downloaded
  322. C:\> pwdump7 >c:\hash.txt
  323. pwdump7 will dump the SAM to the screen and the > character redirects the output to a file called
  324. hash.txt
  325. 3.
  326. copy the hash.txt file to a floppy or USB thumb drive if you are going to use BackTrack to crack the
  327. hashes
  328. 4.
  329. 3.1.2.4 Cached Credentials
  330. When a user logs into a domain their password is cached in the registry so that in the event that the Domain
  331. Controller or network goes down the user can still login to their PC. To export these registry keys you need a
  332. tool call cachedump. It can be downloaded from ftp://ftp.openwall.com/john/contrib/cachedump/
  333. The readme.txt in the zip contains everything you want to know about where the cached credentials are
  334. stored, how cached credentials work, how they are hashed, and how the tool works. Cachedump does not
  335. work on Windows Vista. Vista changed the way that cached creditionals work.
  336. You can also download the fgdump with source file from http://www.foofus.net/fizzgig/fgdump/ and get
  337. cachedump and its source code.
  338. To use:
  339. 1. Extract the cachedump.exe from the zip
  340. 2. Login to the PC as an administrator
  341. 3. Goto a cmd prompt (Start, Run, cmd)
  342. 4. C:\> cd \path to cachedump.exe
  343. 5. C:\> cachedump.exe -v
  344. Cracking Passwords Version 1.1 file:///D:/password10.html
  345. 7 of 45 2/15/2010 3:48 PM
  346. This runs cachedump.exe in verbose mode. I suggest running cachedump in verbose the first time you
  347. use it so you know what is going on and can identify any problems. Once you have good information
  348. displayed on the screen you can use:
  349. C:\> cachedump.exe >cache.txt
  350. and this will redirect the output from the screen to a file called cache.txt
  351. Now you can use John The Ripper or Cain and Abel to crack the hashes. Please note that Cached Credentials
  352. use a different hash than LM or NTLM. The lowercase username is salted with the password.
  353. The best way to protect yourself from this is to disable cached credentials. Change the value of the following
  354. registry key: HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS
  355. NT\CURRENTVERSION\WINLOGON\CACHEDLOGONSCOUNT to 0. You can do this manually or with
  356. Group Policy.
  357. 3.2 Extracting Windows Password hashes remotely
  358. 3.2.1 Using BackTrack Tools
  359. 3.2.1.1 Using ettercap
  360. You can use ettercap and the man in the middle attacks to sniff the username and password of a user over the
  361. network. DO NOT ATTEMPT THIS WITHOUT PERMISSION OF THE USER WHOSE ACCOUNT YOU
  362. WANT TO SNIFF.
  363. You can read an ettercap tutorial at http://openmaniak.com/ettercap.php which covers the basics on how to
  364. use ettercap. There so much that ettercap can do and there are many tutorials covering how to use it I am not
  365. going to duplicate the effort. Just do a quick search using your favorite internet search engine for ettercap
  366. tutorials and read.
  367. 3.2.1.2 Using hashdump (metasploit)
  368. I am not going to cover this in great detail. To use hashdump you first have to use metasploit to compromise
  369. the PC from which you want the password hashes. There are already a number of tutorials that explain how
  370. to use metaspolit. The best documentation is at http://www.metasploit.com/framework/support/. Once you
  371. have compromised the PC using metasploit you can extract the hashes doing:
  372. use priv
  373. hashdump
  374. 3.2.2 Using Windows Tools
  375. 3.2.2.1 Using fgdump
  376. Download one of the fgdump files from http://swamp.foofus.net/fizzgig/fgdump/downloads.htm and
  377. unzip it.
  378. 1.
  379. Login to the system as an administrator and get to a command prompt (Start, Run, cmd). Since this my
  380. system I know administrator password. You will need the administrator password or the username and
  381. password of a an account that is in the local Administrators group on the PC from which you want the
  382. hashes.
  383. 2.
  384. 3. run the fgdump utility you downloaded
  385. Cracking Passwords Version 1.1 file:///D:/password10.html
  386. 8 of 45 2/15/2010 3:48 PM
  387. C:\> fgdump -v -h hostname or IP_Address_of_Target -u username -p password
  388. where username and password are an account with administrator privileges.
  389. copy the 127.0.0.1.pwdump file to a floppy or USB thumb drive if you are going to use BackTrack to crack
  390. the hashes
  391. 3.2.2.2 Using pwdump6
  392. 1. Download pwdump6 from http://en.wikipedia.org/wiki/Pwdump and unzip it.
  393. Login to the system as an administrator and get to a command prompt (Start, Run, cmd). Since this my
  394. system I know administrator password. You will need the administrator password or the username and
  395. password of a an account that is in the local Administrators group on the PC from which you want the
  396. hashes.
  397. 2.
  398. run the utility you downloaded
  399. C:\> pwdump6 -u username -p password hostname or IP_Address_of_Target>c:\hash.txt
  400. where username and password are an account with administrator privileges.
  401. pwdump6 will dump the SAM to the screen and the > character redirects the output to a file called
  402. hash.txt
  403. 3.
  404. copy the hash.txt file to a floppy or USB thumb drive if you are going to use BackTrack to crack the
  405. hashes
  406. 4.
  407. 3.3 Cracking Windows Passwords
  408. 3.3.1 Using BackTrack Tools
  409. My strategy for cracking windows passwords is like this:
  410. 1. Get/Develop a really good wordlist/dictionary
  411. 2. Find the password policy that is enforced for the account you are trying crack
  412. 3. Crack the LM hash using John the Ripper
  413. Crack the NTLM hash with the results of the cracked LM hash and the password policy information
  414. using mdcrack
  415. 4.
  416. If there is no LM hash to crack I proceed to cracking with John the Ripper using the password policy
  417. information and my wordlist. Then I use rainbowtables if the tables match the password policy. http://plaintext.info
  418. is back up and running so I check if they have the cracked password already. To successfully use a
  419. rainbow table you need to know the password policy. No sense downloading a rainbow table that contains
  420. letters and numbers when the password policy requires a symbol (!@#$%^&* etc).
  421. 3.3.1.1 John the Ripper BT3 and BT4
  422. Version 1.7.2 shipped with BackTrack 3. Version 1.7.3.1 with jumbo patch 5 shipped with BT4. The john the
  423. ripper that ships with BT4 requires at least a P4 with SSE2 instructions. If you don't have a processor that
  424. supports SSE2 then you have download and compile john yourself. See the next section for instructions on
  425. how to do this.
  426. 3.3.1.1.1 Cracking the LM hash
  427. john only needs to know the path to the hash.txt to begin bruteforcing and return the uppercase password
  428. # /usr/local/john/john hash.txt
  429. Cracking Passwords Version 1.1 file:///D:/password10.html
  430. 9 of 45 2/15/2010 3:48 PM
  431. 3.3.1.1.2 Cracking the NTLM hash
  432. john only needs to know the path to the hash.txt to begin bruteforcing and return the password
  433. # /usr/local/john/john --format:NT hash.txt
  434. will begin to bruteforce the NTLM hashes
  435. 3.3.1.1.3 Cracking the NTLM hash using the cracked LM hash
  436. Stasik told me it is much easier to crack the NTLM hash if you know the character set. This way you do not
  437. need to bruteforce all possible characters combinations. Once you have TESTTEST, feed a custom character
  438. set of tesTES to john and it will return the proper case password much faster than if you did not limit the
  439. character set. The issue is john has no easy way to limit the character set. You will have to modify the
  440. john.conf file and include the following code that Solar Designer has kindly published to the john-users mail
  441. list:
  442. [List.External:customcharset]
  443. int running; // Are we already running?
  444. int last; // Last character position, zero-based
  445. int c0, c[0x100]; // Cyclic charset
  446. void init()
  447. {
  448. int length, cm, i;
  449. length = 10; // password length
  450. c[c0 = 't'] = 'e'; // change the t and the e to the first and second letters of the custom character set
  451. c['e'] = 's'; // change the e and the s to the second and third letters of the character set
  452. c['s'] = 'T'; // change the s and T to the third and fourth letters
  453. c['T'] = 'E'; // etc
  454. c['E'] = 'S'; // etc
  455. c[cm = 'S'] = c0; // change the S to the last letter of the character set
  456. // If you cannot see the pattern then do not bother with this trick.
  457. // If you can make the necessary changes to suit you environment.
  458. running = 0;
  459. last = length - 1;
  460. i = 0;
  461. while (i < length) word[i++] = cm; word[i] = 0;
  462. }
  463. void generate()
  464. {
  465. int i;
  466. i = last;
  467. while ((word[i] = c[word[i]]) == c0)
  468. if (!i--) {
  469. if (running++) word = 0;
  470. return;
  471. }
  472. }
  473. Once you make the necessary changes begin cracking using:
  474. # /usr/local/john/john -external=customcharset --format:NT hash.txt
  475. Cracking Passwords Version 1.1 file:///D:/password10.html
  476. 10 of 45 2/15/2010 3:48 PM
  477. Some notes from Solar Designer:
  478. Being an external mode, this is not the fastest way to generate candidate passwords, although its
  479. performance is acceptable. Some further optimizations are possible (e.g., cache the last character
  480. outside of the word[] array). Also, be careful when you edit it (such as for a different charset) - errors
  481. in the way the cyclic charset is defined may result in the "while" loop in generate() becoming endless.
  482. 1.
  483. In order to actually crack an NTLM hash with this, you need a build of JtR with support for NTLM
  484. hashes. You may do a custom build with the latest jumbo patch (john-1.7.2-all-9.diff.gz), which means
  485. that you will need to install Cygwin on your Windows system, or you can download such a build made
  486. by someone else (one is linked from the JtR homepage - it is for an older version of the patch, though,
  487. so it is many times slower at NTLM hashes).
  488. 2.
  489. On a modern system, with a recent jumbo patch, and with the proper "make" target for your system,
  490. this should complete its work against an NTLM hash (or against many such hashes) in just a few
  491. minutes.
  492. 3.
  493. 3.3.1.1.4 Cracking cached credentials
  494. john only needs to know the path to the hash.txt to begin bruteforcing and return the password
  495. # /usr/local/john/john --format:mscash hash.txt
  496. 3.3.1.2 John the Ripper - current
  497. The current version of John the Ripper doesn't ship with BT4. It adds some new features (dumbforce and
  498. knownforce) and speeds up several algorithms. However given the way BT4 handles updates I don't
  499. recommend updating the package yourself unless your processor doesn't support SSE2 instructions (i.e.
  500. something less than a P4). I recommend going to http://www.backtrack-linux.org/forums/tool-requests/ and
  501. requesting they update the package to the latest version. Do NOT ask them to drop the SSE2 requirement.
  502. The SSE2 instructions provide real benefits to the cracking process. If you need to compile your own version
  503. here is how.
  504. 3.3.1.2.1 Get and Compile
  505. We first have to remove the existing package and then we can download and compile the program.
  506. 1. open a terminal window
  507. 2. # dpkg -r john
  508. 3. # wget http://www.openwall.com/john/g/john-1.7.4.2.tar.bz2
  509. goto ftp://ftp.openwall.com/john/contrib/
  510. and look for something like john-1.7.4.2-jumbo-1.diff.gz
  511. This is version 1 of the jumbo patch for john 1.7.4.2. Download the latest version that is there.
  512. 4.
  513. 5. # tar -xvf john-1.7.4.2.tar.bz2
  514. 6. # cd john-1.7.4.2
  515. # zcat ../john-1.7.4.2-jumbo-1.diff.gz | patch -p1 -Z
  516. You should see a long list of patching file XXX. If you see X out of Y hunk ignored it means that the
  517. patch did not apply correctly. You either downloaded the wrong version of john or the jumbo patch.
  518. Start over and make sure the jumbo patch matches the version of john you download.
  519. 7.
  520. 8. # cd src
  521. # make
  522. This will display the various systems you can compile john for. I have a P3 that supports MMX so I will
  523. use the command: make linux-x86-mmx. To see which options your CPU supports do a: cat
  524. 9.
  525. Cracking Passwords Version 1.1 file:///D:/password10.html
  526. 11 of 45 2/15/2010 3:48 PM
  527. /proc/cpuinfo and look at the flags. If you have a P4 you probably have SEE2 (check the cpuinfo flags)
  528. then you would use: make linux-x86-see2.
  529. # make linux-x86-mmx
  530. You should see the following when john is done compiling:
  531. gcc DES_fmt.o DES_std.o DES_bs.o BSDI_fmt.o MD5_fmt.o MD5_std.o MD5_apache_fmt.o
  532. BFEgg_fmt.o BF_fmt.o BF_std.o AFS_fmt.o LM_fmt.o NT_fmt.o XSHA_fmt.o DOMINOSEC_fmt.o
  533. lotus5_fmt.o oracle_fmt.o MYSQL_fmt.o mysqlSHA1_fmt.o KRB5_fmt.o KRB5_std.o md5_go.o
  534. rawMD5go_fmt.o md5_eq.o PO_fmt.o md5.o hmacmd5.o hmacMD5_fmt.o IPB2_fmt.o
  535. rawSHA1_fmt.o NSLDAP_fmt.o NSLDAPS_fmt.o OPENLDAPS_fmt.o base64.o md4.o smbencrypt.o
  536. mscash_fmt.o NETLM_fmt.o NETNTLM_fmt.o NETLMv2_fmt.o NETHALFLM_fmt.o mssql_fmt.o
  537. mssql05_fmt.o EPI_fmt.o PHPS_fmt.o MYSQL_fast_fmt.o pixMD5_fmt.o sapG_fmt.o sapB_fmt.o
  538. NS_fmt.o HDAA_fmt.o batch.o bench.o charset.o common.o compiler.o config.o cracker.o crc32.o
  539. external.o formats.o getopt.o idle.o inc.o john.o list.o loader.o logger.o math.o memory.o misc.o
  540. options.o params.o path.o recovery.o rpp.o rules.o signals.o single.o status.o tty.o wordlist.o mkv.o
  541. mkvlib.o unshadow.o unafs.o undrop.o unique.o x86.o x86-mmx.o sha1-mmx.o md5-mmx.o -s -L/usr
  542. /local/lib -L/usr/local/ssl/lib -lcrypto -lm -o ../run/john
  543. rm -f ../run/unshadow
  544. ln -s john ../run/unshadow
  545. rm -f ../run/unafs
  546. ln -s john ../run/unafs
  547. rm -f ../run/unique
  548. ln -s john ../run/unique
  549. rm -f ../run/undrop
  550. ln -s john ../run/undrop
  551. gcc -c -Wall -O2 -fomit-frame-pointer -I/usr/local/include -L/usr/local/lib -funroll-loops genmkvpwd.c
  552. gcc -c -Wall -O2 -fomit-frame-pointer -I/usr/local/include -L/usr/local/lib -funroll-loops
  553. -D_JOHN_MISC_NO_LOG misc.c -o miscnl.o
  554. gcc genmkvpwd.o mkvlib.o memory.o miscnl.o -s -lm -o ../run/genmkvpwd
  555. gcc -c -Wall -O2 -fomit-frame-pointer -I/usr/local/include -L/usr/local/lib -funroll-loops
  556. mkvcalcproba.c
  557. gcc mkvcalcproba.o -s -lm -o ../run/mkvcalcproba
  558. gcc -c -Wall -O2 -fomit-frame-pointer -I/usr/local/include -L/usr/local/lib -funroll-loops calc_stat.c
  559. gcc calc_stat.o -s -lm -o ../run/calc_stat
  560. make[1]: Leaving directory `/root/john-1.7.4.2/src'
  561. 10.
  562. 11. # cd ..
  563. 12. # mv run /pentest/passwords/john
  564. You now have the latest version of John the Ripper and it supports more algorithms than the vanilla John the
  565. Ripper thanks to the jumbo patch.
  566. 3.3.1.2.2 Cracking the LM hash
  567. john only needs to know the path to the hash.txt to begin bruteforcing and return the uppercase password
  568. # /usr/local/john/john hash.txt
  569. 3.3.1.2.3 Cracking the LM hash using known letter(s) in known location(s) (knownforce)
  570. I haven't figured out how to use this feature. John the Ripper is a very powerful tool however it is not very
  571. intuitive to use. I can point you to the John the Ripper wiki which has maillist excerpts cover how to use
  572. dumbforce and knownforce. The url is http://openwall.info/wiki/john/mailing-list-excerpts
  573. Cracking Passwords Version 1.1 file:///D:/password10.html
  574. 12 of 45 2/15/2010 3:48 PM
  575. 3.3.1.2.4 Cracking the NTLM hash
  576. john only needs to know the path to the hash.txt to begin cracking and return the password
  577. # /usr/local/john/john --format:NT hash.txt
  578. will begin to bruteforce the NTLM hashes
  579. 3.3.1.2.5 Cracking the NTLM hash using the cracked LM hash (dumbforce)
  580. I haven't figured out how to use this feature. John the Ripper is a very powerful tool however it is not very
  581. intuitive to use. I can point you to the John the Ripper wiki which has maillist excerpts cover how to use
  582. dumbforce and knownforce. The url is http://openwall.info/wiki/john/mailing-list-excerpts
  583. 3.3.1.2.6 Cracking cached credentials
  584. john only needs to know the path to the hash.txt to begin bruteforcing and return the password
  585. # /usr/local/john/john --format:mscash hash.txt
  586. 3.3.1.3 Using MDCrack
  587. For whatever reason I have been unsuccessful in getting mdcrack-183 to work with any version of wine. This
  588. is strange as I know I had it working previously. To use mdcrack with BackTrack you should upgrade wine to
  589. the latest development version of wine and then use mdcrack-182.zip
  590. For BackTrack 3 users:
  591. 1. Goto http://www.winehq.org/site/download and click on slackware.
  592. 2. download the latest tgz file, which as of this writting is 1.1.29
  593. 3. open a xterm window
  594. 4. # upgradepkg wine-1.1.29-i486-1kjz.tgz
  595. Now you can download mdcrack-182.zip download mdcrack
  596. # wget http://membres.lycos.fr/mdcrack/download/MDCrack-182.zip
  597. or
  598. # wget http://c3rb3r.openwall.net/mdcrack/download/MDCrack-182.zip
  599. 5.
  600. 6. # mkdir mdcrack
  601. 7. # mv MDCrack-182.zip mdcrack
  602. 8. # cd mdcrack
  603. 9. # unzip MDCrack-182.zip
  604. For BackTrack 4 users:
  605. 1. open a xterm window
  606. 2. # wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
  607. # sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/jaunty.list -O /etc/apt/sources.list.d
  608. /winehq.list
  609. 3.
  610. 4. # sudo apt-get update
  611. 5. # sudo apt-get install wine
  612. Now you can download mdcrack-182.zip download mdcrack
  613. # wget http://membres.lycos.fr/mdcrack/download/MDCrack-182.zip
  614. or
  615. # wget http://c3rb3r.openwall.net/mdcrack/download/MDCrack-182.zip
  616. 6.
  617. 7. # mkdir mdcrack
  618. Cracking Passwords Version 1.1 file:///D:/password10.html
  619. 13 of 45 2/15/2010 3:48 PM
  620. 8. # mv MDCrack-182.zip mdcrack
  621. 9. # cd mdcrack
  622. 10. # unzip MDCrack-182.zip
  623. 3.3.1.3.1 Cracking the LM hash
  624. MDCrack doesn't crack LM hashes.
  625. 3.3.1.3.2 Cracking the NTLM hash
  626. # wine MDCrack-sse.exe --algorithm=NTLM1 NTLMHASH
  627. NTLMHASH would be D280553F0103F2E643406517296E7582 for example
  628. The result should be TestTest
  629. The only way to speed up cracking is to know the minimum length of the password and use --minsize= to
  630. specify it.
  631. 3.3.1.3.3 Cracking the NTLM hash using the cracked LM hash
  632. Stasik told me it is much easier to crack the NTLM hash if you know the character set. This way you do not
  633. need to bruteforce all possible characters combinations. Once you have TESTTEST, feed a custom character
  634. set of tesTES to mdcrack and it will return the proper case password much faster than if you did not limit the
  635. character set.
  636. # wine MDCrack-sse.exe --charset=tesTES --algorithm=NTLM1 D280553F0103F2E643406517296E7582
  637. If you know the password length you can use:
  638. # wine MDCrack-sse.exe --charset=tesTES --algorithm=NTLM1 --minsize=8 --maxsize=8
  639. D280553F0103F2E643406517296E7582
  640. The password is TestTest however mdcrack 1.8.3 returns sestTest. I filed a bug report with Gregory
  641. Duchemin, the author of mdcrack, and he has fixed the problem with version 1.8.4.
  642. 3.3.1.4 Using Ophcrack
  643. 3.3.1.4.1 Cracking the LM hash
  644. download ophcrack and the rainbow tables from http://sourceforge.net/project
  645. /showfiles.php?group_id=133599. If you have the hard drive space I would recommend downloading XP free
  646. fast formally known as SSTIC04-5K. If this is a demo or do not have a lot of disk space download XP free
  647. small formally known as SSTIC04-10K. This is not a typo; SSTIC04-5K is a larger download than
  648. SSTIC04-10K. You can also purchase the XP Special table which contain longer passwords and the special
  649. characters. There are special tables for Vista. The small table is Vista free and is free. There is a table you can
  650. purchase called Vista Special which contains hashes for passwords up to 8 characters. See
  651. http://ophcrack.sourceforge.net/tables.php for the details. The rainbow tables that ophcrack uses are NOT
  652. compatible with the rainbow tables generated by rtgen.
  653. 1. # tar -xvzf ophcrack-2.4.1.tar.gz
  654. 2. # cd ophcrack-2.4.1
  655. 3. # ./configure
  656. Cracking Passwords Version 1.1 file:///D:/password10.html
  657. 14 of 45 2/15/2010 3:48 PM
  658. 4. # make
  659. 5. # make install
  660. 6. # ophcrack
  661. 7. click on the load button and select the appropriate option, I will select local SAM.
  662. 8. click on the tables button and select the rainbow table you installed.
  663. click on the launch button. You will see pre-loading table boxes on the screen. You may also see a
  664. message that says "All LM hashes are empty. Please use NThash tables to crack the remaining hashes."
  665. This means that the administrators have disabled windows ability to save LM hashes.
  666. 9.
  667. 10. wait until ophcrack is done
  668. 3.3.1.4.2 Cracking the NTLM hash
  669. You will have to purchase the NTLM rainbow tables from http://www.objectif-securite.ch/en/products.php.
  670. The rainbow table contains 99% of passwords of made of following characters:
  671. length 1 to 6:
  672. 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&'()*+,-./:;&<
  673. =>?@[\]^_`{|}~ (space included)
  674. length 7:
  675. 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  676. length 8:
  677. 0123456789abcdefghijklmnopqrstuvwxyz
  678. You CANNOT generate your own rainbow tables for ophcrack to use. If you know that the password meets
  679. the above specs you can purchase the table and give it a try.
  680. 3.3.1.4.3 Cracking the NTLM hash using the cracked LM hash
  681. There is no way to do this. If ophcrack cracks the LM hash you should switch to john or mdcrack to get the
  682. NTLM password.
  683. 3.3.2 Using Windows Tools
  684. 3.3.2.1 John the Ripper
  685. 3.3.2.1.1 Cracking the LM hash
  686. 1. download john the ripper from http://www.openwall.com/john/
  687. 2. open a command prompt (Start, Run, cmd, enter)
  688. cd to where you extracted john (I extracted john to the root of my C drive) so it would be cd
  689. \john171w\run
  690. C:\> cd \john171w\run
  691. 3.
  692. john only needs to know the path to the hash.txt to begin bruteforcing and return the uppercase
  693. password
  694. C:\> john-386 C:\hash.txt
  695. 4.
  696. 3.3.2.1.2 Cracking the NTLM hash
  697. skype : yamod.gas
Add Comment
Please, Sign In to add comment