Hashcat

In this tutorial we will show you how to create a list of MD5 password hashes and crack them using hashcat.

We will perform a dictionary attack using the rockyou wordlist on a Kali Linux box.

CREATING A LIST OF MD5 HASHES TO CRACK

To create a list of MD5 hashes, we can use  md5sum command.

The full command we want to use is:

echo -n "Password1" | md5sum | tr -d " -" >> hashes

Here we are piping a password to md5sum so a hash is produced. Unnecessary output is then stripped and it is stored in a file in a file called “hashes”.

“echo -n ‘Password1′” is used to print the phrase “Password1”. The -n portion removes the new line added to the end of “Password1”. This is important as we don’t want the new line characters to be hashed with our password.

The part “tr –d ‘ -‘ “ removes any characters that are a space or hyphen from the output like so:

Before:

# echo -n "Password1" | md5sum
2ac9cb7dc02b3c0083eb70898e549b63  -

After:

# echo -n "Password1" | md5sum | tr -d " -"
2ac9cb7dc02b3c0083eb70898e549b63

For demonstration purposes, we’ll create multiple MD5 hashes containing different strength passwords and output them to a file called hashes:

echo -n "Password1" | md5sum | tr -d " -" >> hashes
echo -n "HELLO" | md5sum | tr -d " -" >> hashes
echo -n "MYSECRET" | md5sum | tr -d " -" >> hashes
echo -n "Test1234" | md5sum | tr -d " -" >> hashes
echo -n "P455w0rd" | md5sum | tr -d " -" >> hashes
echo -n "GuessMe3" | md5sum | tr -d " -" >> hashes
echo -n "S3CuReP455Word" | md5sum | tr -d " -" >> hashes
echo -n "HighlyUnlik3lyToB3Cr4ck3d…" | md5sum | tr -d " -" >> hashes

Once you have run these commands will look something like this:

# cat hashes
2ac9cb7dc02b3c0083eb70898e549b63
eb61eead90e3b899c6bcbe27ac581660
958152288f2d2303ae045cffc43a02cd
2c9341ca4cf3d87b9e4eb905d6a3ec45
75b71aa6842e450f12aca00fdf54c51d
98bffa1e0b3872aa0813b0a62a2003ab
b5af0b804ff7238bce48adef1e0c213f
5a53193b4cca4ccdabf3ccb1fa514162

If you already have a list of words then the following bash script can be used to automate the MD5 generation, reading each line in a file, then generating a file off the resulting hashes. Replace ‘wordlist’ with the file path of your word list.

for i in $(cat wordlist); do echo -n "$i"| md5sum | tr -d " -" >> hashes; done

If you do not have md5sum on your machine, you can copy and paste the hashes above and save it in a file called “hashes”. If you want to hash different passwords than the ones above and you don’t have md5sum installed, you can use MD5 generators online such as this one.

RUNNING HASHCAT TO CRACK MD5 HASHES

Now we can start using hashcat with the rockyou wordlist to crack the MD5 hashes. The rockyou wordlist comes pre-installed with Kali. If you are not using Kali you can use another wordlist, or download it from here.

The command to start our dictionary attack on the hashes is:

hashcat –m 0 hashes /usr/share/wordlists/rockyou.txt
Argument Function
-m 0 Tells hashcat which mode to use. 0 is MD5.
Hashes Our file containing the our MD5 password hashes.
/usr/share/wordlists/rockyou.txt Points hashcat to the wordlist containing the passwords to hash and compare.

When you run the command, you should get an output like below:

# hashcat -m 0 hashes /usr/share/wordlists/rockyou.txt

Initializing hashcat v2.00 with 2 threads and 32mb segment-size...

Added hashes from file hashes: 8 (1 salts)


2ac9cb7dc02b3c0083eb70898e549b63:Password1  

eb61eead90e3b899c6bcbe27ac581660:HELLO      

958152288f2d2303ae045cffc43a02cd:MYSECRET   

75b71aa6842e450f12aca00fdf54c51d:P455w0rd   

2c9341ca4cf3d87b9e4eb905d6a3ec45:Test1234   

[s]tatus [p]ause [r]esume [b]ypass [q]uit =>


Input.Mode: Dict (/usr/share/wordlists/rockyou.txt)

Index.....: 1/5 (segment), 3627099 (words), 33550339 (bytes)

Recovered.: 5/8 hashes, 0/1 salts

Speed/sec.: 9.90M plains, 9.90M words

Progress..: 3627099/3627099 (100.00%)

Running...: --:--:--:--

Estimated.: --:--:--:--




[s]tatus [p]ause [r]esume [b]ypass [q]uit =>


