Author Topic: Dictionary Attacks (Your first attempt)  (Read 950 times)

OneHappyTaco

  • Sr. Member
  • ****
  • Posts: 404
  • Reputation: 11
  • Who Dares Wins
  • Computers: Mac
  • iDevices: Iphone 4s
Dictionary Attacks (Your first attempt)
« on: January 28, 2013, 07:36:50 pm »
Today I will be talking about dictionary attacks. Dictionary attacks are a way to crack passwords. It uses long list of passwords to try and get into a system. I will NOT be talking about web forum attacks which is pretty much the master level of dictionary attacks. Let's start with the basics.
I will be talking about crackong SSH. SSH is probaly the best, and easiest way to dictionary attack your victim in my opinion. Most of the time their username for ssh is "root" so you don't have to worry about mutliple usernames to test. To begin, let's nmap our victim.


Nmap is a giant program full of millions of combinations and extras that I can certainly not cover during this mini tutorial. So let's just use a simple nmap command:
nmap -p 22 -PN -v -sT  (victims IP address here)



Heres a screenie:




This will list the open ports of the victim. This way we can figure out if our victim has SSH.

Wait a few seconds for it to gather information and then pay attention for "port 22" being open. If port 22 is open then you know you can dictionary attack your victim.

You will now need a wordlist. A wordlist is a list of possible passwords. Basically wordlist attacks keep trying every word on a wordlist until they succeed or run out of words. So you can either use the wordlists from the repo or enjoy making a custom one. I am going to show you how to make a custom one without using harvester. This way you get to see what each step is doing (and plus it's more fun.) Usually you will want to make a custom wordlist if your victim seems to be interested in a specific type of genre of activities.

For example a while back a friend of mine wanted to see if I could get into his website. The website was like a wiki type thing for the universe, so I imgained his password would be related to space. And I bruteforced the login with my custom wordlist and it WORKED. Here's how:
You will need wget, wyd,  and hydra for this.

Make a folder for all your targets.

cd /var/mobile

Mkdir targets

cd targets


wget -r (the website)

Here it a yellow brick road to the folder:





go into VAR





go into MOBILE




Go into the targets folder you made:












Now after you have downloaded the website let's use wyd to seperate the words.

cd /var/mobile/pentest/passwords/wyd

Now run this:

./wyd.pl -n -o /var/mobile/number1.txt /var/mobile/victims


Here's a screenie:






And another:




This will seperate all the words downloaded into a file. Now we must properly configure it.

cat number1.txt | sort | uniq > number2.txt

Here's a picuture of the number 2 file that I made:






This will configure the spacing and elimate the fautilty words.

Now let's run pw-inspector on it!

cat number2.txt | pw-inspector -m 1 -M 20 > pass.txt



Here's a picture of the pass.txt file:





There you go! A list of possible passwords custom made. Now let's start the attack!

medusa -h (victim's ip) -M ssh -u root -P /var/mobile/pass.txt -n 22


Here's a screenie of medusa dictionary attacking!



I use medusa but you can use hydra if you want. Now let me explain, in depth, everything you i listed above. You can get medusa from:
ininjas.com/repo from cydia or for linux:
http://www.darknet.org.uk/2007/11/medusa-14-parallel-password-cracker-released-for-download/


(-h) is the victim's ip address. Nothing special.



-M is the module name. This basically tells medusa what to bruteforce.

-u is the username

-P is the directory to the wordlist file.

-n is the port (22 for ssh)

Thats all you need to know to run yourfirst bruteforce with medusa! Later I will cover parrell attacks and more advacned things!


P.S. This tutorial is meant for noobs to medusa so many of you pros may consider it "bad" because you were not taught anything and most of it could of been replaced by Harvester. The most important  part of not raising skiddies is making them not use automations for things. Also, if there are any recommendations for me please leave them in the comment section below. And by the way, pictures are a no go because I am having trouble uploading.





How to avoid getting your password bruteforced or dictionary attacked:


Basically having a strong password on all your password required terms. If you are hosting a website explore your website for open ports that link to protocols i.e. telnet, ssh    Or maybe hire a white hat hacker to perform his attacks against your website. A secure password consists of NUMBERS and letters and, at least one crazy sign. Also a simple word that has no numbers, but is a random word that no one will guess is NOT a secure password. There are wordlists out there that have EVERY word in the english language and other languages aswell. Also common passwords are also bad i.e. alex123 or money$ These may seem like "good" passwords because they have numbers, but are not. If you are paranoid about passwords try a password generator. Just pray that your password generator account doesn't get hacked. Finally, don't use password generator apps, like ones found in cydia. The reason behind that is, people could UDID fake with your UDID and get ALL your passwords. You could use programs like listed in the comment section or you could just have a secure password.
« Last Edit: January 30, 2013, 07:02:52 pm by OneHappyTaco »

grinch

  • Administrator
  • Hero Member
  • *****
  • Posts: 1926
  • Reputation: 187
  • the digital grinch who stole your data
    • @DigitalGrinch
  • Badges:
  • iDevices: iPhone 3GS 4.3.3, HTC Evo V 4G ICS
Re: Medusa (the basics)
« Reply #1 on: January 29, 2013, 08:25:03 am »
This is full of WRONG information, and should not be perpetrated as a valid. You will just confuse all the other people that do not know better

You should read this first, understand the different types of password cracking, then rename your post and edit it
https://ininjas.com/forum/index.php?topic=3664.0

You mention tools, but do not discuss where you got them from, their installation, etc

Use a precise scan. Your nmap scan is like walking up and down every NYC block, just looking for one corner of one street.

You claim its for noobs, but no screen shots
If I help you or you appreciate my work, clicking that +1 button is the best thanks I could get.

My opinions are my own, you may agree or disagree with them, but they are only just that; opinions
For example: facebook is the microsoft of social networks

http://goo.gl/PiVjI

@DigitalGrinch
https://twitter.com/DigitalGrinch

I follow all iNinjas members back. PM me if I am not following you

OneHappyTaco

  • Sr. Member
  • ****
  • Posts: 404
  • Reputation: 11
  • Who Dares Wins
  • Computers: Mac
  • iDevices: Iphone 4s
Re: Medusa (the basics)
« Reply #2 on: January 29, 2013, 02:56:40 pm »
I seemed to have mixed up bruteforcing and dictionary attacks. I will fix that now. Also I will read the nmap manual because I don't really have a clue when it comes to that. I will also add in where the tools came from. Thank you for telling me grinch

EDIT: and also pictures are a no go. Whenever I upload a picture it does not show up
« Last Edit: January 29, 2013, 03:04:21 pm by OneHappyTaco »

grinch

  • Administrator
  • Hero Member
  • *****
  • Posts: 1926
  • Reputation: 187
  • the digital grinch who stole your data
    • @DigitalGrinch
  • Badges:
  • iDevices: iPhone 3GS 4.3.3, HTC Evo V 4G ICS
Re: Dictionary Attacks (Your first attempt)
« Reply #3 on: January 29, 2013, 04:41:16 pm »
Yes, proper title now. Anytime a wordlist or passwordlist is used, it is a dictionary style attack. Brute force tries every possible permutation given a "set"

If you just want to see if port 22 is open, use this
Code: [Select]
nmap -p 22 -sT -PN -v ip.ip.ip.ipwith ip.ip.ip.ip being your target IP

Yeah def detail the steps for all required packages. If you are going to make a "noob tutorial" make it for noobs

Screenshots make a better finished product and will get you more +1 from members because more members will be able to follow along. Figure out what is wrong with how you are adding pictures.
Do you upload them to an https:// site then link them here with [IMG] tagging?
I can help you with this issue elsewhere, not in your thread.
If I help you or you appreciate my work, clicking that +1 button is the best thanks I could get.

My opinions are my own, you may agree or disagree with them, but they are only just that; opinions
For example: facebook is the microsoft of social networks

http://goo.gl/PiVjI

@DigitalGrinch
https://twitter.com/DigitalGrinch

I follow all iNinjas members back. PM me if I am not following you

OneHappyTaco

  • Sr. Member
  • ****
  • Posts: 404
  • Reputation: 11
  • Who Dares Wins
  • Computers: Mac
  • iDevices: Iphone 4s
Re: Dictionary Attacks (Your first attempt)
« Reply #4 on: January 29, 2013, 09:17:58 pm »
Better?

Don't like seeing ads? Click here to register!

grinch

  • Administrator
  • Hero Member
  • *****
  • Posts: 1926
  • Reputation: 187
  • the digital grinch who stole your data
    • @DigitalGrinch
  • Badges:
  • iDevices: iPhone 3GS 4.3.3, HTC Evo V 4G ICS
Re: Dictionary Attacks (Your first attempt)
« Reply #5 on: January 30, 2013, 07:35:53 am »
The pictures are so huge I can not tell if they show what you are describing, but yes, it is better that they are there

It is 'bonus' but I like to also explain how to defeat or defend against the attack. It shows true comprehension.

Things like why it is important to change your sshd port from the default 22.

The use of strong passwords, not anything to be found in a wordlist, forcing brute-force

Using tools like Fail2Ban or Artillery that monitors failed ssh login attempts and bans the respective addresses, like in your last screen shot
You see a few 'Account Check' then after a few failed, you get ERROR bc the host is no longer reachable. The victim has blocked your attack.
If I help you or you appreciate my work, clicking that +1 button is the best thanks I could get.

My opinions are my own, you may agree or disagree with them, but they are only just that; opinions
For example: facebook is the microsoft of social networks

http://goo.gl/PiVjI

@DigitalGrinch
https://twitter.com/DigitalGrinch

I follow all iNinjas members back. PM me if I am not following you

Almost

  • Full Member
  • ***
  • Posts: 128
  • Reputation: 20
Re: Dictionary Attacks (Your first attempt)
« Reply #6 on: January 30, 2013, 11:10:25 am »
One additional security precaution is not to let root ssh. Use another account for it and sudo/su when necessary. Although dictionairy/bruteforce attacks are not the main reason to do so, it complicates this attack as a nice side-effect.
(Personally, I use all of the above, except changing the port number. Especially a strong (long & non-dictionairy) pass + Fail2Ban makes me feel quite safe).

edit: Also, +1 for the effort on a nice tut, OHT!

UberN00b

  • Hero Member
  • *****
  • Posts: 524
  • Reputation: 22
  • Perfection is a process.
  • Computers: em250-kav60 netbook
  • iDevices: iPhone 4
Re: Dictionary Attacks (Your first attempt)
« Reply #7 on: January 30, 2013, 11:24:50 am »
It is 'bonus' but I like to also explain how to defeat or defend against the attack. It shows true comprehension.

+1, respeck! (in my Ali G accent)
Same to you Taco!
A million strands of spiderwebs weaved to make my vest!

OneHappyTaco

  • Sr. Member
  • ****
  • Posts: 404
  • Reputation: 11
  • Who Dares Wins
  • Computers: Mac
  • iDevices: Iphone 4s
Re: Dictionary Attacks (Your first attempt)
« Reply #8 on: January 30, 2013, 07:05:57 pm »
Kk, I added that.

Ironman

  • Administrator
  • Hero Member
  • *****
  • Posts: 5104
  • Reputation: 251
  • Badges:
  • Computers: ASUS UL50VT
  • iDevices: iPhone 5, iPhone 4S, iPhone 4, iPhone 3GS
Re: Dictionary Attacks (Your first attempt)
« Reply #9 on: January 31, 2013, 05:40:52 am »
Now you're doing a quality TUT!! Screenies!! Explanation of commands!! Awesome!! +1
Click for How to Add Our Repo
If you're going to ask questions....
At least make them good ones.

Knowledge is the one thing that can never be taken from you

Don't like seeing ads? Click here to register!