<?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[n3wb13Stuff - Medium]]></title>
        <description><![CDATA[Some random stuff! :) - Medium]]></description>
        <link>https://medium.com/infofl00d1ng?source=rss----c6aacc2cc35a---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>n3wb13Stuff - Medium</title>
            <link>https://medium.com/infofl00d1ng?source=rss----c6aacc2cc35a---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 13:25:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/infofl00d1ng" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to ARPSp00f ? — Part 2]]></title>
            <link>https://medium.com/infofl00d1ng/how-to-arpsp00f-part-2-d952e0f8ebd?source=rss----c6aacc2cc35a---4</link>
            <guid isPermaLink="false">https://medium.com/p/d952e0f8ebd</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Amina BALI]]></dc:creator>
            <pubDate>Wed, 25 Jul 2018 20:26:21 GMT</pubDate>
            <atom:updated>2018-12-02T06:11:13.131Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone ! Here is the second part of ARP Spoofing tutorial! After getting through some theorical concepts we’re gonna have some practice to see how an ARP Spoofing attack is performed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*X5mQsloRwheoEkQvGiUTtg.png" /></figure><p>So, first I’m gonna describe our working environnement to make everything clearer !</p><p>Well, we’re gonna use the example of the first part as our scenario using 3 VMs as follow:</p><p><strong>1. Legitimate Web Server :</strong> IP : 10.10.0.1/24; MAC : 08:00:27:8f:57:60</p><p><strong>2.</strong> <strong>Client (victim) : </strong>IP :<strong> </strong>10.10.0.100/24</p><p><strong>3. Hacker machine : </strong>IP : 10.10.0.2/24; MAC : 08:00:27:16:b4:1c</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CSZxh9Luxz0OFAkOi3FIiQ.png" /><figcaption>ARP Sp00fing Attack scenario</figcaption></figure><p>To have a complete scenario we will perform the attack on a server that uses HTTP, then HTTPS with an auto-signed certificate and finally we will get through some Attack mitigation / countermeasures.</p><h3>ARP Sp00nfing attack</h3><p>First, let’s check ARP table of the victim before the attack :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*tD2w6ZbG06Ym_PH8vvXdpw.png" /><figcaption>ARP Table of the victim beforme the attack</figcaption></figure><p>Note that 10.10.0.1 (which is the Web server IP) corresponds to the MAC : 08:00:27:8f:57:60 which is the right MAC address!</p><p>We also check that the client can access to the web server and see the displayed page :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*isMjIeIGf3hSKzW5wQyYrA.png" /><figcaption>Legitimate Web server page</figcaption></figure><p>Now, we move to the hacker machine and perform the attack using <strong>“arpspoof”</strong> from dsniff package that will send fake ARP Reply to the victim (as described in the first part of this tutorial).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*OW_ka4x9uREV4g0P0l23Eg.png" /><figcaption>Send fake ARP Reply to the victim</figcaption></figure><p>So, let’s explain the command used :<strong> arpspoof -t 10.10.0.100 10.10.0.1</strong></p><ul><li>-t : means target, so here we specify the victim to whom we want to send fake ARP Reply and poison its ARP table, here it is our client 10.10.0.100.</li><li>10.10.0.1: represents the spoofed IP of the machine we want to take the identity, here it is our legitimate web server.</li></ul><p>Note that ARP Reply(s) that are being sent contain IP address of the web server and the MAC address of the hacker machine!</p><p>So, now, let’s check ARP table of the victim after starting arpspoof (don’t stop arpspoof until the end of the attack):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6MzridTLO68f7Y3fiblCVg.png" /><figcaption>Victim ARP Table after the attack</figcaption></figure><p>Look at this ! 10.10.0.1 corresponds now to the MAC address 08:00:27:16:b4:1c which is the hacker MAC address ! this means that our attack works !</p><p>Now, we will check the connectivity between the victim and the machine 10.10.0.1 (the hacker machine should reply and not the legitimate) :</p><p>Let’s ping !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*HKu6m6f8uDKXjt3UqFfk2A.png" /></figure><p>Well, it works ! now let’s access the web server from the victim browser and see who replies:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*1_5FquFP8phdU-xVSHJrJQ.png" /><figcaption>ARP spoofing attack works</figcaption></figure><p>Well, as u can see, now when the client tries to access the legitimate web server, the hacker responds !</p><p>Now let’s try the attack with an autosigned certificate!</p><p>First, we activate SSL module : <strong>a2enmod ssl </strong>and then enable our site to use https: <strong>a2ensite default-ssl </strong>(we will use the default configuration in Apache2)</p><p>Now, when the client tries to access the web server he gets this security warning message :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*1tNUrJ_qiXeK21IxDrEmAg.png" /></figure><p>Let’s add it to security exceptions and here we are :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gs8O5Vex0rkvH9XdBDvmTg.png" /></figure><p>Now, we repeat the same steps as before (when using http) and we don’t have any security warning when performing the attack, it’s totally trasparent to the victim:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*WpKBQIg-mrIwu_Oe3H5_tw.png" /></figure><p>Well, this is due to the fact that we accepted to add to web server to security exceptions means that we trust it ! and because of this we didn’t get any security warining when the hacker machine replyed !</p><p>There is no verification of the authenticity of the information so the attack works!</p><p>Well, now I’m sure u wanna know how to avoid this attack ?</p><h3>Attack mitigation / countermeasures</h3><p>Well, what we’re gonna do is to set up a certificate authority that will sign the certificate of our legitimate Web server and that our client (victim) will trust !</p><p>We first, create a local certificate authority using openssl and then generate a cetificate request from the legitimate Web server that will be signed by the authority and then we will configure the web server to use this certificate and add the authority as a trusted certificate authority on the client browser.</p><p>After this, access to the Web Server will be secured :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*H_Y_FJvpGqze-YW66WjOVg.png" /></figure><p>Now, if we try to perform the attack as we did before, we got this security warning saying that the issuer of the certificate is uknown :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*b5h_HnBU8i0HfjQNCGj04Q.png" /></figure><p>The attack has been detected because the certificate presented by the attacker hasn’t been signed by the certificate authority trusted by our client.</p><p>Of course, if the victim chooses to add a security exception after getting the warning, it’s up to her … she will get some bad surprises then … 👀</p><p>Hope you enjoyed reading this second part of ARP Spoofing tutorial!</p><p><strong>Thanks for reading</strong> 😊</p><p><strong>PS. Dont forget to send me any suggestion about this article and please let me know about any other solution you propose and don’t forget:</strong></p><blockquote>“Knowledge increases by sharing but not by saving.”</blockquote><blockquote>― Kamari aka Lyrikal</blockquote><p><strong>Enjoy your time being here! 😉</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d952e0f8ebd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infofl00d1ng/how-to-arpsp00f-part-2-d952e0f8ebd">How to ARPSp00f ? — Part 2</a> was originally published in <a href="https://medium.com/infofl00d1ng">n3wb13Stuff</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to ARPSp00f ? — Part 1]]></title>
            <link>https://medium.com/infofl00d1ng/how-to-arpsp00f-part-1-ab3a17fe323?source=rss----c6aacc2cc35a---4</link>
            <guid isPermaLink="false">https://medium.com/p/ab3a17fe323</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[Amina BALI]]></dc:creator>
            <pubDate>Wed, 25 Jul 2018 14:35:29 GMT</pubDate>
            <atom:updated>2018-07-27T18:49:33.725Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone ! I was thinking about doing some tutorials about some basic and important concepts everyone in the h4ck W0r1d should know! So, for this first tutorial, I thought about making a step by step tutorial to learn what is ARP protocol, ARPSpoofing attack and how it works (for learning purpose of course!) Hope you’ll enjoy reading it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*X5mQsloRwheoEkQvGiUTtg.png" /></figure><p>What u should know is that ARP spoofing, also called ARP poisoning, is a very important attack to know because it is used to drive many other attacks! so it is really a <strong>MUST </strong>to know !</p><p>Well first, let me explain to you what is ARP protocol and ARP Spoofing attack in this first part and then we’ll move to some practice in the second part!</p><h3><strong>ARP’WHAT ?</strong></h3><p>ARP stands for <strong><em>Address Resolution Protocol</em></strong>, this protocol is used to make the correspondance between an IP address and a MAC address.</p><p><strong>OKKK… AND THEN ?</strong></p><p>In an Ethernet Network, communication between two or more machines is done at the physical level, every machine is identified uniquely by its MAC address.</p><p>Exchanged frames get through the physical layer first, where destination MAC address is checked to accept or not the frame then this one is sent to higher levels if it is accepted, and then IP address is checked at logical level.</p><p>There is a correspondence relationship between the physical and the logical addresses of the same machine. Each IP address corresponds to a single MAC address in a LAN. This correspondence is maintained in a table called ARP table or ARP cache in each machine of the network, this table is populated by requests sent via the ARP protocol.</p><p><strong>COOOL, BUT how it actually works !?</strong></p><p>Well ! when a host wants to communicate with another one on the same LAN knowing its IP address, he needs to get his MAC address (<strong><em>remember :</em> communication in Ethernet Network is done at the physical level, so… We need the MAC address to communicate !</strong>)</p><p>So first, he will check in his ARP table if there is an entry that corresponds to the IP address of the host with whom he wants to communicate, if yes, then he directly puts the corresponding MAC address in the destination MAC address field of the frame and send it.</p><p>However, if the entry is not in its cache, he must send a physical-level broadcast <strong>ARP request</strong> to all machines in the network so that the one with the corresponding IP address figuring in the destination IP address field of the packet responds with its MAC address in unicast mode to the requester (<strong>ARP Reply</strong>). After that, a new entry is created in the ARP table of the requester and the frame can finally be sent to the right machine.</p><p><strong>OK ! </strong>🤯<strong>Now that we finally know what is ARP protocol, then WHAT IS ARP SPOOFING ?</strong></p><p><strong>U SPOOF WHAT ? </strong>🙄</p><h3>What is ARP Spoofing and how it works ?</h3><p>Well, ARP Spoofing is an attack that exploit ARP protocol, Let’s see how !</p><p>This attack exploit a <strong>feature </strong>in the ARP protocol to spoof the victim ARP table entry corresponding to the IP address we want to spoof!</p><p>What u have to know is that an <strong><em>ARP Reply is accepted by a host without any verification, even if he didn’t send an ARP request ! and the ARP table is being updated if the reply is different from the actual entry.</em></strong></p><p>You may ask why ? why accepting a reply without even sending a request ? Well, this is done for performance purposes…!</p><p><strong>You got it, right ?</strong></p><p>Well, yes … The attacker will simply send crafted packets in huge quantity with a fake MAC address (His MAC Address) corresponding to the spoofed IP at regular intervals of time and the target will update its ARP table and here we go … The victim will communicate with the wrong machine and maybe exchange some sentive data with it ! All the trafic will get through the Attacker machine !</p><h4><strong>Steps to perform an ARP Spoofing attack</strong></h4><p><strong>1. Get the IP address of the target (spoofed IP) and the victim :</strong> done by scanning passively the network trafic.</p><p><strong>2. Building ARP REPLY frames:</strong> build ARP responses containing the spoofed IP as IP source and attacker MAC address as source MAC send to the victim in unicast.</p><p><strong>3. Sending unsolicited fake ARP REPLY :</strong> build ARP reply are sent to the victim in a continuous way at regular time intervals so that the victim will update its ARP table with the fake correspondance.</p><p>Here is a simple diagram that summarizes all what have been said before :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CSZxh9Luxz0OFAkOi3FIiQ.png" /><figcaption>ARP Sp00fing Attack example</figcaption></figure><p>Hope you enjoyed reading this first part of ARP Spoofing tutorial.</p><p><strong>Thanks for reading</strong> 😊</p><p><strong>PS. Dont forget to send me any suggestion about this article and please let me know about any other solution you propose and don’t forget:</strong></p><blockquote>“Knowledge increases by sharing but not by saving.”</blockquote><blockquote>― Kamari aka Lyrikal</blockquote><p><strong>Enjoy your time being here! 😉</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab3a17fe323" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infofl00d1ng/how-to-arpsp00f-part-1-ab3a17fe323">How to ARPSp00f ? — Part 1</a> was originally published in <a href="https://medium.com/infofl00d1ng">n3wb13Stuff</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[L00sy C0mpar!s0n — CTF Write-up — Guess the Token 3]]></title>
            <link>https://medium.com/infofl00d1ng/l00sy-c0mpar-s0n-ctf-write-up-guess-the-token-3-8f70fbf86bdf?source=rss----c6aacc2cc35a---4</link>
            <guid isPermaLink="false">https://medium.com/p/8f70fbf86bdf</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Amina BALI]]></dc:creator>
            <pubDate>Fri, 20 Jul 2018 16:23:30 GMT</pubDate>
            <atom:updated>2018-07-27T18:58:31.709Z</atom:updated>
            <content:encoded><![CDATA[<p>Yet another Web write-up about the challenge Guess the Token 3 proposed during the Shellmates Mini CTF 2018 with learning purpose. Here you’ll find all details about the approach used to solve this task and some usefull information summarized in the conclusion section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*iovMYlOq2tPhCARHbRwBnA.png" /></figure><h3>Challenge description</h3><blockquote><strong>Title:</strong> Guess the token 3</blockquote><blockquote><strong>Category:</strong> Web</blockquote><blockquote><strong>Description:</strong></blockquote><blockquote>Cette fois-ci, Jack pense que son code est infaillible ! Prouvez-lui qu’il a tort !</blockquote><blockquote>This time, Jack thinks his code is infallible! Prove him he’s wrong!</blockquote><blockquote><a href="http://192.168.0.200/guess_the_token_3/index.php">http://192.168.0.200/guess_the_token_3/index.php</a></blockquote><blockquote><strong>Points:</strong> 100</blockquote><blockquote><strong>Difficulty:</strong> Easy to medium</blockquote><blockquote><strong>Author:</strong> Raouf &amp;Mohamed</blockquote><h3>Analysis</h3><p>When we click on the link in the description this simple page shows up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*PFn1-6cnEQ81homLuEikbA.png" /></figure><p>The ‘view source’ catches our attention, here is the php source that we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*3Uf2UCdZD8GNb60WEd9v5A.png" /></figure><p>So as we can see, the token is very simple to generate, all we do is get the current timestamp with the php function time() and concatenate it to a random number in the range [1, 50] (included). We got this from the comment section in our source!</p><p>Now, let’s move to the condition part! We first check if the token given is correct by comparing it strictly to the stored token in $TOKEN. (Notice the “<strong>===</strong>” which stands for strict comparison, means that type and value have to match in both sides!)</p><p>Now, we move to the second part of the comparison:</p><blockquote>$username.$TOKEN.rand(1,31337)==”0e830400451993494058024219903391&quot;</blockquote><p>So, the username concatenated with the token value and a random number between 1 and 31337 has to match with “0e830400451993494058024219903391”. Not that easy to guess the username, right? BUT, when we focus more on this part, we notice the use of “==” which stands for loose comparison, means that only values have to match after determining the type automatically by php based on the context (<strong>type juggling</strong>)!</p><p><strong>This is a great way to go!</strong></p><p><strong><em>So, what we should do is provide a username that will make php think both sides are equal without being really equal ?!</em></strong></p><p>Means that even if the input does not form the right string, php will consider the condition as verified! How can we do this?</p><p>Well, if we focus more on the string “0e830400451993494058024219903391”, we see that it starts with 0e! this makes us think about exponent numbers in 0</p><p>format which gives the value of 0 when evaluating! Okey, good! This leads us think of providing an input that will make php also think it’s an exponent number as we did! For this, we observe the left part of the loose comparison: $username.$TOKEN.rand(1,31337), we notice that if we provide a username with value of 0e, we will get the same format as the previous string! (knowing that the token is a sequence of numbers!). So, we got it! We just need to make username equal to 0e and php will consider it as a numerical number and evaluate it to 0 on both sides!</p><h3><strong>Resolution</strong></h3><p>Now that we analyzed and understand how the whole thing works, we only need to write a script that will put “0e” as the username value and generate all the possible tokens and try them one by one until the flag is returned.</p><p>As we practically have the code that generates the tokens we will reuse it as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*8m17XVsjWK5XL7frFvMMww.png" /></figure><p>We put the generated tokens into a text file (tokens.txt) that we will use in our python script to post the tokens and “0e” as username:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*kFvB8oO3NCEmZACPAQkeAQ.png" /></figure><p>When we execute the script (python ./guess_the_token_3.py) we finally get the flag:</p><p><strong>Shellmates{php_l00sy_0peration_is_n0t_a_g00d_0ption}</strong></p><blockquote>PS. Of course, we could have put everything in the same script: generate the token and test them! I used the php code to generate the tokens just because the code was already there, so I reused it directly!</blockquote><h3><strong>Conclusion : What we learn from this task</strong></h3><blockquote>Through this task we learned about comparison types in php which are (according to php comparison operators <a href="http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison">manual</a>):</blockquote><blockquote>1. <strong>Loose comparison</strong>: (like == and !=) also called “equal”, for example $a==$b, TRUE if $a is equal to $b after type juggling ! You may ask wth is type juggling, so, type juggle in php is simply the fact that when we declare a variable, specifying its type is not required, this one is determined by the value or the context of this variable. So, for example if we assign an integer value to a variable, it will automatically become an int and if we assign to it a string it will become a string!</blockquote><blockquote>In our case, we had a great example of juggling type based on the context! As we saw, we provided “0e” as username and after php concatenates it with the token and a random number, it interpreted it as a numerical string, an exponent number actually, in the form of 0! So, it considered it as 0 (after conversion and calculation) and automatically the other part of the loose comparison too (0e830400451993494058024219903391), so, we ended up with both sides equal to zero and automatically a verified condition!</blockquote><blockquote><strong>For more details about php loose comparison, go check </strong><a href="https://www.owasp.org/images/6/6b/PHPMagicTricks-TypeJuggling.pdf"><strong>this</strong></a><strong> very interesting article.</strong></blockquote><blockquote>2. <strong>Strict comparison</strong>: (like === and !==) also called “identical”, here types and values matter! Types will not change “magically”, no conversion going on. for example, $a===$b, TRUE if $a is equal to $b, and they are of the same type.</blockquote><p><strong>Thanks for reading</strong> 😊</p><p><strong>PS. Dont forget to send me any suggestion about this article and please let me know about any other solution you propose and don’t forget:</strong></p><blockquote>“Knowledge increases by sharing but not by saving.”</blockquote><blockquote>― Kamari aka Lyrikal</blockquote><p><strong>Enjoy your time being here! 😉</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f70fbf86bdf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infofl00d1ng/l00sy-c0mpar-s0n-ctf-write-up-guess-the-token-3-8f70fbf86bdf">L00sy C0mpar!s0n — CTF Write-up — Guess the Token 3</a> was originally published in <a href="https://medium.com/infofl00d1ng">n3wb13Stuff</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazing Pipes| CTF Write-up | Eye See Ummm P]]></title>
            <link>https://medium.com/infofl00d1ng/another-shellmates-ctf-write-up-eye-see-ummm-p-e4894bb1f1ae?source=rss----c6aacc2cc35a---4</link>
            <guid isPermaLink="false">https://medium.com/p/e4894bb1f1ae</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Amina BALI]]></dc:creator>
            <pubDate>Wed, 18 Jul 2018 22:03:58 GMT</pubDate>
            <atom:updated>2018-07-27T18:59:45.489Z</atom:updated>
            <content:encoded><![CDATA[<p>Here is another CTF Write-up from Shellmates Mini CTF 2018 for the Networking challenge Eye See Ummm P, where I put all details of my solution for the task in a sort of tutorial for beginners in the hacking and CTF World!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*7wooESiEz97u-0xcvdwQ9w.png" /></figure><h3>Challenge description</h3><blockquote>Title: Eye see Ummm P 2</blockquote><blockquote>Category: Networking</blockquote><blockquote>Description:</blockquote><blockquote>Find the flag in this icmp capture. Not so obvious this time!</blockquote><blockquote><a href="http://s000.tinyupload.com/index.php?file_id=00170443021747343741">Foren4.pcap</a></blockquote><blockquote>Flag format: Shellmates{…}.</blockquote><blockquote>Points: 100</blockquote><blockquote>Difficulty: Easy to Medium</blockquote><blockquote>Author: Raouf</blockquote><h3>Analysis</h3><p>The file in the description is a pcap file that contains a capture of icmp packet exchanged between host 192.168.1.113 and host 192.168.1.9.</p><p>When we open the file with Wireshark and we start analyzing the content of the different packets we don’t notice anything ‘special’ in the data section (which is generally the first part we check)</p><h4><strong>Information:</strong></h4><blockquote>· ICMP stands for Internet Control Message Protocol, it is a protocol that is used by network devices to send error messages when testing connectivity. For example: an unreachable router or host in the network, an exceeded delay to deliver packets, etc. Two main used commands use ICMP protocol: ping and traceroute commands that serve to test connectivity and delivery packets between two nodes. In addition to that, the traceroute command shows the nodes in the path from source to destination.</blockquote><blockquote>· The data section does not import at all in ICMP protocol but if we need it we can modify it to hold data, generally it is used to make the packets larger for fragmentation testing and other network issues).</blockquote><blockquote>· Data in echo request and echo reply are generally the same because the reply is as its name shows a ‘reply’ to the request and icmp does not deal with data section so it will just reply the echo request to prove connectivity between two points in the network!</blockquote><p>So, here is an example of the content of one of the icmp echo reply packet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*HYFOnkmIIarN9Pnk5Y1kUQ.png" /></figure><p>So, as we said, the data in echo reply and echo request are the same and there for analyzing data section in only request or reply would be sufficient. That’s why we ordered packets by Info field in wireshark to see in order all the reply packets and then all the request packets. This will help us analyze them better.</p><p>In our case, the data section is always formed of a constant part: <strong>!”$%&amp;’()*+;-./01234567 </strong>which has no apparent sense! And a variable part (byte 50 and 51) but this time also with no apparent meaning!</p><p><strong>BUT</strong> then, when we really focus on the packets content, specially the echo request ones, something attracts our attention! The TTL of the request packets! They different from TTL of reply packets and each one is different from the other!</p><p>While moving through the packets we notice that the TTL value is a printable character, the first is an “S”, second an “h”, third “e”, etc. Seem to be the three beginning letters of <strong>She</strong>llmates! As we continue, we notice that the flag format appears from one TTL value to another!</p><p><strong>We got it!</strong></p><p>The flag is hidden in the TTL values of request packets! Amazing, right?</p><p><strong>Information:</strong></p><blockquote>· TTL or Time To Live is a numeric value actually, a timer value that informs nodes in the network about how long they should hold or use a packet before it expires, this is made to avoid L3 loops (network layer loops) so that packets don’t float around network forever…In the same region, TTL has the default value of 64.</blockquote><blockquote>· In ICMP (ping and traceroute commands), TTL reprsesents the number of hops in the path from the source to the destination, whenever a node is crossed, the TTL is incremented by one! So, with this logic, the first hop will discard a TTL of 1, the second a TTL of 2 and so on!</blockquote><h3><strong>Resolution</strong></h3><p>Now that we analyzed the packets and figured out where the flag is hidden, we only have to find a way to extract it without too many efforts!</p><p><strong><em>(Lazy people here? :P)</em></strong>.</p><p>Well, if you’re not that lazy, you can just copy the characters hold in TTL of echo request packets, one by one and write them down and you got the flag! BUT, it’s not really a proper way to do it! Let’s find a better funny way!</p><p>What we do first, is export packets content in plaintext with the help of our dear packet analyzer Wireshark. For this, we filter packets by keeping only request packets, this is made by applying this filter: <strong>ip.dest == 192.168.1.9 </strong>because requests are sent from host 192.168.1.113 to host 192.168.1.9 (we could have used this filter ip.src == 192.168.1.113 too!) and then go Edit and Mark All Displayed, that will select all your packets! After that go export that to plaintext, go to File, Export Packet Dissections and then As Plain_Text.</p><p>You’ll get a file that contains lines which look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*T7vZjktFFw8LyfE7B-TPgw.png" /></figure><p>Here, what matters to us is the TTL value! The idea is to find a way to get all TTL values, concatenate them in one string and display them as characters!</p><p>We open our terminal and move to the folder that contains the file we’ve just saved (packettext), and execute this command line:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*EpZq_jtR-szksisv5iF39w.png" /></figure><p><strong>Explanations:</strong></p><p>The first command: cat packttext will get and display the content of the text file, the pipe “|” will then follow the result to the second command: grep “ttl” as an input to this one! The grep command will search for all lines that match the criteria which is containing “ttl” string. We follow the result to the third command: cut -d “=” -f4, this command will first divide the previous result into fields, each field will contain a string that is before or after the separator “=”, for example:</p><p>If the input of the cut -d “=” -f3 command is: string1=string2=string3 string4</p><p>This will become first: string1 string2 string3 string4</p><p>So, 3 fields as you can see due to the separation by “=” s(-d “=”), after that, the displayed result will be: string3 string4, because we told the cut command to give us the 3rd field (-f3) from the result.</p><p>Ok, now we can easily figure out that the result of our third command will be a certain number of lines which look like: 180 (reply in 8) (referred to the previous screenshot of our file content). But this is not what we want yet! Our goal is to extract only 180 without what comes after. Here comes the fourth command: cut -d “(“ -f1, as you may know it will simply give us the TTL value, in our example 180. Now that we extracted all TTL values, what left to do is to convert ASCII values to text, this is what the last command does: awk ‘{print(“%c”, $1)}’, for every TTL value returned by the fourth command in $1, this command will display it as character (%c). At the end, we will get all the characters concatenated in one string and stored in our file: flag.txt (the “&gt;” role is to redirect the command result into the specified file).</p><p>Finally, we open the flag.txt file and we get our flag:</p><p><strong>Shellmates{Th3re_1s_n0_T1me_t0_L1v3}</strong></p><h3>Conclusion : What we learn from this task</h3><blockquote>· Through this task, we had an overview of packets analyzing with Wireshark: ordering, filtering and exporting packets.</blockquote><blockquote>· We knew more about icmp protocol, ping and traceroute commands and icmp packet format, specially the data and TTL field.</blockquote><blockquote>· The use of some linux commands: cat, grep, cut and awk.</blockquote><blockquote>· The use of linux pipes and redirections.</blockquote><blockquote>· And finally: Pipes are magic *-*.</blockquote><p><strong>Thanks for reading</strong> 😊</p><p><strong>PS. Dont forget to send me any suggestion about this article and please let me know about any other solution you propose and don’t forget:</strong></p><blockquote>“Knowledge increases by sharing but not by saving.”</blockquote><blockquote>― Kamari aka Lyrikal</blockquote><p><strong>Enjoy your time being here! 😉</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4894bb1f1ae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infofl00d1ng/another-shellmates-ctf-write-up-eye-see-ummm-p-e4894bb1f1ae">Amazing Pipes| CTF Write-up | Eye See Ummm P</a> was originally published in <a href="https://medium.com/infofl00d1ng">n3wb13Stuff</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shellmates Mini CTF 2018 — Write-up — Guess the token 2]]></title>
            <link>https://medium.com/infofl00d1ng/shellmates-mini-ctf-2018-write-up-eye-see-ummm-p-2-2511d5decda1?source=rss----c6aacc2cc35a---4</link>
            <guid isPermaLink="false">https://medium.com/p/2511d5decda1</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[Amina BALI]]></dc:creator>
            <pubDate>Tue, 17 Jul 2018 20:39:47 GMT</pubDate>
            <atom:updated>2018-07-20T16:20:57.975Z</atom:updated>
            <content:encoded><![CDATA[<p>Shellmates Mini CTF 2018 is a CTF for learning purpose organized by <a href="https://www.facebook.com/shellmates/">@Shellmates Club</a><strong>. Here is another write-up for the web challenge : Guess the token 2.</strong></p><blockquote>This will be a sort of step by step tutorial so that anyone can get into it! Even beginners! Almost all my write-ups will be detailed like this one!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*-gEynkC3MaDQsjQ0ML3mmA.png" /></figure><h3>Challenge description</h3><blockquote><strong>Title:</strong> Guess the token 2</blockquote><blockquote><strong>Category:</strong> Web</blockquote><blockquote><strong>Description:</strong></blockquote><blockquote>Cette fois-ci, Jack a essayé d’améliorer son code ou du moins c’est ce qu’il pense ! Pouvez-vous lui prouver le contraire ?</blockquote><blockquote>This time, Jack improved his code, that’s what he thinks … Can you prove him he’s wrong?</blockquote><blockquote><a href="http://192.168.0.200/guess_the_token_2/index.php">http://192.168.0.200/guess_the_token_2/index.php</a></blockquote><blockquote><strong>Points:</strong> 75</blockquote><blockquote><strong>Difficulty:</strong> Easy</blockquote><blockquote><strong>Authors:</strong> Raouf &amp;Mohamed</blockquote><p>When we click on the link in the description this simple page shows up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*0Gra23_JS43I-SFUCVDalA.png" /></figure><p>The ‘view source’ catches our attention, here is the php source that we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*XNQXO468v_KH0HHrT_xAAQ.png" /></figure><p>We notice two interesting parts in the code that give us very useful hints and information about how the token is generated and validated.</p><p>The first thing we notice is the that the username md5 hash is equal to <strong>4ff9fc6e4e5d5f590c4f2134a8cc96d1</strong>, a quick research on google and we got an online <a href="https://md5.gromweb.com/?md5=4ff9fc6e4e5d5f590c4f2134a8cc96d1">tool</a> that helps us retrieve some common strings from their md5 hash, here is what we get:<strong> jack</strong></p><p>So, the username is jack, we are now done with it.</p><p>Let’s move to the token part!</p><p>The obvious part is that the input token $p_token must match with the right token stored in $TOKEN.</p><p>Ok, now the commented section attracts our attention!!!</p><blockquote>// TODO : fix TOKEN with current time</blockquote><blockquote>//$current_time = time();</blockquote><blockquote>//$TOKEN = md5($current_time.’_’.rand(1,50));</blockquote><blockquote>//echo $TOKEN;</blockquote><p>This part reveals us how the token has been generated before it was stored in $TOKEN. As we can see, the token is md5 hash of the current time value ($current_time) concatenated with an underscore and then concatenated with a random number between 1 and 50 (included).</p><p>Now, take a look at the very first line of the comment section! It is a precious hint about the value that should be held in the $current_time variable, it says that we have to <strong>fix the token value with the current time</strong>!</p><p>What we understand here is that the value of the $current_time variable has been fixed to the ‘current time’, the value of time when the $TOKEN variable has been set.</p><p>And <strong>HERE </strong>comes the first commented part of the source code that holds information about the user, the author and the last DATE when the code has been edited!!! Which is: <strong>Tuesday, July 3, 2018 1:32:34 AM GMT+01:00</strong>. We automatically think that the value of the current time is the timestamp of this date.</p><p><strong>Inf0:</strong> Timestamp is the numeric value returned by the php function time() based on the current time. It is a representation of the date time.</p><p>To get the timestamp that has been used when affecting the last value of $TOKEN, we use an online <a href="http://www.4webhelp.net/us/timestamp.php">converter</a> date to timestamp and here is what we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*joP_Hyoe7Q7A180vGY5xHQ.png" /></figure><p>The timestamp is: <strong>1530577954</strong></p><p>So, now we know that the token has this form: 1530577954_rand(1,50). It’s obvious that what we should do is generate all the possible tokens by looping in the rang [1,50] and try them one by one until we got the flag returned.</p><h3>Resolution</h3><p>Now that we analyzed and understand how the whole thing works, we only need to write a script that will generate all the possible tokens and then try them one by one until the flag is returned.</p><p>As we practically have the code that generates the tokens we will reuse it as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l1LRVm_OnHOW-jH0lqzg2g.png" /></figure><p>We put the generated tokens into a text file (tokens.txt) that we will use in our python script to post the tokens:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p0DVKXU8Tc0v7bcSmY7xjw.png" /></figure><p>When we execute the script (python ./guess_the_token_2.py) we finally get the flag:</p><p><strong>Shellmates{php_is_insecur3_y0u_should_m0v3_0n}</strong></p><blockquote>PS. Of course, we could have put everything in the same script: generate the token and test them! I used the php code to generate the tokens just because the code was already there, so I reused it directly!</blockquote><h3>Conclusion : What we learn from this task</h3><blockquote>We learned through this challenge that you should pay attention to the information you put in your source code because it can be a gift offered on silver platter for some crooks. Specially the comments you put in your code!</blockquote><blockquote>We also learned that even if hash algorithms are one way and cannot be reversed, some strings are very common and obvious and there are some tools that use data bases holding a certain number of known hash codes so pay attention to the words you use in your password, username and any other sensitive information.</blockquote><p><strong>Thanks for reading</strong> 😊</p><p><strong>PS. Dont forget to send me any suggestion about this article and please let me know about any other solution you propose and don’t forget:</strong></p><blockquote>“Knowledge increases by sharing but not by saving.”</blockquote><blockquote>― Kamari aka Lyrikal</blockquote><p><strong>Enjoy your time being here! 😉</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2511d5decda1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infofl00d1ng/shellmates-mini-ctf-2018-write-up-eye-see-ummm-p-2-2511d5decda1">Shellmates Mini CTF 2018 — Write-up — Guess the token 2</a> was originally published in <a href="https://medium.com/infofl00d1ng">n3wb13Stuff</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shellmates Mini CTF 2018 — Write-up — Guess the token 1]]></title>
            <link>https://medium.com/infofl00d1ng/shellmates-mini-ctf-2018-write-up-eye-see-ummm-p-1-eacdfe71d670?source=rss----c6aacc2cc35a---4</link>
            <guid isPermaLink="false">https://medium.com/p/eacdfe71d670</guid>
            <category><![CDATA[tutoriales]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[Amina BALI]]></dc:creator>
            <pubDate>Tue, 17 Jul 2018 10:43:57 GMT</pubDate>
            <atom:updated>2018-07-18T22:03:08.631Z</atom:updated>
            <content:encoded><![CDATA[<p>Shellmates Mini CTF 2018 is a CTF for learning purpose organized by <a href="https://www.facebook.com/shellmates/">@Shellmates Club</a><strong>. Here you’ll find my write-up for the first web challenge : Guess the token 1.</strong></p><blockquote>This will be a sort of step by step tutorial so that anyone can get into it! Even beginners! Almost all my write-ups will be detailed like this one!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*aL9X7S3cDChQ_UhVKSKAIQ.png" /></figure><h3>Challenge description</h3><blockquote><strong>Title:</strong> Guess the token 1</blockquote><blockquote><strong>Category:</strong> Web</blockquote><blockquote><strong>Description:</strong></blockquote><blockquote>Jack est un très mauvais programmer, pouvez-vous le confirmer ?</blockquote><blockquote>Jack is a very bad programmer, can you confirm that?</blockquote><blockquote><a href="http://192.168.0.200/guess_the_token_1/index.php">http://192.168.0.200/guess_the_token_1/index.php</a></blockquote><blockquote><strong>Points:</strong> 35</blockquote><blockquote><strong>Difficulty:</strong> Easy</blockquote><blockquote><strong>Authors:</strong> Raouf &amp; Mohamed</blockquote><h3>Analysis</h3><p>When we click on the link in the description this simple page shows up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*If35Rgj01eNKrmt1C1i8EA.png" /></figure><p>The ‘view source’ catches our attention, here is the php source that we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OEyL9CJNo6MAxefUl0eOkg.png" /></figure><p>We notice an interesting part in the code that helps us know how the token is generated and validated (the rectangular pink one) and as we can see the username is totally useless (unused to validate the form) so we can let it empty or put any username we want.</p><p>So, here we must be very careful and pay attention to this line:</p><blockquote>$token = md5(‘$current_time’.’_’.rand(1,10));</blockquote><p>As we can see the current_time variable is put between single quotes and in php this means that we refer to the string $current_time and not the variable value.</p><p>This means that for every generated token we first take the $current_time string and then concatenate it with ‘_’ and finally with a random number between 1 and 10 (included) after that we hash the string with md5 algorithm. Finally, the generated token is compared to the right token stored in $token.</p><h3>Resolution</h3><p>Now that we analyzed and understand how the whole thing works, we only need to generate all the possible tokens and then try them one by one until the flag is returned.</p><p>As we practically have the code that generates the tokens we will reuse it as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXXQAApc6-z3J4SbORisNg.png" /></figure><p>We put the generated tokens into a text file (tokens.txt) that we will use in our python script to post the tokens:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1epHXK3bzxxRlbFQD1drlA.png" /></figure><p>When we execute the script (python ./guess_the_token_1.py) we finally get the flag:</p><p><strong>Shellmates{0bs3rve_an4lyse_d3duce}</strong></p><blockquote>PS. Of course, we could have put everything in the same script: generate the token and test them! I used the php code to generate the tokens just because the code was already there, so I reused it directly!</blockquote><h3>Conclusion : What we learn from this task</h3><blockquote>We learned through this challenge to make the difference between what is put between single quotes and double quotes in PHP:</blockquote><blockquote>When no quotes are used, it’s clear that we refer to the variable, for example: $var.</blockquote><blockquote>When we put something between single quotes, the complete string will be displayed as it is as we saw with ‘$currrent_time’, for example: <em>echo ‘this is a $var’ will display: this is a $var</em></blockquote><blockquote>When we put something between double quotes, the variables are evaluated, so the example before will become: <em>echo “this is a $var” that will display: this is a variable (if we assure that the value of $var is ‘variable’).</em></blockquote><blockquote>For more details about single and double quotes in php, take a look at this <a href="https://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php">link</a>.</blockquote><p><strong>Thanks for reading</strong> 😊</p><p><strong>PS. Dont forget to send me any suggestion about this article and please let me know about any other solution you propose and don’t forget:</strong></p><blockquote>“Knowledge increases by sharing but not by saving.”</blockquote><blockquote>― Kamari aka Lyrikal</blockquote><p><strong>Enjoy your time being here! 😉</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eacdfe71d670" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infofl00d1ng/shellmates-mini-ctf-2018-write-up-eye-see-ummm-p-1-eacdfe71d670">Shellmates Mini CTF 2018 — Write-up — Guess the token 1</a> was originally published in <a href="https://medium.com/infofl00d1ng">n3wb13Stuff</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>