Input.Mode: Dict (/usr/share/wordlists/rockyou.txt)

Index.....: 2/5 (segment), 3351795 (words), 33550340 (bytes)

Recovered.: 5/8 hashes, 0/1 salts

Speed/sec.: 16.43M plains, 16.43M words

Progress..: 3351795/3351795 (100.00%)

Running...: 00:00:00:01

Estimated.: --:--:--:--


...

[s]tatus [p]ause [r]esume [b]ypass [q]uit =>


Input.Mode: Dict (/usr/share/wordlists/rockyou.txt)

Index.....: 5/5 (segment), 553095 (words), 5720149 (bytes)

Recovered.: 5/8 hashes, 0/1 salts

Speed/sec.: 9.23M plains, 9.23M words

Progress..: 553095/553095 (100.00%)

Running...: --:--:--:--

Estimated.: --:--:--:--



Started: Thu Jul 14 05:37:50 2016           

Stopped: Thu Jul 14 05:37:53 2016

Towards the top of the output you can see the hashes that were cracked side-by-side with the plaintext password and hash.

From the output we can determine the following passwords we hashed were not in the rockyou wordlist:

  • GuessMe3
  • S3CuReP455Word
  • HighlyUnlik3lyToB3Cr4ck3d

Unless told otherwise, any hash that hashcat cracks will be stored in a hashcat.pot file. This will be created in directory where you ran hashcat.

The contents of your “hashcat.pot” file from this tutorial should look like the following:

#cat hashcat.pot
2ac9cb7dc02b3c0083eb70898e549b63:Password1
eb61eead90e3b899c6bcbe27ac581660:HELLO
958152288f2d2303ae045cffc43a02cd:MYSECRET
75b71aa6842e450f12aca00fdf54c51d:P455w0rd
2c9341ca4cf3d87b9e4eb905d6a3ec45:Test1234

SUMMARY

This has been a basic tutorial on how to crack MD5 hashes using hashcat. We’ve MD5 hashed passwords and using hashcat, cracked five out of the total eight. The attack technique that we used within hashcat was a dictionary attack with the rockyou wordlist.

Docker Cheatsheet

Starting and Stopping

Import / Export

  • docker cp copies files or folders between a container and the local filesystem.
  • docker export turns container filesystem into tarball archive stream to STDOUT.

Executing Commands

To enter a running container, attach a new shell process to a running container called foo, use: docker exec -it foo /bin/bash.

Lifecycle

  • docker images shows all images.
  • docker import creates an image from a tarball.
  • docker build creates image from Dockerfile.
  • docker commit creates image from a container, pausing it temporarily if it is running.
  • docker rmi removes an image.
  • docker load loads an image from a tar archive as STDIN, including images and tags (as of 0.7).
  • docker save saves an image to a tar archive stream to STDOUT with all parent layers, tags & versions (as of 0.7).
  • docker images shows all images.
  • docker import creates an image from a tarball.
  • docker build creates image from Dockerfile.
  • docker commit creates image from a container, pausing it temporarily if it is running.
  • docker rmi removes an image.
  • docker load loads an image from a tar archive as STDIN, including images and tags (as of 0.7).
  • docker save saves an image to a tar archive stream to STDOUT with all parent layers, tags & versions (as of 0.7).

Info

  • docker history shows history of image.
  • docker tag tags an image to a name (local or registry).
  • docker ps shows running containers.
  • docker logs gets logs from container. (You can use a custom log driver, but logs is only available for json-file and journald in 1.10).
  • docker inspect looks at all the info on a container (including IP address).
  • docker events gets events from container.
  • docker port shows public facing port of container.
  • docker top shows running processes in container.
  • docker stats shows containers’ resource usage statistics.
  • docker diff shows changed files in the container’s FS.
  • docker history shows history of image.
  • docker tag tags an image to a name (local or registry).

Hacking Challenges

https://ctf.hackerfire.com

http://www.janosgyerik.com/hacking-contest-on-a-live-cd/

https://contained.af/

https://smashthestack.org

https://www.pentestpractice.com/challenges

https://ctf.saluslab.net/

https://demo.ctfd.io/

https://potatopla.net/crypto/

https://cryptopals.com/

https://ctf.hak4kidz.com/

https://www.holidayhackchallenge.com/

https://github.com/Hackademic/hackademic/

https://www.amanhardikar.com/mindmaps/Practice.html

https://www.brainquest.sk/

https://www.bright-shadows.net/

https://www.canyoucrackit.co.uk/

https://www.canyouhack.it/

https://www.captf.com/practice-ctf/

https://www.chall.stypr.com/

https://www.chall.tasteless.eu/

https://www.challengeland.co/

