# Роль обратной разработки в понимании артефактов: когда документация — враг, а декомпилятор — друг Максим Суханов · CICADA8 Слайды · https://2025.moscow-forensics-day.workers.dev/slides/14-suhanov-obratnaya-razrabotka Текст слайдов распознан автоматически с картинок комплекта; мелкий текст внутри скриншотов распознаётся не всегда. --- ## Стр. 1 — 06:35:59 MOSCOW FORENSICS DAY '25 IVIL МАКСИМ СУХАНОВ «РОЛЬ ОБРАТНОЙ РАЗРАБОТКИ В ПОНИМАНИИ АРТЕФАКТОВ: КОГДА ДОКУМЕНТАЦИЯ — ВРАГ, А ДЕКОМПИЛЯТОР - ДРУГ» MFD MFD ## Стр. 2 — 06:36:15 CIOADA& Роль обратной разработки в понимании артефактов: когда документация - враг, а декомпилятор - друг Максим Суханов Руководитель направления обнаружения киберугроз и реагирования на инциденты CICADA8 ## Стр. 3 — 06:36:34 ОБО МНЕ • Ранее работал в BI.ZONE, Group-IB • 15лет в сферах Digital Forensics, Incident Response, Malware Analysis, Threat Intelligence • Занимался обратной разработкой форматов NTFS, FAT12/16/32, exFAT, реестра Windows, теневых копий • Создаю утилиты и библиотеки: - уагр (парсер файлов реестра Windows), dfir_ntfs (парсер томов NTFS, FAT12/16/32 exFAT, а также теневых копий), - winmem_decompress (распаковщик сжатых страниц из дампов памяти), - и многое другое... Ищу и нахожу уязвимости в парсерах файловых систем, загрузчиках и других местах МАКСИМ СУХАНОВ Руководитель направления обнаружения киберугроз и реагирования на инциденты CICADA8 m.suhanov@cicada8.ru CIOADA® ## Стр. 4 — 06:37:40 Проблема • Есть наблюдаемые артефакты, следы, аномалии.. • Как, в принципе, обосновать их интерпретацию? • Два подхода: • Сослаться на кого-то: статью, книгу, документацию, иные чужие результаты. • Найти ответ и обосновать самому: провести экспертный эксперимент и т. п. CIOADA& ## Стр. 5 — 06:38:21 Проблема в одной цитате «Я доверяю документации» CIDADA: ## Стр. 6 — 06:38:51 02 «Обман» со стороны вендоров CIOADA® ## Стр. 7 — 06:39:26 Временных меток в NTFS нет! • Это нам сообщает официальная документация [1][2]: STANDARD_INFORMATION structure 01/06/2021 [This structure is valid only for version 3 of NTFS volumes; it may be altered in future versions.] Contains the standard information attribute. This attribute is present in every base file record and must be resident. Syntax 4a Copy typedef struct _STANDARD_INFORMATION ( UCHAR Reserved[0x30]: ULONG OwnerId; ULONG SecurityId; } STANDARD_INFORMATION, *PSTANDARD_INFORMATION; Members Reserved Reserved. Ownerld The identifier of the file owner, from the security index. CIOADA8 Securityld The security identifier for the file. ## Стр. 8 — 06:40:01 FILE_NAME structure 01/07/2021 [This structure is valid only for version 3 of NTFS volumes; it may be altered in future versions.] Represents a file name attribute. A file has one file name attribute for every directory it is entered into. Syntax Copy typedef struct _FILE_NAME ( FILE_REFERENCE ParentDirectory; UCHAR Reserved[8x38]; UCHAR FileNameLength; UCHAR Flags; WCHAR FileName 1]; } FILE_NAME, *PFILE_NAME; Members ParentDirectory A file reference to the directory that indexes to this name. See MFT_SEGMENT_REFERENCE. Reserved Reserved. FileNameLength The length of the file name, in Unicode characters. Flags The file name flags. FILE NAME_NTFS (0x01) FILE_NAME_DOS (0x02) CIOADAB FileName The first character of the file name. ## Стр. 9 — 06:40:29 Ответ • Видимо, вендор защищает служебные структуры NTFS от «кривых ручек». • Поэтому «ненужные» поля «зарезервированы». CIOADA8 ## Стр. 10 — 06:41:09 03 Забыли, что все уже не так CIOADAS ## Стр. 11 — 06:42:20 Пропали пользовательские данные из теневой копии! • А такого быть не может [3]! Can I exclude files from a shadow copy to save space? VSS is designed to create shadow copies of entire volumes. Temporary files, such as paging files, are automatically History active omitted from shadow copies to save space. 0000 1F80: 00 00 00 00 00 00 00 00 00 09 00 09 00 00 00 00 0000 1F90: 00 00 IFAO: 0000 To exclude specific files from shadow copies, use the following registry key: FilesNot ToSnapshot. ДрЕ Притка 0000 1FB0: 0000 1FCO: 0000 1FDO: • Note 0000 1FEO: 0000 1FFO: 0000 2000: 00 00 08 00 The FilesNotToSnapshot registry key is intended to be used only by applications. Users who attempt to use it History vss dfir ntfs encounter limitations such as: 00 00 00 00 00 00 00 00 06 0000 1F80: 00 08 00 00 00 00 0000 1F90: 00 00 0000 IFAO: • It can't delete files from a shadow copy that was created on a Windows Server by using the Previous Versions 0000 1FB0: 0000 1FCO: feature. 0000 1FDO: • It can't delete files from shadow copies for shared folders. 0000 1FEO: 0000 1FFO- • It can delete files from a shadow copy that was created by using the Diskshadow utility, but it can't delete files 0000 2000: 00 00 from a shadow copy that was created by using the VssAdmin utility. • Files are deleted from a shadow copy on a best-effort basis. This means that they aren't guaranteed to be deleted. CIOADA: For more information, see Excluding Files from Shadow Copies. ## Стр. 12 — 06:43:58 Ответ • Начиная с Windows 8, по умолчанию пользовательские файлы исключаются из теневой копии. Но в некоторых случаях все равно попадают! • Это поведение официально не было задокументировано. • Известны, как минимум, два ответа вендора клиентам, где это поведение описано... • Из них один случай в контексте атаки шифровальщика! [4] We have also received a response from Microsoft indicating that it is highly likely this function is the cause of the file corruption. Although the reasons for this specification change have not been made public, we speculate that it is related to performance issues from saving all data into a snapshot, utilization efficiency issues in the snapshot area, excessive expansion of user data, and the fact that "file history" is now recommended for backing up user data. CIDADA ## Стр. 13 — 06:45:50 Детали • Сначала теневая копия создается, затем из нее исключаются кластеры с пользовательскими данными. • За процесс исключения отвечает «SrTasks.exe». • Пользовательские файлы находятся по встроенным правилам (в частности, по расширениям) путем итерации по записям в $MFT. CIDADAB ## Стр. 14 — 06:47:42 Задокументировали другую реализацию файловой системы... • Не от Windows NT, а от Windows 95 [5]! Yes, the (in) famous fatgen103.pdf document, retired from Microsoft's own site, but still available at https://web.archive.org/web/20210723100623/http://download.microsoft.com/ It sternly says at page 14: "It is really quite simple how this works. The FAT type one of FAT12, FAT16, or FAT32-is determined by the count of clusters on the volume and nothing else." But see below...: \> But as Alain pointed Microsoft FAT implementation (fastfat.sys) for > FAT32 detection does not use number of clusters, but rather explicit > marking of FAT32. Same behavior has Linux kernel implementation \> (msdos.ko and vfat.ko) and same in dosfstools project. Hence this > non-standard FAT32 can be still created by mkfs. fat. Actually, what I meant in my previous mail was that *everything else* that is referred to in the FAT32 extended boot block (root directory location, etc.) would depend on this explicit marking (fatLen/bigFatLen), but not the number of FAT bits themselves. However, your remark got me thinking, and so I tried it out on a Windows 10 VM. ...and lo and behold: the mere presence of a FAT32 extended boot block (as signaled by fat_len being 0) was enough to make it use 32 fat bits, even if the number of clusters was too low for FAT32. CIOADA& Sorry for having been to easily misled by an assertive, but nonfactual, Microsoft statement. ender presence of 132 extended boat blunt as weet for that ingle consider appropriate number of FAT bits. Regards, Alain ## Стр. 15 — 06:48:43 04 Кейс: Prefetch CIOADA& ## Стр. 16 — 06:49:04 Что хранится в этих файлах? Op-EXPLORER.EXE-[...H-[...].pf CIDADA• ## Стр. 17 — 06:49:46 Гипотезы и версии 1. Уж не троян ли? 2. [...] когда сама программа запрашивает отслеживание самой себя 3. boot prefetch 4. [...] процесс, [...] живущий исключительно в оперативке Правильный ответ есть в блоге про ASP.NET [6], но там артефакт (файл «Op-*.pf») упоминается вскользь.. CIOADA& ## Стр. 18 — 06:50:49 Правильный ответ из блога The features simple uses the operation recorder API. See OperationStart and OperationEnd APls on msdn. This APls require an integer used as an Id of the operation. We use a hash code of the app domain app id, which is a string. string domainId = HttpRuntime.AppDomainAppId; int operationId = domainId.GetHashCode(); The OperationStart call is made the first time the app domain is created. The OperationEnd API is called at the end of the request in which we called OperationStart. A .pf file should be created on the prefetch directory: C:>dir SwindirsPrefetch Volume in drive C has no label. Volume Serial Number is CC5B-113C Directory of C:WindowsPrefetch 02/16/2012 04:17 PM