<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[t3chnocat.com]]></title><description><![CDATA[Pentesting, Security, Networking and Tech]]></description><link>https://t3chnocat.com/</link><image><url>https://t3chnocat.com/favicon.png</url><title>t3chnocat.com</title><link>https://t3chnocat.com/</link></image><generator>Ghost 5.18</generator><lastBuildDate>Sat, 11 Apr 2026 20:13:16 GMT</lastBuildDate><atom:link href="https://t3chnocat.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Identity Debt in the Age of Vibe Coding]]></title><description><![CDATA[<h1></h1><h3 id="designing-identity-systems-that-keep-pace-with-ai-driven-development"><strong>Designing identity systems that keep pace with AI-driven development</strong></h3><blockquote><strong>Thesis:</strong> Identity systems designed for human-paced development are failing in AI-accelerated environments. To secure modern infrastructure, identity must be <strong>default-closed</strong>, <strong>zero-friction</strong>, and <strong>automation-driven</strong>.</blockquote><h3 id="the-snap-why-identity-is-breaking"><strong>The Snap: Why Identity is Breaking</strong></h3><p>We have entered an era where engineers can &quot;vibe code&quot;</p>]]></description><link>https://t3chnocat.com/identity_debt/</link><guid isPermaLink="false">69bc8489058376f3fa17e32d</guid><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Thu, 19 Mar 2026 23:31:23 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2026/03/t3chnocat_secure_foundation.png" medium="image"/><content:encoded><![CDATA[<h1></h1><h3 id="designing-identity-systems-that-keep-pace-with-ai-driven-development"><strong>Designing identity systems that keep pace with AI-driven development</strong></h3><blockquote><strong>Thesis:</strong> Identity systems designed for human-paced development are failing in AI-accelerated environments. To secure modern infrastructure, identity must be <strong>default-closed</strong>, <strong>zero-friction</strong>, and <strong>automation-driven</strong>.</blockquote><h3 id="the-snap-why-identity-is-breaking"><strong>The Snap: Why Identity is Breaking</strong></h3><img src="https://t3chnocat.com/content/images/2026/03/t3chnocat_secure_foundation.png" alt="Identity Debt in the Age of Vibe Coding"><p>We have entered an era where engineers can &quot;vibe code&quot; production-grade tools in hours using LLMs. But identity systems still assume weeks of setup, manual tickets, and cross-team coordination.</p><p>That mismatch is creating a new class of risk: <strong>Identity Debt.</strong> <strong>Identity Debt is the accumulation of unauthenticated or weakly authenticated internal systems created faster than governance can keep up.</strong> It is a growing surface area of &quot;naked&quot; infrastructure created because the official path was too slow. Instead of resisting this shift, I designed an identity foundation to match development velocity.</p><hr><h3 id="1-fail-open-identity-is-dead"><strong>1. Fail-Open Identity is Dead</strong></h3><p>Most identity frameworks are fundamentally flawed: they assume developers will remember to secure every route with a decorator. In a high-velocity environment, that assumption is a liability.</p><p>I built a <strong>Default-Closed Wrapping</strong> model:</p><p><strong>The Philosophy:</strong> Security must be enforced at the application boundary, not at the developer&#x2019;s discretion.</p><p><strong>The Implementation:</strong> I built a <code>protect_app(app)</code> initialization that wraps the entire application instance, protecting every route automatically.</p><p><strong>The Impact:</strong> This eliminates an entire class of &quot;forgotten auth&quot; vulnerabilities at the framework level. By requiring developers to explicitly use an <code>@allow_unauthenticated</code> decorator to make a route public, I moved the burden of security from the human to the framework.</p><h3 id="2-friction-is-the-real-vulnerability"><strong>2. Friction is the Real Vulnerability</strong></h3><p>The biggest barrier to secure identity is not complexity - it&#x2019;s <strong>Day 1 Friction</strong>. If a developer cannot get a working auth flow locally in under a minute, they will bypass it.</p><p><strong>The Insight:</strong> I implemented a <strong>Universal Sandbox Pattern</strong> that auto-bootstraps for local prototyping.</p><p><strong>The Outcome:</strong> I inverted the default: the fastest path is now the secure one. Developers can reach a functional OIDC handshake locally with zero configuration. By eliminating the need for a ticket just to see a &quot;Hello World&quot; app, I made security the path of least resistance.</p><h3 id="3-solving-the-socio-technical-bottleneck"><strong>3. Solving the Socio-Technical Bottleneck</strong></h3><p>Most identity systems fail not because of technology, but because of the coordination overhead between Engineering and IT. To fix identity, I had to fix the <strong>Provisioning Pipeline</strong>.</p><p>I created a CLI tool that consumes application metadata and generates a standardized <strong>Identity Provisioning Spec</strong>. This reduces onboarding from multi-day coordination cycles to a near-instant, self-service process by automating the exact JSON and documentation required for administrative approval.</p><h3 id="4-the-urgency-of-agentic-identity"><strong>4. The Urgency of Agentic Identity</strong></h3><p>This already extends beyond human users. The next failure mode is not human misuse - it&#x2019;s <strong>Autonomous Agents</strong> operating with unclear identity boundaries.</p><p>Agents won&#x2019;t just read data; they will take actions across systems, chain commands, and escalate privileges implicitly. Without clear identity boundaries, those actions become untraceable, ungoverned, and impossible to constrain. My framework provides the foundation for <strong>Machine-to-Machine (M2M)</strong> authentication, ensuring that agentic workflows inherit the same governance and telemetry standards as human ones.</p><hr><h3 id="the-architecture-the-identity-aware-sidecar"><strong>The Architecture: The Identity-Aware Sidecar</strong></h3><p>Not all systems can be modified, but identity still needs to be enforced. For services where code changes aren&apos;t possible (legacy tools, third-party containers), I utilize a sidecar proxy that enforces identity before traffic ever reaches the application.</p><pre><code> [ USER ] ----&gt; [ IDENTITY PROXY ] ----&gt; [ TARGET APP ]
                      |                     (Isolated)
              (OIDC Handshake)
                      |
              [ IDENTITY PROVIDER ]
