<?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 Wijdane El Ouahabi on Medium]]></title>
        <description><![CDATA[Stories by Wijdane El Ouahabi on Medium]]></description>
        <link>https://medium.com/@wijdane.elouahabi5?source=rss-9213991ad69a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Wijdane El Ouahabi on Medium</title>
            <link>https://medium.com/@wijdane.elouahabi5?source=rss-9213991ad69a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 21:42:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wijdane.elouahabi5/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[Building a Web Pentesting Lab: SQLi, XSS, Command Injection, Path Traversal, File Upload in a…]]></title>
            <link>https://medium.com/@wijdane.elouahabi5/building-a-web-pentesting-lab-sqli-xss-command-injection-path-traversal-file-upload-in-a-d34f4cb78415?source=rss-9213991ad69a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d34f4cb78415</guid>
            <dc:creator><![CDATA[Wijdane El Ouahabi]]></dc:creator>
            <pubDate>Wed, 16 Sep 2026 20:00:32 GMT</pubDate>
            <atom:updated>2026-09-16T20:00:32.305Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Web Pentesting Lab: SQLi, XSS, Command Injection, Path Traversal, File Upload in a Vulnerable Flask App</h3><h3>Introduction</h3><p>As part of my hands-on practice in offensive cybersecurity, I built a fully containerized web pentesting lab based on Flask, SQLite and Docker. The goal: a controlled environment to reproduce, understand and document the most common web vulnerabilities from the OWASP Top 10 — SQL injection, reflected and stored XSS, CSRF, command injection, path traversal, insecure file upload and brute force.</p><p>This project, “web-pentesting-lab”, isn’t meant to be a realistic application — it’s a training ground: every route in the app is intentionally vulnerable, documented, and reproducible. In this article, I walk through the architecture, the vulnerable source code, and the exploitation proof-of-concepts for each of the 7 vulnerabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*c1QlDfkBu8KNsxTt7E9T0Q.png" /></figure><p>— Checking the Kali environment (Python 3.14, pip, git, Docker, Docker Compose)</p><h3>1. Project architecture</h3><p>The project is organized around three main folders: app/ for the application code, attacks/ for per-vulnerability documentation, and screenshots/ for test evidence.</p><pre>web-attacks-lab/<br>│<br>├── app/<br>│   ├── app.py<br>│   ├── database.py<br>│   ├── templates/<br>│   └── uploads/<br>│<br>├── attacks/<br>│   ├── 01-sql-injection/<br>│   ├── 02-xss/<br>│   ├── 03-csrf/<br>│   ├── 04-command-injection/<br>│   ├── 05-path-traversal/<br>│   ├── 06-file-upload/<br>│   └── 07-brute-force/<br>│<br>├── requirements.txt<br>├── Dockerfile<br>├── docker-compose.yml<br>└── README.md</pre><ul><li>app/: Flask web application code</li><li>app/templates/: HTML pages (Jinja2)</li><li>app/uploads/: storage for uploaded files (no security checks)</li><li>attacks/01 to 07: documentation and test commands per attack</li><li>screenshots/: visual evidence for each tested vulnerability</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*1Iiz3V5X2Hyv6EqSFuQIBA.png" /></figure><p>— Creating the folder structure (mkdir -p app/templates, app/uploads, attacks/{01-sql-injection,...,07-brute-force}, screenshots, touch app.py database.py requirements.txt Dockerfile docker-compose.yml README.md)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*0qnFDpQfORMlwhuTZfSpuQ.png" /></figure><p>— Output of the tree command: 13 directories, 6 files</p><h3>2. Setting up the Python environment</h3><p>The project uses a Python virtual environment with Flask as the web framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*SRwz4iPsx56NITt-IHUhTA.png" /></figure><p>— Installing Flask (pip install flask) in the virtual environment: Flask 3.1.3, Jinja2, Werkzeug, itsdangerous, click, blinker, MarkupSafe</p><p>Installed dependencies are frozen into requirements.txt:</p><pre>pip freeze &gt; requirements.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*5RtIsgP2afxKMKLS2UsNAg.png" /></figure><p>— Exporting dependencies (pip freeze &gt; requirements.txt)</p><h3>3. Database (database.py)</h3><p>The SQLite database app/users.db contains two tables:</p><ul><li>users (id, username, password, email) — pre-populated with 3 test accounts: admin / admin123, alice / alice123, bob / bob123</li><li>comments (id, username, comment) — used for stored XSS</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*4kS2PuzoV6jNLR8j92mUNw.png" /></figure><p>— Code of app/database.py: table creation and test user insertion</p><h3>4. Flask application (app.py): the vulnerable routes</h3><p>Each route in the application demonstrates a specific vulnerability, marked with an # INTENTIONALLY VULNERABLE comment in the source code.</p><h3>4.1 SQL Injection — /user</h3><p>The SQL query is built through direct string concatenation of user input (f-string), with no prepared statement:</p><pre>query = f&quot;SELECT * FROM users WHERE username = &#39;{username}&#39;&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*0RNU-VdBEK6waaQEL21Eig.png" /></figure><p>— /user route (SQL Injection) in app.py</p><h3>4.2 Reflected XSS — /search</h3><p>The q parameter is re-injected into the template with the Jinja2 |safe filter, intentionally disabling auto-escaping:</p><pre>{{ query|safe }}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*7eRYsGxATftAUxHTtu_EVw.png" /></figure><p>— /search (reflected XSS) and /comments (stored XSS) routes</p><h3>4.3 Command Injection — /ping</h3><p>The host parameter is directly concatenated into a shell command executed via subprocess.check_output(..., shell=True):</p><pre>command = f&quot;ping -c 1 {host}&quot;</pre><h3>4.4 Path Traversal — /download</h3><p>The file parameter is used as-is to open a file on the server, with no validation or directory restriction:</p><pre>with open(filename, &quot;r&quot;) as f:<br>    content = f.read()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*uH0AZVV43KLfrTl8mcrimQ.png" /></figure><p>— /download (Path Traversal) and /upload (File Upload) routes</p><h3>4.5 Insecure File Upload — /upload</h3><p>The uploaded file is saved directly under its original name, with no extension or MIME-type validation:</p><pre>file.save(path)</pre><h3>5. HTML templates</h3><p>Each route has a dedicated HTML page under app/templates/.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*f3CVSrxHMVk0T2flIrYvqQ.png" /></figure><p>— index.html: homepage listing the 7 vulnerable modules</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*JuPCkTSCkRJGjnzz-kT6xA.png" /></figure><p>— login.html: login form</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*GXCfuFHKUO4-l82-BtLSFg.png" /></figure><p>— search.html: search form with {{ query|safe }} (reflected XSS)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*h_TZqDKVlcyAx_6zyBEFbA.png" /></figure><p>— profile.html: profile display and email-change form (CSRF)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*Oevs0fcmxuRscF-Ktwv4Xw.png" /></figure><p>— upload.html: file upload form</p><h3>6. Preparing the target file for Path Traversal</h3><p>A secret.txt file is created at the root of app/ to simulate a sensitive resource that should normally be inaccessible:</p><pre>echo &quot;THIS IS A SECRET LAB FILE&quot; &gt; app/secret.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*Esn-AT4QTVqhCM2qJEqHdg.png" /></figure><p>— Creating and verifying the app/secret.txt file</p><h3>7. Exploitation walkthrough</h3><h3>7.1 Launching the application</h3><p>[Screenshot 20] — Homepage (http://127.0.0.1:5000) listing the 7 modules, and normal access to /user?username=admin</p><h3>7.2 SQL Injection</h3><p>By injecting &#39; OR &#39;1&#39;=&#39;1 into the username parameter, the query returns the entire users table instead of a single account:</p><pre>http://127.0.0.1:5000/user?username=&#39; OR &#39;1&#39;=&#39;1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*_0TUHrJfOMWC7EjKUnVQgA.png" /></figure><p>— SQL injection result: all 3 accounts (admin, alice, bob) are exposed</p><h3>7.3 Cross-Site Scripting (XSS)</h3><p>Injecting the payload &lt;script&gt;alert(document.domain)&lt;/script&gt; into the q parameter, executed immediately client-side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*4QYR05ynWgpLSKzTTZkCrA.png" /></figure><p>— Normal search (q=hello) followed by execution of the XSS payload with an alert() showing the domain</p><h3>7.4 Command Injection</h3><p>Injecting ; whoami into the host parameter triggers execution of an arbitrary system command alongside the legitimate ping:</p><pre>http://127.0.0.1:5000/ping?host=127.0.0.1; whoami</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*w7O8EBir199d9tHNFgttoA.png" /></figure><p>— ping output followed by the output of the injected command</p><h3>7.5 Path Traversal</h3><p>Directly reading the app/secret.txt file, then bypassing any potential path filtering via app/../app/secret.txt:</p><pre>http://127.0.0.1:5000/download?file=app/secret.txt<br>http://127.0.0.1:5000/download?file=app/../app/secret.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*s7SeaYLo7vqywOQDJimyBw.png" /></figure><h3>7.6 Insecure File Upload</h3><p>Uploading a legitimate test.txt file, then a test.php file — both accepted with no extension restriction and stored directly under app/uploads/.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*_YiYSt5IfZhFt__qAXqUIA.png" /></figure><p>— Creating test files, uploading, then listing (ls -la app/uploads/) confirming the presence of test.php on the server</p><h3>Conclusion</h3><p>This lab demonstrates, in a practical and reproducible way, the real-world impact of seven of the most critical web vulnerabilities: SQL injection, reflected and stored XSS, command injection, path traversal, and insecure file upload. Each vulnerability was intentionally implemented in a minimal Flask application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d34f4cb78415" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Port Scan Detection (Detection Engineering)]]></title>
            <link>https://medium.com/@wijdane.elouahabi5/port-scan-detection-detection-engineering-26ca10ded2a6?source=rss-9213991ad69a------2</link>
            <guid isPermaLink="false">https://medium.com/p/26ca10ded2a6</guid>
            <dc:creator><![CDATA[Wijdane El Ouahabi]]></dc:creator>
            <pubDate>Thu, 20 Aug 2026 16:23:02 GMT</pubDate>
            <atom:updated>2026-08-20T16:29:35.685Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Introduction</h3><p>Port scanning is one of the earliest steps in offensive reconnaissance: an attacker probes a target machine to identify active services before attempting to exploit them. This project aims to understand this mechanism, simulate it in a controlled environment, and then build a tool capable of detecting it in real time, without relying on an existing solution like Suricata.</p><h3>2. Objectives</h3><ul><li>Understand the technical mechanics of port scanning</li><li>Simulate a realistic attack from a Linux machine (Kali)</li><li>Configure a victim machine with an active web service</li><li>Build a Python detector capable of identifying a scan in real time</li></ul><h3><strong>3. Lab Architecture</strong></h3><p>The lab consists of two Kali Linux virtual machines on the same local network:</p><ul><li><strong>Kali 1 (Attacker)</strong> — IP: 192.168.91.153 — tool: Nmap</li><li><strong>Kali 2 (Victim)</strong> — IP: 192.168.91.154 — Apache (web service) + Python detector (Scapy)</li></ul><p>Traffic flows from the attacker to the victim as TCP SYN packets, captured and analyzed live on the victim machine.</p><h3>3. Lab Architecture</h3><p>The lab consists of two Kali Linux virtual machines on the same local network:</p><ul><li><strong>Kali 1 (Attacker)</strong> — IP: 192.168.91.153 — tool: Nmap</li><li><strong>Kali 2 (Victim)</strong> — IP: 192.168.91.154 — Apache (web service) + Python detector (Scapy)</li></ul><p>Traffic flows from the attacker to the victim as TCP SYN packets, captured and analyzed live on the victim machine.</p><h3>4. Environment Setup</h3><p>On the victim, Scapy was installed:</p><pre>sudo apt update<br>sudo apt install python3-scapy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*VGh5TBR3ulq6ExmDfVUAeQ.png" /></figure><p><strong>network interface config (</strong><strong>ip addr) + ping test between the two machines</strong></p><p>Before writing any detection logic, it was necessary to confirm that network traffic was actually visible. A minimal script confirmed that Scapy correctly captured packets flowing through the interface, printing each packet received.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*VQC4AhHge6G2hs2v15iXng.png" /></figure><p><strong>content of the initial </strong><strong>detector.py script</strong></p><p>A simple ping test between the two machines confirmed that ICMP and ARP traffic was properly intercepted by Scapy — an essential step before adding any detection rule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*jnSqqYlXKPdDtGOrEQAbsA.png" /></figure><p><strong>ping test to the victim (192.168.91.154)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*wct3uGrZ7-mfwMo51JwMwA.png" /></figure><p><strong>Scapy capturing ICMP/ARP packets in the terminal</strong></p><h3>5. Setting Up a Web Service on the Victim</h3><p>To make the scenario realistic (a real-world attacker would encounter open ports running actual services, not just closed ports), an Apache server was activated on the victim:</p><pre>sudo systemctl start apache2<br>sudo systemctl enable apache2</pre><p>The service was confirmed active and running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*QZV9x67CEhag1BuBXVr-Gw.png" /></figure><p><strong>Apache service status showing it’s active and running</strong></p><h3>6. Initial Reconnaissance Scan</h3><p>From the attacker, an Nmap SYN stealth scan was launched against the first 100 ports:</p><pre>sudo nmap -sS -p 1-100 192.168.91.154</pre><p>Result: port 80 (HTTP) appears open, confirming that Apache is detectable, while the remaining 99 ports stay closed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*wByJC4HzuQcmRePtetu9Qg.png" /></figure><p><strong>Nmap scan result showing port 80 open, 99 closed</strong></p><h3>7. Building the Detector</h3><p>The detection logic relies on a simple principle: a port scan is characterized by <strong>a single source IP contacting a large number of distinct ports within a short time</strong>, using TCP SYN packets without ACK — the typical signature of an Nmap -sS scan.</p><p>The script maintains a dictionary mapping each source IP to the list of ports it recently contacted, keeping only events within a defined time window (TIME_WINDOW = 10 seconds). Once enough unique ports are reached (PORT_THRESHOLD = 20), an alert is triggered with the source IP, target IP, number of scanned ports, and the relevant time window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*uqEr4XqV6keD3jAVNlXyEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*YWjFZDAIW8fBBM-PEtml3w.png" /></figure><p><strong>source code of </strong><strong>port_scan_detector.py.</strong></p><h3>8. Launch and Validation</h3><p>The detector was started on the victim,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*dDoRSbDZbcNEuPKnt2QZfw.png" /></figure><p><strong>detector startup, showing threshold/window parameters</strong></p><p>then a new 100-port scan was run from the attacker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*Y4ywThslWJt3tLpDpDyBAQ.png" /></figure><p><strong>Nmap 100-port scan command launched from the attacker</strong></p><p>The detector immediately flagged the abnormal activity, displaying in real time the growing count of unique ports contacted, then firing an alert once the 20-port threshold was crossed:</p><pre>🚨 PORT SCAN DETECTED<br>Attacker IP : 192.168.91.153<br>Target      : 192.168.91.154<br>Ports       : 20<br>Window      : 10 seconds</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*ruMnIhmxC3DfOD0Jkh8T4A.png" /></figure><p><strong>detector output showing the repeated alerts (20, 21, 22, 23 ports)</strong></p><p><strong>Notable observation</strong>: the alert fires again for every additional port detected after the threshold is crossed (21, 22, 23 ports...), producing multiple alerts for a single scan. This was identified as an improvement point during testing.</p><h3>9. Threshold Calibration (Detection Engineering)</h3><p>A good detector must be calibrated to distinguish a real scan from normal network activity.</p><p><strong>Test A — Scanning only 5 ports</strong></p><pre>sudo nmap -sS -p 1-5 192.168.91.154</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*KEHGieWr7eM5ynGb5gAE8A.png" /></figure><p><strong>5-port scan command, showing all ports closed</strong></p><p>Result: no alert, since the number of contacted ports (5) stays below the threshold (20). This confirms the detector doesn’t react to activity too limited to be considered a scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*5VsRK5Lr5AK3ZZ7dGoTX2w.png" /></figure><p>detector output confirming no alert for the 5-port scan</p><p><strong>6- enabling SSH service</strong></p><pre>sudo systemctl start ssh<br>sudo systemctl enable ssh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*EEGsnLFH-w892VsI0BPQbw.png" /><figcaption><strong>SSH service enabled on the victim</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*PVUebXIhjZN4BVHcbVFp5Q.png" /></figure><p>scan of ports 1–20, all closed</p><p><strong>Test B — Scanning exactly 20 ports (1–20)</strong></p><pre>sudo nmap -sS -p 1-20 192.168.91.154</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*kcrmM_OovjN14Y_8Wnm38g.png" /><figcaption><strong>Nmap scan of ports 1–20, all closed</strong></figcaption></figure><h3>Conclusion</h3><p>This project covered the full lifecycle of a detection capability: understanding the threat, setting up a realistic test environment, developing detection logic grounded in raw network traffic observation, and validating and calibrating it empirically through multiple test scenarios.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26ca10ded2a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building and Attacking Active Directory: A Full Lab Walkthrough]]></title>
            <link>https://medium.com/@wijdane.elouahabi5/building-and-attacking-active-directory-a-full-lab-walkthrough-12136a0fd7e8?source=rss-9213991ad69a------2</link>
            <guid isPermaLink="false">https://medium.com/p/12136a0fd7e8</guid>
            <dc:creator><![CDATA[Wijdane El Ouahabi]]></dc:creator>
            <pubDate>Sat, 15 Aug 2026 20:46:44 GMT</pubDate>
            <atom:updated>2026-08-15T20:46:44.504Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><blockquote><em>In this project, I built a complete </em><strong><em>Active Directory lab environment</em></strong><em> to practice both </em><strong><em>infrastructure configuration</em></strong><em> and </em><strong><em>offensive security testing</em></strong><em>. The lab consists of three machines: a </em><strong><em>Windows Server 2022</em></strong><em> configured as the Domain Controller for the domain </em><em>MARVEL.local, a </em><strong><em>Windows 10</em></strong><em> machine (</em><em>CLIENT01) joined to the domain as a standard client, and a </em><strong><em>Kali Linux</em></strong><em> machine acting as the attacker.</em></blockquote><blockquote><em>The goal of this project was twofold. First, to gain hands-on experience configuring a real-world Active Directory environment — including domain promotion, DNS, Certificate Services, users, groups, and Group Policy. Second, to apply offensive security techniques against that environment, simulating how an attacker could enumerate, exploit, and escalate privileges within an AD domain — starting from the client machine and ultimately targeting the domain itself.</em></blockquote><blockquote><em>This write-up documents the entire process step by step: the initial AD configuration, the vulnerabilities and misconfigurations introduced (intentionally or as byproducts of common real-world mistakes), and the attack techniques used from Kali Linux to compromise </em><em>CLIENT01 and escalate access within the domain.</em></blockquote><h4>Suggested structure to follow it with:</h4><p><strong>🧩 Lab Overview</strong> <em>(quick technical summary, good as a bullet list or small table)</em></p><ul><li><strong>Attacker Machine:</strong> Kali Linux</li><li><strong>Client Machine:</strong> Windows 10 — CLIENT01</li><li><strong>Domain Controller:</strong> Windows Server 2022 — MARVEL.local</li><li><strong>Network:</strong> <em>(fill in — e.g., isolated NAT/host-only network, IP ranges)</em></li></ul><p><strong>Part 1: Domain Promotion (MARVEL.local)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*GohVaTK_DyxtAUbKbGMcWw.png" /></figure><p>I began by promoting the Windows Server 2022 machine to a Domain Controller using the Active Directory Domain Services Configuration Wizard. Since this was a brand-new environment, I selected <strong>“Add a new forest”</strong> and set the root domain name to MARVEL.local.</p><p><strong>2. Domain Controller Options — Functional Levels &amp; DNS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*W3tnPMc8QA5OPWicc_7TZg.png" /></figure><p>I kept the forest and domain functional level at <strong>Windows Server 2016</strong> for broad compatibility, and left <strong>DNS Server</strong> and <strong>Global Catalog</strong> enabled so the DC could also handle name resolution for the domain. I then set a DSRM password for recovery purposes.</p><p><strong>3. DNS Options — Delegation Warning</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*Wf0k-daAbEG5ds7caG8jwA.png" /></figure><p>The wizard flagged that a DNS delegation could not be created since no authoritative parent zone exists — expected behavior in an isolated lab with no external DNS hierarchy, so I proceeded without delegation.</p><p><strong>4. Additional Options — NetBIOS Name</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*97LtpiQpQIWOm3ktmTIqNg.png" /></figure><p>The wizard automatically generated the NetBIOS name <strong>MARVEL</strong>, the short-form domain identifier used for legacy authentication (e.g., MARVEL\Administrator).</p><p><strong>5. Paths — Database, Logs &amp; SYSVOL</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*JVnOYZ5rG2ICtGTaeyARLA.png" /></figure><p>I left the default file paths for the AD database, log files, and SYSVOL folder, keeping everything under C:\Windows.</p><p><strong>6. Review Options — Final Configuration Summary</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*TFcQtZQeHahB8apt4C7TIQ.png" /></figure><p>Before installing, I reviewed the full summary of selections — confirming DNS installation, no delegation, and default paths — then proceeded to install. After the prerequisites check passed, Windows Server 2022 was successfully promoted to the first Domain Controller of MARVEL.local.</p><p><strong>7. Selecting Server Roles — Adding AD CS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*lnDea0ngbR0vsVdzxacAvQ.png" /></figure><p>With the domain established, I added the <strong>Active Directory Certificate Services</strong> role to introduce PKI capability into the lab — a key component in real-world AD environments and a common target in certificate-based attack paths.</p><p><strong>8. Adding Required Management Tools</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*UOg8CzGJ35joQ9W0D6vCDQ.png" /></figure><p>The wizard prompted to include the <strong>Certification Authority Management Tools</strong>, required to manage AD CS. I accepted the default and continued.</p><p><strong>9. Selecting Additional Features</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*PcVgTNtgWyTtcbLnnezgAw.png" /></figure><p>I left the remaining optional Windows features at their defaults, with <strong>Group Policy Management</strong> already installed from the domain setup stage.</p><p><strong>10. Role Services &amp; Installation Confirmation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*ACTD_FRdzlM9Eul75D8uXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*YWEQfJhUMI9hBlVmACALyQ.png" /></figure><p>Under AD CS role services, I selected only <strong>Certification Authority</strong>, keeping the setup minimal since the goal was a basic internal CA rather than full web enrollment services. I confirmed the installation and allowed the server to restart automatically if needed.</p><p><strong>11. Installation Complete</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*tsQxE1nOa2dQ5XoxwAgnjw.png" /></figure><p>The AD CS role installed successfully. However, a post-deployment configuration step was still required to actually activate the Certification Authority — which I’ll cover in the next part of this series.</p><p><strong>Part 3: Configuring the Certification Authority (AD CS Post-Deployment)</strong></p><p><strong>12. AD CS Configuration — Credentials</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*SKVQaWVZ7HsskqGcvAiMPA.png" /></figure><p>After installing the AD CS role, a post-deployment configuration was required to activate the Certification Authority. I confirmed the configuration would run using the MARVEL\Administrator account, which holds Enterprise Admins rights needed to configure an Enterprise CA.</p><p><strong>13. Role Services — Certification Authority</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*l1pI2ehp4T4wzzA1d34y-g.png" /></figure><p>I selected only <strong>Certification Authority</strong> as the role service to configure, keeping the CA minimal for this lab rather than deploying full web enrollment services.</p><p><strong>14. Setup Type — Enterprise CA</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*Z64r7r9_d3jltMDjtj8ndQ.png" /></figure><p>I chose <strong>Enterprise CA</strong> since it integrates directly with Active Directory Domain Services, allowing certificates to be issued and managed automatically through AD rather than manually as with a standalone CA.</p><p><strong>15. CA Name — Defining the Certificate Authority Identity</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*iaQ2Nxn5KYp671S_zVItAg.png" /></figure><p>I set the CA’s common name to MARVEL-WIN-6LR0766B361-CA, with the distinguished name suffix DC=MARVEL,DC=local, which ties the CA&#39;s identity directly to the domain.</p><p><strong>16. Confirmation — Finalizing the CA Configuration</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*b8v0MoJnbxWpdxUrnUP5pg.png" /></figure><p>Before configuring, I reviewed the summary: an <strong>Enterprise Root CA</strong> using RSA with SHA256 and a 2048-bit key length, with a certificate validity period extending to 2125. Clicking Configure completed the Certificate Authority setup, giving the domain a functioning internal PKI.</p><p><strong>Part 4: Creating Users, Groups, and a Vulnerable Service Account</strong></p><p><strong>17. Default Active Directory Groups</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*UJF7_cp-jnD4PbC1fZrXnA.png" /></figure><p>With the domain and PKI in place, I moved on to populating Active Directory with users and groups. The default <strong>Groups</strong> container already includes built-in security groups such as Domain Admins, Domain Users, Enterprise Admins, and DNS Admins, which I used as the basis for assigning permissions to new accounts.</p><p><strong>18. Creating a Standard Domain User</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*EonG6DjDtzucL1aQ8Nfa6w.png" /></figure><p>I created a standard domain user, <strong>Frank Castle</strong> (fcastle), to represent a normal employee account within the domain, used later to simulate realistic client-side authentication.</p><p><strong>19. Cloning a User Account</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*K4u7PXZ5uQt9LwSocRewkQ.png" /></figure><p>To speed up user provisioning, I used the Copy Object — User feature in ADUC to clone an existing account and quickly create additional users, such as Peter Packer (ppacker), while retaining consistent group memberships and settings.</p><p><strong>20. Planting a Vulnerable Service Account</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*TMz-irO1flRAFqadLJADHw.png" /></figure><p>To simulate a common real-world misconfiguration, I created a service account, <strong>SQL Service</strong>, and — intentionally — stored its password in plaintext in the account’s <strong>Description</strong> field. This is a classic AD misconfiguration that attackers frequently discover through simple LDAP enumeration, and it would later serve as an entry point during the attack phase of this project.</p><p><strong>Part 5: SPN Registration and File Share Exposure</strong></p><p><strong>21. Registering a Service Principal Name (SPN) for Kerberoasting</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*BiYXrAfDVGMKu5xGiO79BA.png" /></figure><p>Using setspn -a HYDRA-DC/SQLService.MARVEL.local:60111 MARVEL\SQLService, I registered a Service Principal Name for the SQL Service account. Associating an SPN with a domain user account (rather than a machine account) is a well-known Kerberoasting vulnerability, since any authenticated domain user can request a Kerberos service ticket for that SPN and attempt to crack its password offline.</p><p><strong>22. Creating a Shared Folder on the File Server</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*4aW3l36YhZgZy3KCpqODfA.png" /></figure><p>On the file server, I created a folder named hackme on the C: drive, intended to be shared out as an accessible SMB resource — simulating an exposed file share that an attacker could discover during network enumeration.</p><p><strong>23. Configuring the SMB Share Profile</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*E63haQoCHDW-Kwtm9GtYQQ.png" /></figure><p>Using the <strong>New Share Wizard</strong>, I selected the <strong>SMB Share — Quick</strong> profile, the standard method for sharing files with Windows-based clients on the network.</p><p><strong>24. Naming and Finalizing the Share</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*UPj1fxezQMkzkUVElHYeFA.png" /></figure><p>I named the share hackme, with the local path C:\hackme and remote path \\WIN-6LR0766B361\hackme, making it accessible over the network — this share would later be used to test SMB enumeration and unauthorized access from the Kali attacker machine.</p><p><strong>Part 6: Network Configuration &amp; Joining CLIENT01 to the Domain</strong></p><p><strong>25. Domain Controller Network Configuration</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*2y4WSwv23T6TLIAu7Kf1pw.png" /></figure><p>To ensure reliable name resolution and domain communication, I configured a static IP on the Domain Controller. The DC’s Ethernet adapter was set to 192.168.169.10/24, with the DNS server pointing to itself (192.168.169.10), since the DC also hosts the domain&#39;s DNS role.</p><p><strong>26. Configuring the Client’s Static IP and DNS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*d1KK3YzACx1YxvhSrg0nIw.png" /></figure><p>On the <strong>Windows 10 client (CLIENT01)</strong>, I manually configured a static IP address (192.168.169.20/24) and set the preferred DNS server to the Domain Controller&#39;s IP (192.168.169.10). This step is essential — without pointing the client&#39;s DNS to the DC, it would be unable to resolve the domain name MARVEL.local and would fail to join the domain.</p><p><strong>27. Confirming the Client Joined the Domain</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*xTqsqkqZ8sm72z-KLcpXlw.png" /></figure><p>After joining CLIENT01 to the MARVEL.local domain, I verified the join was successful from the Domain Controller by checking <strong>Active Directory Users and Computers</strong>, where <strong>CLIENT01</strong> now appears under the <strong>Computers</strong> container as a recognized domain-joined machine.</p><p><strong>28. Granting Local Administrator Rights on the Client</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*ha3jBhpi6Vox-uUfWTT3gg.png" /></figure><p>To simulate a realistic (and commonly over-privileged) environment, I added the domain user <strong>fcastle</strong>, along with a local account, to the client’s local <strong>Administrators</strong> group. Granting standard domain users local admin rights on client machines is a frequent real-world misconfiguration — it significantly expands the attack surface, since compromising this one account would grant full administrative control over the client machine.</p><p><strong>2. Offensive Operations: Reconnaissance &amp; Initial Access</strong></p><p><strong>2.1 Network &amp; Initial Enumeration</strong></p><p><strong>2.1.1 Host Discovery with Nmap Ping Sweep</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*9KApmB76xi4EFjOvfYFs5g.png" /></figure><p>With the Kali attacker machine connected to the lab network (192.168.91.0/24), I began with a ping sweep using nmap -sP 192.168.91.0/24 to identify live hosts. The scan revealed four active hosts, including the gateway and two VMware-hosted machines — consistent with the Domain Controller and client VM expected in this environment.</p><p><strong>2.1.2 Service Enumeration on a Discovered Host</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*46Cz6LOKWP_vEHSeuWWRKw.png" /></figure><p>I ran a targeted scan against one of the discovered hosts using nmap -PN -sV --top-ports 50 --open 192.168.91.2, checking for open ports and running services. Only port 53 (DNS) appeared open on this host, marked as tcpwrapped, indicating limited exposure on this particular target.</p><p><strong>2.1.3 SMB Enumeration with NetExec</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*sRj94l1Y2aLmA9e5z6drYQ.png" /></figure><p>Using <strong>NetExec (nxc)</strong> to enumerate SMB across the subnet (nxc smb 192.168.91.0/24), I identified two key targets: the <strong>Domain Controller (DC)</strong> running Windows Server 2022, with <strong>SMB signing disabled</strong> and <strong>Null Authentication allowed</strong> — a significant misconfiguration — and <strong>CLIENT01</strong>, a Windows 10 machine also with SMB signing disabled. Both findings are notable, since disabled SMB signing can enable relay attacks, and Null Auth allows unauthenticated enumeration of the DC</p><p><strong>2.2 Active Directory (AD) Discovery</strong></p><p><strong>2.2.1 Anonymous AD Enumeration with enum4linux</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*7kuBEwyZWKH1_x1_UTQLIA.png" /></figure><p>Leveraging the Null Authentication vulnerability discovered on the DC, I ran enum4linux -a -u &quot;&quot; -p &quot;&quot; 192.168.91.134 to attempt anonymous enumeration against the Domain Controller. The tool successfully identified the domain/workgroup name as <strong>MARVEL</strong>, confirming the null session was accepted without credentials.</p><p><strong>2.2.2 Confirming Domain Role and SID</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*eYO5wQVEEs5dngvOnHdl0g.png" /></figure><p>The enumeration continued to identify the target as an active <strong>Domain Controller</strong> for <strong>MARVEL</strong>, running both Workstation and File Server services. Critically, the tool confirmed <strong>anonymous sessions were permitted</strong> using blank credentials, and successfully retrieved the domain’s <strong>SID</strong> (S-1-5-21-909403083-1080228275-1902956442) — valuable information for further enumeration and potential SID-based attacks later in the assessment.</p><p><strong>2.2.3 Limitations of Anonymous Enumeration</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*7uEGC0TvwFPKtsFOCJP-Tg.png" /></figure><p>While the null session allowed basic domain discovery, further attempts to pull OS details and user listings via querydispinfo and enumdomusers were denied (NT_STATUS_ACCESS_DENIED) — indicating that while Null Auth was enabled, RPC-level user enumeration had additional restrictions in place.</p><p><strong>2.2.4 Share Enumeration and Password Policy Discovery</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*VOCm-XG9O7OHGYtCAhSutQ.png" /></figure><p>Share enumeration via SMB1 also failed due to the protocol being unavailable, and a specific share query returned NT_STATUS_RESOURCE_NAME_NOT_FOUND. Despite these restrictions, enum4linux proceeded to attempt mapping accessible shares and began retrieving the domain&#39;s <strong>password policy</strong>, which is valuable reconnaissance for planning future password-spraying or brute-force attempts.</p><p><strong>2.3 Attack Path Mapping with BloodHound</strong></p><p><strong>2.3.1 Starting the Neo4j Database</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*NKtSZxFXTWsyahdbIxdvHQ.png" /></figure><p>BloodHound relies on a Neo4j graph database to store and visualize AD relationships, so I started the service using sudo neo4j console. The initial startup created the default database and enabled the Bolt interface on localhost:7687, along with the web interface on port 7474.</p><p><strong>2.3.2 Handling an Existing Neo4j Instance</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*PgbJvaeql44dPX5XUmVIVQ.png" /></figure><p>On a later attempt, Neo4j reported it was already running under a previous process ID, showing that the service had persisted from an earlier session.</p><p><strong>2.3.3 Restarting Neo4j Cleanly</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*RFrqbQTtZOFGEOUxJmqBYw.png" /></figure><p>To ensure a clean session, I identified and killed the existing Neo4j-related processes using sudo kill -9, then relaunched neo4j console. The database initialized successfully and re-enabled the Bolt interface, ready for BloodHound data ingestion.</p><p><strong>2.3.4 Collecting AD Data with BloodHound.py</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*R18kmoRR7rwTi32AvbIONQ.png" /></figure><p>Using the domain credentials for <strong>fcastle</strong>, I ran bloodhound-python -u &#39;fcastle&#39; -p &#39;p@ssw0rd&#39; -d MARVEL.local -ns 192.168.91.134 -c All --zip to collect Active Directory data via LDAP. Since Kerberos authentication to dc.marvel.local:88 failed, the tool automatically fell back to NTLM. The collection completed successfully, identifying <strong>1 domain, 2 computers, 7 users, 52 groups, 2 GPOs, 2 OUs, and 19 containers</strong>, all compressed into a BloodHound-compatible ZIP file for analysis.</p><p><strong>2.3.5 Re-launching Neo4j for Analysis</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*_tq1MogpAyEck8cyMBU1Ig.png" /></figure><p>With the collection complete, I restarted the Neo4j console once more to prepare the graph database for importing the BloodHound data and beginning the analysis phase.</p><p><strong>2.3.6 Visualizing the Attack Path in BloodHound</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*8FLAGjYSONMUSSZAilRAog.png" /></figure><p>After importing the collected data into BloodHound’s web interface, I explored the relationships around the <strong>SQLSERVICE</strong> account. The graph revealed that SQLSERVICE has direct <strong>GenericWrite</strong>, <strong>GenericAll</strong>, <strong>WriteOwner</strong>, <strong>WriteDacl</strong>, and <strong>AllExtendedRights</strong> permissions — meaning that compromising this single service account would provide a clear escalation path toward <strong>Domain Admins</strong> and <strong>Enterprise Admins</strong> group membership.</p><p><strong>2.3.7 SQLSERVICE Account Details</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*QLn2Wt1UPGRai4KzLPtwEg.png" /></figure><p>Inspecting the SQLSERVICE node directly in BloodHound confirmed the earlier misconfiguration: the account’s <strong>Description</strong> field contains the plaintext password, and the account holds a registered <strong>SPN</strong> (DC/SQLService.MARVEL.local:60111), making it vulnerable to both LDAP description harvesting and Kerberoasting. Notably, the account also has <strong>AdminCount: TRUE</strong> and <strong>Password Never Expires: TRUE</strong>, both signs of a high-privilege, poorly maintained service account.</p><p><strong>2.4 Enumeration with PowerView</strong></p><p><strong>2.4.1 Enumerating Domain Information</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*hc7fKTAUZlV1OTxKBm_mbg.png" /></figure><p><em>From the compromised client, I imported </em><strong><em>PowerView</em></strong><em> (</em><em>. .\PowerView.ps1) and ran </em><em>Get-NetDomain to confirm domain-level details — verifying the forest name (</em><em>MARVEL.local), the Domain Controller (</em><em>DC.MARVEL.local), and role owners (PDC, RID, and Infrastructure Master), all hosted on the same DC in this single-DC lab environment.</em></p><p><strong>2.4.2 Harvesting Plaintext Credentials from User Descriptions</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*uVMMjIbGS7zt1y1ZHdCL3w.png" /></figure><p>Using Get-NetUser | select description, I extracted the <strong>Description</strong> field for all domain users — successfully retrieving the plaintext password (p@ssw0rd) stored on the SQL Service account. This confirms, from a second independent tool (PowerShell/PowerView instead of BloodHound), how easily plaintext credentials stored in AD attributes can be harvested by any authenticated user with basic read access</p><p><strong>2.2.4 Enumerate SMB Users with CrackMapExec on AD Domain</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7fkbtagMP4Mre2YPN9T7Fw.png" /></figure><p>Using the compromised <strong>fcastle</strong> credentials, I authenticated against CLIENT01 via crackmapexec smb 192.168.91.133 -u fcastle -p &#39;p@ssw0rd&#39; -d MARVEL.local --users. Authentication succeeded, confirming valid domain credentials. While a direct query against the DC failed due to a connection error, CrackMapExec fell back to the SAMR protocol and successfully enumerated local/domain accounts on CLIENT01, including <strong>Administrateur</strong>, <strong>DefaultAccount</strong>, <strong>Invité</strong>, and <strong>WDAGUtilityAccount</strong> — giving a clearer picture of the accounts present on the client machine.</p><p><strong>2.5 Credential Capture via LLMNR/NBT-NS Poisoning</strong></p><p><strong>2.5.1 Launching Responder</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*RMHBdOfCCbvwfF2F2PHzbw.png" /></figure><p>To capture credentials passively over the network, I launched <strong>Responder</strong> with responder -I eth0 -dPv, enabling poisoning for <strong>LLMNR, NBT-NS, MDNS, and DHCP</strong>, while leaving DHCPv6 disabled. Responder also spun up multiple fake servers (SMB, HTTP, FTP, SQL, LDAP, RDP, and others) to capture authentication attempts across a wide range of protocols.</p><p><strong>2.5.2 Responder Actively Poisoning the Network</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*Rk3wBvXJRu4CV4xzTSkclg.png" /></figure><p>With Responder running, it began actively poisoning <strong>LLMNR and MDNS</strong> name resolution requests broadcast on the network — responding to queries for wpad, CLIENT01, and DC from multiple hosts, tricking clients into resolving these names to the Kali attacker machine instead of the legitimate hosts.</p><p><strong>2.5.3 Capturing an NTLMv2 Hash from the Domain Administrator</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XLmDXDk5FuVP8E2syhO2gw.png" /></figure><p>The poisoning attack succeeded: a client attempted to resolve a non-existent hostname (fakehost), and Responder intercepted the resulting SMB authentication attempt. This yielded a captured <strong>NTLMv2-SSP hash</strong> for the <strong>MARVEL\Administrator</strong> account — the domain&#39;s built-in Administrator — a critical capture, since successfully cracking this hash could lead directly to full domain compromise.</p><p><strong>2.5.4 Reviewing the Captured Hash</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgED_MFqjHE2a6VD_IZKig.png" /></figure><p>The captured hash was saved locally to captured_hashes.txt for offline cracking, preserving the full NTLMv2 response needed for a dictionary or brute-force attack.</p><p><strong>2.5.5 Cracking the Captured Hash with John the Ripper</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jR41wZGe2mgBHGyz2W3Pfw.png" /></figure><p>Using john --wordlist=/usr/share/wordlists/rockyou.txt captured_hashes.txt, I attempted to crack the captured hash offline. The attack succeeded almost instantly, recovering the plaintext password <strong>p@ssw0rd</strong> for the <strong>Administrator</strong> account — granting full <strong>Domain Admin</strong> level credentials and, effectively, complete control over the MARVEL.local domain.</p><p><strong>2.6 Domain Compromise via mitm6 + NTLM Relay to LDAP (DCSync Rights Escalation)</strong></p><p><strong>2.6.1 Launching mitm6 for IPv6/DNS Poisoning</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*MU7RiUxyKTrz2QCk0cX-pA.png" /></figure><p>To set up a relay attack, I launched <strong>mitm6</strong> with mitm6 -d MARVEL.local, which abuses the fact that Windows clients query for IPv6 configuration (DHCPv6) by default, even on IPv4-only networks. mitm6 answered these requests, assigning itself as the IPv6 DNS server for <strong>CLIENT01</strong> and the <strong>Domain Controller</strong>, and began spoofing WPAD (Web Proxy Auto-Discovery) responses — positioning the Kali machine as a man-in-the-middle for DNS and proxy resolution across the domain.</p><p><strong>2.6.2 Relaying Captured Authentication to LDAPS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*VIdz7tgielWJkUZe-u-Abg.png" /></figure><p>With mitm6 poisoning active, I launched impacket-ntlmrelayx -6 -t ldaps://192.168.91.144 -wh fakewpad.MARVEL.local -l lootme to relay any captured NTLM authentication attempts to the Domain Controller&#39;s <strong>LDAPS</strong> service. When a machine (in this case, authenticating as <strong>MARVEL\Administrator</strong>) attempted to resolve the spoofed WPAD host, its credentials were relayed live to LDAPS on the DC, and the relay <strong>succeeded</strong>.</p><p><strong>2.6.3 Escalating Privileges via the Relayed Session</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*d2h1hjeY0RcObMk3O_lJyg.png" /></figure><p>Because the relayed session belonged to a Domain Admin-equivalent account, ntlmrelayx automatically enumerated the relayed user&#39;s privileges and discovered it could <strong>create new users</strong> and <strong>add users to privileged groups</strong> such as <strong>Enterprise Admins</strong>. It then abused this access to:</p><ol><li>Create a new domain user (PHyOnnYFnY) with a randomly generated password,</li><li>Modify the domain’s ACL to grant this new user <strong>Replication-Get-Changes-All</strong> rights — the permission required to perform a <strong>DCSync attack</strong>.</li></ol><p>This effectively gave the attacker a <strong>backdoor account with domain replication rights</strong>, without ever needing to crack a single password — a textbook example of relay-based privilege escalation. The tool even logged a helpful next step: <em>“Try using DCSync with secretsdump.py and this user.”</em></p><p><strong>2.6.4 Confirming the Rogue User in Active Directory</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*zfe8GcGl-2Zo2rwUv4zCWA.png" /></figure><p>Verifying directly on the Domain Controller via Active Directory Users and Computers, the newly created account PHyOnnYFnY now appears alongside legitimate domain users — with no descriptive metadata, making it look inconspicuous at a glance, but with elevated replication rights granted behind the scenes.</p><p><strong>2.6.5 Domain User Report — Full Account Inventory</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*eNFTYy_3EkvHvmp-6g6dlA.png" /></figure><p>A full domain user report (generated via BloodHound/PingCastle-style output) confirms the final state of the domain’s user accounts. This includes the SQL Service account’s exposed plaintext password, and — critically — the rogue account <strong>PHyOnnYFnY</strong>, created entirely through the relay attack, now holding privileges equivalent to <strong>Domain Admins</strong> and listed under <strong>Group Policy Creator Owners</strong>, giving it the ability to modify Group Policy across the entire domain.</p><h4>2.7 Kerberoasting the SQL Service Account</h4><p><strong>2.7.1 Requesting Kerberos Service Tickets with GetUserSPNs</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*-SY0-IectPME6dvByFZ6jQ.png" /></figure><p>Using the valid fcastle credentials, I ran impacket-GetUserSPNs MARVEL.local/fcastle:p@ssw0rd -dc-ip 192.168.91.144 -request to enumerate all accounts with registered <strong>Service Principal Names (SPNs)</strong> and request their Kerberos service tickets. This returned the <strong>SQLService</strong> account — the same account with the plaintext-password misconfiguration found earlier — along with a full <strong>TGS (Ticket Granting Service) hash</strong>, ready for offline cracking. Notably, the account is also a member of <strong>Group Policy Creator Owners</strong>, making it a high-value Kerberoasting target.</p><p><strong>2.7.2 Saving and Cracking the TGS Hash</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*bB5bs4aF4apvuFBbgpkv6A.png" /></figure><p>I saved the captured ticket hash to capt_hash.txt and cracked it offline using john --wordlist=/usr/share/wordlists/rockyou.txt capt_hash.txt. The attack succeeded almost instantly, recovering the plaintext password <strong>p@ssw0rd</strong> for the <strong>SQLService</strong> account — confirming, through a completely independent attack technique (Kerberoasting rather than LDAP description harvesting), the same weak credential exposure.</p><h4>2.8 Kerberos Ticket-Based Authentication (Pass-the-Ticket)</h4><p><strong>2.8.1 Requesting a Valid TGT for fcastle</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*280ulsWz3ptbqvdE5ofsrQ.png" /></figure><p>With valid domain credentials in hand, I used impacket-getTGT MARVEL.local/fcastle:p@ssw0rd -dc-ip 192.168.91.144 to request a legitimate <strong>Ticket Granting Ticket (TGT)</strong> from the Domain Controller&#39;s KDC. The ticket was saved locally as fcastle.ccache.</p><p><strong>2.8.2 Loading the Ticket for Authentication</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*Yt166AmFvjoaxlLK_llrAA.png" /></figure><p>I confirmed the ticket file was created (ls *.ccache), then exported it as the active Kerberos credential cache using export KRB5CCNAME=$(pwd)/fcastle.ccache. This allows any Kerberos-aware tool run afterward to authenticate using the cached ticket instead of a plaintext password.</p><p><strong>2.8.3 Authenticating via Pass-the-Ticket over SMB</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*Hlv7OWDH6S5jVj6Z3bCCbA.png" /></figure><p>Using the cached ticket, I connected to CLIENT01 with impacket-smbclient -k -no-pass -dc-ip 192.168.91.144 &#39;MARVEL.local/fcastle@CLIENT01.MARVEL.local&#39;. The -k -no-pass flags forced Kerberos authentication using the ticket instead of a password, successfully opening an authenticated SMB session — demonstrating a <strong>Pass-the-Ticket (PtT)</strong> technique, a stealthier alternative to using plaintext credentials or NTLM hashes directly.</p><h3>Conclusion</h3><p>This project set out to build a realistic Active Directory environment from the ground up — deploying a Windows Server 2022 Domain Controller, joining a Windows 10 client, and configuring supporting services like DNS and Active Directory Certificate Services — and then to attack that same environment as an adversary would, using a Kali Linux machine.</p><p>What started as a handful of small, individually unremarkable misconfigurations ended up chaining together into full domain compromise. That’s the real lesson of this lab: in Active Directory, security failures are rarely about one catastrophic flaw. They’re about small oversights that, combined, hand an attacker a complete path to Domain Admin.</p><h4>Attack Chain Summary</h4><ol><li><strong>Reconnaissance</strong> — Nmap and NetExec identified live hosts and revealed that SMB signing was disabled and Null Authentication was permitted on the Domain Controller.</li><li><strong>Anonymous Enumeration</strong> — enum4linux used the Null Auth misconfiguration to enumerate the domain name, SID, and structure without any credentials.</li><li><strong>Credential Harvesting</strong> — BloodHound and PowerView both uncovered a service account (SQLService) with its password stored in plaintext in the AD <strong>Description</strong> field.</li><li><strong>Kerberoasting</strong> — The same SQLService account, which had a registered SPN, was Kerberoasted and its ticket cracked offline in seconds — confirming the weak password through a second, independent technique.</li><li><strong>LLMNR/NBT-NS Poisoning</strong> — Responder captured an NTLMv2 hash for the <strong>Domain Administrator</strong> account itself, which was cracked in under a second due to a weak password.</li><li><strong>NTLM Relay to LDAP (mitm6 + ntlmrelayx)</strong> — Relaying a captured authentication attempt to LDAPS allowed the creation of a rogue domain user with <strong>DCSync rights</strong>, effectively creating a stealthy backdoor capable of extracting every credential in the domain.</li><li><strong>Pass-the-Ticket</strong> — A legitimate Kerberos TGT was requested and reused to authenticate without ever touching a plaintext password again, demonstrating a stealthier, more evasive access method.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12136a0fd7e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>