{"id":961,"date":"2018-10-19T18:55:13","date_gmt":"2018-10-19T18:55:13","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=961"},"modified":"2018-10-22T23:49:40","modified_gmt":"2018-10-22T23:49:40","slug":"antivirus-evasion-bypassing-av-with-veil","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/19\/antivirus-evasion-bypassing-av-with-veil\/","title":{"rendered":"Antivirus Evasion : Bypassing AV with Veil"},"content":{"rendered":"<p>In real life pentesting scenarios, the antivirus is an added layer of security, which we have conveniently ignored so far. However, in this tutorial we will see how we can encrypt the payload and make it harder for the AV(antivirus) to detect it.<\/p>\n<h3>Prerequisites<\/h3>\n<p>You 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&#8217;t do so again.<\/p>\n<p>If you haven&#8217;t got the prerequisites covered, I&#8217;d suggesting you start by <a href=\"http:\/\/www.kalitutorials.net\/2014\/02\/penetration-testing-hacking-xp.html\" target=\"_blank\" rel=\"noopener\">hacking into an unpatched Windows XP machine<\/a>.<\/p>\n<h3>Install Veil-evasion<\/h3>\n<p>This 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.<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p>sudo apt-get update<\/p><\/blockquote>\n<blockquote><p>sudo apt-get install veil-evasion<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>Type veil-evasion in the terminal and you&#8217;ll be asked if you want to continue with the installation.<\/p>\n<p><a href=\"https:\/\/1.bp.blogspot.com\/-zZXxLJYw7KY\/VrcR_2K4PYI\/AAAAAAAABk4\/4_e4REGdxlI\/s1600\/Veil%2BEvasion%2B1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/1.bp.blogspot.com\/-zZXxLJYw7KY\/VrcR_2K4PYI\/AAAAAAAABk4\/4_e4REGdxlI\/s320\/Veil%2BEvasion%2B1.png\" width=\"320\" height=\"110\" \/><\/a><br \/>\nType y. Wait for the installation to finish. It could take a while. The installation would ask you to install Python &amp; Ruby (don&#8217;t change installation directories even if it says that Python is already installed), which is just a matter of clicking <i>next <\/i>and <i>finish.<\/i><\/p>\n<h2>Veil Evasion &#8211; Creating a simple payload<\/h2>\n<p>Type<i> veil-evasion <\/i>on the terminal to start it.<\/p>\n<p><a href=\"https:\/\/2.bp.blogspot.com\/-hQIaIKBdWDE\/VrcSNqQcr9I\/AAAAAAAABlA\/mzNhNh3ahl8\/s1600\/Veil%2BEvasion%2B2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/2.bp.blogspot.com\/-hQIaIKBdWDE\/VrcSNqQcr9I\/AAAAAAAABlA\/mzNhNh3ahl8\/s320\/Veil%2BEvasion%2B2.png\" width=\"320\" height=\"192\" \/><\/a><br \/>\n1) Type list to see available payloads.<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p>list<\/p><\/blockquote>\n<p>2) Use any payload you want to. I&#8217;m using python\/shellcode_inject\/flat. Type<\/p>\n<blockquote><p>use python\/shellcode_inject\/flat<\/p><\/blockquote>\n<p><a href=\"https:\/\/1.bp.blogspot.com\/-ioDjSosS7nA\/VrcSAEiKrmI\/AAAAAAAABk8\/bUTlqR50UNU\/s1600\/Veil%2BEvasion%2B3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/1.bp.blogspot.com\/-ioDjSosS7nA\/VrcSAEiKrmI\/AAAAAAAABk8\/bUTlqR50UNU\/s320\/Veil%2BEvasion%2B3.png\" width=\"320\" height=\"138\" \/><\/a><br \/>\n3) You can use set option to change any values you want to change. We don&#8217;t need that right now. Type info to see the settings you can change.<\/p>\n<blockquote><p>info<\/p><\/blockquote>\n<p>4) Type generate<\/p>\n<blockquote><p>generate<\/p><\/blockquote>\n<p><a href=\"https:\/\/3.bp.blogspot.com\/-RuzStnPcBSE\/VrcSqsP2xeI\/AAAAAAAABlQ\/ze0kRJdK3wk\/s1600\/Veil%2BEvaion%2B4.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/3.bp.blogspot.com\/-RuzStnPcBSE\/VrcSqsP2xeI\/AAAAAAAABlQ\/ze0kRJdK3wk\/s320\/Veil%2BEvaion%2B4.png\" width=\"320\" height=\"143\" \/><\/a><br \/>\n5) Choose option 1<br \/>\n<a href=\"https:\/\/1.bp.blogspot.com\/-ObH_njWdIIU\/VrcSqYcZ-AI\/AAAAAAAABlI\/mXzwLIOLIKI\/s1600\/Veil%2BEvasion%2B5.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/1.bp.blogspot.com\/-ObH_njWdIIU\/VrcSqYcZ-AI\/AAAAAAAABlI\/mXzwLIOLIKI\/s320\/Veil%2BEvasion%2B5.png\" width=\"320\" height=\"119\" \/><\/a><br \/>\n6) Press enter, or if you want to use some other exploit, then type it&#8217;s name.<br \/>\n7) 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.<br \/>\n<a href=\"https:\/\/1.bp.blogspot.com\/-MNteOV1KMmI\/VrcSqdpnnmI\/AAAAAAAABlM\/OSrUIOOWQI4\/s1600\/Veil%2BEvasion%2B6.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/1.bp.blogspot.com\/-MNteOV1KMmI\/VrcSqdpnnmI\/AAAAAAAABlM\/OSrUIOOWQI4\/s320\/Veil%2BEvasion%2B6.png\" width=\"320\" height=\"147\" \/><\/a><br \/>\n8) Give your payload a name. Then choose 1 or 2 for Payload creation method. I chose 1.<\/p>\n<p><a href=\"https:\/\/4.bp.blogspot.com\/-QPHk2L7eLX0\/VrcSrNAE-nI\/AAAAAAAABlU\/3iTuKbVv7PI\/s1600\/Veil%2BEvasion%2B7.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/4.bp.blogspot.com\/-QPHk2L7eLX0\/VrcSrNAE-nI\/AAAAAAAABlU\/3iTuKbVv7PI\/s320\/Veil%2BEvasion%2B7.png\" width=\"320\" height=\"168\" \/><\/a><\/p>\n<p>Your payload will get generated in a bit. Don&#8217;t upload it to online scanners, since they distribute it to different AV companies and the detection rate increases.<\/p>\n<p>PS: If you are having issues, scroll down to the troubleshooting section below.<\/p>\n<h2>Veil Evasion &#8211; Creating An encrypted payload<\/h2>\n<p>Let&#8217;s try to create an encypted payload, one which will be undetectable by most AVs.<\/p>\n<p>We&#8217;ll use AES encryption to encrypt the payload. This is a pretty strong algorithm and should provide pretty low detection rate.<\/p>\n<p>1) Select the payload (this step is the only difference between the encrypted payload and simple payload)<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p>use python\/shellcode_inject\/<b>aes_encrypt<\/b><\/p><\/blockquote>\n<table>\n<tbody>\n<tr>\n<td><a href=\"https:\/\/3.bp.blogspot.com\/-sMcg1YjYAs0\/V-48cqWkyII\/AAAAAAAAByw\/pjZzWPU-ruYaDqsTgZBnKI1edmHOE-c4QCLcB\/s1600\/Choose%2Bpayload.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/3.bp.blogspot.com\/-sMcg1YjYAs0\/V-48cqWkyII\/AAAAAAAAByw\/pjZzWPU-ruYaDqsTgZBnKI1edmHOE-c4QCLcB\/s320\/Choose%2Bpayload.png\" width=\"320\" height=\"214\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td>Don&#8217;t be confused by the directory at which I currently am in (\/Veil-Evasion\/Setup)<br \/>\nin all the screenshots.<br \/>\nI created a troubleshooting section below for which I was in this directory, and never<br \/>\nswitched back to home directory. This doesn&#8217;t change anything.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2) Look at the parameters\/options that we can choose<\/p>\n<blockquote><p>info<\/p><\/blockquote>\n<p><a href=\"https:\/\/3.bp.blogspot.com\/-0-Sh8AOgh-A\/V-48dBobitI\/AAAAAAAABy4\/01GffAilX_4X6DpWKjgX9vV1Ksl9JhAoACLcB\/s1600\/Generate%2Bpayload.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/3.bp.blogspot.com\/-0-Sh8AOgh-A\/V-48dBobitI\/AAAAAAAABy4\/01GffAilX_4X6DpWKjgX9vV1Ksl9JhAoACLcB\/s320\/Generate%2Bpayload.png\" width=\"320\" height=\"209\" \/><\/a><br \/>\n3) Change anything you want to change. I&#8217;m not changing anything and using all the default options.<br \/>\n4) Generate the encrypted payload.<\/p>\n<blockquote><p>generate<\/p><\/blockquote>\n<p>5) Choose option 1, press enter for default payload. Follow the same procedure as the previous case. Choose the LHOST, LPORT.<br \/>\n<a href=\"https:\/\/1.bp.blogspot.com\/-kNh8cUgrbGg\/V-48dAkgb_I\/AAAAAAAABzA\/YpTn6d7Gqm0W-djVRbJxsC392pUqUbl1wCLcB\/s1600\/Use%2Bmsfvenom.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/1.bp.blogspot.com\/-kNh8cUgrbGg\/V-48dAkgb_I\/AAAAAAAABzA\/YpTn6d7Gqm0W-djVRbJxsC392pUqUbl1wCLcB\/s320\/Use%2Bmsfvenom.png\" width=\"320\" height=\"211\" \/><\/a><br \/>\n6) Give your payload a name. I call it veiled.<\/p>\n<p>7) Choose 1 (pyinstaller).<\/p>\n<p><a href=\"https:\/\/4.bp.blogspot.com\/-Ys9p-IVM3m4\/V-48doOT4NI\/AAAAAAAABzE\/brzyAGPI-kkf4UNSWdtwb1VS9qbtOuezQCLcB\/s1600\/Use%2Bpyinstaller.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/4.bp.blogspot.com\/-Ys9p-IVM3m4\/V-48doOT4NI\/AAAAAAAABzE\/brzyAGPI-kkf4UNSWdtwb1VS9qbtOuezQCLcB\/s320\/Use%2Bpyinstaller.png\" width=\"320\" height=\"207\" \/><\/a><\/p>\n<p>Generated executable can be seen here-<br \/>\n\/usr\/share\/veil-output\/compiled\/veiled.exe<\/p>\n<table>\n<tbody>\n<tr>\n<td><a href=\"https:\/\/1.bp.blogspot.com\/-6NKDBFZqZrU\/V-48cjn1rHI\/AAAAAAAABy0\/CVfoLP0_M3YuYIHnCAGnMUVcWTiy6ZzvgCLcB\/s1600\/Encrypted%2Bpayload%2Bgenerated.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/1.bp.blogspot.com\/-6NKDBFZqZrU\/V-48cjn1rHI\/AAAAAAAABy0\/CVfoLP0_M3YuYIHnCAGnMUVcWTiy6ZzvgCLcB\/s320\/Encrypted%2Bpayload%2Bgenerated.png\" width=\"320\" height=\"213\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td>This is the second payload I created with the name veiled so it got changed to<br \/>\nveiled1.exe<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>That&#8217;s it, you now have a payload that can bypass a lot of AVs easily.<\/p>\n<h2>Troubleshooting<\/h2>\n<p>If you&#8217;re getting this error<\/p>\n<p>ERROR: Can&#8217;t find python.exe in \/root\/.config\/wine\/veil\/drive_c\/Python27\/<\/p>\n<p>Then it means apt-get failed you, and there are some uninstalled\/mis-configured dependencies<\/p>\n<p>Try this solution-<\/p>\n<blockquote><p>git clone https:\/\/github.com\/Veil-Framework\/Veil-Evasion.git<\/p><\/blockquote>\n<p>It&#8217;s going to be approximately a 300 MB download.<\/p>\n<p>then<\/p>\n<p>&nbsp;<\/p>\n<blockquote><p>cd Veil-Evasion\/setup\/<\/p><\/blockquote>\n<p>then<\/p>\n<blockquote><p>.\/setup.sh -c<\/p><\/blockquote>\n<table>\n<tbody>\n<tr>\n<td><a href=\"https:\/\/2.bp.blogspot.com\/-XtFAAShggQk\/V-4u9035iAI\/AAAAAAAAByM\/ScDauAFN1XMcKoltdrV_G6zJTpLVxNPEQCLcB\/s1600\/Veil%2BEvasion.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/2.bp.blogspot.com\/-XtFAAShggQk\/V-4u9035iAI\/AAAAAAAAByM\/ScDauAFN1XMcKoltdrV_G6zJTpLVxNPEQCLcB\/s320\/Veil%2BEvasion.png\" width=\"320\" height=\"214\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td>This step may take some time. You&#8217;ll have to wait.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table>\n<tbody>\n<tr>\n<td><a href=\"https:\/\/3.bp.blogspot.com\/-Yy7YfGXbtIo\/V-41a_VqLNI\/AAAAAAAAByc\/BccPEXgdrswGuw98237l537qDnijvcKRQCLcB\/s1600\/Python%2Binstallation.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/3.bp.blogspot.com\/-Yy7YfGXbtIo\/V-41a_VqLNI\/AAAAAAAAByc\/BccPEXgdrswGuw98237l537qDnijvcKRQCLcB\/s320\/Python%2Binstallation.png\" width=\"320\" height=\"281\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td>You&#8217;ll have to install a lot of stuff including python, ruby, etc. with Wine<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>then<\/p>\n<blockquote><p>cd ..\/setup\/<\/p><\/blockquote>\n<p>then<\/p>\n<blockquote><p>python update.py<\/p><\/blockquote>\n<p>This should fix the issues.<\/p>\n<h2>Tinkering<\/h2>\n<p>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 &#8216;veiled&#8217; 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&#8217;t detect.<\/p>\n<p>&nbsp;<\/p>\n<h2>What to expect<\/h2>\n<p>Imagine your created payload is FUD (fully undetectable). Let&#8217;s reiterate the steps you performed-<\/p>\n<ol>\n<li>Figured out how to use Kali (live USB, dual boot, VM, doesn&#8217;t matter).<\/li>\n<li>Completed the steps given in a very easy to follow tutorial (I hope it was easy to follow).<\/li>\n<\/ol>\n<p>Now ask yourself how hard it was to do the above steps, and how many people would be able to do it. Let&#8217;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&#8217;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?<\/p>\n<p>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&#8217;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&#8217;t give you the password of a facebook account, simple stuff like this won&#8217;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.<\/p>\n<p>So no, your payload won&#8217;t be perfect, and yes, it&#8217;s a good thing.<\/p>\n<p><a href=\"https:\/\/www.kalitutorials.net\/2016\/02\/antivirus-evasion-bypassing-av-with-veil.html\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In real life pentesting scenarios, the antivirus is an added layer of security, which we have conveniently ignored so far. However, in this tutorial we will see how we can encrypt the payload and make it harder for the AV(antivirus) to detect it. Prerequisites You should know how the basics of generating payloads using metasploit, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/19\/antivirus-evasion-bypassing-av-with-veil\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Antivirus Evasion : Bypassing AV with Veil&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-961","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=961"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/961\/revisions"}],"predecessor-version":[{"id":1253,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/961\/revisions\/1253"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}