<?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 Bilal Ansari on Medium]]></title>
        <description><![CDATA[Stories by Bilal Ansari on Medium]]></description>
        <link>https://medium.com/@bilxallll?source=rss-7971eb739e9b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HroO7bCJSclzW05l</url>
            <title>Stories by Bilal Ansari on Medium</title>
            <link>https://medium.com/@bilxallll?source=rss-7971eb739e9b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 05:15:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bilxallll/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[22 Minutes to Domain Admin: What I Learned Reconstructing an Attack From 249 Log Events]]></title>
            <link>https://medium.com/@bilxallll/22-minutes-to-domain-admin-what-i-learned-reconstructing-an-attack-from-249-log-events-45f7cd319dd3?source=rss-7971eb739e9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/45f7cd319dd3</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[incident-resposne]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Bilal Ansari]]></dc:creator>
            <pubDate>Fri, 09 Oct 2026 12:31:01 GMT</pubDate>
            <atom:updated>2026-10-09T12:31:01.802Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KUcgLuNOWRe17JHQS07I_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UodgIyN2xm9EjWRYWen5rg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5mqvMdU-TyQQ0ho_PwzUFg.png" /></figure><p>When I was studying for Security+, I kept running into the same gap. The textbooks walk you through the incident response phases (preparation, detection, containment, eradication, recovery), but none of them show you what an analyst actually <em>does</em> in the middle of an incident. What do you open first? How do you turn a pile of raw events into a story someone can act on?</p><p>So I built a simulation to find out. I modeled a multi-stage intrusion, wrote Python tools to reconstruct the timeline and extract indicators of compromise (IOCs), and finished by writing the kind of formal incident report a real analyst hands to leadership.</p><h3>The Scenario</h3><p>The simulated attacker brute-forces a single domain user account and reaches full domain compromise in <strong>22 minutes</strong>. The chain looks like this:</p><p><strong>Brute Force → Initial Access → Discovery → Privilege Escalation → Lateral Movement → Credential Dumping → Persistence → C2</strong></p><p>Phase | MITRE Technique | Host</p><p>Brute force (23 failed attempts) | T1110 | WS-ACCT01</p><p>Recon: whoami, ipconfig, net, nltest | T1087, T1033 | WS-ACCT01</p><p>Token impersonation | T1078 | WS-ACCT01</p><p>SMB/RDP hops across three machines | T1021 | WS-HR03 → FILE02 → DC</p><p>Mimikatz on the domain controller | T1003 | DC-CORP01</p><p>Scheduled task + new service | T1053, T1543 | DC-CORP01</p><p>Beacon to a Tor exit node | T1041 | DC-CORP01</p><p>The blast radius: 4 hosts and 2 compromised accounts, one of them a domain admin.</p><p>To keep it honest, I surrounded the attack with realistic background noise. The dataset has <strong>249 events, and only about 50 are malicious</strong>. That ratio matters, because the first lesson of incident response is that the attack never announces itself.</p><h3>What I Built</h3><ul><li><strong>A timeline reconstruction engine</strong> that ingests Windows event artifacts and rebuilds the attack in order, grouped by MITRE tactic.</li><li><strong>An IOC extractor</strong> that pulls out malicious IPs, processes, and accounts and checks them against threat intel.</li><li><strong>An artifact generator</strong> that produces the multi-phase attack data, so anyone can reproduce the run with one command.</li><li><strong>A formal incident report</strong> (IR-2025–001) with an executive summary, minute-by-minute timeline, root cause analysis, containment actions, and remediation recommendations.</li></ul><p>The telemetry comes from Windows Security events (4624, 4625, 4648, 4672, 4688, 4698, 4776, 7045) plus simulated Sysmon process and network data.</p><h3>What the Timeline Revealed</h3><p>Three findings came out of the reconstruction, and each one is a detection gap rather than an attack technique.</p><p><strong>1. No account lockout policy.</strong> The attacker made 23 failed logins in about three minutes and nothing responded. A standard lockout policy (5 attempts in 30 minutes) would have ended the incident at phase one.</p><p><strong>2. Discovery went completely unnoticed.</strong> Eight recon commands ran back to back, and no alert fired. Process creation logging (Event ID 4688) was on, but no rule correlated a burst of recon tools from a single account. The data to catch it existed. Nobody had written the detection.</p><p><strong>3. Speed.</strong> Twenty-two minutes from a guessed password to domain admin is realistic. Once an attacker has Mimikatz on a domain controller, the clock runs out fast if nothing fires early in the chain.</p><h3>What Surprised Me</h3><p>Building the timeline taught me more than any other part of the project. With 249 events spread across four hosts, the attack is invisible until you correlate by source IP and username across time windows. Individually, almost every malicious event looks routine.</p><p>I also learned that MITRE tactic grouping is better for <em>communication</em> than for <em>detection</em>. Grouping by tactic tells the story of what the attacker was trying to do at each stage. The raw Event IDs tell you what actually happened. You need both, but they serve different audiences: the first for your incident commander, the second for your fellow analysts.</p><p>Writing the final report changed how I think about evidence. Every finding needs a timestamp, a source, and a technique ID before it means anything to the person who has to act on it.</p><h3>What’s Next</h3><p>This project and my <a href="https://github.com/bilxall/soc-detection-lab">SOC Detection Lab</a> are two halves of one workflow. The lab is about writing detections, and this simulation shows where detections were missing. The natural next step is closing the loop: writing rules for the gaps this incident exposed (lockout alerting, recon-burst correlation) and testing them against this same dataset.</p><h3>Try It Yourself</h3><p>The full project, including the scripts, the attack artifacts, and the complete incident report, is on GitHub. Clone it and run ./run.sh to reproduce everything:</p><p><a href="https://github.com/bilxall/ir-simulation"><strong>github.com/bilxall/ir-simulation</strong></a></p><p><em>I’m Bilal Ansari, an M.S. Cybersecurity graduate (University of South Florida) with CompTIA Security+ and Google Cybersecurity Professional certifications, currently looking for SOC Analyst and Security Analyst roles. Connect with me on </em><a href="https://www.linkedin.com/in/bilalmkansari/"><em>LinkedIn</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45f7cd319dd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a SOC Detection Engine: What I Learned Chasing Attackers Through 9,600 Log Lines]]></title>
            <link>https://medium.com/@bilxallll/building-a-soc-detection-engine-what-i-learned-chasing-attackers-through-9-600-log-lines-8b94b2faf8fa?source=rss-7971eb739e9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b94b2faf8fa</guid>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[soc-analyst]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[siem]]></category>
            <dc:creator><![CDATA[Bilal Ansari]]></dc:creator>
            <pubDate>Thu, 10 Sep 2026 08:06:14 GMT</pubDate>
            <atom:updated>2026-09-10T08:06:14.469Z</atom:updated>
            <content:encoded><![CDATA[<p>When I started studying for SOC analyst roles, I kept running into the same problem: every tutorial showed me <em>what</em> an attack technique looks like in isolation, but none of them showed me what it looks like buried inside a normal day’s worth of noise. Reading about a brute-force attack in a blog post is one thing. Finding it inside thousands of legitimate login events, at 2am, under time pressure, is another.</p><p>So I built my own lab to close that gap, a Python-based detection engine that ingests Windows Security Event Logs, simulates a realistic 8-hour SOC shift, and hunts for four real attacker techniques hidden inside the noise. I mapped every detection to MITRE ATT&amp;CK and rebuilt the same logic as Splunk SPL queries, so the project reflects both “I can write the detection logic” and “I can operationalize it in a SIEM.”</p><h3>The Setup</h3><p>The lab generates 9,600+ synthetic Windows Security Events representing a normal business day, with a realistic attack chain woven in:</p><p><strong>Brute Force → Initial Access → Lateral Movement → Credential Dumping → Persistence</strong></p><p>Only 66 of those 9,600+ events which were well under 1% belong to the actual attack. That ratio was intentional. I wanted to build something that had to actually <em>find</em> the signal, not just print “attack detected” against a dataset where the attack was the only thing happening.</p><h3>The Four Detections</h3><p>Technique | MITRE ID | Event IDs | Severity</p><p>Brute-force login campaign | T1110 | 4625 | High</p><p>Post-compromise lateral movement | T1021 | 4624, 4648 | High</p><p>NTLM Pass-the-Hash | T1550.002 | 4776, 4624 (Type 3) | Medium</p><p>Mimikatz-style credential dumping | T1003 | 4688 | Critical</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*O3k9zHQdAe8hdNV2UDJQ7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iDANsPGwajwyJwbDpzkNtA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QkBK6iXYzD6Iw5ZOdG-PUA.png" /><figcaption>Outputs</figcaption></figure><p>Each one required different logic, and building them taught me different lessons:</p><p><strong>Brute force</strong> was the most straightforward, a sliding 60-second window counting failed logon attempts (Event ID 4625) per user, firing at 5+ failures from the same source. Simple, but it’s also where I first ran into the false-positive problem: legitimate users fat-finger passwords too.</p><p><strong>Lateral movement</strong> was more interesting. I tracked unique WorkstationName values per user across Type 3 (network) logons, firing when a single account touched 3+ hosts in a 5-minute window. That threshold came from actually looking at what normal traffic looks like, a real user doesn&#39;t network-logon to three machines in five minutes, but an IT admin doing routine maintenance might come close. Getting that boundary right, instead of just picking a number that felt reasonable, was the actual engineering work.</p><p><strong>Pass-the-Hash</strong> detection flags Event ID 4776 (NTLM validation) paired with Type 3 logons from non-local IPs, since legitimate NTLM network authentication almost never originates from outside the domain in a well-configured environment.</p><p><strong>Credential dumping</strong> matches process names in Event ID 4688 against known offensive tooling (Mimikatz, procdump, wce, gsecdump) and common LOLBins used for credential theft.</p><h3>What Actually Surprised Me</h3><p>I expected the hard part to be <em>writing</em> detections. It wasn’t. The hard part was realizing how much of SOC work is fighting noise, not finding attacks. With 9,600+ events and only 66 malicious ones, the real skill isn’t pattern matching — it’s deciding what threshold, time window, and correlation logic separates “attacker” from “IT admin having a normal Tuesday.”</p><p>That shifted how I think about detection engineering entirely. I stopped asking “what does this event mean?” and started asking “what technique does this behavior map to, and what would an analyst actually need to see to confirm it?” That reframing which is starting from the analyst’s decision, not the raw log line would be, I think, the difference between a detection that fires and a detection that’s <em>useful</em>.</p><h3>From Python to Splunk</h3><p>Once the detection logic worked in Python, I rebuilt each one as an SPL query so the project wasn’t just a scripting exercise, but it reflects how this logic would actually run inside a SIEM a SOC team uses day to day:</p><p>spl</p><pre>index=windows EventCode=4625<br>| bucket _time span=5m<br>| stats count by _time, src_ip, TargetUserName<br>| where count &gt;= 5<br>| eval mitre=&quot;T1110 - Brute Force&quot;</pre><p>spl</p><pre>index=windows EventCode=4624 LogonType=3<br>| bucket _time span=5m<br>| stats dc(ComputerName) AS unique_hosts by _time, TargetUserName<br>| where unique_hosts &gt;= 3<br>| eval mitre=&quot;T1021 - Remote Services&quot;</pre><p>Translating the same logic across two different tools also forced me to understand <em>why</em> the logic worked, not just that it worked. Python let me debug step by step, while SPL forced me to think in terms of aggregation and time-bucketing the way a real SIEM does.</p><h3>What’s Next</h3><p>The current version works against a static, simulated dataset. The natural next step is wiring it into a live environment, a small Sysmon-instrumented Windows VM feeding real-time logs into Splunk, so the same detections run against live traffic instead of a generated file. I’d also like to add a fifth technique around persistence (scheduled tasks / registry run keys), since the current chain stops at credential dumping.</p><h3>Try It Yourself</h3><p>The full project, including the log generator, detection engine, SPL queries, and setup guide for a Splunk + Sysmon lab environment, is on GitHub:</p><p><a href="https://github.com/bilxall/soc-detection-lab"><strong>github.com/bilxall/soc-detection-lab</strong></a></p><p><em>I’m Bilal Ansari, an M.S. Cybersecurity graduate (University of South Florida) and CompTIA Security+ / Google Cybersecurity Professional certified analyst, currently looking for SOC Analyst and Security Analyst roles. Connect with me on </em><a href="https://www.linkedin.com/in/bilalmkansari/"><em>LinkedIn</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b94b2faf8fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>