We are hunting for techniques and tactics of attackers using Prefetch files

We are hunting for techniques and tactics of attackers using Prefetch files

Trace files, or Prefetch files, have been present in Windows since the XP era. Since then, they have helped digital forensics specialists and computer incident responders find traces of program launches, including malicious ones. Leading computer forensics specialist at Group-IB Oleg Skulkin discusses what can be found using Prefetch files and how to do it.

Prefetch files are stored in the directory %SystemRoot%Prefetch and serve to speed up the program launch process. If we look at any of these files, we will see that its name consists of two parts: the name of the executable file and a checksum of the path to it, made up of eight characters.

Prefetch files contain a wealth of useful information from a forensic perspective: the name of the executable file, the number of times it was executed, lists of files and directories with which the executable interacted, and, of course, timestamps. Forensic experts typically use the creation date of a specific Prefetch file to determine the date of the program's first launch. Additionally, these files store the date of its last launch, and starting from version 26 (Windows 8.1) — timestamps for the seven most recent launches.

Let’s take one of the Prefetch files, extract data from it using PECmd by Eric Zimmerman, and look at each part. For demonstration, I will extract data from the file CCLEANER64.EXE-DE05DBE1.pf.

So, let's start from the top. Naturally, we have the creation, modification, and access timestamps for the file:

We are hunting for techniques and tactics of attackers using Prefetch files
Following that are the name of the executable file, the checksum of the path to it, the size of the executable file, as well as the version of the Prefetch file:

We are hunting for techniques and tactics of attackers using Prefetch files
Since we are dealing with Windows 10, next we will see the number of launches, the date and time of the last launch, and seven timestamps indicating previous launch dates:

We are hunting for techniques and tactics of attackers using Prefetch files
Following that is information about the volume, including its serial number and creation date:

We are hunting for techniques and tactics of attackers using Prefetch files
And last but not least — a list of directories and files with which the executable interacted:

We are hunting for techniques and tactics of attackers using Prefetch files
Laten we ons richten op de mappen en bestanden waarmee het uitvoerbare bestand interactie heeft gehad. Deze gegevens stellen digitale forensische specialisten, incidentresponsprofessionals en experts in proactieve dreigingsdetectie in staat om niet alleen vast te stellen of een bepaald bestand is uitgevoerd, maar ook, in sommige gevallen, om de specifieke tactieken en technieken van aanvallers te reconstrueren. Tegenwoordig maken cybercriminelen vaak gebruik van tools voor het onherstelbaar wissen van gegevens, zoals SDelete, waardoor de mogelijkheid om tenminste sporen van het gebruik van bepaalde tactieken en technieken te herstellen cruciaal is voor elke moderne verdediger — een computerforensisch expert, incidentresponsprofessional of Threat Hunter-expert.

Laten we beginnen met de tactiek Initial Access (TA0001) en de meest populaire techniek — Spearphishing Attachment (T1193). Sommige cybercriminaliteitsgroepen benaderen de keuze voor dergelijke bijlagen vrij creatief. Zo gebruikte de groep Silence hiervoor bestanden in CHM-formaat (Microsoft Compiled HTML Help). Dit brengt ons bij een andere techniek — Compiled HTML File (T1223). Dergelijke bestanden worden uitgevoerd met behulp van hh.exe, wat betekent dat als we gegevens uit het Prefetch-bestand extraheren, we zullen weten welk specifiek bestand door het slachtoffer was geopend:

We are hunting for techniques and tactics of attackers using Prefetch files
Laten we verdergaan met voorbeelden uit echte zaken en overgaan naar de volgende tactiek Execution (TA0002) en techniek CSMTP (T1191). Microsoft Connection Manager Profile Installer (CMSTP.exe) kan door aanvallers worden gebruikt om schadelijke scripts uit te voeren. Een goed voorbeeld is de groep Cobalt. Als we gegevens uit het Prefetch-bestand extraheren, cmstp.exe, kunnen we opnieuw achterhalen wat er precies werd uitgevoerd:

We are hunting for techniques and tactics of attackers using Prefetch files
Een andere populaire techniek is Regsvr32 (T1117). Regsvr32.exe wordt ook vaak door aanvallers gebruikt om uit te voeren. Hier is weer een voorbeeld van de groep Cobalt: als we gegevens uit het Prefetch-bestand extraheren, regsvr32.exe, zullen we opnieuw zien wat er werd uitgevoerd:

We are hunting for techniques and tactics of attackers using Prefetch files
De volgende tactieken zijn Persistence (TA0003) en Privilege Escalation (TA0004), evenals Application Shimming (T1138) als techniek. Deze techniek werd door Carbanak/FIN7 gebruikt om zich in systemen te verankeren. Gewoonlijk wordt hiervoor gewerkt met databases met informatie over programma-incompatibiliteit (.sdb) met behulp van sdbinst.exe. Het Prefetch-bestand van dit uitvoerbare bestand kan ons helpen te achterhalen wat de namen van deze databases zijn en waar ze zich bevinden:

We are hunting for techniques and tactics of attackers using Prefetch files
Zoals te zien is in de illustratie, hebben we niet alleen de bestandsnaam die is gebruikt voor de installatie, maar ook de naam van de geïnstalleerde database.

Laten we kijken naar een van de meest typische voorbeelden van netwerkpromotie (TA0008) — PsExec, dat gebruikmaakt van administratieve gedeelde bronnen (T1077). Een dienst met de naam PSEXECSVC (natuurlijk kan ook elke andere naam worden gebruikt als de aanvallers de parameter hebben gebruikt -r) wordt op het doel systeem aangemaakt, dus als we gegevens uit het Prefetch-bestand extraheren, zien we dat het volgende is uitgevoerd:

We are hunting for techniques and tactics of attackers using Prefetch files
Ik sluit af met waar ik begon — het verwijderen van bestanden (T1107). Zoals ik al eerder aangaf, gebruiken veel aanvallers SDelete voor het voorgoed verwijderen van bestanden in verschillende fases van de aanvalscyclus. Als we de gegevens uit het Prefetch-bestand bekijken sdelete.exe, dan zien we wat er precies is verwijderd:

We are hunting for techniques and tactics of attackers using Prefetch files

Natuurlijk is dit geen uitputtende lijst van technieken die kunnen worden ontdekt tijdens de analyse van Prefetch-bestanden, maar het zou voldoende moeten zijn om te begrijpen dat dergelijke bestanden niet alleen kunnen helpen om sporen van opstarten te vinden, maar ook om specifieke tactieken en technieken van aanvallers te reconstrueren.

Bron: habr.com

Koop betrouwbare webhosting met bescherming tegen DDoS, VPS VDS servers 🔥 Koop betrouwbare webhosting met bescherming tegen DDoS, VPS VDS servers | ProHoster