https://www.cmdchallenge.com/

https://www.codechef.com/contests/

https://www.counterhack.net/Counter_Hack/Challenges.html

https://www.cryptoclub.org/challenges/index.php

https://www.ctf.forgottensec.com/wiki/index.php

https://www.dareyourmind.net/

https://www.dftt.sourceforge.net/

https://www.en.hacktest.net/

https://www.enigmagroup.org/

https://www.exploit.co.il/projects/vuln

https://www.exploit-exercises.com

https://www.gendou.com/crypto/

https://hack.me/

https://www.hackburger.ee/

https://www.hackergateway.com/

https://www.hacking-challenges.de/

https://www.hacksplaining.com/exercises

https://www.hackthebox.eu/

https://www.hackthis.co.uk/

https://www.hackthissite.org/

https://www.halls-of-valhalla.org/beta/challenges

https://www.hellboundhackers.org/

https://www.ismellpackets.com/category/packet-challenge/

https://www.javaist.com/rosecode/problems.php

https://lab.pentestit.ru/

https://www.lost-chall.org/

https://www.me.hack.me/login

https://www.microcontest.com/

https://microcorruption.com/login

https://www.mod-x.co.uk/

https://www.netforce.nl/challenges/

https://www.netresec.com/

https://www.newbiecontest.org/index.php

https://www.noe.systems/

https://www.overthewire.org/wargames/

https://www.p0wnlabs.com/free/forensics

https://www.pentest.training/index.php

https://www.pentesterlab.com/exercises/

https://www.plaidctf.com/

https://www.practicalpentestlabs.com/

https://www.praetorian.com/challenges/pwnable

https://www.pwnable.kr/index.php

https://www.pwnable.tw/

http://pwnadventure.com/

https://www.questionengine.securitytreasurehunt.com/

https://www.rankk.org/

https://www.reversing.be/

https://www.reversing.kr/

https://www.root-me.org/lang=en

https://www.ringzer0team.com

https://www.sabrefilms.co.uk/revolutionelite/

https://www.slavehack.com/

https://www.solveme.peng.kr/

https://www.spoj.com/problems/classical/

https://www.suninatas.com/

https://www.tdhack.com/

https://www.thisislegal.com

http://www.trythis0ne.com/index.php

https://www.trytodecrypt.com/

https://www.vulnhub.com

https://www.w3challs.com/

https://www.wargame.kr/challenge

https://www.wixxerd.com

/https://www.yashira.org/

https://www.yoire.com/

Recon-ng

Recon-ng is a full-featured Web Reconnaissance framework written in Python. Complete with independent modules, database interaction, built in convenience functions, interactive help, and command completion, Recon-ng provides a powerful environment in which open source web-based reconnaissance can be conducted quickly and thoroughly.

Recon-ng has a look and feel similar to the Metasploit Framework, reducing the learning curve for leveraging the framework. However, it is quite different. Recon-ng is not intended to compete with existing frameworks, as it is designed exclusively for web-based open source reconnaissance.

Start recon-ng 

root@kali:~# recon-ng

View commands

recon-ng > help

Show Modules

recon-ng > show modules

View keys

One of the strengths and beauties of Recon-ng is the use of various application programming interfaces (APIs) to extract useful recon information. For instance, Recon-ng can use Bing, Google, Facebook, Instagram, LinkedIn, and other online applications once you get the API key. With that key, you have almost unlimited access to that application.

recon-ng > keys list

When you obtain an API key and you want to add it to Recon-ng for use, you simply add it to the keys. For instance, if I received an API key from Facebook and that key was “123456”, I could add it to Recon-ng by typing:

recon-ng > keys add facebook_api 123456

Usage

Load a module

recon-ng > use recon/domains-vulnerabilities/xssposed

This loads the module into memory and makes it ready for use. Let’s get some info on this module by typing:

recon-ng > show info

Scan a website with the loaded module.

recon-ng > set source xxxxxxxxxx.com

Then run the loaded module.

recon-ng > run 

pscp

Upload a file from one system to another

#pscp c:\documents\foo.txt fred@example.com:/tmp/foo

Pull file from a system

#pscp fred@example.com:/etc/hosts c:\temp\example-hosts.txt

 

Common Ports

