<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by alestorm980 on Medium]]></title>
        <description><![CDATA[Stories by alestorm980 on Medium]]></description>
        <link>https://medium.com/@oscardjuribe?source=rss-4e7424503429------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4nBSObz4a-EqDXQV</url>
            <title>Stories by alestorm980 on Medium</title>
            <link>https://medium.com/@oscardjuribe?source=rss-4e7424503429------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:21:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@oscardjuribe/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[TryHackMe Advent of Cyber Day 11: A Christmas Tale of An Unintended Local Privilege Escalation]]></title>
            <link>https://medium.com/@oscardjuribe/tryhackme-advent-of-cyber-day-11-a-christmas-tale-of-an-unintended-local-privilege-escalation-60b6fecb26f7?source=rss-4e7424503429------2</link>
            <guid isPermaLink="false">https://medium.com/p/60b6fecb26f7</guid>
            <category><![CDATA[localprivilegeescalation]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[advent-of-cyber-2024]]></category>
            <category><![CDATA[aircrack-ng]]></category>
            <dc:creator><![CDATA[alestorm980]]></dc:creator>
            <pubDate>Fri, 13 Dec 2024 01:13:24 GMT</pubDate>
            <atom:updated>2024-12-13T01:13:24.267Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PD-E11Srq4RPqt1UrCX2XQ.png" /><figcaption>Try Hack Me — Day 11</figcaption></figure><p>In recent days, I’ve been working with a colleague on the <a href="https://tryhackme.com/r/room/adventofcyber2024">Advent of Cyber</a> challenges by TryHackMe, an annual event where a new room is released daily, covering various cybersecurity topics. Today, I want to share an unintended privilege escalation me and a friend (<strong>@Sierris</strong>) discovered on one of the machines using <strong>aircrack-ng</strong>.</p><p>The room for Day 11 focuses on <strong>Wi-Fi hacking</strong>. Once connected to the machine, we need to capture a WPA handshake and then crack it.</p><p>Something that caught our attention was that this box allowed us to run certain commands as root without requiring admin privileges.</p><p>After discussing it with my teammate, <strong>@Sierris</strong>, we decided to investigate further and see what could be done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ftn8A7_yBXUWYo_X3uchJA.png" /><figcaption>Casual conversation among hackers</figcaption></figure><p>We are logged in as the user glitch. Checking the list of allowed commands, we noticed that, aside from some network-related commands, we could execute airodump-ng, aireplay-ng, and aircrack-ng with elevated privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A35940McMcafPZEp5O-o2w.png" /><figcaption>Allowed commands as root</figcaption></figure><p>As a reminder, aircrack-ng is a cracking tool for WEP/WPA/WPA2 networks.</p><p>We reviewed the manuals for these allowed commands to find a way to execute commands and came across something interesting in the aircrack-ng documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4emXpqhLakHQtcIONbKMYg.png" /><figcaption>Aircrack-ng man page</figcaption></figure><p>The -l option allows us to write the obtained key to a file. Since we can run this as root, it enables us to overwrite any file on the machine with elevated privileges.</p><p>Before proceeding, we tested the output format of this option by using the WPA handshake capture we had obtained in the room.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pH69jCvehKR8QBaTC49c4g.png" /><figcaption>Key output to a file</figcaption></figure><p>Nice! We see that the key is written directly to the file without any additional content.</p><p>At this point, we have file overwrite capabilities as root on the machine. However, before we can escalate privileges, we need to address two challenges:</p><ol><li><strong>How can we control what gets written?</strong></li><li><strong>What should we overwrite?</strong></li></ol><h3>Controlling What Gets Written</h3><p>The first part is relatively straightforward: we need to create a network with a password matching the content we want to write.</p><p>From an <a href="https://www.securew2.com/blog/understanding-wpa2-password-security#:~:text=How%20Many%20Characters%20Are%20Allowed,longer%20password%20for%20better%20protection">online research</a>, we learned that the maximum WPA password length is 63 characters. Thus, we need to craft a valid payload within this length limit to achieve privilege escalation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rTHiVhn2MYGiEc27GTC3BQ.png" /><figcaption>Max allowed passphrase size on WPA2</figcaption></figure><h3>What Should We Overwrite?</h3><p>Initially, we considered overwriting /etc/crontab since we could potentially create a cron job under 63 characters to escalate privileges. However, for some reason, overwriting this file did not work as expected. Seems like the service was not reloading the file.</p><p>After further thought, we remembered a trick involving PAM (Pluggable Authentication Modules). PAM is a system for configuring authentication methods for various applications and services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rpv_X6dg6kqPJoyYQw4Dew.png" /><figcaption>PAM modules</figcaption></figure><p>These configuration files use .so modules located in /usr/lib/x86_64-linux-gnu/security, each performing specific actions.</p><p>For example, one entry in /etc/pam.d/su allows the root user to execute the su command without a password:</p><pre>auth       sufficient pam_rootok.so</pre><p>We can modify one of these configurations to execute commands without a password. Specifically, we will add the following line to /etc/pam.d/su:</p><pre>auth sufficient pam_permit.so</pre><p>The pam_permit.so module always returns success regardless of the credentials provided, and the sufficient keyword indicates that no further lines need to be evaluated, as this method is sufficient.</p><p>Before generating our payload, let’s validate the current behavior of the su command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*q80rt26UR32mMfkQAuPH7w.png" /><figcaption>su authentication failure</figcaption></figure><p>As expected, authentication fails.</p><h3>Crafting the Payload</h3><p>We need to create a .cap file with a WPA handshake where the password is auth sufficient pam_permit.so. To do this, We used a mobile device to set up a hotspot with this password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*3gJojgJ-4NITDOY2FfLdxw.png" /><figcaption>WPA2 hotspot setup</figcaption></figure><p>Next, I used <strong>airodump-ng</strong> to capture the network traffic and obtain a valid WPA handshake. If you&#39;re unfamiliar with this process, I recommend completing <a href="https://tryhackme.com/r/room/adventofcyber2024"><strong>Day 11 of Advent of Cyber</strong></a>.</p><p>Before cracking the password, we need to upload our .cap file and create a dictionary to <strong>“crack”</strong> our handshake. So, we created words.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Px8KiHDFAwEvCeX2VtbHxA.png" /><figcaption>Wordlist used</figcaption></figure><p>Remember that out content must exists inside the dictionary.</p><p>Now we can execute the following command:</p><pre>sudo aircrack-ng -a &lt;wpa-type&gt; -b &lt;bssid&gt; -w /home/glitch/words.txt rce2-01.cap -l /etc/pam.d/su</pre><p>Once the payload is executed, we can now use the su command without a password to escalate to <strong>root</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ROZc1PMHb0p1ztsx4INkg.png" /><figcaption>Privilege escalation</figcaption></figure><p>Boom! we got a root shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*JxpB4iwz0dEowu--m5154g.png" /><figcaption>I am in</figcaption></figure><p>This unintended privilege escalation highlights how seemingly minor misconfigurations, like allowing certain tools to run as root, can lead to critical vulnerabilities when leveraged creatively.</p><p>Hack the planet!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60b6fecb26f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>