<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by 0xK4sh1k on Medium]]></title>
        <description><![CDATA[Stories by 0xK4sh1k on Medium]]></description>
        <link>https://medium.com/@mohamedkashik963?source=rss-6946a93047f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nPy-zs_H6V9cGVP7KAKF2A.jpeg</url>
            <title>Stories by 0xK4sh1k on Medium</title>
            <link>https://medium.com/@mohamedkashik963?source=rss-6946a93047f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:04:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohamedkashik963/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[SQLi Truncation LAB]]></title>
            <link>https://medium.com/@mohamedkashik963/sqli-truncation-lab-5fc1e63bfe7d?source=rss-6946a93047f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fc1e63bfe7d</guid>
            <dc:creator><![CDATA[0xK4sh1k]]></dc:creator>
            <pubDate>Mon, 03 Jun 2024 23:15:59 GMT</pubDate>
            <atom:updated>2024-06-03T23:15:59.571Z</atom:updated>
            <content:encoded><![CDATA[<p>LAb link <a href="https://www.root-me.org/en/Challenges/Web-Server/SQL-Truncation">SQL Truncation</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyxupulcoZ1FZ4t-0e9W8Q.jpeg" /></figure><p>Let’s start with a short brief about <strong><em>SQLi truncation</em></strong>:<br>SQL Injection Truncation (SQLi Truncation) is a type of SQL injection attack that exploits how databases handle inputs exceeding specified field lengths. When data is longer than the field can store, the excess is truncated, potentially leading to security flaws.</p><p>We can start with open our lab and see what in it :D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UP90RWI683WHtRkad86ZrA.png" /><figcaption>We can see Home, Register and Administration</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lByXA3pOM2Kb00pk4M8wwg.png" /><figcaption>Register page</figcaption></figure><p>As we can see in Register page there are 2 inputs <br>1 =&gt; username<br>2=&gt; Password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJvlcCtvtrZCN3hLil31wA.png" /><figcaption>And here The Administration page</figcaption></figure><p>As we can see , only need the password <br>Ok let’s try :D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1J7OTO1uB3JTffFMaOvkig.png" /></figure><p>We will intercept the request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e4wnQVARgV3-j7P0N_umbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*dsCwj8TTuVr-T22hDVrA_w.png" /></figure><p>There are 2 restrected functions , firstly we will make the password 8 chars</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_5wOjWfKP7nV5Brl4eFdkA.png" /></figure><p>The same response ,So the <strong><em>Admin </em></strong>is a real user <br>But i see a very good note in the response</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rzg2mhyUwtDzmG3a4eZO4A.png" /></figure><p>VARCHAR , CHAR <br>What is there ? And How they will help us to solve the lab ?</p><blockquote><strong><em>Char and VARCHAR Data Types</em></strong></blockquote><p><strong>CHAR</strong> and <strong>VARCHAR</strong> are two data types commonly used in SQL databases to store string data. Here’s a brief explanation of each:</p><p><strong>CHAR(n)</strong>: A fixed-length character data type. It stores exactly n characters. If the input string is shorter than n characters, it pads the string with spaces to ensure it reaches the fixed length. For example, CHAR(10) always stores 10 characters. [ In our case is 32 ]</p><p><strong>VARCHAR(n)</strong>: A variable-length character data type. It stores up to n characters, but only uses as much space as needed to store the actual string (plus a small amount of overhead for length tracking). For example, VARCHAR(10) can store up to 10 characters, but if you only store 5 characters, it will use space for just those 5 characters. <br>[ In our case 12 in login ]</p><h4>Truncation with CHAR and VARCHAR</h4><p>Truncation can occur in SQL databases when input data exceeds the defined length of a VARCHAR column. Here’s how it works:<br><strong>VARCHAR(n) Truncation</strong>:</p><ul><li>If the input string exceeds the maximum length n, it will be truncated to fit within n characters. [ In our case 12 ]</li><li>Example: If a column is defined as VARCHAR(5) and you try to insert &#39;abcdef&#39;, only &#39;abcde&#39; will be stored.</li></ul><p>Let’s try in our lab :D</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gDOFNqsChK9XZ5_5WVwTpA.png" /></figure><blockquote>We will discuss one by one: <br>Firstly: login =&gt; we entered Admin+++++++x <br>Admin =&gt; is 5 chars <br>+++++++=&gt; 7 spaces <br>there are 12 chars as the VARCHAR need but we need to Bypass it but How ? <br>what about adding any char as <strong><em>X</em></strong></blockquote><p>As we can see in the request and the response we can bypass VARCHAR and the user was saved</p><p>Ok now we can login our new password on Administration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4cn_8mJcWMF8VTCkx87gpA.png" /></figure><p>BooooooooooM !!!!!!!!!!!<br>We can get the Administration page and see the Flag</p><p>SQL injection truncation is a subtle yet dangerous vulnerability that can compromise database security. Understanding how CHAR and VARCHAR data types can be exploited through truncation is crucial for preventing such attacks</p><blockquote>Mitigations :<br>1. Using unique constraint <br>2. Using strict modes as strict_all_tables and strict_trans_tables</blockquote><p>In the end we all pray for palestine<br><strong><em>Free Palestine</em></strong></p><p>You can Follow me on <a href="http://www.linkedin.com/in/0xk4sh1k">Linkedin </a>And <a href="https://x.com/0xK4sh1k">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fc1e63bfe7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blind SQL injection with condotional responses]]></title>
            <link>https://medium.com/@mohamedkashik963/blind-sql-injection-with-condotional-responses-5e491cd45669?source=rss-6946a93047f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e491cd45669</guid>
            <dc:creator><![CDATA[0xK4sh1k]]></dc:creator>
            <pubDate>Mon, 19 Feb 2024 16:25:21 GMT</pubDate>
            <atom:updated>2024-02-19T16:51:31.127Z</atom:updated>
            <content:encoded><![CDATA[<p>Get ready for a fun ride into the world of web security! In this write-up, we’re exploring Blind SQL Injection using PortSwigger’s lab. Don’t worry if it sounds fancy — we’ll keep it super simple.</p><p>Think of Blind SQL Injection like a cool detective game. Our mission? To uncover hidden stuff on a website without the site even knowing. And the tool we’ll be using is PortSwigger’s lab — our virtual playground.</p><p>The exciting part? We’re focusing on something called conditional responses. It’s like learning secret handshakes to make the website spill the beans.</p><p>Whether you’re new to this or a seasoned explorer, join us in this adventure. We’ll decode the techy stuff, solve puzzles, and reveal the secrets hidden behind websites. So, grab your detective hat, and let’s dive into the world of Blind SQL Injection and conditional responses together!</p><p>let’s gooooo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XeLSOtIRALtPlMSRQsjy8w.png" /></figure><p>After take a look in the web app there is nothing important ok let’s intercept the request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R2mccXLFp-U1_c8jeN_GpQ.png" /></figure><p>i found 2 ineresting things in Burp <br>First thing in the request =&gt; <strong><em>TrackingId</em></strong><em> </em><br>Second thing in the response =&gt; <strong><em>Welcome back!</em></strong></p><blockquote>Let’s play with <strong><em>TrackingId </em></strong>and see the effect in the response</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p0-ajqSX1hgXHMYngy8ucg.png" /></figure><p>When we change the TrackingId , the response delete “welcome back!” hmmmmmm. good :) <br>Lets make a simple payload to check SQLi such as</p><pre>&#39; and 1=1 -- - </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8dLAKpMJoVUzUn4PZdGm8w.png" /></figure><p>Great. “Welcome back!” retured again</p><p>Let’s check it by using another payload such as</p><pre>&#39; and (select &#39;a&#39; from users limit 1)= &#39;a&#39; -- -</pre><p>(select ‘a’ from users limit 1)= ‘a’ —</p><blockquote><strong><em>The past cammand means that we compare ‘a’ with ‘a’ but what about<br> [ from users limit 1 ] =&gt; If hefinds a table named ‘users,’ he will print ‘welocme backe!’ because it true and if he doesn’t find it, he will not print thing because it non true .</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EnoIdQs4cbyXYLnJXTyP-Q.png" /></figure><blockquote>Very good there is SQLi …. let’s exploit it but take care it’s blind SQLi</blockquote><p>First thing we have dicovered there is a table named “users” and we know there was a username called “administrator” let’s guess his password by using length function to check the lenght of his password</p><pre>&#39; and (select &#39;a&#39; from users where username=&#39;administrator&#39; and length(password)&gt;1) = &#39;a&#39; -- -</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nQo7MXc3viodXxA6KzY6JA.png" /></figure><p>Certainly the password will be more than 1 char <br>let’s bruteforce the length of password to know his length</p><p>We send the request to the intruder and bruteforce the number 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ikaG7mvJRhsHHCdnLJIog.png" /></figure><p>The password is more than 19 but less tahn 21 .. it’s so difficult to guess it ;)</p><p>After knowing the length of password .. Now we will guess all the password by bruteforcing</p><blockquote>It we be using function substring to compare every char</blockquote><pre>&#39; and (selcet substring(password, 1, 1) from users where username=&#39;administrator&#39;) = &#39;a&#39; -- - </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZkgTxhuQbbfy0uxzX49r6A.png" /></figure><p>Now we should change first number “1” and “a” to bruteforce them <br>but what about the tibe bruteforce we should use … in Burp Pro we can use <strong><em>Cluster bomb ..</em></strong> It helps us to bruteforce two variable in same time</p><blockquote><strong><em>The two variables will be the first “1” in substring function and “a” that we will compare it with [ a-z , 0–9 ] <br>That mean “1” is the first char we will compare the first char with all [ a-z , 0–9 ] when it true the “ welcome back! ” will print in the response</em></strong></blockquote><p>But how we can grap the “welocme back!” without true condotion ??? <br>let’s Brute force the first char only then use <strong><em>cluster bomb</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j51FOqE0fvrwW00_o20Pwg.png" /></figure><p>make sure we use min length : 1 <br>and max length : 1 <br>and choose the bruteforcer payload to make the character [ a-z , 0–9 ] then brute force it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5QJGnmxTIZtamwkpPphGqw.png" /></figure><p>We find the “q” is the first char ok.. let’s take the request to intruder and bruteforce it again but using cluster bomb to grap “welcome back!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*83wcNzoWFsZAkiUKV3Lyyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHNwQvcsaVo4iKxGkzRgqQ.png" /></figure><p><strong>We make the brute force “20” chars because the password was 20 chars</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GWiMQhJ6DQmrjJUgUVDCAA.png" /></figure><p>And the chars will be [ a-z , 0–9 ]</p><p>Then grep “welcome back!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3JOICXe6m319DhYKNDjCQ.png" /></figure><blockquote>Then run the attack …. After the attack ends <strong>try organizing the first payload</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctaVepewvS03xyVFavqEXA.png" /></figure><blockquote>After that, take each letter by order and put them next to each other; you will find the combined 20 letters.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9kCoMF8GNxifrQcwWRZxcw.png" /></figure><blockquote><strong>Finally</strong></blockquote><p>My frind <a href="https://www.linkedin.com/in/anas-ibrahim-b996b921a/">Anas </a>makes a script to automate this lab check it from <a href="https://github.com/0x0anas/Blind_SQLi_using_Python">here</a></p><p>And there you have it — our journey into the world of Blind SQL Injection with conditional responses is complete! PortSwigger’s lab has been our playground, helping us understand how websites can sometimes reveal more than they intend.</p><p>By playing the detective and using clever tricks, we’ve not only found weak spots but also mastered the art of getting websites to spill the beans with conditional responses. It’s like discovering secret passages in a digital maze!</p><blockquote><strong>Thanks for reading follow me in </strong><a href="https://twitter.com/0xK4sh1k"><strong>X</strong></a><strong> and </strong><a href="https://www.linkedin.com/in/0xk4sh1k/"><strong>LinkedIn</strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e491cd45669" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web cache poisoning with multiple headers]]></title>
            <link>https://medium.com/@mohamedkashik963/web-cache-poisoning-with-multiple-headers-5fbef795e0cc?source=rss-6946a93047f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fbef795e0cc</guid>
            <dc:creator><![CDATA[0xK4sh1k]]></dc:creator>
            <pubDate>Tue, 13 Feb 2024 22:44:12 GMT</pubDate>
            <atom:updated>2024-02-14T10:01:22.264Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>The target for this labs is caching the <strong><em>alert(document.cookie)</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQUm-m0Q2K7DCjnGbB8exQ.png" /></figure><p>After open the lab this what opened….. <strong>nothing important</strong></p><p>Let’s intercept the request in Burp</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWCmvkbKjQhipi3tfBHAQg.png" /></figure><p>Ok , what about playing <strong><em>Host header ?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pC6w3KUaV5i4j1imEOPkkg.png" /></figure><p>Nothing :(</p><p>Ok , now lets do something different by adding <strong><em>X-Forwarded-scheme</em></strong></p><p><strong>X-Forwarded-Scheme header instead. Notice that if you include any value other than HTTP, you receive a 302 response.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ak__Iray14U07tvgVLHoHg.png" /></figure><p>Goood , What about add <strong><em>X-Forwarded-Host</em></strong> again :)</p><p>What about the js file what we see in the first response ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cLCjkxvpLNLDcEaouSDkoA.png" /></figure><blockquote><strong>/resource/js/tracking.js</strong></blockquote><p>Now we can add the X-Forwarded-Host and the js file let’s do it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9pdA4rDCS0rj0GJO7Jzygg.png" /></figure><blockquote>Before sending any request we should change the file in the exploit server into <strong>/resource/js/tracking.js</strong> and change the body to <strong><em>alert(document.cookie)</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NjJMPDfWYeRtRzuhLuS21g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubGxNQSpVyqJJkgbAuEaug.png" /></figure><p>We should do more than 30 request to cache the this file with new contet…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ZSsfNcJPD8EyHYEK_z4sA.png" /></figure><p>finally do it ……</p><p><a href="http://www.linkedin.com/in/0xk4sh1k"><strong>LinkedIn</strong></a><strong> </strong><a href="https://twitter.com/0xK4sh1k"><strong>X</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fbef795e0cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WriteUp For Kioptrix level 1]]></title>
            <link>https://medium.com/@mohamedkashik963/writeup-for-kioptrix-level-1-340b8845fd1f?source=rss-6946a93047f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/340b8845fd1f</guid>
            <category><![CDATA[vulnhub]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[0xK4sh1k]]></dc:creator>
            <pubDate>Sun, 05 Feb 2023 22:05:25 GMT</pubDate>
            <atom:updated>2023-02-05T22:05:25.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1uUA9rwQFwj2XCstjExv1Q.png" /></figure><blockquote>1- Firstly I try to know the ip address by using =&gt; <strong>netdiscover</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uDBcVXTdm8-YvqN6fvORMA.png" /></figure><blockquote>2- After knowing the ip address , I use <strong>nmap</strong> to know open ports and option -A to know all things about the open ports</blockquote><pre>nmap -A 192.168.1.17</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhgbCBbgmAdPqWFXnOU2iQ.png" /><figcaption><strong>I found port 139 open =&gt; samba</strong></figcaption></figure><blockquote>3- Then try to know the version of samba by using Metasploit , and I found a module called <strong><em>auxiliary/scanner/smb/smb_version</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPBSBdz1A-nugkL78psBZA.png" /></figure><blockquote>4- I used this module to know the version of smb</blockquote><blockquote>And version was <strong>Samba 2.2.1a</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ad41MsoJSdPI_fN08jmLdQ.png" /></figure><blockquote>5- By searching on google to find an exploit of samba I found an exploit called <strong>trans2open</strong> and this is his module <strong>exploit/linux/samba/trans2open</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L6NPOjQIh1ouAqE5rD2bfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vyingG_Wv-sRmD6ZUjNtVA.png" /></figure><blockquote>6- Then use this module to attack the machine</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1MyGo2kaJoaawxJuRzHpQ.png" /></figure><blockquote>7- Now I search for a payloads for this module and found a good payload called <strong>payload/linux/x86/shell/reverse_tcp</strong> and use it</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZcT0blb-7syToSogO41zsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o3hMSdAVWSFQZ582Xs0sLQ.png" /></figure><blockquote>8- After running the exploit on machine I have a <strong>shell</strong> ^__^</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*98Q8NIFmlEQ1Wxy4M5i9vw.png" /></figure><blockquote>9- There are 3 sessions were opened</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LDtIo6ceI32uzh_oXn1J1A.png" /></figure><p><a href="https://www.facebook.com/profile.php?id=100008142576939">facebook</a> <a href="http://www.linkedin.com/in/0xk4sh1k">LinkedIn </a><a href="https://l.facebook.com/l.php?u=https%3A%2F%2Ftryhackme.com%2Fp%2Fmohamedkashik%3Ffbclid%3DIwAR0w-oQcBOm2ju2kUjrZuFBeXESKbLqAutjTd491Gyk3ejZycXY0qy0x6YE&amp;h=AT1Pu5eOVVK6atX_1vzrsXX8izlGAKMVv2QOWXsABVXts-mbOnY5PEwRqm_cVViHEiPvwwxH1-0dXcU0LVR6w5vX1fD93XHCJQwqgFqIiZTV4tf2ZfqbvsLi7WDyEtZWI2bwgw">TryHackMe</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=340b8845fd1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>