<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by A.Atashgar on Medium]]></title>
        <description><![CDATA[Stories by A.Atashgar on Medium]]></description>
        <link>https://medium.com/@a-atashgar?source=rss-16165bbe9d37------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by A.Atashgar on Medium</title>
            <link>https://medium.com/@a-atashgar?source=rss-16165bbe9d37------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:35:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@a-atashgar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lateral Movement via BitLocker COM Hijacking: A Comprehensive Technical Analysis and Detection…]]></title>
            <link>https://medium.com/@a-atashgar/lateral-movement-via-bitlocker-com-hijacking-a-comprehensive-technical-analysis-and-detection-1340a9391a79?source=rss-16165bbe9d37------2</link>
            <guid isPermaLink="false">https://medium.com/p/1340a9391a79</guid>
            <dc:creator><![CDATA[A.Atashgar]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 01:53:57 GMT</pubDate>
            <atom:updated>2025-09-23T01:24:31.538Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lateral Movement via BitLocker COM Hijacking: A Comprehensive Technical Analysis and Detection Guide</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZwmUdXwUDXiGz9MJwNcicQ.jpeg" /></figure><h3>Introduction</h3><p>In the realm of cybersecurity, lateral movement techniques continue to pose significant challenges, enabling attackers to expand their foothold within compromised networks. A novel method disclosed by Fabian Mosch at the <strong>Troopers 2025 conference</strong> exploits Microsoft’s <strong>BitLocker</strong> full disk encryption feature to achieve remote code execution. Termed <strong>BitLocker COM Hijacking</strong>, this technique manipulates BitLocker’s <strong>Component Object Model (COM)</strong> objects through <strong>Windows Management Instrumentation (WMI)</strong>, allowing adversaries to execute arbitrary code under the context of an interactive user on a target host. If the user possesses elevated privileges, such as domain administrator rights, this can escalate to full domain compromise.</p><p><strong>BitLocker</strong>, a built-in Windows feature, provides full-volume encryption to safeguard data at rest, particularly on endpoints like workstations and laptops. It protects against unauthorized access in scenarios such as device theft or loss. However, as with many Windows components, BitLocker introduces processes, files, and registry keys that inadvertently increase the <strong>attack surface</strong>. This vulnerability arises from elements like COM objects and registry configurations, which attackers can abuse for malicious purposes.</p><p>Threat actors frequently adopt publicly disclosed techniques to minimize development efforts and hinder attribution. As highlighted in the original disclosure [1], organizations must integrate such modern methods into their offensive and defensive strategies. This article delves into the technique’s mechanics, execution playbook, and robust detection approaches, including a refined <strong>Splunk query</strong> and <strong>SIGMA rule</strong> developed through iterative lab testing. The goal is to equip detection engineers, threat hunters, and purple teams with actionable insights for proactive defense.</p><h3>Technique Overview</h3><p><strong>BitLocker COM Hijacking</strong> targets Windows endpoints where BitLocker is enabled, leveraging remote registry manipulation to inject malicious DLLs into trusted processes. The attack begins with session enumeration to identify interactive users, followed by enabling the RemoteRegistry service for WMI-based access. Attackers then modify specific registry keys to redirect COM object loading, coercing BitLocker processes to execute payloads.</p><p>Key CLSIDs involved:</p><ul><li><strong>{A7A63E5C-3877–4840–8727-C1EA9D7A4D50}</strong>: Vulnerable key loaded by BaaUpdate.exe.</li><li><strong>{ab93b6f1-be76–4185-a488-a9001b105b94}</strong>: BDEUILauncher class that spawns processes like BaaUpdate.exe and BdeUISrv.exe as the interactive user.</li></ul><p>The attack flow:</p><ol><li><strong>Enumeration</strong>: Identify logged-in users.</li><li><strong>Service Activation</strong>: Enable RemoteRegistry via WMI (EventID 7040).</li><li><strong>Registry Modification</strong>: Create InProcServer32 subkey under the CLSID to point to a malicious DLL (EventID 4657).</li><li><strong>Registry Access</strong>: Process accesses the hijacked key (EventID 4663).</li><li><strong>Process Execution</strong>: Trigger BitLocker processes to load the DLL (EventID 4688).</li></ol><p>This blends malicious activity with legitimate BitLocker operations, making it stealthy. It is most effective on client systems (Windows 10/11) but less so on servers where BitLocker is typically disabled.</p><h3>APIs and Dependencies</h3><p>The <strong>BitLockMove</strong> tool [2], a .NET-based proof-of-concept (PoC), simulates the attack. For remote session enumeration, it relies on undocumented Microsoft APIs from the winsta.dll library, associated with qwinsta.exe for displaying Remote Desktop sessions.</p><p>Exported APIs: | API | Function | | — — | — — | | WinStationOpenServerW | Open a handle to the specified server | | WinStationCloseServer | Close the handle to the server | | WinStationEnumerateW | Enumerate all sessions on the system | | WinStationQueryInformationW | Retrieve information about a session |</p><p>These APIs are undocumented but can be reverse-engineered from qwinsta.exe. Official alternatives include WTSEnumerateSessionsW from wtsapi32.dll. Detection should focus on image load events for winsta.dll or wtsapi32.dll in non-legitimate processes, such as through process injection (e.g., into qwinsta.exe or tsadmin.msc).</p><h3>Registry Manipulation</h3><p>The attack modifies the registry via WMI to enable RemoteRegistry and hijack COM objects. Sample code for enabling the service:</p><pre>static class RemoteRegistry<br>{<br>    static void EnableRemoteRegistryViaWMI(string computerName, string username = null, string password = null)<br>    {<br>        try<br>        {<br>            ConnectionOptions options = new ConnectionOptions();<br>            if (!string.IsNullOrEmpty(username) &amp;&amp; !string.IsNullOrEmpty(password))<br>            {<br>                options.Username = username;<br>                options.Password = password;<br>            }<br>            ManagementScope scope = new ManagementScope(<br>                $&quot;\\\\{computerName}\\root\\cimv2&quot;, options);<br>            scope.Connect();<br>            // Get the RemoteRegistry service<br>            ObjectQuery query = new ObjectQuery(&quot;SELECT * FROM Win32_Service WHERE Name=&#39;RemoteRegistry&#39;&quot;);<br>            ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);<br>            foreach (ManagementObject service in searcher.Get())<br>            {<br>                // Change startup type to Automatic<br>                ManagementBaseObject inParams = service.GetMethodParameters(&quot;ChangeStartMode&quot;);<br>                inParams[&quot;StartMode&quot;] = &quot;Automatic&quot;;<br>                service.InvokeMethod(&quot;ChangeStartMode&quot;, inParams, null);<br>                // Start the service<br>                service.InvokeMethod(&quot;StartService&quot;, null);<br>            }<br>        }<br>    }<br>}</pre><p>It then creates the registry path:</p><pre>\SOFTWARE\Classes\CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}</pre><p>Subkey InProcServer32 points to the malicious DLL. The BDEUILauncher interface (methods: BdeUIProcessStart, BdeUIContextTrigger, GetUserLogonTime) triggers BdeUISrv.exe, with BaaUpdate.exe vulnerable.</p><h3>Playbook</h3><p>BitLockMove executes from C2 frameworks like Empire using dotnet inline-execute for in-memory loading. Enumeration:</p><pre>dotnet inline-execute /home/kali/BitlockMove.exe mode=enum target=10.0.0.6</pre><p>Attack:</p><pre>dotnet inline-execute /home/kali/BitlockMove.exe mode=attack target=10.0.0.6 dllpath=C:\tmp\demon.x64.dll targetuser=ipurple\Administrator command=&quot;C:\tmp\demon.x64.exe&quot;</pre><p>Requirements: Local Administrator privileges. Cleanup deletes the DLL.</p><p>Detection Opportunities</p><p>Detecting <strong>BitLocker COM Hijacking</strong> requires a robust logging and monitoring setup to capture specific Windows events that indicate malicious activity. The technique generates distinct artifacts across service changes, registry modifications, and process creation, which can be correlated to identify the attack with high fidelity. This section outlines the prerequisites for collecting these logs, the specific events to monitor, and a detailed explanation of a comprehensive <strong>Splunk query</strong> and <strong>SIGMA rule</strong> designed to detect the attack. These detection mechanisms were developed and refined through iterative lab testing, ensuring they align with real-world scenarios as described in the original disclosure [1].</p><h3>Prerequisites for Log Collection</h3><p>To effectively detect <strong>BitLocker COM Hijacking</strong>, organizations must ensure the appropriate Windows event logs are collected and ingested into a <strong>Security Information and Event Management (SIEM)</strong> system like Splunk. Below are the key steps to set up logging:</p><ol><li><strong>Enable Windows Event Logging</strong>:</li></ol><ul><li><strong>Security Event Logs</strong>: Ensure the Windows Security log channel is enabled to capture <strong>EventID 4657</strong> (registry value creation), <strong>EventID 4663</strong> (registry object access), and <strong>EventID 4688</strong> (process creation). These logs require auditing to be configured:</li><li><strong>Group Policy Configuration</strong>: Navigate to <strong>Computer Configuration &gt; Policies &gt; Windows Settings &gt; Security Settings &gt; Advanced Audit Policy Configuration &gt; Audit Policies</strong> in Group Policy Management.</li><li><strong>Audit Registry</strong>: Enable <strong>Audit Object Access</strong> with “Success” auditing to capture 4657 and 4663 events. Use:</li><li>auditpol /set /subcategory:&quot;Registry&quot; /success:enable</li><li><strong>Audit Process Creation</strong>: Enable <strong>Audit Process Creation</strong> to capture 4688 events:</li><li>auditpol /set /subcategory:&quot;Process Creation&quot; /success:enable</li><li>Verify with:</li><li>auditpol /get /category:*</li><li><strong>System Event Logs</strong>: Enable the System log channel for <strong>EventID 7040</strong> (service start type changes). This is enabled by default in most Windows configurations but should be verified:</li><li>Check <strong>Event Viewer &gt; Windows Logs &gt; System</strong> for Service Control Manager events.</li></ul><ol><li><strong>Enable Detailed Registry Auditing</strong>:</li></ol><ul><li>For <strong>EventID 4657</strong> and <strong>4663</strong>, configure auditing for the specific registry path involved:</li><li>Path: <strong>HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID{A7A63E5C-3877–4840–8727-C1EA9D7A4D50}</strong>.</li><li>Use <strong>regedit</strong> or Group Policy to set auditing:</li><li>Right-click the CLSID key in <strong>regedit</strong>, select <strong>Permissions &gt; Advanced &gt; Auditing</strong>, and add auditing for “Everyone” with “Set Value” and “Query Value” permissions.</li><li>Alternatively, use PowerShell:</li><li>$acl = Get-Acl &quot;HKCU:\Software\Classes\CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}&quot; $rule = New-Object System.Security.AccessControl.RegistryAuditRule(&quot;Everyone&quot;, &quot;SetValue,QueryValue&quot;, &quot;Success&quot;, &quot;None&quot;) $acl.AddAuditRule($rule) Set-Acl -Path &quot;HKCU:\Software\Classes\CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}&quot; -AclObject $acl</li><li>This ensures registry modifications and accesses are logged.</li></ul><ol><li><strong>Configure Log Forwarding</strong>:</li></ol><ul><li>Use a log forwarder (e.g., <strong>Windows Event Forwarding</strong>, <strong>Splunk Universal Forwarder</strong>, or <strong>Sysmon</strong>) to send logs to your SIEM:</li><li><strong>Splunk Universal Forwarder</strong>: Install on endpoints and configure to collect <strong>Security</strong> and <strong>System</strong> logs:</li><li>Edit inputs.conf:</li><li>[WinEventLog://Security] disabled = 0 index = wineventlog renderXml = false [WinEventLog://System] disabled = 0 index = wineventlog renderXml = false</li><li><strong>Sysmon</strong>: Optionally, use Sysmon to enhance process creation (EventID 1) and registry events (EventIDs 12–14). Configure with a rule to monitor the CLSID path:</li><li>&lt;Sysmon&gt; &lt;EventFiltering&gt; &lt;RegistryEvent onmatch=&quot;include&quot;&gt; &lt;TargetObject name=&quot;BitLockerCLSID&quot; condition=&quot;contains&quot;&gt;CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}&lt;/TargetObject&gt; &lt;/RegistryEvent&gt; &lt;ProcessCreate onmatch=&quot;include&quot;&gt; &lt;Image condition=&quot;endswith&quot;&gt;baaupdate.exe&lt;/Image&gt; &lt;Image condition=&quot;endswith&quot;&gt;BdeUISrv.exe&lt;/Image&gt; &lt;/ProcessCreate&gt; &lt;/EventFiltering&gt; &lt;/Sysmon&gt;</li><li>Restart the forwarder or Sysmon service after configuration.</li></ul><ol><li><strong>Verify Log Ingestion</strong>:</li></ol><ul><li>In Splunk, run:</li><li>index=wineventlog EventCode IN (7040, 4657, 4663, 4688) | stats count by EventCode</li><li>Ensure all four EventIDs are present. If not, check auditing settings or forwarder configuration.</li></ul><ol><li><strong>Time Synchronization</strong>:</li></ol><ul><li>Ensure endpoints and the SIEM use synchronized time (e.g., via NTP) to enable accurate correlation within a <strong>5-minute timeframe</strong>.</li></ul><h3>Detection Strategies</h3><p>Detection focuses on correlating four key events:</p><ul><li><strong>EventID 7040</strong>: RemoteRegistry service start type change (e.g., from Disabled to Auto Start).</li><li><strong>EventID 4657</strong>: Creation of a registry value under the BitLocker CLSID.</li><li><strong>EventID 4663</strong>: Access to the same CLSID registry path.</li><li><strong>EventID 4688</strong>: Creation of suspicious processes (baaupdate.exe or BdeUISrv.exe).</li></ul><h4>Service Changes (EventID 7040)</h4><p>Changes to the <strong>RemoteRegistry</strong> service are a critical indicator, as the attack enables it for remote access. Monitor for transitions from <strong>Disabled</strong> to <strong>Auto Start</strong> or <strong>Manual Start</strong>.</p><p><strong>SIGMA Rule</strong>:</p><pre>title: Detection of Remote Registry Service Enablement<br>id: d2a4f7c1-6e23-4b88-b9d2-c1f2e8a4b7c5<br>status: experimental<br>description: Detects when the RemoteRegistry service start type is changed from Disabled to Manual or Automatic via System event 7040, excluding legitimate service control manager operations.<br>author: Panos Gkatziroulis<br>date: 2025-07-31<br>references:<br>  - https://kb.eventtracker.com/evtpass/evtpages/EventId_7040_ServiceControlManager_50628.asp<br>  - https://github.com/SigmaHQ/sigma/wiki/Detection-Engineering<br>tags:<br>  - attack.lateral_movement<br>logsource:<br>  product: windows<br>  service: system<br>  source: Microsoft-Windows-Service Control Manager<br>detection:<br>  selection:<br>    EventID: 7040<br>    ServiceName: &#39;RemoteRegistry&#39;<br>    OldStartType: &#39;Disabled&#39;<br>    NewStartType:<br>      - &#39;Manual Start&#39;<br>      - &#39;Auto Start&#39;<br>  legit_scm:<br>    SubjectProcessName|endswith: &#39;\\services.exe&#39;<br>    SubjectUserName: &#39;NT AUTHORITY\\SYSTEM&#39;<br>  condition: selection and not legit_scm<br>falsepositives:<br>  - Administrators manually reconfiguring Remote Registry for remote management.<br>  - Enterprise management tools adjusting service start types.<br>level: high</pre><p><strong>Splunk Query</strong>:</p><pre>index=wineventlog EventCode=7040 ServiceName=&quot;RemoteRegistry&quot; OldStartType=&quot;Disabled&quot; NewStartType IN (&quot;Manual Start&quot;, &quot;Auto Start&quot;) NOT (SubjectProcessName=&quot;*\\services.exe&quot; SubjectUserName=&quot;NT AUTHORITY\\SYSTEM&quot;)<br>| table _time ComputerName ServiceName OldStartType NewStartType Message</pre><p><strong>Key Fields</strong>:</p><ul><li><strong>ServiceName</strong>: RemoteRegistry</li><li><strong>OldStartType</strong>, <strong>NewStartType</strong>: Indicates the change (e.g., Disabled to Auto Start).</li><li><strong>Message</strong>: Contains the service change description (e.g., “RemoteRegistry enabled”).</li></ul><h4>Registry Modifications (EventID 4657 and 4663)</h4><p>The attack creates a registry value under <strong>HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID{A7A63E5C-3877–4840–8727-C1EA9D7A4D50}</strong> (4657) and accesses it (4663). The <strong>ObjectName</strong> must match between these events to confirm the same CLSID path is targeted.</p><p><strong>SIGMA Rule</strong>:</p><pre>title: Detect Access and Modification of BitLocker CLSID Key<br>id: 55a3b814-9d6c-4d9a-a3bc-36f4f1c8a29e<br>description: Detects registry value changes (4657), deletions (4660), or accesses (4663) against the COM CLSID under HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}.<br>author: Panos Gkatziroulis<br>date: 2025-08-01<br>references:<br>  - https://docs.microsoft.com/windows/security/threat-protection/auditing/event-4657<br>  - https://docs.microsoft.com/windows/security/threat-protection/auditing/event-4660<br>  - https://docs.microsoft.com/windows/security/threat-protection/auditing/event-4663<br>tags:<br>  - attack.lateral_movement<br>  - attack.t1021.003<br>logsource:<br>  product: windows<br>  service: security<br>detection:<br>  selection_4657:<br>    EventID: 4657<br>    ObjectName|contains: &#39;HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}&#39;<br>  selection_4660:<br>    EventID: 4660<br>    ObjectName|contains: &#39;HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}&#39;<br>  selection_4663:<br>    EventID: 4663<br>    ObjectName|contains: &#39;HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}&#39;<br>  condition: selection_4657 or selection_4660 or selection_4663<br>falsepositives:<br>  - Legitimate software registering or modifying COM objects under this CLSID.<br>  - User-initiated COM or shell operations.<br>level: high</pre><p><strong>Splunk Query</strong>:</p><pre>index=wineventlog (EventCode=4657 OperationType=&quot;New registry value created&quot; ObjectName=&quot;*CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}*&quot;) OR (EventCode=4663 ObjectName=&quot;*CLSID\{A7A63E5C-3877-4840-8727-C1EA9D7A4D50}*&quot;)<br>| transaction ComputerName ObjectName maxspan=5m<br>| where eventcount&gt;=2<br>| table _time ComputerName ObjectName OperationType NewValueType NewValue AccessMask ProcessName</pre><p><strong>Key Fields</strong>:</p><ul><li><strong>ObjectName</strong>: Must match between 4657 and 4663 (e.g., HKEY_CURRENT_USER\...\CLSID\{A7A63E5C-...}).</li><li><strong>OperationType</strong>: “New registry value created” for 4657.</li><li><strong>AccessMask</strong>: For 4663, values like 0x2 (Write) or 0x4 (ReadControl) indicate access type.</li><li><strong>NewValueType</strong>, <strong>NewValue</strong>: For 4657, indicate the registry value (e.g., REG_SZ, C:\tmp\demon.dll).</li></ul><h4>Process Creation (EventID 4688)</h4><p>Suspicious processes include <strong>baaupdate.exe</strong> (parent: <strong>explorer.exe</strong>) and <strong>BdeUISrv.exe</strong> (parent: <strong>svchost.exe</strong>).</p><p><strong>Splunk Query</strong>:</p><pre>index=wineventlog EventCode=4688 ( (process_name=&quot;baaupdate.exe&quot; AND parent_process_name=&quot;explorer.exe&quot;) OR (process_name=&quot;BdeUISrv.exe&quot; AND parent_process_name=&quot;svchost.exe&quot;) )<br>| table _time ComputerName parent_process_name process_name parent_process_id process_id</pre><p><strong>Key Fields</strong>:</p><ul><li><strong>process_name</strong>, <strong>parent_process_name</strong>: Indicate the process and its parent.</li><li><strong>process_id</strong>, <strong>parent_process_id</strong>: Unique identifiers for tracking.</li></ul><h3>Advanced Correlation Query (Splunk)</h3><p>The comprehensive <strong>Splunk query</strong> correlates all four events (7040, 4657, 4663, 4688) to detect the full attack chain. It ensures the <strong>ObjectName</strong> matches between 4657 and 4663, events occur on the same <strong>ComputerName</strong>, and are within a <strong>5-minute timeframe</strong>. The query outputs only the <strong>ServiceMessage</strong> for 7040 for clarity.</p><p><strong>Splunk Query</strong>:</p><pre>index=wineventlog EventCode IN (7040, 4657, 4663, 4688) <br>[ search index=wineventlog EventCode=7040 service=&quot;Remote Registry&quot; <br>  | fields ComputerName <br>  | dedup ComputerName <br>]<br>| where <br>    (EventCode=7040 AND service=&quot;Remote Registry&quot;) OR <br>    (EventCode=4657 AND Operation_Type=&quot;New registry value created&quot; AND Object_Name LIKE &quot;%CLSID%&quot;) OR <br>    (EventCode=4663 AND Object_Name LIKE &quot;%CLSID%&quot;) OR <br>    (EventCode=4688 AND (<br>        (process_name=&quot;baaupdate.exe&quot; AND parent_process_name=&quot;explorer.exe&quot;) OR <br>        (process_name=&quot;BdeUISrv.exe&quot; AND parent_process_name=&quot;svchost.exe&quot;)<br>    ))<br>| eval srvchngstsTime=if(EventCode=7040, _time, null)<br>| eval regvlsetTime=if(EventCode=4657, _time, null)<br>| eval reghandleTime=if(EventCode=4663, _time, null)<br>| eval procexecTime=if(EventCode=4688, _time, null)<br>| eval ServiceMessage=if(EventCode=7040, Message, null)<br>| eval ProcessName_4663=if(EventCode=4663, process, null)<br>| eval CLSID_Path=if(EventCode IN (4657, 4663), Object_Name, null)<br>| stats <br>    values(srvchngstsTime) AS srvchngstsTime <br>    values(regvlsetTime) AS regvlsetTime <br>    values(reghandleTime) AS reghandleTime <br>    values(procexecTime) AS procexecTime <br>    values(ServiceMessage) AS ServiceMessage <br>    values(CLSID_Path) AS CLSID_Path <br>    values(New_Value_Type) AS New_Value_Type <br>    values(New_Value) AS New_Value<br>    values(Access_Mask) AS AccessMask <br>    values(ProcessName_4663) AS ProcessName_4663 <br>    values(parent_process_id) AS parent_process_id <br>    values(parent_process_name) AS parent_process_name <br>    values(process_id) AS process_id <br>    values(process_name) AS process_name <br>    values(TimeDiff1) AS TimeDiff_Service_to_Registry <br>    values(TimeDiff2) AS TimeDiff_Registry_to_Handle <br>    values(TimeDiff3) AS TimeDiff_Handle_to_Process <br>    count(eval(EventCode=7040)) AS ServiceEvents <br>    count(eval(EventCode=4657)) AS RegistryEvents <br>    count(eval(EventCode=4663)) AS HandleEvents <br>    count(eval(EventCode=4688)) AS ProcessEvents <br>    by ComputerName<br>| where ServiceEvents&gt;0 AND RegistryEvents&gt;0 AND HandleEvents&gt;0 AND ProcessEvents&gt;0 AND isnotnull(CLSID_Path)<br>| eval srvchngstsTime=strftime(srvchngstsTime, &quot;%Y-%m-%d %H:%M:%S&quot;)<br>| eval regvlsetTime=strftime(regvlsetTime, &quot;%Y-%m-%d %H:%M:%S&quot;)<br>| eval reghandleTime=strftime(reghandleTime, &quot;%Y-%m-%d %H:%M:%S&quot;)<br>| eval procexecTime=strftime(procexecTime, &quot;%Y-%m-%d %H:%M:%S&quot;)<br>| table <br>    ComputerName <br>    srvchngstsTime<br>    ServiceMessage<br>    regvlsetTime<br>    CLSID_Path <br>    New_Value_Type <br>    New_Value <br>    reghandleTime <br>    ProcessName_4663<br>    AccessMask <br>    procexecTime<br>    parent_process_id<br>    parent_process_name <br>    process_id<br>    process_name <br>| rename <br>    ComputerName AS &quot;Host&quot; <br>    CLSID_Path AS &quot;CLSID Path&quot; <br>    srvchngstsTime AS &quot;Service Change Time&quot; <br>    ServiceMessage AS &quot;Service Message&quot; <br>    regvlsetTime AS &quot;Registry Change Time&quot; <br>    New_Value_Type AS &quot;Registry Value Type&quot; <br>    New_Value AS &quot;Registry Value&quot; <br>    reghandleTime AS &quot;Handle Creation Time&quot; <br>    AccessMask AS &quot;Access Mask&quot; <br>    ProcessName_4663 AS &quot;Process Accessing Registry&quot; <br>    procexecTime AS &quot;Process Execution Time&quot; <br>    parent_process_name AS &quot;Parent Process&quot; <br>    process_name AS &quot;Process Name&quot; <br>    parent_process_id AS &quot;Parent Process ID&quot; <br>    process_id AS &quot;Process ID&quot; <br>| sort - &quot;Service Change Time&quot;</pre><p><strong>Query Breakdown</strong>:</p><ul><li><strong>Time Scope and Index</strong>: earliest=-1h index=wineventlog limits the search to the last hour in the wineventlog index, optimizing performance.</li><li><strong>Subsearch</strong>: Filters for hosts with <strong>EventID 7040</strong> (RemoteRegistry changes) to reduce noise:</li><li>[ search earliest=-1h index=wineventlog EventCode=7040 ServiceName=&quot;RemoteRegistry&quot; | fields ComputerName | dedup ComputerName ]</li><li><strong>Event Filtering</strong>: Selects relevant events:</li><li><strong>7040</strong>: ServiceName=&quot;RemoteRegistry&quot;.</li><li><strong>4657</strong>: OperationType=&quot;New registry value created&quot; AND ObjectName LIKE &quot;%CLSID%&quot;.</li><li><strong>4663</strong>: ObjectName LIKE &quot;%CLSID%&quot;.</li><li><strong>4688</strong>: Suspicious processes (baaupdate.exe with parent explorer.exe, or BdeUISrv.exe with parent svchost.exe).</li><li><strong>Time Calculations</strong>: eval commands assign timestamps (srvchngstsTime, regvlsetTime, etc.) and calculate time differences (TimeDiff1, TimeDiff2, TimeDiff3) to ensure events occur within a 5-minute window.</li><li><strong>Correlation</strong>: stats groups events by ComputerName and CLSID_Path (matching ObjectName between 4657 and 4663):</li><li>| stats ... by ComputerName, CLSID_Path</li><li><strong>Filtering</strong>: where ServiceEvents&gt;0 AND RegistryEvents&gt;0 AND HandleEvents&gt;0 AND ProcessEvents&gt;0 AND isnotnull(CLSID_Path) ensures all four events are present with a matching CLSID.</li></ul><h3>Advanced Correlation (SIGMA Rule)</h3><p>The <strong>SIGMA rule</strong> provides a SIEM-agnostic detection mechanism, translatable to Splunk, Elastic, or other platforms:</p><pre>title: Remote Registry Service Change (7040)<br>id: 5c1b0d38-2a2e-4b48-9f3d-2f7f0bc3c7a9<br>name: rr_7040<br>status: experimental<br>description: Detects a change to the RemoteRegistry service state (Event ID 7040).<br>author: AAtashGar<br>date: 2025/09/23<br>references:<br>    - https://ipurple.team/2025/08/04/lateral-movement-bitlocker/<br>    - https://github.com/rtecCyberSec/BitlockMove<br>logsource:<br>    product: windows<br>    service: system<br>detection:<br>    sel:<br>        EventID: 7040<br>        ServiceName: RemoteRegistry<br>    condition: sel<br>level: medium<br>falsepositives:<br>    - Admin changes<br><br>---<br>title: New CLSID Registry Value Created (4657)<br>id: 9f6a5f04-4f2c-4b6a-9a42-6f0b9f8e5b1e<br>name: clsid_new_4657<br>status: experimental<br>description: Detects creation of a new registry value in CLSID path.<br>author: AAtashGar<br>date: 2025/09/23<br>references:<br>    - https://ipurple.team/2025/08/04/lateral-movement-bitlocker/<br>    - https://github.com/rtecCyberSec/BitlockMove<br>logsource:<br>    product: windows<br>    service: security<br>detection:<br>    sel:<br>        EventID: 4657<br>        OperationType: &quot;New registry value created&quot;<br>        ObjectName|contains: &quot;CLSID&quot;<br>    condition: sel<br>level: medium<br>falsepositives:<br>    - Legitimate software installation<br><br>---<br>title: CLSID Path Access/Handle (4663)<br>id: 0a8b8a5b-0a22-4c7c-9f7d-3bdb6d7da8c1<br>name: clsid_access_4663<br>status: experimental<br>description: Detects handle or access to CLSID path.<br>author: AAtashGar<br>date: 2025/09/23<br>references:<br>    - https://ipurple.team/2025/08/04/lateral-movement-bitlocker/<br>    - https://github.com/rtecCyberSec/BitlockMove<br>logsource:<br>    product: windows<br>    service: security<br>detection:<br>    sel:<br>        EventID: 4663<br>        ObjectName|contains: &quot;CLSID&quot;<br>    condition: sel<br>level: medium<br>falsepositives:<br>    - Legitimate registry access by system tools<br><br>---<br>title: Suspicious Process Creation Related to BitLocker COM Hijack (4688)<br>id: 6b7b2c2d-1f3e-45d9-8b8e-3e6c1c9a0d55<br>name: proc_bitlocker_4688<br>status: experimental<br>description: Detects creation of specific processes potentially used in BitLocker COM hijack scenario.<br>author: AAtashGar<br>date: 2025/09/23<br>references:<br>    - https://ipurple.team/2025/08/04/lateral-movement-bitlocker/<br>    - https://github.com/rtecCyberSec/BitlockMove<br>logsource:<br>    category: process_creation<br>detection:<br>    s1:<br>        EventID: 4688<br>        Image|endswith: &#39;\baaupdate.exe&#39;<br>        ParentImage|endswith: &#39;\explorer.exe&#39;<br>    s2:<br>        EventID: 4688<br>        Image|endswith: &#39;\BdeUISrv.exe&#39;<br>        ParentImage|endswith: &#39;\svchost.exe&#39;<br>    condition: s1 or s2<br>level: high<br>falsepositives:<br>    - Rare but possible legitimate executions<br><br>---<br>title: Lateral Movement via BitLocker COM Hijacking (temporal)<br>id: 3f3f6a91-0e6a-4a6e-9a3b-0f6c7e9d2a44<br>status: experimental<br>description: Correlates service change (7040), registry creation (4657), registry access (4663),<br>  and suspicious process creation (4688) within a short timeframe on the same host.<br>author: AAtashGar<br>date: 2025/09/23<br>references:<br>    - https://ipurple.team/2025/08/04/lateral-movement-bitlocker/<br>    - https://github.com/rtecCyberSec/BitlockMove<br>correlation:<br>    type: temporal<br>    rules:<br>        - rr_7040<br>        - clsid_new_4657<br>        - clsid_access_4663<br>        - proc_bitlocker_4688<br>    group-by:<br>        - ComputerName<br>    timespan: 5m<br>    condition:<br>        gte: 4<br>tags:<br>    - attack.t1574<br>    - attack.t1546</pre><p><strong>Convert to Splunk</strong>:</p><pre>sigma convert -t splunk -p splunk_windows win_ltr_mvm_Bitlocker_com_hij.yaml</pre><p>This rule ensures <strong>ObjectName</strong> matching between 4657 and 4663, reducing false positives.</p><p><strong>References</strong>:</p><ol><li><a href="https://ipurple.team/2025/08/04/lateral-movement-bitlocker/">Lateral Movement via BitLocker — iPurple Team</a></li><li><a href="https://docs.microsoft.com/windows/security/threat-protection/auditing/">Microsoft Windows Security Auditing</a></li><li><a href="https://kb.eventtracker.com/evtpass/evtpages/EventId_7040_ServiceControlManager_50628.asp">EventID 7040 Service Control Manager</a></li><li><a href="https://docs.splunk.com/Documentation/Splunk/latest/Installation/Configuration">Splunk Validated Architectures</a></li><li><a href="https://github.com/SigmaHQ/sigma/wiki/Detection-Engineering">SIGMA Detection Engineering</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1340a9391a79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting Kerberoasting]]></title>
            <link>https://medium.com/@a-atashgar/detecting-kerberoasting-e74e2df4f544?source=rss-16165bbe9d37------2</link>
            <guid isPermaLink="false">https://medium.com/p/e74e2df4f544</guid>
            <dc:creator><![CDATA[A.Atashgar]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 00:18:02 GMT</pubDate>
            <atom:updated>2024-07-28T01:15:30.788Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>Kerberoasting allows attackers to determine sensitive passwords and the most common place for detecting this attack is on the domain controller. In this post, we will look into the details of Kerberoasting from a DFIR perspective.</p><p>Domain Controllers can contain a wealth of information, especially when it comes to tracking user authentication activity across a domain. They should be examined in any intrusion investigation to look for account compromise and lateral movement. We recently added analytics into Cyber Triage to detect domain controller attacks, including Kerberoasting, and wanted to share more about it.</p><p>In this post, we will cover:</p><ul><li>Kerberoasting Key Concepts</li><li>Kerberoasting Details</li><li>Attack Goal</li><li>Attack Requirements</li><li>Artifacts for Detection</li></ul><h3>Kerberoasting Key Concepts</h3><p>Kerberoasting (<a href="https://attack.mitre.org/techniques/T1558/003/">T1558.003</a>) is a tactic used by threat actors to get credentials to a domain account by exploiting normal Kerberos behavior in a Windows Active Directory (AD) environment.</p><p>The basic concept is that an attacker interacts with the domain controller to get a “ticket” that has data encrypted using a user’s password hash. The attacker then brute forces the data offline and learns the password. They can then use that password to log into other systems.</p><p>From a DFIR perspective:</p><ul><li>The domain controller has events that show when the attacker requested the ticket, but it could blend in with normal activity</li><li>The computer used to request the ticket may have artifacts from Kerberoasting tools that were run</li><li>The computers that were accessed using the password will have no evidence that Kerberoasting occurred.</li></ul><h3>Kerberoasting Details</h3><p>To understand how Kerberoasting works and how to detect its activity you must first understand the basics of<a href="https://learn.microsoft.com/en-us/windows/win32/secauthn/microsoft-kerberos"> Kerberos authentication in Windows</a>. There are a few main components:</p><ul><li><a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-principals">Security Principals</a>: Represents user, service, and computer accounts in AD. Security Principles can act as both clients (end users and computers) and services hosting various resources (file shares, databases, etc…) within the domain.</li><li><a href="https://learn.microsoft.com/en-us/windows/win32/secauthn/key-distribution-center">Key Distribution Center (KDC)</a>: A service on a Domain Controller (DC). It is responsible for providing a secure mechanism to prove an entity’s identity through the use of session based tickets.</li><li><a href="https://learn.microsoft.com/en-us/windows/win32/secauthn/ticket-granting-tickets">Ticket-Granting-Ticket (TGT)</a>: A ticket that provides the ability for a security principal to prove its identity to the KDC and request Service Tickets.</li><li><a href="https://learn.microsoft.com/en-us/windows/win32/secauthn/session-tickets">Service Ticket (ST)</a>: A ticket that provides the ability for a security principal to prove its identity to a service. The service determines if the identity is authorized to access its resources. Part of the ticket is encrypted with the service accounts password hash. <strong>This is the key component that Kerberoasting takes advantage of.</strong></li></ul><p>The below diagram helps to illustrate the Kerberoasting attack flow, which is identical to a Kerberos authentication diagram except for step 5 where the attacker offloads a ticket for offline cracking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*2YfD6kOc0H2hW5zJU6cU6Q.png" /><figcaption>Image 1- Kerberoasting</figcaption></figure><p>A standard Kerberoasting attack goes as follows:</p><ol><li>The threat actor uses a compromised domain account and requests a Ticket Granting Ticket (TGT) from the domain controller via an <a href="https://learn.microsoft.com/en-us/windows/win32/secauthn/authentication-service-exchange">Authentication Service Request</a> (AS Req).</li><li>The domain controller verifies the user’s (compromised) identity and sends back a TGT via Authentication Service response (AS Rep).</li><li>Next, the threat actor requests a Service Ticket (ST) by sending the TGT in a <a href="https://learn.microsoft.com/en-us/windows/win32/secauthn/ticket-granting-service-exchange">Ticket-Granting Service Request</a> (TGS Req).</li><li>If successful, the domain controller sends back the ST in a TGS response (TGS Rep). The ST contains the encrypted password.</li><li>With a ST in hand the attacker can transfer the ticket to a machine dedicated to brute forcing the password offline using John the Ripper, HashCat, or other password guessing tools.</li></ol><p>For a more detailed look at the Kerberos authentication process in full check out Tim Medins, who first discovered Kerberoasting, blog <a href="https://redsiege.com/tools-techniques/2020/10/detecting-kerberoasting/">here</a> and Sean Metcalfs blog <a href="https://adsecurity.org/?p=3458">here.</a></p><h3>Attack Goal</h3><p>The goal of Kerberoasting is to obtain the password for service accounts. The password for the compromised account can then be used for:</p><ul><li><strong>Persistence</strong>: There are no indicators that an attacker has successfully Kerberoasted an account since the brute force is done offline. As a result, threat actors can hold on to the credentials and use them as a persistence mechanism if they lose access to a target.</li><li><strong>Lateral Movement:</strong> Newly obtained credentials can be used to move to new systems previously inaccessible depending on permissions of the compromised account.</li><li><strong>Privilege Escalation:</strong> Newly obtained credentials may have higher privileges than the account performing the attack. This is often the case since no special privileges are needed to perform Kerberoasting.</li></ul><h3>Attack Requirements</h3><p>For a successful Kerberoasting attack to take place two criteria must be met:</p><ul><li>Obtain a Service Ticket</li><li>Brute force the password from a Service Ticket</li></ul><h3>1.1 Details For Getting a Service Ticket</h3><p>The threat actor ultimately wants a service ticket to decrypt the password from.</p><p>Under normal Kerberos operation a user (security principle) must hold a valid Ticket Granting Ticket (TGT) to obtain a Service Ticket (ST) from the domain controller (Key Distribution Center). This requires an adversary to have access to a domain account prior to performing any Kerberoasting activity. There are no special privileges required so any account within the domain will work.</p><p>If access to an account is not possible another non-standard approach to getting a Service Ticket can be attempted. The alternate approach requires an attacker to find an account that has <a href="https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-kile/ae60c948-fda8-45c2-b1d1-a71b484dd1f7">Kerberos pre-authentication</a> disabled. When an account has pre-authentication disabled a TGT can be requested without having to provide credentials. This allows an attacker to craft a special AS REQ that will return a Service Ticket instead of the normal TGT as discussed <a href="https://www.semperis.com/blog/new-attack-paths-as-requested-sts/">here.</a></p><p>Once an adversary is capable of requesting ST it’s time to find the <a href="https://learn.microsoft.com/en-us/windows/win32/ad/service-principal-names">Service Principal Names</a> (SPNs) or account names to request STs for. This is key to understanding the scope of a Kerberoasting attack. A Service Ticket will only ever be encrypted with an account that has a SPN associated with it. As a result, only accounts with a SPN are susceptible to Kerberoasting. These are often computer accounts and service accounts that are associated with a service like MS SQL. However, normal user accounts can have a SPN as well. These are the core targets of a Kerberoasting attack as we will discuss shortly.</p><p>Obtaining a list of Kerberoastable accounts is trivial when the threat already has access to an account. Active Directory (AD) can be queried to get a list of all accounts with an SPN. Further refinement can be done to only get admin accounts with SPN or other filtering criteria to find interesting Kerberoastable accounts.</p><p>Ex. Powershell command to retrieve all admin accounts with a SPN:</p><pre>get-aduser -filter {AdminCount -eq 1 -and ServicePrincipalName -like &#39;*&#39;} -prop * |<br> select name,created,passwordlastset,lastlogondate,ServicePrincipalName</pre><p>One thing that should be noted is that the get-aduser command is not on the client system by default, considering that the start of such attacks is on the client side, the attacker can use Ldap queries to ask his questions. Ask AD without needing special access</p><p>An example Ldap query using Powershell:</p><pre>$ldapFilter = &quot;(&amp;(objectClass=user)(servicePrincipalName=*)(!(name=*$)))&quot;<br>$user=[adsisearcher]$ldapFilter<br>$user.FindAll()</pre><p>This capability is already baked into many of the Kerberoasting tools out there like <a href="https://github.com/GhostPack/Rubeus">Rubeus</a>, <a href="https://powersploit.readthedocs.io/en/latest/Recon/Invoke-Kerberoast/">Invoke-Kerberoast</a>, and Impackets <a href="https://github.com/fortra/impacket/blob/master/examples/GetUserSPNs.py">GetUsersSPNs.py</a>. For a detailed look at how to perform Kerberoasting using some of previously mentioned tools check out the great red team write ups from <a href="https://book.hacktricks.xyz/windows-hardening/active-directory-methodology/kerberoast">HackTricks</a> and <a href="https://www.ired.team/offensive-security-experiments/active-directory-kerberos-abuse/t1208-kerberoasting">Ired.Team</a>.</p><h3>1.1 Brute Force The Password From A Service Ticket</h3><p>Getting a ST for an account with an associated SPN is only half the battle. The Service Ticket provides the data necessary to perform an offline brute force attack. For the attack to be successful a threat actor must guess the password, usually with a tool like <a href="https://www.openwall.com/john/">John the Ripper</a>, <a href="https://hashcat.net/hashcat/">HashCat</a> or <a href="https://github.com/chroblert/domainWeakPasswdCheck/blob/master/domainAccountCheck-v1.0/kerberoast/tgsrepcrack.py">tgsrepcrack.py</a>. Kerberoasting relies on poor password management and weak passwords, which is not hard to come by. However, there are a few tricks to increase the chances of a successful attack:</p><ul><li>Target user accounts</li><li>Request older encryption on Service Tickets</li></ul><p>Kerberoasting is generally useless when it comes to targeting computer accounts and other <a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-service-accounts">managed service accounts</a>. Not because these accounts cannot be Kerberoasted but they are impractical to attack due to the strong password management on such accounts. Computer account passwords are <a href="https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/domain-member-maximum-machine-account-password-age">updated every 30 days</a>, by default, and <a href="https://adsecurity.org/?p=280">contain a 120 unicode character password</a>. Similarly, managed service accounts have passwords that are managed by AD and have similar password age and length requirements that computer accounts have. As a result, Kerberoasting attacks tend to focus on standard user accounts that administrators create and manage. Again relying on the hope that administrators are not setting strong passwords or updating the password as frequently as one should.</p><p>Attackers can additionally leverage weak encryption on Service Tickets to increase the likelihood of cracking a password. Adversaries and many tools will often request ST with RC4 as the encryption. This was replaced by AES starting with Windows 2008 Server and Windows Vista. Again this does not mean AES ST are not susceptible to Kerberoasting it just means it is more work and time to try and brute force those tickets. <strong>ST with RC4 should generally not exist in your environment unless you have applications or older systems that require it.</strong></p><h3>DFIR Artifacts for Kerberoasting Detection</h3><p>With a few simple searches related to the Kerberoasting attack, we find that the first thing introduced in the detection of the attack is the log related to the Windows operating system with the event code 4769, which is known as A Kerberos service ticket was requested.</p><p>But the question is, how can this event code help in identifying the attack, at the moment, many user accounts send requests to receive TGS to use different services, which causes a log with event code 4769 to be generated.</p><p>Let me explain one thing easily once and for all, sometimes in order to detect attacks we need to follow the path taken by the attackers.</p><p>The first step to implement this attack by the attacker after obtaining a normal user account in the organization is to find user accounts with SPN. By the way, this is the first step that should be done from our side. At the beginning of the work, it should be clear to us that which user account may be misused.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CzZbIyqCci7PFQTk03xPnw.png" /></figure><p>As this process is relatively simple for the attacker, it is also simple for us, but considering that we may use special tools such as SIEMs for identification; I would like to explain this, if you use Splunk, you can connect to your ADs and make Ldap queries by installing and configuring the Splunk Supporting Add-on for Active Directory application.</p><p>Sample query to extract the required data from AD:</p><pre>| ldapsearch domain=&quot;default&quot; search=&quot;(&amp;(objectClass=user)(servicePrincipalName=*))&quot; attrs=&quot;cn,accountExpires,company,dc,department,displayName,distinguishedName,employeeID,employeeNumber,givenName,initials,mail,manager,memberOf,mobile,postalCode,sAMAccountName,sn,st,streetAddress,telephoneNumber,title,userAccountControl,whenChanged,whenCreated,SecureLevel1,SecureLevel2,description,sAMAccountType, userPrincipalName,userWorkstations&quot;<br>| eval flag = &quot;true&quot;<br>| table SecureLevel1,SecureLevel2,accountExpires,cn,company,dc,department,displayName,distinguishedName,employeeID,employeeNumber,givenName,initials,mail,manager,memberOf,mobile,postalCode,sAMAccountName,sAMAccountType,description,sn,st,streetAddress,telephoneNumber,title,userAccountControl,whenChanged,whenCreated,userPrincipalName,userWorkstations,flag<br>| search sAMAccountName!=&quot;*$&quot; sAMAccountName!=&quot;$*&quot;<br>| outputlookup SPN_Users.csv</pre><p>Going back to the famous event code 4769, we are currently able to identify the attack using this event code, provided we pay attention to a few important points.</p><p>1- Adding the information extracted from the previous step to log 4769 so that only the requests sent to these destinations are monitored.</p><p>2- Items that the user requests and the user has the same SPN should be removed.</p><p>3- In many cases, there may be an SPN user account that several users have permission to send requests to, these should also be identified and removed.</p><p>4- The krbtgt service does not help us in identifying this attack and should be removed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZuWD-65M0u25oXbKjIogNg.png" /></figure><pre>index=windows EventCode=4769 service_name!=krbtgt <br>| rex field=user &quot;(?&lt;user_name&gt;[^@]+)&quot;<br>| lookup SPN_Users.csv sAMAccountName as service_name OUTPUT flag<br>| where isnotnull(flag)<br>| eval match=if(user_name!=service_name, &quot;No_match&quot;, &quot;match&quot;)<br>| where match=&quot;No_match&quot;<br>| table _time src_ip user_name service_name</pre><p>It can also be seen in the picture, by applying these items to the event code 4769, it is possible to get close to detecting the attack and to identify abnormal items at the time of TGS request.</p><p>I want to end the article with a question that you can find the answer to in the description of the attack. In your opinion, what should we do if the attacker gets access to the authorized user account by accident or by prior planning during the initial access stage? Do we have a workaround?</p><p>We have removed these authorized users from our query!</p><p>Good luck</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e74e2df4f544" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>