7 Echo
19 Chargen
20-21 FTP
22 SSH/SCP
23 Telnet
25 SMTP
42 WINS Replication
43 WHOIS
49 TACACS
53 DNS
67-68 DHCP/BOOTP
69 TFTP
70 Gopher
79 Finger
80 HTTP
88 Kerberos
102 MS Exchange
110 POP3
113 Ident
119 NNTP (Usenet)
123 NTP
135 Microsoft RPC
137-139 NetBIOS
143 IMAP4
161-162 SNMP
177 XDMCP
179 BGP
201 AppleTalk
264 BGMP
318 TSP
381-383 HP Openview
389 LDAP
411-412 Direct Connect
443 HTTP over SSL
445 Microsoft DS
464 Kerberos
465 SMTP over SSL
497 Retrospect
500 ISAKMP
512 rexec
513 rlogin
514 syslog
515 LPD/LPR
520 RIP
521 RIPng (IPv6)
540 UUCP
554 RTSP
546-547 DHCPv6
560 rmonitor
563 NNTP over SSL
587 SMTP
591 FileMaker
593 Microsoft DCOM
631 Internet Printing
636 LDAP over SSL
639 MSDP (PIM)
646 LDP (MPLS)
691 MS Exchange
860 iSCSI
873 rsync
902 VMware Server
989-990 FTP over SSL
993 IMAP4 over SSL
995 POP3 over SSL
1025 Microsoft RPC
1026-1029 Windows Messenger
1080 SOCKS Proxy
1080 MyDoom
1194 OpenVPN
1214 Kazaa
1241 Nessus
1311 Dell OpenManage
1337 WASTE
1433-1434 Microsoft SQL
1512 WINS
1589 Cisco VQP
1701 L2TP
1723 MS PPTP
1725 Steam
1741 CiscoWorks 2000
1755 MS Media Server
1812-1813 RADIUS
1863 MSN
1985 Cisco HSRP
2000 Visco SCCP
2002 Cisco ACS
2049 NFS
2082-2083 cPanel
2100 Oracle XDB
2222 DirectAdmin
2302 Halo
2483-2484 Oracle DB
2745 Bagle.H
2967 Symantec AV
3050 Interbase DB
3074 XBOX Live
3124 HTTP Proxy
3127 MyDoom
3128 HTTP Proxy
3222 GLBP
3260 iSCSI Target
3306 MySQL
3389 Terminal Server
3689 iTunes
3690 Subversion
372 World of Warcraft
3784-3785 Ventrilo
4333 mSQL
4444 Blaster
4664 Google Desktop
4672 eMule
4899 Radmin
5000 UPnP
5001 Slingbox
5001 iperf
5004-5005 RTP
5050 Yahoo! Messenger
5060 SIP
5190 AIM/ICQ
5222-5223 XMPP/Jabber
5432 PostgreSQL
5500 VNC Server
5554 Sasser
5631-5632 pcAnywhere
5800 VNC over HTTP
5900+ VNC Server
6000-6001 X11
6112 Battle.net
6129 DameWare
6257 WinMX
6346-6347 Gnutella
6500 GameSpy Arcade
6566 SANE
6588 AnalogX
6665-6669 IRC
6679/6697 IRC over SSL
6699 Napster
6881-6999 BitTorrent
6891-6901 Windows Live
6970 Quicktime
7212 GhostSurf
7648-7649 CU-SeeMe
8000 Internet Radio
8080 HTTP Proxy
8086-8087 Kaspersky AV
8118 Privoxy
8200 VMware Server
8500 Adobe ColdFusion
8767 TeamSpeak
8866 Bagle.B
9100 HP JetDirect
9101-9103 Bacula
9119 MXit
9800 WebDAV
9898 Dabber
9988 Rbot/Spybot
9999 Urchin
10000 Webmin
10000 BackupExec
10113-10116 NetIQ
11371 OpenPGP
12035-12036 Second Life
12345 NetBus
13720-13721 NetBackup
14567 Battlefield
15118 Dipnet/Oddbob
19226 AdminSecure
19638 Ensim
20000 Usermin
24800 Synergy
25999 Xfire
27374 Sub7
31337 Back Orifice
33434+ traceroute

ncat

# Connect mode (ncat is client) | default port is 31337
ncat <host> [<port>]

# Listen mode (ncat is server) | default port is 31337
ncat -l [<host>] [<port>]

# Transfer file (closes after one transfer)
ncat -l [<host>] [<port>] < file

# Transfer file (stays open for multiple transfers)
ncat -l –keep-open [<host>] [<port>] < file

# Receive file
ncat [<host>] [<port>] > file

# Brokering | allows for multiple clients to connect
ncat -l –broker [<host>] [<port>]

# Listen with SSL | many options, use ncat –help for full list
ncat -l –ssl [<host>] [<port>]

# Access control
ncat -l –allow <ip>
ncat -l –deny <ip>

# Proxying
ncat –proxy <proxyhost>[:<proxyport>] –proxy-type {http | socks4} <host>[<port>]

# Chat server | can use brokering for multi-user chat
ncat -l –chat [<host>] [<port>]