Query: detect Detects when an attacker modifies values of the Disk Cleanup Handler in the registry to achieve persistence via autorun. in logs
Matching passage: Sigma rule: Detects when an attacker modifies values of the Disk Cleanup Handler in the registry to achieve persistence via autorun.. Logsource: windows / registry_set. Rule: title: Persistence Via Disk Cleanup Handler - Autorun id: d4e2745c-f0c6-4bde-a3ab-b553b3f693cc status: test description: 'Detects when an attacker modifies values of the Disk Cleanup Handler in the registry to achieve persistence via autorun. The disk cleanup manager is part of the operating system. It displays the dialog box […] The user has the option of enabling or disabling individual handlers by selecting or clearing their check box in the disk cleanup manager''s UI. Although Windows comes with a number of disk cleanup handlers, they aren''t designed to handle files produced by other applications. Instead, the disk cleanup manager is designed to be flexible and extensible by enabling any developer to implement and register their own disk cleanup handler. Any developer can extend the available disk cleanup services by implementing and registering a disk cleanup handler. ' references: - https://persistence-info.github.io/Data/diskcleanuphandler.html - https://www.hexacorn.com/blog/2018/09/02/beyond-good-ol-run-key-part-86/ author: Nasreddine Bencherchali (Nextron Systems) date: 2022-07-21 modified: 2023-08-17 tags: - attack.persistence logsource: category: registry_set product: windows detection: root: TargetObject|contains: \SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\ selection_autorun: TargetObject|contains: \Autorun Details: DWORD (0x00000001) selection_pre_after: TargetObject|contains: - \CleanupString - \PreCleanupString Details|contains: - cmd - powershell - rundll32 - mshta - cscript - wscript - wsl - \Users\Public\ - \Windows\TEMP\ - \Microsoft\Windows\Start Menu\Programs\Startup\ condition: root and 1 of selection_* falsepositives: - Unknown level: medium
Near-miss passage: Sigma rule: Detects creation of default named pipe used by the DiagTrackEoP POC, a tool that abuses "SeImpersonate" privilege.. Logsource: windows / pipe_created. Rule: title: HackTool - DiagTrackEoP Default Named Pipe id: 1f7025a6-e747-4130-aac4-961eb47015f1 status: test description: Detects creation of default named pipe used by the DiagTrackEoP POC, a tool that abuses "SeImpersonate" privilege. references: - https://github.com/Wh04m1001/DiagTrackEoP/blob/3a2fc99c9700623eb7dc7d4b5f314fd9ce5ef51f/main.cpp#L22 author: Nasreddine Bencherchali (Nextron Systems) date: 2022-08-03 modified: 2023-08-07 tags: - attack.privilege-escalation logsource: product: windows category: pipe_created definition: Note that you have to configure logging for Named Pipe Events in Sysmon config (Event ID 17 and Event ID 18). The basic configuration is in popular sysmon configuration (https://github.com/SwiftOnSecurity/sysmon-config), but it is worth verifying. You can also use other repo, e.g. https://github.com/Neo23x0/sysmon-config, https://github.com/olafhartong/sysmon-modular. How to test detection? You can check powershell script from this site https://svch0st.medium.com/guide-to-named-pipes-and-hunting-for-cobalt-strike-pipes-dc46b2c5f575 detection: selection: PipeName|contains: thisispipe condition: selection falsepositives: - Unlikely level: critical