Робота з реєстром
Нам потрібно відстежувати зміни, які вносяться до значення реєстру AppInit_DLLs, яке дає змогу автоматично завантажувати бібліотека динамічного компонування (DLL) для певних процесів у системі. Пов’язане значення реєстру з подібними функціональними можливостями — AppCertDlls. Повні шляхи до значень реєстру:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
HKLM\SYSTEM\CurrentControlSet\Control\SESSION MANAGER\ AppCertDlls
Правило
<?xml version='1.0' encoding='UTF-8'?> <rule> <description> <name>AppInit DLL Registry Creation [A0101]</name> <category>Persistence</category> <os>Windows</os> <severity>80</severity> <mitreattackid>T1218.011</mitreattackid> <explanation>AppInit DLL is a mechanism that allows an arbitrary list of DLLs to be loaded into each user-mode process on the system. DLLs that are specified in the `AppInit_DLLs` value in the Registry key `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows` are loaded by user32.dll into (almost) every process that loads user32.dll. The AppInit DLL functionality is disabled in Windows 8 and later versions when secure boot is enabled.</explanation> <benignCauses>AppInit_DLLs are rarely used by specific software, such as graphic card support dlls or virtual machine software.</benignCauses> <maliciousCauses>AppInit_DLLs are sometimes used by malware to achieve persistence on the target machine.</maliciousCauses> <recommendedActions>1. Evaluate if the change to the Applnit_DLLs correlates with known software, a software update, patch cycles, etc. 2. Evaluate the process/module that made the change. 3. Check for presence of new/non-standard DLLs on the computer. 4. If a suspicious process/module or DLL is detected, start the incident response process (for example, disconnect the computer from the internet, update your antivirus product and scan the computer for malware, send samples for analysis, block modules, etc.).</recommendedActions> </description> <definition> <operations> <operation type="RegSetValue"> <operator type="OR"> <operator type="AND"> <operator type="OR"> <condition component="RegistryItem" property="Key" condition="starts" value="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows"/> <condition component="RegistryItem" property="Key" condition="starts" value="HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows"/> </operator> <condition component="RegistryItem" property="Key" condition="ends" value="Appinit_Dlls"/> </operator> <operator type="AND"> <condition component="RegistryItem" property="Key" condition="starts" value="HKLM\SYSTEM\ControlSet"/> <condition component="RegistryItem" property="Key" condition="ends" value="Control\SESSION MANAGER\AppCertDlls"/> </operator> </operator> </operation> </operations> </definition> <maliciousTarget name="current"/> <actions> <action name="TriggerDetection"/> <action name="StoreEvent"/> </actions> </rule> |
На що слід звернути увагу в наведеному вище прикладі правила:
1.Використовуйте скорочені значення HKEY замість повних, оскільки повні значення HKEY не зіставляються
2.Включення Wow6432Node для AppInit_DLLs. Це значення й багато інших значень дублюються в цьому розділі реєстру для підтримки x86 у системах x64. Нам також потрібно відстежувати це значення.
3.Зіставлення значення реєстру за допомогою умови ends. Спочатку ми вирішили зіставити ім’я значення реєстру AppInit_DLLs і перевірити, чи є шлях до значення реєстру бажаним. Теоретично, такий підхід має зменшити навантаження на сервер завдяки обчисленню умов за короткою схемою. Окрім того, можна використовувати повний шлях до значень реєстру для зіставлення (HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs).
4.Значення реєстру CurrentControlSet — це альтернативне символьне посилання, яке динамічно оцінюється операційною системою і вказує на ControlSet%number%. Оскільки Enterprise Inspector отримує шлях до реєстру зі значенням ControlSet%number%, ми розділяємо шлях до значення реєстру на два компоненти.