Showing posts with label brute force. Show all posts
Showing posts with label brute force. Show all posts

Saturday, March 19, 2016

Kali Tool Series - John the Ripper

John the Ripper is a tool for getting passwords by bruteforcing. Make sure you don’t apply any of followings more others’ accounts or services. Try your own accounts or services.

Get Password of an Unix-like Machine

Followings are only work with an unix-like machine, and the user had already gained the access of files on it. That is, we need /etc/passwd and /etc/shadow (only /etc/passwd for acient machine).

> unshadow /etc/passwd /etc/shadow > ~/passwd

Use John’s default word list to crack the password:

> john ~/passwd

Use custom wordlist:

> john --wordlist=word.list ~/passwd

where word.list is your custom list.

To show the result:

> john --show ~/passwd

Crack Wifi

Use Wordlist (WPA2)

Use wireshark or airodump-ng to get .cap file of the traffic. Then:

> aircrack-ng –w wordlist.lst -b 00:0c:29:80:9a:85 my_traffic*.cap

where -b option indicates the MAC of your targetting BSSID, and input files are those .cap files.

Try All

Another solution is to try every possible password which is guaranteed to found the password, but it might also take forever.

> john -stdout -incremental | aircrack-ng -b 00:0c:29:80:9a:85 -w - my_traffic*.cap

Session Control

To run a long password testing process, we can make it run in the background:

> john --session=all_rules_session --wordlist=all.lst &

To check the session status:

> john --status=all_rules_session
0g 0:00:00:02  2/3 0g/s 411.5p/s 411.5c/s 411.5C/s

To restore the session:

> john --restore

Password Wordlist

For longer wordlist, one can find it online. However, there are some existing wordlist on Kali for users to apply.

> ls /usr/share/wordlists/
dirb  dirbuster  dnsmap.txt  fasttrack.txt  fern-wifi  metasploit  metasploit-jtr  nmap.lst  rockyou.txt.gz  sqlmap.txt  termineter.txt  wfuzz

they are wordlist files from different applications:

> file /usr/share/wordlists/*
/usr/share/wordlists/dirb:           symbolic link to /usr/share/dirb/wordlists
/usr/share/wordlists/dirbuster:      symbolic link to /usr/share/dirbuster/wordlists
...
/usr/share/wordlists/wfuzz:          symbolic link to /usr/share/wfuzz/wordlist

Interestingly, the best wordlist is actually hidden in the rockyou.txt.gz, so:

> gzip -dc < rockyou.txt.gz > ~/wordlist.txt

then we got wordlist.txt.

Resource

Sunday, May 4, 2014

Defend from DirBuster (avoid brute force directories and files names on web/application servers)

* Trying to brute force directories and files names on deployed servers is ILLEGAL!

Some fake hackers like to hack deployed servers by using tools like "DirBuster"; however, it's easy to defend. Also remember that applying brute force on deployed server is ILLEGAL and that will get you into trouble.

I am using IP 123.123.123.123 as the attacker's IP here.

1. Ban the attacker's IP

In the apache setting file add:
<Location />
        Order deny,allow
        Deny from 123.123.123.123
</Location>

2. Setup mod_evasive

Follow the instruction here, which is:
  • apt-get install apache2-utils
  • make sure module configuration is on in Apache setting:
    • Include mods-enabled/*.load
    • Include mods-enabled/*.conf
  • configure DOS parameters by adding following into .conf file of the site
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify someone@somewhere.com
</IfModule>
To test, run this perl script: https://github.com/KoHead/mod_evasive/blob/master/test.pl

3. Setup Nagios with notifications

Setup a system monitoring program on the server, so if there's anything abnormal the administrator will receive emails immediately. Check: http://www.nagios.org/