PrerequisitesYou should know how the basics of generating payloads using metasploit, i.e. have a basic idea about pentesting. I have covered these already, and won't do so again.
If you haven't got the prerequisites covered, I'd suggesting you start by hacking into an unpatched Windows XP machine.
Install Veil-evasionThis is one the rare moments when you actually have to install a hacking tool in Kali Linux. That said, the process is incredibly simple, and a simple apt-get will work.
sudo apt-get update
sudo apt-get install veil-evasion
Type veil-evasion in the terminal and you'll be asked if you want to continue with the installation.
Veil Evasion - Creating a simple payloadType veil-evasion on the terminal to start it.
list2) Use any payload you want to. I'm using python/shellcode_inject/flat. Type
info4) Type generate
7) Enter LHOST (listener IP, i.e. your IP from ifconfig) and LPORT (any unused port works), enter any extra msfoptions you want to enter (not required here). Enter any name you want.
Your payload will get generated in a bit. Don't upload it to online scanners, since they distribute it to different AV companies and the detection rate increases.
PS: If you are having issues, scroll down to the troubleshooting section below.
Veil Evasion - Creating An encrypted payloadLet's try to create an encypted payload, one which will be undetectable by most AVs.
We'll use AES encryption to encrypt the payload. This is a pretty strong algorithm and should provide pretty low detection rate.
1) Select the payload (this step is the only difference between the encrypted payload and simple payload)
4) Generate the encrypted payload.
generate5) Choose option 1, press enter for default payload. Follow the same procedure as the previous case. Choose the LHOST, LPORT.
7) Choose 1 (pyinstaller).
Generated executable can be seen here-
|This is the second payload I created with the name veiled so it got changed to|
If you're getting this error
ERROR: Can't find python.exe in /root/.config/wine/veil/drive_c/Python27/
Then it means apt-get failed you, and there are some uninstalled/mis-configured dependencies
Try this solution-
git clone https://github.com/Veil-Framework/Veil-Evasion.gitIt's going to be approximately a 300 MB download.
|This step may take some time. You'll have to wait.|
|You'll have to install a lot of stuff including python, ruby, etc. with Wine|
python update.pyThis should fix the issues.
I just generated an encrypted payload without a lot of tinkering. You can play with the options, try out everything that veil offers, and get a much more 'veiled' payload. As far as bypassing antiviruses is concerned, experimentation is key. Keep trying out different options till one generates a payload that your target AV won't detect.
What to expect
Imagine your created payload is FUD (fully undetectable). Let's reiterate the steps you performed-
- Figured out how to use Kali (live USB, dual boot, VM, doesn't matter).
- Completed the steps given in a very easy to follow tutorial (I hope it was easy to follow).
Now ask yourself how hard it was to do the above steps, and how many people would be able to do it. Let's say 1 in every 100 persons who tries to do the steps 1 and 2 succeeds. This would mean, one in every 100 persons who wants to write a virus/payload/trojan that cannot be detected by any antivirus, would succeed. Would you want to live in a world where there are viruses which can't be detected by AVs, and these can be created by anyone with a bit of brain, internet access, and odds (1 against 100) in his favor?
Obviously not. The antivirus companies constantly keep evolving their algos, and the good ones would detect veil payloads. If you are clever, you can make the payload such that it's detected only by very few AVs, but making a completely undetectable payload is hard, as it should be. There are crypters available, which are not free of cost, which encrypt your payloads, and then they are FUD for a short while at least. However, just like searching google for hack facebook and typing the username on a bogus website doesn't give you the password of a facebook account, simple stuff like this won't make an invincible payload. However, since you did do a lot of genuine work, the payload can certainly bypass a lot of common AVs, and with a bit of effort, you can probably make it almost FUD.
So no, your payload won't be perfect, and yes, it's a good thing.