</code></pre><p><strong>The Outcome: </strong>This ensures that legacy and third-party systems inherit modern identity controls without requiring code changes. This is how identity systems need to evolve: not as a bottleneck to development, but as infrastructure that scales with it.</p><hr><h2 id="appendix">Appendix: </h2><h2 id="deep-dive-%E2%80%94-hardening-the-identity-boundary">Deep Dive &#x2014; Hardening the Identity Boundary</h2><p></p><h3 id="secretless-by-design">Secretless by Design</h3><p>A core property of this framework is that it is fully secretless.</p><p>Traditional internal systems rely on static API keys or long-lived service account credentials, which become high-value targets once exposed. In practice, these credentials are frequently over-permissioned and difficult to rotate, making them a persistent source of risk.</p><p>This model removes that class of problem entirely. All authentication is handled through short-lived, identity-based OIDC flows, eliminating the need for stored secrets at the application layer.</p><p><strong>If there are no static credentials, there are no credentials to steal.</strong></p><hr><p><em>While the external interface is optimized for developer velocity, the underlying implementation adheres to strict security constraints required for enterprise Zero Trust environments. For those interested in the technical specifics:</em></p><ul><li><strong>Cryptographic Verification:</strong> Every inbound JWT is validated against the OIDC provider&apos;s JWKS (JSON Web Key Set) endpoint. I built a local caching layer with a short TTL for these keys to minimize handshake latency while ensuring we are always using the current rotation.</li><li><strong>Correlation &amp; Observability:</strong> I designed the framework to automatically inject a unique <code>X-Identity-Trace-ID</code> into the headers of every proxied request. This enables seamless correlation in the SIEM, mapping a single user&#x2019;s path across multiple downstream microservices without requiring per-app logging logic.</li><li><strong>Session Lifecycle Management:</strong> I use a sliding-window session model combining short-lived OIDC tokens with a secure, HTTP-only session cookie. This ensures that session revocation at the Identity Provider propagates to the application boundary in near real-time.</li><li><strong>Entropy &amp; State Protection:</strong> To prevent CSRF and Replay attacks, the library manages the OIDC <code>state</code> and <code>nonce</code> parameters using a cryptographically secure random generator, ensuring every handshake is unique and cryptographically bound to the initial request.</li></ul>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Cache]]></title><description><![CDATA[<p>Cache was a medium rated Linux box where enumerating a website found some hard-coded creds and a vhost that contained an Electronic Medical Records application. This EMR app had some SQL injection vulnerabilities that allowed a password hash to be dumped and cracked, gaining access to the EMR app. A</p>]]></description><link>https://t3chnocat.com/htb-cache/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182be</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 10 Oct 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/10/cache.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/10/cache.png" alt="HackTheBox Writeup: Cache"><p>Cache was a medium rated Linux box where enumerating a website found some hard-coded creds and a vhost that contained an Electronic Medical Records application. This EMR app had some SQL injection vulnerabilities that allowed a password hash to be dumped and cracked, gaining access to the EMR app. A PHP reverse shell was uploaded through the EMR app and those hard-coded creds found earlier came in handy to <code>su</code> to the user &apos;ash&apos;. From there, creds for a user &apos;luffy&apos; were pulled out of <code>memcached</code>. For root, I found two paths. The intended route was a Docker container escape. I added cache.htb to /etc/hosts and got started.</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Without creds, time to check out the web server:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-1.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>News:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-2.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Author:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-3.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Login:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-4.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>In short order I found some creds hardcoded in a js file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-5.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>These creds worked for the login screen but lead nowhere:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-6.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>I ran gobuster on the site and got nowhere. I was a bit stuck until I looked a bit closer at the website:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-7.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>I added hms.htb to /etc/hosts, tried opening it up in a browser and was greeted with a login page:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-8.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>The previously found creds did not work here so I enumerated more with gobuster:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-9.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>admin.php gave me a version number:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-10.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Googling around for vulnerabilties found <a href="https://www.open-emr.org/wiki/images/1/11/Openemr_insecurity.pdf">this article</a> which described multiple instances of SQL injection as well as an authentication bypass. The auth bypass was incredibly simple. First navigate to the registration page:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-11.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Then just change the URL to something else. In this case I chose the &apos;find_appt_popup_user.php&apos; file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-12.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Hitting the search button auto-filled some parameters in:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/10/image-13.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Knowing that there are SQL injection vulnerabilties, I put a 1&apos; for one of the parameters and received an error:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-14.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>I saved the working request in Burp as &apos;req.txt&apos; and threw it at sqlmap with <code>sqlmap -r req.txt -D openemr --tables</code> to find some juicy looking tables:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-15.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>A few sqlmap commands later, I got a password hash:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-16.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Cracked the hash:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-17.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>The creds worked and I was in the EMR app:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/10/image-18.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>There was a file upload function in the app so I uploaded a reverse shell &apos;rs.php&apos;:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/10/image-19.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>I accessed <a href="http://hms.htb/sites/default/images/rs.php">http://hms.htb/sites/default/images/rs.php</a> and caught a shell:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-20.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Ash&apos;s password worked and I was able to <code>su</code> to him:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-21.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-22.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>While enumerating the system, I spied <code>memcached</code> being run on port 11211:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/10/image-23.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>I had never worked with it before so I googled around and found <a href="https://www.hackingarticles.in/penetration-testing-on-memcached-server/">this very helpful article</a>. I connected to it with netcat and ran a test command <code>stats slabs</code>:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-24.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>A few moments later, I ran <code>get user</code> and got some creds:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-25.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>The creds worked and I now had a shell as luffy:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-26.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><h2 id="privilege-escalation-intended-route">Privilege Escalation - Intended Route</h2><p>My notes are a bit fuzzy here so apologies, but during enumeration, Docker was found to be running on the system. Googling around eventually lead me to <a href="https://github.com/Frichetten/CVE-2019-5736-PoC">this PoC of a Docker escape</a>. The requirements were to have root access in the container, which we do have. I had issues getting a working exploit (which is why my notes suffered here). I tried various reverse shells, msfvenom payloads and none worked - they would all connect back to me as luffy instead of root. What finally did the trick was the following C code:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-27.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>The compilation:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-28.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>I changed the PoC code as follows:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-29.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>This would change /tmp/t3chnocat to be owned by root and also make it a SUID binary. I built the binary and moved/renamed:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-30.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Transferred the files via scp:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-31.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>As expected, we see both files are owned by luffy:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-32.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Now let&apos;s run the Ubuntu docker image:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-33.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>In another shell, list the active containers and copy the t3chnocat-suid file over to the container:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-34.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Run the file in the container:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-35.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Run /bin/sh from the host:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-36.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>In the container we see that something happened:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-37.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Check the /tmp folder and see that the &apos;t3chnocat&apos; binary is now a SUID owned by root:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-38.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Run the binary:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-39.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Catch a root shell:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-40.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-41.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><h2 id="privilege-escalation-unintended-and-super-easy-route">Privilege Escalation - Unintended and Super Easy Route</h2><p>After finding out that Docker was running, a trip to GTFOBins found <a href="https://gtfobins.github.io/gtfobins/docker/">this</a>. Here I list the images and run the exploit:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/10/image-42.png" class="kg-image" alt="HackTheBox Writeup: Cache" loading="lazy"></figure><p>BAM, root!</p><h2 id="taking-a-break">Taking a break</h2><p>This will be my last writeup for a while as this was the last HTB box I finished before starting a new job. One of these days I&apos;ll have more time to play around on HTB again. Until then, keep hacking :D</p>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Admirer]]></title><description><![CDATA[<p>Admirer was an easy rated Linux machine that had a lot more steps than I expected, given the rating. A robots.txt file hinted at the presence of credentials which were found with forced browsing. One of these creds worked on the FTP service, allowing us to download a backup</p>]]></description><link>https://t3chnocat.com/htb-admirer/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182bd</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 26 Sep 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/09/admirer.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/09/admirer.png" alt="HackTheBox Writeup: Admirer"><p>Admirer was an easy rated Linux machine that had a lot more steps than I expected, given the rating. A robots.txt file hinted at the presence of credentials which were found with forced browsing. One of these creds worked on the FTP service, allowing us to download a backup file of the website. Inside this archive were various PHP files, more credentials and a clue about the directory structure. More forced browsing found an Adminer instance which was exploited to read a local file, this time containing credentials which worked for SSH. Finally, sudo access to a shell script as well as the ability to set an environment variable were used to gain a root shell. I added admirer.htb to my /etc/hosts and started doing recon.</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Let&apos;s check the webpage:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-1.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Clicking on the &apos;about&apos;:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-2.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>Nmap said there&apos;s 1 disallowed entry in robots.txt so let&apos;s check it out:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-3.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Unfortunately we don&apos;t have access:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-4.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>I ran gobuster on the root directory and came up with nothing. Gobuster on the admin-dir came up with something:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-5.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Ultimately, this didn&apos;t seem to help much other than letting us know someone is a fan of The Big Bang Theory:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/09/image-6.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>I scratched my head for a bit before thinking about how robots.txt mentioned contacts and creds, so I tried cred.txt and struck gold with credentials.txt:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/09/image-7.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>The ftp creds worked:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-8.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>There were a couple of juicy looking files so I grabbed them:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-9.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Sql.dump was not helpful but I extracted the gzip file:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-10.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>This had some interesting content:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-11.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>There were creds in the index.php file that didn&apos;t work anywhere so I took a look inside the utility-scripts folder:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-12.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>There were more creds which again didn&apos;t work anywhere. The admin_tasks.php was accessible on admirer.htb but I didn&apos;t have any permissions to do anything fun, so I ran gobuster on the utility-scripts folder:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/09/image-13.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Adminer.php looked interesting so I checked it out:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-14.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Aah, it&apos;s nice when the version number is right there eh? A quick search found <a href="https://www.foregenix.com/blog/serious-vulnerability-discovered-in-adminer-tool">this article</a> detailing a vulnerability in Adminer. In a nutshell, you need to have the Adminer instance connect to your own MySQL database and load data from a local file on admirer.htb. I spun up a MySQL service on my attacking machine and created a test database:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/09/image-15.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Then I granted the root user on admirer.htb access to it:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-16.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Now I could use the adminer.php file to log onto the SQL service on my attacking machine:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-17.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>This worked and some shady looking dude in a hoodie said &apos;I&apos;m in&apos;:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-18.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>I created a table:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-19.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Next, I loaded the contents of /var/www/html/index.php on Admirer into a table:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-20.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Viewing the table revealed a password:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-21.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>We finally have a working password and a shell:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-22.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/09/image-23.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>Waldo has sudo access to set an environment variable and to run a shell script:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-24.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Running the script as-is didn&apos;t let me do much so I examined the script. Inside, this caught my eye:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-25.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>It checks if you are root and if you are, it runs /opt/scripts/backup.py. Let&apos;s see what&apos;s in that script:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-26.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>It became clear that the idea was probably to change the path for the python library, have it load my malicious library and run my own function named &apos;make_archive&apos;. First, I checked if netcat was installed and confirmed that it had the &apos;-e&apos; flag available:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-27.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Sweet. Next I created my own shutil.py in /tmp/.meow with a &apos;make_archive&apos; function that would connect back to me with a reverse shell:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-28.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>The next step was to figure out what environment variable would tell python where to look for libraries. The answer was <a href="https://docs.python.org/3/using/cmdline.html#environment-variables">PYTHONPATH</a>. Now to put it all together:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-29.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>With a netcat listener, I caught a root shell:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/09/image-30.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/09/image-31.png" class="kg-image" alt="HackTheBox Writeup: Admirer" loading="lazy"></figure><p></p>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Quick]]></title><description><![CDATA[<p>Quick was a hard rated Linux box and man, did it earn that rating. A website was accessed via the QUIC protocol and a password was retrieved. A list of potential usernames was compiled from the &apos;normal&apos; website and used to spray the password and get past a</p>]]></description><link>https://t3chnocat.com/htb-quick/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182bc</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 29 Aug 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/08/quick.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/08/quick.png" alt="HackTheBox Writeup: Quick"><p>Quick was a hard rated Linux box and man, did it earn that rating. A website was accessed via the QUIC protocol and a password was retrieved. A list of potential usernames was compiled from the &apos;normal&apos; website and used to spray the password and get past a login page. ESI injection was then performed to execute code and get a shell. A local print service was forwarded to the attacking machine through a SSH tunnel and a discovered MySQL password was used to login to it. A symlink was used to force the print server to connect to the attacking machine and send a higher-privileged user&apos;s private SSH key. Finally, a URL encoded password was found and used to su to root. I added quick.htb to /etc/hosts and dug in.</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-51.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Let&apos;s check port 9001:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-52.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>The &apos;portal&apos; link leads to https://portal.quick.htb, so I added it to my /etc/hosts but it didn&apos;t work. </p><p>&apos;Clients&apos;:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-53.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>&apos;Get started&apos; leads to a login page:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-54.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Without any creds, I ran gobuster:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-55.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Ticket.php redirectd back to the login page. For once, /server-status was readable and other than what looked to be a SQL query, I didn&apos;t see anything interesting:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-56.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>At a dead end, I scanned UDP ports out of desperation and was confused at the result:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-57.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Some googling around and I learned about the <a href="https://developer.akamai.com/blog/2020/04/14/quick-introduction-http3">QUIC protocol</a> which was pretty interesting. I wasted hours trying to get experimental builds of curl to work - quiche and other libraries refused to play nice. I finally found <a href="https://developers.cloudflare.com/http3/intro/http3-client/">this client</a> that enabled me to move forward. Now that was working, let&apos;s check out the portal site that didn&apos;t work over TCP:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-58.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I used the http3 client to access pages, save them as HTML files, then opened them up in a browser:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-61.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-62.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>The &apos;docs&apos; page had links to a couple of PDFs:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-63.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>So I saved them:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-64.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>QuickStart.pdf:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-65.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-66.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Connectivity.pdf contains a password and a quick login page:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-67.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-68.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>The .jsp page didn&apos;t work but now that I had a password, it was time to come up with some potential usernames and spray that password at the login page. By looking at the names of people who gave testimonials on the website and the client list which included the countries they were from, I compiled a list of potential emails:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-69.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I put the password from Connectivity.pdf in pass.txt:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-70.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Now, let&apos;s look at the login attempt:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-71.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Putting everything together resulted in the following <code>hydra</code> command which found creds:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-72.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>These creds worked and I was presented with a ticketing system:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-73.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I created a ticket to see what would happen:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-74.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>A popup appeared after submitting: </p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-75.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Okay, what happens when I search:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-76.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I tried a quote mark:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-77.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>This lead me down a looong rabbit hole trying various SQL injections. I finally got a nudge to take a closer look at some headers where I spied something called &apos;Esigate&apos;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-78.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I started googling around and found <a href="https://blog.h3xstream.com/2019/05/esi-injection-part-2-abusing-specific.html">this article</a> about ESI injections. With some experimentation, I was able to get it to reach out to my attacking machine:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-79.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>On my machine:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-80.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Some more googling around and I found potential payloads for <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/XSLT Injection/README.md#remote-code-execution-with-java">RCE with java through XSLT injections</a>. I did notice that I had to keep changing the xsl filenames or they wouldn&apos;t download from me. With some experimentation, I got ping to work:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-81.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Once I had that going, I experimented more and found that stringing commands together with <code>;</code> or <code>&amp;&amp;</code> didn&apos;t seem to work so I had to tackle it in stages. I first created a reverse shell script:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-84.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>The next xsl downloaded the script to /tmp/t.sh:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-85.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Let&apos;s make the script executable:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-86.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Finally, run the script:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-87.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>With a netcat listener, I caught a shell as Sam:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-88.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-89.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>A MySQL password was in plain text here:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-90.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I used it to poke around the database and got some hashes:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-91.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I couldn&apos;t crack these hashes and put it aside for the time being. Further enumeration showed some ports listening locally:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-92.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I checked out /etc/apache2/sites-enabled/000-default.conf and found the relevant section:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-93.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Since I needed to forward port 80 to my machine, I created a SSH key pair, added the public key to /home/sam/.ssh/authorized_hosts and used the private key to tunnel:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-94.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Next I edited /etc/hosts and pointed printerv2.quick.htb to localhost. With that done, I could finally load up the webpage:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-95.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>The index.php file makes it clear that I needed to login as srvadm@quick.htb:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-96.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Since I couldn&apos;t crack the hash, I changed the hash to a known value in MySQL:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-97.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Now I could log on as srvadm@quick.htb with Elisa&apos;s password:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-98.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I tried adding a new printer with my IP:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-99.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>The printer shows up:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-100.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I set up a netcat listener and clicked the printer button to &apos;test&apos; print:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-102.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Now I can add a job:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-103.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-104.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Now if we look at job.php:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-105.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I&apos;m not fluent in PHP at all but from what I could gather, the contents of /var/www/printer/jobs/$date are sent to the printer&apos;s network socket after the file is made world readable. </p><p>My idea was then to symlink the created file to srvadm&apos;s id_rsa file and have it sent to the &apos;printer&apos; (my netcat listener). You can see from the $file variable that the date starts with the year first so I created a while loop as follows:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-107.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I kept spamming the POST request to job.php;</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-108.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>With a netcat listener on 9100 set to keep listening - <code>ncat -nlvp 9100 --keep-open</code> - I eventually got a key:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-109.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>I saved this key and I was able to SSH in as srvadm:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-110.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>This one was tricky and took a while for me to find as it was hiding in plain sight. In /home/srvadm/.cache/conf.d/printers.conf there&apos;s a section with a DeviceURI:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-111.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>If you URL decode the section after &apos;srvadm%40quick.htb:&apos; you get: &amp;ftQ4K3SGde8?</p><p>This password lets you su to root:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-112.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-113.png" class="kg-image" alt="HackTheBox Writeup: Quick" loading="lazy"></figure>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Magic]]></title><description><![CDATA[<p>Magic was a medium rated Linux box that required you to find a hidden upload function then bypass its upload restrictions to execute code and catch a shell as www-data. From here, creds for mysql were stored in plaintext, allowing you to dump the database and get more creds for</p>]]></description><link>https://t3chnocat.com/htb-magic/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182bb</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 22 Aug 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/08/magic.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/08/magic.png" alt="HackTheBox Writeup: Magic"><p>Magic was a medium rated Linux box that required you to find a hidden upload function then bypass its upload restrictions to execute code and catch a shell as www-data. From here, creds for mysql were stored in plaintext, allowing you to dump the database and get more creds for the user Theseus. Finally a SUID binary did not use quoted paths and this was exploited to gain a root shell. I added magic.htb to /etc/hosts and got started.</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-23.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>With no creds, let&apos;s check out http:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-24.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>I clicked on the &apos;login&apos; link:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-25.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>After trying admin/admin and such, I decided to enumerate more with gobuster:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-26.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>Upload.php looked juicy but it redirected when I tried to access it. I loaded up Burp, set it to intercept and changed the &apos;302&apos; shown below to a &apos;200&apos;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-27.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>This worked and I was shown an upload interface:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-28.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>I immediately tried to upload a php reverse shell but was booted back to the login. I checked Burp&apos;s history and saw the reason why:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-29.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>Okay, let&apos;s see what a legit upload looks like:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-30.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>Cat pic uploaded successfully:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-31.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>I tried various things here - null bytes, double extensions (e.g. shell.php.jpg) and got nowhere. Eventually I googled around and found <a href="https://github.com/xapax/security/blob/master/bypass_image_upload.md">this article</a> that detailed using <code>exiftool</code> to bypass file upload filtering. Sadly my notes here are spotty but I believe I did <code>exiftool -Comment=$(cat webshell.php) meow.jpg</code>, where webshell.php can be found <a href="https://github.com/WhiteWinterWolf/wwwolf-php-webshell">here</a>. I then renamed it to &apos;meow2.php.jpg&apos;, uploaded it, accessed it directly and was pleased to see it had worked:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-35.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>Since the box is running php, I went with a php reverse shell:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-36.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>With a netcat listener, I caught a shell as www-data:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-37.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>There were some interesting files in /var/www/Magic:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-38.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>There were plaintext creds in db.php5:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-39.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>Those creds worked for mysql. Whoever left the &apos;all_databases.sql&apos; saved me the trouble of doing it myself but I believe <code>mysqldump -u thesus Magic -p</code> would have dumped the database to that file. Within it, are another set of creds:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-40.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>That password works for <code>su</code>:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-41.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-42.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>I ran <a href="https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS">LinPEAS</a>, which spit out a bunch of SUID files. One of them had a plausible name but I had never seen it before anywhere:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-43.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>I ran <code>strings /bin/sysinfo</code> to take a peek at what it might be doing:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-44.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>A bunch of commands (lshw, fdisk, cat, free) are being run without quoted paths and this is ripe for abuse. I chose <code>free</code> to be my victim and created a short bash reverse shell script named &apos;free&apos; in /tmp:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-45.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>I made it executable:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-46.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>Now, the important step of setting the path to /tmp so that <code>/bin/sysinfo</code> would look there for <code>free</code> first:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-47.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>I really should have done <code>PATH=/tmp:$PATH</code> so I could keep using standard commands without having to type their full path. Oops. Anyway, with that in place I ran <code>/bin/sysinfo</code> and with a netcat listener, I caught a root shell:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-48.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-49.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-50.png" class="kg-image" alt="HackTheBox Writeup: Magic" loading="lazy"></figure><p></p>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Traceback]]></title><description><![CDATA[<p>Traceback was an easy rated Linux machine that required finding a webshell on an already pwned website, using it to upload a php reverse shell, then catching a shell as webadmin. From there, webadmin had access to running <code>luvit</code> as sysadmin so a simple Lua script was used to catch</p>]]></description><link>https://t3chnocat.com/htb-traceback/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182ba</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 15 Aug 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/08/traceback.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/08/traceback.png" alt="HackTheBox Writeup: Traceback"><p>Traceback was an easy rated Linux machine that required finding a webshell on an already pwned website, using it to upload a php reverse shell, then catching a shell as webadmin. From there, webadmin had access to running <code>luvit</code> as sysadmin so a simple Lua script was used to catch a reverse shell as sysadmin. Finally, lax permissions on motd files allowed me to append reverse shell code to catch a shell as root. I added Traceback to my /etc/hosts and got started.</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>Without any creds for ssh, let&apos;s check http:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-1.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>I always check the source code for things like this and saw a nice little comment:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-2.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>I ran gobuster first to see if it might find the backdoor:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-3.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>No luck finding the backdoor but the .ssh file was a peek at the future:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-4.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>I poked around a bit more but didn&apos;t find anything. Finally I googled &apos;some of the best web shells you might need&apos; and found <a href="https://github.com/TheBinitGhimire/Web-Shells">this</a>. I saved the list of shells to shells.txt and ran gobuster again:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-5.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>Accessing smevk.php showed a login page:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-6.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>The hackers had bad opsec and admin/admin worked as creds:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-7.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>I uploaded a php reverse shell, accessed via browser and caught a shell as webadmin:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-8.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>I generated a ssh key pair and appended the public key to webadmin&apos;s authorized_keys file:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-9.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>I now had a stable shell:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-10.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>In the home dir was a nice little note:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-11.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>It turns out that sysadmin gave webadmin the ability to run <code>luvit</code> as sysadmin:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-12.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>I ran <code>luvit</code> to see wtf it was and had no idea what to do with it:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-13.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>I found the <a href="https://github.com/luvit/luvit">github page</a> and after googling a bit more, was not entirely surprised to see that PayloadsAllTheThings had an <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology and Resources/Reverse Shell Cheatsheet.md#lua">entry</a> for it. I created rs.lua:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-14.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>As webadmin, I ran `sudo -u sysadmin /home/sysadmin/luvit rs.lua&apos; and caught a reverse shell as sysadmin:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-22.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-16.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>I proceeded to append the same ssh public key generated earlier to sysadmin&apos;s authorized_keys file and got ssh access:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-17.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>While enumerating the system, I saw an interesting set of commands being run:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-18.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>This was a huge hint for the next step and was most likely there to clean up after lazy htb players. Let&apos;s take a look at /etc/update-motd.d:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-19.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>All of these are owned by root and sysadmin has write access. These motd (message of the day) scripts are run when someone logs in. I appended bash reverse shell code to one of these, which should give us a reverse shell when someone logs in. I readied a netcat listener, ssh&apos;ed in and caught a root shell:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/08/image-20.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/08/image-21.png" class="kg-image" alt="HackTheBox Writeup: Traceback" loading="lazy"></figure><p></p>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Cascade]]></title><description><![CDATA[<p>Cascade was a medium rated Windows machine where a legacy password found in LDAP enabled access to SMB shares. In those shares were various files, one of which was a registry file containing a password for VNC which was decrypted and used to gain a shell. This password also allowed</p>]]></description><link>https://t3chnocat.com/htb-cascade/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b9</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 25 Jul 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/07/cascade.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/07/cascade.png" alt="HackTheBox Writeup: Cascade"><p>Cascade was a medium rated Windows machine where a legacy password found in LDAP enabled access to SMB shares. In those shares were various files, one of which was a registry file containing a password for VNC which was decrypted and used to gain a shell. This password also allowed access to a share which had a database and an .exe file. The database contained an encrypted password and some light reverse engineering was done on the .exe to decrypt it. This allowed a pivot to another user account which had access to the Active Directory recycle bin, allowing us to recover a temporary administrator&apos;s password. This password was the same as the &apos;normal&apos; administrator&apos;s and was used to gain an admin shell. This one was a bit involved to strap in and let&apos;s go!</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-96.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>We can tell that this is a domain controller. Note that the domain is shown as &apos;cascade.local&apos; so I added that to my /etc/hosts file.</p><p>Next I dumped all of the LDAP info with a script I wrote. This one isn&apos;t on my github yet as I want to test it against more HTB boxes first:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-97.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Let&apos;s check the usernames:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-98.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>I tried a few things here like ASREP roasting which failed so I started sifting through the volumes of LDAP data. There was so much data that it took 2-3 tries to find what I needed in the users-full.txt file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-99.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Base64 decoding the string:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-100.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Let&apos;s throw that password at CrackMapExec just to confirm I have the username right:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-101.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Ryan does not have permissions for Win-RM so let&apos;s check SMB:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-102.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>He does not have permission for the juicy &apos;Audit$&apos; share so let&apos;s check &apos;Data&apos;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-103.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>There are files scattered throughout the directories so I downloaded them all:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-104.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-105.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-106.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-107.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Let&apos;s check the meeting notes first:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-108.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Setting the temporary admin account password to the same as the normal admin account password? Genius!</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-131.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>ArkAdRecyclebin.log:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-109.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>This tells us that the AD recycle bin program is being run as &apos;ArkSvc&apos; and two objects were deleted - &apos;Test&apos; and &apos;TempAdmin&apos;. </p><p>Finally, the VNC .reg file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-132.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>See that strange looking password? A quick search turned up <a href="https://www.raymond.cc/blog/crack-or-decrypt-vnc-server-encrypted-password/">this article</a>. The author links to an online decrypter but it either didn&apos;t load or skeeved me out so I went to github and found <a href="https://github.com/trinitronx/vncpasswd.py">this tool</a> instead. Running it yielded a password:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-111.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Let&apos;s throw that at CME:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-112.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>I used the creds to score a shell as Steve:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-113.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-114.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>Steve has access to the &apos;Audit$&apos; share:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-115.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>I downloaded everything in there and started going through them. I checked out the database file first:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-116.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Sweet, creds for ArkSvc! Unfortunately they are encrypted so I kept looking. I opened up CascAudit in <a href="https://github.com/icsharpcode/ILSpy">ILSpy</a> and found this:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-133.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Okay, that&apos;s the key - wtf do I do with it?? I was stuck here for a while until I opened up the CascCrypto.dll file in ILSpy and saw this:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-118.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>This was looking promising. Armed with the <a href="https://www.pcmag.com/encyclopedia/term/initialization-vector">Initialization Vector</a>, cipher mode and key, I headed over to <a href="https://gchq.github.io/CyberChef/">CyberChef</a> and plugged things in:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-119.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>The password worked and we now have a shell as ark-svc:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-120.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>We can see that ark-svc belongs to the &apos;AD Recycle Bin&apos; group:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-121.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>I never knew that AD had a recycle bin. It makes sense but never occurred to me. Some googling around and I found <a href="https://www.petri.com/using-active-directory-recycle-bin">this helpful article</a>. The first thing I did was import the AD module:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-123.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>The next step took was to output a list of deleted objects:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-124.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Now, to narrow down the query to just &apos;tempadmin&apos; and show all properties:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-125.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Base64 decode that sucker:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-126.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Bacteria noodles??? Ok, let&apos;s go with that and try psexec:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-128.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-129.png" class="kg-image" alt="HackTheBox Writeup: Cascade" loading="lazy"></figure><p></p>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Sauna]]></title><description><![CDATA[<p>Sauna was an easy rated Windows box with a focus on Active Directory. A list of users was generated from a website and AS-REP roasting was used to obtain a password hash. This hash was cracked and a shell gained with WinRM as the user &apos;fsmith&apos;. A plain</p>]]></description><link>https://t3chnocat.com/htb-sauna/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b8</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 18 Jul 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/07/sauna.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/07/sauna.png" alt="HackTheBox Writeup: Sauna"><p>Sauna was an easy rated Windows box with a focus on Active Directory. A list of users was generated from a website and AS-REP roasting was used to obtain a password hash. This hash was cracked and a shell gained with WinRM as the user &apos;fsmith&apos;. A plain text password was found in the registry, allowing a pivot to the user &apos;svc_loanmgr&apos;. Bloodhound was used to determine that &apos;svc_loanmgr&apos; has &apos;GetChanges&apos; privileges which allowed us to use the DCSync attack to get the administrator&apos;s password hash. PSExec was the final step to an system shell. I added sauna.htb to my /etc/hosts file and dove in.</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-75.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>This looks to be a domain controller for egotistical-bank.local.</p><p>I took a look through LDAP but didn&apos;t find much other than a common name for Hugo Smith:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-76.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>I couldn&apos;t access SMB so checked out HTTP:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-77.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>There was a search box that threw errors but I couldn&apos;t get anywhere with it:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-78.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-79.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>I tried changing it to a POST request and got nothing.</p><p>Elsewhere on the page there was a list of team members:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-80.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>I compiled some possible usernames for the team members:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-81.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>I dislike brute force attacks and tried an <a href="https://www.harmj0y.net/blog/activedirectory/roasting-as-reps/">AS-REP</a> roasting attack using GetNPUsers.py from the <a href="https://github.com/SecureAuthCorp/impacket">impacket</a> suite and got a hash:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-82.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>It was the 8th username that got a hash so I saved it as fsmith.hash and cracked it with rockyou.txt:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-83.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>Evil-WinRM was used to get a shell with these creds:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-84.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-85.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>Let&apos;s see what user accounts are on the system:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-86.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>Part of the enumeration process on Windows machines is checking the registry for passwords and I struck gold here:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-87.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>I used these creds with Win-RM and now had a shell as svc_loanmgr:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-88.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>I poked around the system as svc_loanmgr and couldn&apos;t find anything interesting. <a href="https://github.com/BloodHoundAD/BloodHound">Bloodhound</a> is a great tool for AD environments that lets you visualize how you can exploit permissions and group memberships. I copied the SharpHound script to Sauna and imported it:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-89.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>Next I ran the command to have it collect data:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-90.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>I transferred this zip file to my machine and imported its data into Bloodhound. The first query I ran was naturally &quot;Find Shortest Paths to Domain Admins&quot; which wasn&apos;t very helpful. The next query was &quot;Find Principals with DCSync Rights&quot;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-91.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>This was much more promising, showing that svc_loanmanager has both GetChanges and GetChangesAll privileges:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-92.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>This meant that the <a href="https://attack.stealthbits.com/privilege-escalation-using-mimikatz-dcsync">DCSync attack</a> was on the table. In a nutshell, svc_loanmgr has the ability to sync account password data from the domain controller. Impacket once again came into play with secretsdump.py:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-93.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>With psexec.py, hashes are just as good as passwords. I fed it administrator&apos;s hash and got a shell as system:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-94.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-95.png" class="kg-image" alt="HackTheBox Writeup: Sauna" loading="lazy"></figure><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Book]]></title><description><![CDATA[<p>Book was a very interesting medium rated Linux machine that introduced me to some new techniques. SQL Truncation was used to takeover the admin account in a web application. XSS was then used to read local files, including a SSH private key which yielded a stable shell. Finally a vulnerable</p>]]></description><link>https://t3chnocat.com/htb-book/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b7</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 11 Jul 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/07/book.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/07/book.png" alt="HackTheBox Writeup: Book"><p>Book was a very interesting medium rated Linux machine that introduced me to some new techniques. SQL Truncation was used to takeover the admin account in a web application. XSS was then used to read local files, including a SSH private key which yielded a stable shell. Finally a vulnerable version of <code>logrotate</code> was exploited to escalate privileges to root. I added book.htb to my /etc/hosts file and got to work.</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-50.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>Let&apos;s see what HTTP has:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-51.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>I created an account and logged in:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-52.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>I clicked on &apos;Books&apos;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-53.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>Clicking on a plant downloads a pdf:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-54.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>There&apos;s an upload function under &apos;Collection&apos;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-55.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>Naturally I tried uploading a php reverse shell which got me nowhere. There was some other functionality on the site like giving the admin some feedback that I couldn&apos;t do anything with as well. </p><h2 id="initial-foothold">Initial Foothold</h2><p>I was stuck here for quite a while. I enumerated more, tried <code>gobuster</code> with different wordlists, etc and simply couldn&apos;t figure out a vector. After some hours, I caved and peeked at the forums to find many others stuck in the same position. I did come away with some valuable clues on what to look at - account takeover and a character limit on the sign up form. I checked the source code for the signup form and sure enough, there was a character limit I had glossed over previously:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-56.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>Some googling around and I found <a href="https://resources.infosecinstitute.com/sql-truncation-attack/#gref">this article</a> detailing a SQL Truncation attack. This was a new one to me so I gave it a try and signed up for an account, making sure to use &apos;admin&apos; as a name and that the email field was more than 20 characters and started with &apos;admin@book.htb&apos;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-57.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>The request looked like this from Burp:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-58.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>After this, I was then able to login as admin!</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-59.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>As the admin user, there was now an option to export PDFs under the Collections menu:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-60.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>I tried uploading a PHP reverse shell again to see if exporting would trigger it but had no luck - the uploaded file would just disappear. I flailed around here for a loooong time before eventually coming across <a href="https://www.noob.ninja/2017/11/local-file-read-via-xss-in-dynamically.html">this article</a>. Like the SQL Truncation thing, this was new to me. I tried to read /etc/passwd first entering this as the book title: <code>test<strong>&lt;script&gt;x=new &#xA0;XMLHttpRequest;x.onload=function(){document.write(this.responseText)};x.open(&quot;GET&quot;,&quot;file:///etc/passwd&quot;);x.send();&lt;/script&gt;</strong></code></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-61.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>Clicking on the PDF export by &apos;Collections&apos; opened up a new file that contained the contents of /etc/passwd:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-62.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>I created a ton of PDF files trying to find creds in various PHP files before it occurred to me I should look for SSH private keys. The user &apos;reader&apos; seemed like a good option so I used this payload: <code>test<strong>&lt;script&gt;x=new &#xA0;XMLHttpRequest;x.onload=function(){document.write(this.responseText)};x.open(&quot;GET&quot;,&quot;file:///home/reader/.ssh/id_rsa&quot;);x.send();&lt;/script&gt;</strong></code></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-63.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>I saved this to &apos;id_rsa&apos; and it worked to get me a stable shell via SSH:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-64.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-65.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>I looked around manually and all I found was a &apos;backups&apos; folder in reader&apos;s home directory with some uninteresting log files inside:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-69.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>Nothing else jumped out to me so I uploaded <a href="https://github.com/DominicBreuker/pspy">pspy</a> and watched for a little while. I soon noticed an odd <code>logrotate</code> command being run:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-66.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>I checked the version of <code>logrotate</code>:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-67.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>A quick search found <a href="https://packetstormsecurity.com/files/154743/Logrotate-3.15.1-Privilege-Escalation.html">this post</a> detailing a race condition where it was possible to escalate privileges if <code>logrotate</code> was being run as root and the user is in control of the logfile path. Both conditions were fulfilled so I gave it a try. That post had a link to <a href="https://github.com/whotwagner/logrotten">a github page</a> with code so I cloned the repo, compiled it and uploaded the binary to Book as <code>logrotten</code>. Following the rest of the post, I created a reverse shell payload:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-70.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>Then I ran the exploit:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-71.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>The last step was to modify the log file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-72.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>With a netcat listener, I caught a root shell:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-73.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-74.png" class="kg-image" alt="HackTheBox Writeup: Book" loading="lazy"></figure>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: ForwardSlash]]></title><description><![CDATA[<p>ForwardSlash was a hard rated Linux box where a LFI vulnerability on a file upload function found on a vhost was exploited with PHP wrappers to find creds that worked for SSH. A backup utility was found that required a bash one-liner to read a backup file containing creds for</p>]]></description><link>https://t3chnocat.com/htb-forwardslash/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b6</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 04 Jul 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/07/forwardslash.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/07/forwardslash.png" alt="HackTheBox Writeup: ForwardSlash"><p>ForwardSlash was a hard rated Linux box where a LFI vulnerability on a file upload function found on a vhost was exploited with PHP wrappers to find creds that worked for SSH. A backup utility was found that required a bash one-liner to read a backup file containing creds for another user. Finally, an encrypted disk partition was decrypted with a script to gain root&apos;s private SSH key for a root shell. I added forwardslash.htb to my /etc/hosts and got started.</p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Let&apos;s check out http:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-1.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Uh oh, someone got hacked. Let&apos;s see what <code>gobuster</code> turns up:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-2.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Note.txt:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-3.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I took the hint and added backup.forwardslash.htb to my host file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-4.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>I didn&apos;t have an account but the sign up form worked:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-5.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I got in and checked out the dashboard:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-6.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>A quick message about our environment:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-7.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>The message continues in the source code:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-8.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>The &apos;Change your profile picture&apos; button looked ripe for abuse:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-9.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>It was disabled via HTML as the source shows:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-17.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>This is circumvented by interrupting it with Burp and deleting those pesky &apos;disabled&apos; tags:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-11.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I sent a test URL with a Python http server running just to confirm it would work:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-12.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Yup, it works:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-13.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I played around with it and sent the site&apos;s login.php to see what would happen:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-14.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-15.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Looking at the POST request in Burp showed that the url parameter was in the body so in a Repeater tab, I tried /etc/password as a url:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/07/image-16.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Now that LFI is confirmed, time to figure out files to look at so <code>gobuster</code> once again comes out to play:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-18.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Config.php sounded promising but contained creds I couldn&apos;t do anything with:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-19.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>&apos;Dev&apos; directories are often good targets but I had no access:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-20.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I was unable to view some of the php files with LFI and it took a while before I thought to look at <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/73aa26ba6891981ec2254907b9bbd4afdc745e1d/File%20Inclusion/README.md">PayloadsAllTheThings</a> for ideas. There I learned about using php wrappers:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-21.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I tried it on index.php:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-22.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Got a base64 encoded block back:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-23.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Cool, it worked perfectly even though this particular file was of no help:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-24.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I checked out the other php files and turned up nothing. I scratched my head over this until I reviewed my notes and realized that the /dev directory might have an index.php file in it. I repeated the process above and found creds inside:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-25.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Those creds worked for SSH and we now have a stable shell on the box:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-27.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>Chiv had access to Pain&apos;s home directory and in it there&apos;s a note:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-28.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Inside Pain&apos;s home directory was an &apos;encryptorinator&apos; folder:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-29.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Let&apos;s check out this encrypter.py file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-30.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I didn&apos;t know what to do with this yet so I continued to enumerate the system. I found another note in /var/backups:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-31.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>The files in there:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-32.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>That config.php.bak file looks tempting but I could not view it. Back to enumerating! I eventually found a SUID file <code>/usr/bin/backup</code>:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-33.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Let&apos;s run it to see what happens:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-34.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>I flailed here for a good while trying to be fancy - figuring out the time, hashing it, etc. before I got a nudge that I had everything I needed already. That set off a lightbulb/facepalm combo and I shortly had a bash one-liner that would read the value from the error message, create a symlink to the config.php.bak file and re-run the <code>/usr/bin/backup</code> file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-35.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>These creds allowed me to <code>su</code> to Pain:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-36.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-37.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>Let&apos;s see what Pain has sudo access to:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-38.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Further enumeration revealed an encrypted file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-39.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Let&apos;s try decrypting just to see what it looks like:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-40.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>The intended route appears to be decrypting the backup and mounting it. I believe some people took an unintended route of uploading their own image, mounting it and getting root that way but I didn&apos;t think of that :/.</p><p>Remember that &apos;encryptorinator&apos; folder in Pain&apos;s home directory? It&apos;s what was used to encrypt the disk image and from what I gathered from HTB Discord, the encryption is weak &#xA0;and easily defeated. I tried to figure out the flaw but the math gave me a headache and so I went brute force with rockyou.txt. I was able to bumble/copy-paste my way into throwing rockyou.txt at the problem but had major issues trying to figure out how to parse the results which was screenfuls of junk. I finally teamed up with someone and here&apos;s the final script we came up with:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-41.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>It was basically a lot of guesswork and experimentation where we wanted to have results that contained more than 145 ASCII characters shown. Running the script wasn&apos;t pretty but it worked:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-42.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>The password let me decrypt the file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-43.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Mount it:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-44.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Inside we find an id_rsa file:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-45.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-46.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>This private key lets us SSH in as root:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-47.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/07/image-49.png" class="kg-image" alt="HackTheBox Writeup: ForwardSlash" loading="lazy"></figure>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: PlayerTwo]]></title><description><![CDATA[<p>PlayerTwo was an insane rated Linux box that was a hell of a journey. I debated about doing this writeup because I got the root flag in an unintended way but hey, it&apos;s still a win! First you had to get the correct vhost name in order to</p>]]></description><link>https://t3chnocat.com/htb-playertwo/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b5</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 27 Jun 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/06/playertwo.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/06/playertwo.png" alt="HackTheBox Writeup: PlayerTwo"><p>PlayerTwo was an insane rated Linux box that was a hell of a journey. I debated about doing this writeup because I got the root flag in an unintended way but hey, it&apos;s still a win! First you had to get the correct vhost name in order to find a Twirp installation. Interacting with that yielded some creds for a login page which promptly stopped you with a 2FA prompt. A bit of guesswork with an API got some backup codes that gave access to a website. A PDF file was hosted on the site that detailed firmware architecture with a download link to the firmware, along with a link to upload and verify firmware. The firmware was downloaded, edited and exploited to gain a shell. Once on the system, Mosquitto was used to read a SSH private key and a stable SSH shell was gained. From here, the intended route was binary exploitation but I&apos;m horrible at that. I added playertwo.htb to my /etc/hosts file and started scoping things out. </p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-49.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Port 80 showed an error message:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-50.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Port 8545 wasn&apos;t much help either:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-51.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I started enumerating more and got nowhere fast, getting stuck for a little while. Finally while looking through notes, I looked closer at the error message on port 80 and saw that it said &apos;Please contact MrR3boot@player2.htb&apos;. I added player2.htb to /etc/hosts and got a better result:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-52.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>The rest of the page talks about how Player was compromised without much else. Time to start gobusting:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-53.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I proceeded to gobust each of those directories searching for the same extensions and got nowhere. After quite some time, I got a nudge to look for .proto files:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-54.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I downloaded the file and checked it out:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-55.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I never heard of Twirp or .proto files and had to do a lot of googling. It turns out that Twirp is <a href="https://github.com/twitchtv/twirp">&quot;a framework for service-to-service communication emphasizing simplicity and minimalism.&quot;</a> The proto file is written in Go which I know next to nothing about - yay. Port 8545 had given the Twirp error so I started there. It took a lot of time, experimentation and reading <a href="https://twitchtv.github.io/twirp/docs/example.html">two</a> articles on Twirp&apos;s <a href="https://twitchtv.github.io/twirp/docs/curl.html">docs</a> over and over again but I finally got a curl command working that gave me creds of some kind:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-58.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I played around with this for a while getting ever changing creds for 0xdf, mprox and jkr. At some point I noticed that sending the number 0 resulted in the password staying the same while the name changed:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-59.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Ok, where do these creds go?? A short while later, I checked the source code of player2.htb and saw this:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-60.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Let&apos;s check it out:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-61.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I used the generated creds above then got hit with 2FA:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-62.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Time for more enumeration. Gobuster turned up some things:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-64.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I was stuck here for a long time, gobusting everything, fuzzing for potential php parameters and all kinds of failure. I don&apos;t even remember how I came across it but while flailing at the API, I got an error message:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-66.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I threw the request to Burp and changed it to a POST request:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-67.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Ok, a change in error messages is good - that means something is right. The error message is in JSON format so I tried POSTing the cookie as the session value and got a different error message, &quot;Missing parameters&quot;. Cue all kinds of flailing on my end before I took a breath and thought about TOTP and what it stood for - Time-based One Time Password. If you&apos;ve ever used Google Authenticator, they give you backup codes to use so I started playing around looking for that:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-68.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Some more flailing and I eventually got the syntax right:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-69.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Entering that finally let me in to the website whose animations promptly bogged down my VM:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-70.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>I browsed around the site and found a link to a PDF about their firmware:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-71.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-72.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-73.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I downloaded the tar file and extracted it:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-74.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p><code>strings</code> is a handy command to run on binaries to show what may be stored as plain text inside:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-78.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I don&apos;t know much about bin ex and needed a nudge that the &apos;stty raw -echo min 0 time 0&apos; was the thing to focus on. I did know that the &apos;system&apos; call is <a href="https://www.go4expert.com/articles/exploit-c-t24920/">important</a> and googling around taught me that stty line reads user input so that started making some sense. Bin ex is not my strength but I do know how to use a hexeditor so gave that a try. The idea was to replace the &apos;stty&apos; line called by system with my own command. In order to not completely throw off the binary, the length of my command needs to be the same. Let&apos;s count the characters in the &apos;stty&apos; line:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-79.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>So we need to match the length of 28 characters. I decided to start with ping and came up with a padded command that matched the length:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-80.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I opened up Protobs.in in <code>hexedit</code> and found the &apos;stty&apos; line:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-82.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Then I headed to <a href="https://gchq.github.io/CyberChef/">CyberChef</a> to convert my ping command to hex:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-83.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I changed the hex and saved:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-84.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I tarred up the edited firmware and uploaded:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-85.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-86.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-87.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-88.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><p>I had <code>tcpdump</code> listening for icmp requests and got a ping:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-90.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><!--kg-card-begin: html--><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://media.giphy.com/media/d6Dnfmd6kPfjkdTVaS/giphy.gif" class="kg-image" alt="HackTheBox Writeup: PlayerTwo"><figcaption>RCE! RCE!</figcaption></figure><!--kg-card-end: html--><p>So the next step was going for a shell. I created a short reverse shell script:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-91.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I was able to get PlayerTwo to download a shell script from me pretty easily but it took a little while for me to realize that just because it grabbed the file from me successfully didn&apos;t mean it was able to write to whatever location it was trying by default. Here&apos;s the hex to download my script and write it to /tmp/e:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-92.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Hex to make the script executable and run it:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-93.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>With a netcat listener, I finally got a shell:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-94.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>I went down a lot of rabbitholes looking at mysql and whatnot before running <a href="https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS">linpeas</a>. It flagged mosquitto.conf:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-95.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p><code>ps -aux</code> shows that it is running:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-96.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I had never heard of Mosquitto and only vaguely heard of MQTT. A bit of googling and I found an excellent <a href="https://morphuslabs.com/hacking-the-iot-with-mqtt-8edaf0d07b9b">article describing it and how to hack it</a>. I copied his script from section 6:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-97.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I proceeded to run it on PlayerTwo and got a ton of stuff flying by before I spied a private key:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-98.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Linpeas also flagged a couple of users from /etc/passwd:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-109.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I copied the key, saved it and now had SSH access as observer:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-99.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-100.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>There&apos;s a PDF in observer&apos;s home dir:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-101.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I downloaded and viewed it:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-102.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-103.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-104.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-105.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-106.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-107.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p></p><p>I poked around the system some more and found the binary for the configuration utility mentioned in the PDF:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-108.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>Seeing the libc included with the binary gave me a sinking feeling - binary exploitation that I don&apos;t really know how to do.</p><h2 id="the-unintended-win">The Unintended Win</h2><p>I thought I might have to be satisfied with just the user flag when a HTB buddy gave me a cryptic clue to use what I had already done. I had to think it over for a bit before settling on the MQTT thing. What if I could use that to read a file other than observer&apos;s id_rsa? I backed up the private key and was surprised I was able to create a symlink to the root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-110.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I re-ran the MQTT script and where I saw the id_rsa file earlier, now sat the root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-111.png" class="kg-image" alt="HackTheBox Writeup: PlayerTwo" loading="lazy"></figure><p>I look forward to watching how Ippsec does the intended route :D.</p>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Servmon]]></title><description><![CDATA[<p>ServMon was an easy rated Windows box that took me longer to solve than I expected given the rating. Sensitive files stored on an anonymous FTP server, a directory traversal vulnerability in a web server and some password spraying were used to gain a low privilege shell. From there, the</p>]]></description><link>https://t3chnocat.com/htb-servmon/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b4</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 20 Jun 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/06/servmon.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/06/servmon.png" alt="HackTheBox Writeup: Servmon"><p>ServMon was an easy rated Windows box that took me longer to solve than I expected given the rating. Sensitive files stored on an anonymous FTP server, a directory traversal vulnerability in a web server and some password spraying were used to gain a low privilege shell. From there, the admin password for NSClient++ was found stored in plain text and port forwarding was used to access the NSClient++ web server. These admin privileges were abused to upload and run a reverse shell script resulting in a system shell. I added servmon.htb to my /etc/hosts and got to work.</p><h2 id="enumeration-">Enumeration:</h2><p>nmap:</p><blockquote>Nmap scan report for servmon.htb (10.10.10.184)<br>Host is up (0.070s latency).<br>Not shown: 65516 closed ports<br>PORT &#xA0; &#xA0; &#xA0;STATE SERVICE &#xA0; &#xA0; &#xA0; VERSION<br>21/tcp &#xA0; &#xA0;open &#xA0;ftp &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; Microsoft ftpd<br>| ftp-anon: Anonymous FTP login allowed (FTP code 230)<br>|<em>01-18-20 &#xA0;12:05PM</em></blockquote><blockquote><em>Users</em><br><em>| ftp-syst:</em><br><em>|</em> &#xA0;SYST: Windows_NT<br>22/tcp &#xA0; &#xA0;open &#xA0;ssh &#xA0; &#xA0; &#xA0; &#xA0; &#xA0; OpenSSH for_Windows_7.7 (protocol 2.0)<br>| ssh-hostkey:<br>| &#xA0; 2048 b9:89:04:ae:b6:26:07:3f:61:89:75:cf:10:29:28:83 (RSA)<br>| &#xA0; 256 71:4e:6c:c0:d3:6e:57:4f:06:b8:95:3d:c7:75:57:53 (ECDSA)<br>|_ &#xA0;256 15:38:bd:75:06:71:67:7a:01:17:9c:5c:ed:4c:de:0e (ED25519)<br>80/tcp &#xA0; &#xA0;open &#xA0;http<br>| fingerprint-strings:<br>| &#xA0; GetRequest, HTTPOptions, RTSPRequest:<br>| &#xA0; &#xA0; HTTP/1.1 200 OK<br>| &#xA0; &#xA0; Content-type: text/html<br>| &#xA0; &#xA0; Content-Length: 340<br>| &#xA0; &#xA0; Connection: close<br>| &#xA0; &#xA0; AuthInfo:<br>| &#xA0; &#xA0; <br>| &#xA0; &#xA0; <br>| &#xA0; &#xA0; <br>| &#xA0; &#xA0; <br>| &#xA0; &#xA0; <br>| &#xA0; &#xA0; <br>| &#xA0; &#xA0; <br>| &#xA0; &#xA0; <br>| &#xA0; &#xA0; <br>| &#xA0; NULL:<br>| &#xA0; &#xA0; HTTP/1.1 408 Request Timeout<br>| &#xA0; &#xA0; Content-type: text/html<br>| &#xA0; &#xA0; Content-Length: 0<br>| &#xA0; &#xA0; Connection: close<br>|_ &#xA0; &#xA0;AuthInfo:<br>|_http-title: Site doesn&apos;t have a title (text/html).<br>|_http-trane-info: Problem with XML parsing of /evox/about<br>135/tcp &#xA0; open &#xA0;msrpc &#xA0; &#xA0; &#xA0; &#xA0; Microsoft Windows RPC<br>139/tcp &#xA0; open &#xA0;netbios-ssn &#xA0; Microsoft Windows netbios-ssn<br>445/tcp &#xA0; open &#xA0;microsoft-ds?<br>5040/tcp &#xA0;open &#xA0;unknown<br>5666/tcp &#xA0;open &#xA0;ssl/nrpe?<br>|<em>ssl-date: TLS randomness does not represent time</em><br><em>6063/tcp &#xA0;open &#xA0;tcpwrapped</em><br><em>6699/tcp &#xA0;open &#xA0;tcpwrapped</em><br><em>7680/tcp &#xA0;open &#xA0;pando-pub?</em><br><em>8443/tcp &#xA0;open &#xA0;ssl/https-alt</em><br><em>| fingerprint-strings:</em><br><em>| &#xA0; FourOhFourRequest, HTTPOptions, RTSPRequest, SIPOptions:</em><br><em>| &#xA0; &#xA0; HTTP/1.1 404</em><br><em>| &#xA0; &#xA0; Content-Length: 18</em><br><em>| &#xA0; &#xA0; Document not found</em><br><em>| &#xA0; GetRequest:</em><br><em>| &#xA0; &#xA0; HTTP/1.1 302</em><br><em>| &#xA0; &#xA0; Content-Length: 0</em><br><em>| &#xA0; &#xA0; Location: /index.html</em><br><em>|</em> &#xA0; &#xA0;tings.<br>| http-title: NSClient++<br>|_Requested resource was /index.html<br>| ssl-cert: Subject: commonName=localhost<br>| Not valid before: 2020-01-14T13:24:20<br>|_Not valid after: &#xA0;2021-01-13T13:24:20<br>|_ssl-date: TLS randomness does not represent time<br>49664/tcp open &#xA0;msrpc &#xA0; &#xA0; &#xA0; &#xA0; Microsoft Windows RPC<br>49665/tcp open &#xA0;msrpc &#xA0; &#xA0; &#xA0; &#xA0; Microsoft Windows RPC<br>49666/tcp open &#xA0;msrpc &#xA0; &#xA0; &#xA0; &#xA0; Microsoft Windows RPC<br>49667/tcp open &#xA0;msrpc &#xA0; &#xA0; &#xA0; &#xA0; Microsoft Windows RPC<br>49668/tcp open &#xA0;msrpc &#xA0; &#xA0; &#xA0; &#xA0; Microsoft Windows RPC<br>49669/tcp open &#xA0;msrpc &#xA0; &#xA0; &#xA0; &#xA0; Microsoft Windows RPC<br>49670/tcp open &#xA0;msrpc &#xA0; &#xA0; &#xA0; &#xA0; Microsoft Windows RPC</blockquote><p>Let&apos;s see what the website looks like:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-19.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>NVMS eh? Let&apos;s see if searchsploit has anything on it:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-20.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Let&apos;s try it out:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-21.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Well, that worked. The problem with LFI is that you need to know specific filenames since you can&apos;t browse directories so I put that on the backburner for now.</p><p>Without any creds, I checked FTP to see if anonymous access was enabled. It was and I downloaded a juicy looking file from Nadine&apos;s home directory:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-22.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>I found another text file in Nathan&apos;s directory and grabbed that too:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-23.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Let&apos;s see what&apos;s in &apos;Confidential.txt&apos;:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="/content/images/2020/06/image-24.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"><figcaption>Baaaad opsec.</figcaption></figure><p>Nathan&apos;s to-do list:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-25.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>Now that we have a file name and location to check out courtesy of Nadine, it&apos;s time to use that directory traversal vulnerability from earlier:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-26.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>I saved the potential passwords to &apos;passwords.txt&apos; and created a &apos;users.txt&apos; with Nadine and Nathan&apos;s names inside. Time to spray with crackmapexec:</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="/content/images/2020/06/image-27.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"><figcaption>Sir Mix-A-Lot has some serious longevity.</figcaption></figure><p>Let&apos;s just verify it works with SMB as I could not list shares with a null session before:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-28.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>I tried the password on SSH and got in:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-29.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-30.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>While enumerating the system, I saw that NSClient++ was installed, matching the nmap results:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-31.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Let&apos;s check searchsploit again:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-32.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Let&apos;s see what the text says:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-33.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Let&apos;s see if that holds true for us:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-34.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>With the password ready to paste in, I hit up http://servmon.htb:8443 to try and sign in:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-35.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>I got bonged at the door:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-36.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Looks like some port forwarding is needed:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-37.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Now I&apos;m able to log in and access NSClient++:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-38.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>NSClient++ was originally made as an agent for <a href="https://www.nagios.org/">Nagios</a>, which I am pretty familiar with so I thought I had it made.</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-39.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>NSClient++ has the ability to run external scripts but its GUI was so vastly different than what I had seen in Nagios that I simply could not get it to work. I failed for hours trying various things before finally taking a breather and looking at some <a href="https://docs.nsclient.org/api/rest/scripts/">api docs</a>. I tried to list the external scripts installed:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-40.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Encouraged by that, I tried running a script:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-41.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Sweet, that worked! Time to create a reverse shell script using nc.exe that I uploaded to c:\temp:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-42.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>Now to upload it:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-43.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>OCD required me to make sure it was there:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-44.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>I probably could have run the script with <code>curl</code> like I did the other one but I was so annoyed at the GUI I had to show it who&apos;s boss. I found my script under &apos;Queries&apos;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-45.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>I clicked on &apos;rs&apos; then &apos;run:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-46.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>With a netcat listener, I caught a shell as system:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-47.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p>The root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-48.png" class="kg-image" alt="HackTheBox Writeup: Servmon" loading="lazy"></figure><p></p>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Monteverde]]></title><description><![CDATA[<p>Monteverde was a medium difficulty Windows box in which lazy password practice combined with password spraying allowed access to a SMB share. An Azure XML file was found with another password which was again sprayed to get a shell. The compromised user was a member of the &apos;Azure Admins&</p>]]></description><link>https://t3chnocat.com/htb-monteverde/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b3</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 13 Jun 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/06/monteverde.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/06/monteverde.png" alt="HackTheBox Writeup: Monteverde"><p>Monteverde was a medium difficulty Windows box in which lazy password practice combined with password spraying allowed access to a SMB share. An Azure XML file was found with another password which was again sprayed to get a shell. The compromised user was a member of the &apos;Azure Admins&apos; group and these privileges were abused to become domain admin on the box. Pretty nifty and I got to learn a bit about Azure. </p><h2 id="enumeration">Enumeration</h2><p>nmap scan:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>This looks like a domain controller for Megabank. SMB and WinRM stick out to me. I could not get a list of SMB shares without creds so I ran enum4linux and got a list of users and saved it to a file &apos;users.txt&apos;:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-1.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>One all too common password scheme is to set the password to the same as the login, presumably because you can never forget it. So I fired up <code>crackmapexec</code> and sprayed:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-2.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>Those creds work and we can now get a list of shares:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-3.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>I started poking around in the shares and was somewhat surprised to find that &apos;SABatchJobs&apos; had access to the &apos;users$&apos; share:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-4.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>In mhope&apos;s directory, there&apos;s an XML file so I grabbed it:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-5.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>In it we find a password:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-6.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>In theory, I could have just tried the password with mhope&apos;s account but it&apos;s quite fun to password spray so that&apos;s what I did:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-7.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>I fired up Evil-WinRM and got a shell:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-8.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-9.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>It&apos;s always helpful to know what you&apos;re working with when you&apos;ve got a shell so let&apos;s see what groups we are a member of:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-10.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>&apos;Azure Admins&apos; caught my eye as it&apos;s not something I usually see on HTB. &#xA0;After some googling around I found <a href="https://blog.xpnsec.com/azuread-connect-for-redteam/">this article</a> detailing how you can get plain text credentials when the Azure AD Connect service syncs things between the local AD domain and the Azure domain. This reminded me of the DCSync attacks that some boxes have used on HTB and elsewhere. Anyway, that article has a PoC script - problem is, it didn&apos;t work as is. It took a lot of time and a nudge to get it working. There were 3 changes that needed to be made. Unfortunately, I somehow managed to delete the edited file so here are my notes on the changes made :</p><ol><li>Remove the &apos;@_xpn_&apos; from this line: <code>Write-Host &#x201C;AD Connect Sync Credential Extract POC (@<em>xpn</em>)\n&#x201D;</code> </li><li> &#xA0;The connection string should be <code>$client = new-object System.Data.SqlClient.SqlConnection -ArgumentList &quot;Server=LocalHost;Database=ADSync;Trusted_Connection=True;&quot;</code></li><li>This line has the wrong type of quote marks. It needs the double quotes: <code>add-type -path &apos;C:\Program Files\Microsoft Azure AD Sync\Bin\mcrypt.dll&#x2019;</code></li></ol><p>Here&apos;s what it looks when run:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-11.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-12.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>I have a feeling that vbscrub (a Windows wizard who has created some boxes for HTB and has a great <a href="https://www.youtube.com/channel/UCpoyhjwNIWZmsiKNKpsMAQQ/featured">youtube channel</a>) took pity on everyone struggling to get the above PoC working because he posted an <a href="https://vbscrub.com/2020/01/14/azure-ad-connect-database-exploit-priv-esc/">article</a> a few days after Monteverde was released. In it, he goes over the exploit and links to a <a href="https://github.com/VbScrub/AdSyncDecrypt/releases">compiled program</a> you can simply run:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-13.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>With the administrator password, we use Evil-WinRM again to get an admin shell:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/06/image-14.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure><p>Root flag:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/06/image-15.png" class="kg-image" alt="HackTheBox Writeup: Monteverde" loading="lazy"></figure>]]></content:encoded></item><item><title><![CDATA[HackTheBox Writeup: Resolute]]></title><description><![CDATA[<p>Resolute was a medium rated Windows machine in which LDAP was queried for a list of users and an initial account password. This password was sprayed across the found usernames for a shell. Enumerating the system yielded a password for another user who was a member of the DnsAdmins group.</p>]]></description><link>https://t3chnocat.com/htb-resolute/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b2</guid><category><![CDATA[HTB]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sat, 30 May 2020 15:00:00 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/05/resolute.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/05/resolute.png" alt="HackTheBox Writeup: Resolute"><p>Resolute was a medium rated Windows machine in which LDAP was queried for a list of users and an initial account password. This password was sprayed across the found usernames for a shell. Enumerating the system yielded a password for another user who was a member of the DnsAdmins group. These privileges were combined with a DLL injection attack to gain a system shell. All in all, a fun box. Let&apos;s get started.</p><h2 id="enumeration">Enumeration</h2><p>nmap:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-114.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>This is a pretty typical port list for a domain controller. I checked SMB first but couldn&apos;t list any shares so it was time to check LDAP. A piece of key information from this is that the domain is listed as &apos;megabank.local&apos;. Let&apos;s see if we can get a list of users first:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-115.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>With some bash-fu, I cleaned this up and saved the sAMAccountName fields to &apos;users.txt&apos;. Next, I dumped everything LDAP would give me into a file &apos;ldap.txt&apos;:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-116.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><h2 id="initial-foothold">Initial Foothold</h2><p>This was a ton of info to sift through in the LDAP dump but eventually I found a password in the description field for Marlo Novak:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-117.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>Does this happen in real life? Yes it does - some admins incorrectly assume that only someone with administrative privileges can read the &apos;description&apos; field. Anyway, this password didn&apos;t work for Marko so I used CrackMapExec to try the password on my list of users:</p><figure class="kg-card kg-image-card"><img src="/content/images/2020/05/image-118.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>The nmap scan showed that port 5985 is open. It&apos;s the default port for WinRM so I gave that a shot and got a shell:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-119.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>User flag:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-120.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><h2 id="user-pivot">User Pivot</h2><p>I enumerated the system for quite a while and turned up nothing before remembering that PowerShell needs a flag to view hidden files (on Linux, I do <code>ls -al</code> reflexively without thinking about it). I found an interesting folder &apos;PSTranscripts&apos; in the root of the drive:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-121.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>Inside it we find a text file:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-122.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>In the text file we find creds for Ryan:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-123.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>I try those creds and they work, giving us a new WinRM shell as Ryan:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-124.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><h2 id="privilege-escalation">Privilege Escalation</h2><p>On Ryan&apos;s desktop there&apos;s an interesting note:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-125.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>I think it&apos;s basically to clean up after HTB players who don&apos;t clean up after themselves and to avoid spoiling the machine when multiple people are hacking at it - nothing helpful with privilege escalation. Anyway, with Windows machines when I pivot to another user, one of the things I always check is group membership:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-126.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>The DnsAdmins group caught my eye. A bit of googling around and I found <a href="https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/from-dnsadmins-to-system-to-domain-compromise">this article</a> which detailed how to escalate to SYSTEM from DnsAdmins. &#xA0;Basically you create a malicious DLL, run <code>dnscmd</code> to load said DLL, then restart the DNS service. </p><h3 id="the-dll">The DLL</h3><p>My first thought was to use <code>msfvenom</code> to create a DLL but I ran into allllll kinds of headaches with Windows Defender detecting and killing my attempts. After quite some time, I eventually found <a href="https://github.com/J3wker/DLLicous-MaliciousDLL">this script</a> which uses C for the reverse shell. It required some tweaking as it downloads nc.exe from github.com by default. I edited it to download it from me instead:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-127.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>I ran the script to generate the DLL with a nc.exe reverse shell payload:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-128.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><h3 id="injecting-the-dll">Injecting the DLL</h3><p>I hosted the DLL in a Samba share and ran <code>dnscmd</code> to inject the DLL:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-129.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><h3 id="restarting-the-dns-service-pwned">Restarting the DNS service = pwned</h3><p>First I started a Python simple HTTP server to host nc.exe for Resolute to download from. The final step was to restart the DNS service:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-130.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>I saw nc.exe being downloaded from my HTTP server and with a netcat listener, I caught a shell as SYSTEM:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-132.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure><p>The root flag:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="/content/images/2020/05/image-133.png" class="kg-image" alt="HackTheBox Writeup: Resolute" loading="lazy"></figure>]]></content:encoded></item><item><title><![CDATA[Certified Unethical Hacker - Plagiarism Doesn't Pay]]></title><description><![CDATA[<p>This blog is hosted on a server that I control and I check the logs pretty regularly to make sure things are on the up and up. While checking logs yesterday, I noticed a spike of referrals from a website I didn&apos;t recognize so I checked it out:</p>]]></description><link>https://t3chnocat.com/certified-unethical-hacker/</link><guid isPermaLink="false">61072264f3e7bc0e1d1182b1</guid><category><![CDATA[Pentesting]]></category><category><![CDATA[HTB]]></category><category><![CDATA[Misc]]></category><dc:creator><![CDATA[t3chnocat]]></dc:creator><pubDate>Sun, 24 May 2020 23:07:52 GMT</pubDate><media:content url="https://t3chnocat.com/content/images/2020/06/shame.png" medium="image"/><content:encoded><![CDATA[<img src="https://t3chnocat.com/content/images/2020/06/shame.png" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay"><p>This blog is hosted on a server that I control and I check the logs pretty regularly to make sure things are on the up and up. While checking logs yesterday, I noticed a spike of referrals from a website I didn&apos;t recognize so I checked it out:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-83.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>Looks pretty innocuous right? I clicked on his Obscurity writeup and instantly recognized images and word-for-word plagiarism from my writeups. I did some investigation and found he ripped off other people as well for at least four writeups - Obscurity, OpenAdmin, Traverxec and Mango.</p><h2 id="obscurity">Obscurity</h2><p>This is lifted straight from my writeup:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-87.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>My writeup:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-85.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>Here&apos;s more plagiarism from Manish Bhardwaj:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-86.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>My writeup:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-88.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>Here&apos;s the page info from Firefox:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-89.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>Manish Bhardwaj hotlinked to all of the images for my Obscurity writeup:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-90.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><h2 id="openadmin">OpenAdmin</h2><p>Manish Bhardwaj also ripped off my writeup on OpenAdmin:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-91.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>More word-for-word plagiarism from Manish Bhardwaj:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-93.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>My writeup:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-94.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>I guess I should be thankful he linked to my github instead of claiming that as his own too:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-95.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>I&apos;m not the only person he steals from though:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-96.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-97.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>The original source:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-111.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>You can find that original post he stole from <a href="https://atalaysblog.wordpress.com/2020/05/02/hackthebox-openadmin/">here</a>. </p><h2 id="traverxec">Traverxec</h2><p>Yet more plagiarism. Manish Bhardwaj is passing this off as his own:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-101.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>The real source:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-102.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>The only time Manish Bhardwaj hosts an image on his site is when it&apos;s stolen and snipped:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-103.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>The original post Manish Bhardwaj stole from can be found <a href="https://medium.com/@khaledfawzy_19843/hackthebox-traverxec-writeup-92deaaa3080d">here</a>. </p><h2 id="mango">Mango</h2><p>More plagiarism:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-104.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p></p><p>Again, the only time Manish Bhardwaj hosts the image is when it&apos;s snipped:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-105.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p></p><p>The original post Manish Bhardwaj stole from can be found <a href="https://medium.com/@bigb0ss/htb-mango-write-up-52fdd7e67cc6">here</a>. </p><h2 id="an-unplesasant-surprise-for-manish-bhardwaj-">An Unplesasant Surprise (for Manish Bhardwaj)</h2><p>Since I have full control of this server, I made some tweaks to my webserver configuration. Without touching anything on his server, his writeups that plagiarized my images now look like this:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-106.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p></p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-107.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>I would love to see his face when he discovers this :D.</p><h2 id="the-plagiarizer">The Plagiarizer</h2><p>Look at this guy&apos;s profile:</p><figure class="kg-card kg-image-card"><img src="https://t3chnocat.com/content/images/2020/05/image-108.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>Manish Bhardwaj bills himself as a Certified Ethical Hacker and appears to be teaching courses on the subject:</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-109.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>Part of being an ethical hacker is well, being ETHICAL. There is nothing ethical about plagiarizing other people&apos;s work and passing it off as your own. I strongly encourage anyone thinking of hiring Manish Bhardwaj to reconsider and look elsewhere. Can you really trust him not to do anything shady with your network given the behavior exhibited here?</p><p>To add insult on top of injury, he is trying to profit off plagiarizing others by monetizing with Google ads!</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://t3chnocat.com/content/images/2020/05/image-110.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure><p>To sum it all up:</p><figure class="kg-card kg-image-card"><img src="https://t3chnocat.com/content/images/2020/05/image-112.png" class="kg-image" alt="Certified Unethical Hacker - Plagiarism Doesn&apos;t Pay" loading="lazy"></figure>]]></content:encoded></item></channel></rss>