<?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 Ashiquethaha on Medium]]></title>
        <description><![CDATA[Stories by Ashiquethaha on Medium]]></description>
        <link>https://medium.com/@ashiquethaha78?source=rss-a64c98f6e162------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jRoL_Z7KDgZtXhgxaU91Xw.jpeg</url>
            <title>Stories by Ashiquethaha on Medium</title>
            <link>https://medium.com/@ashiquethaha78?source=rss-a64c98f6e162------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:54:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ashiquethaha78/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[Neonify WriteUp HackTheBox]]></title>
            <link>https://medium.com/@ashiquethaha78/ashiquethaha-hackthebox-neonify-challenge-writeup-a86ef5bb4f8d?source=rss-a64c98f6e162------2</link>
            <guid isPermaLink="false">https://medium.com/p/a86ef5bb4f8d</guid>
            <category><![CDATA[hackthebox-challenge]]></category>
            <category><![CDATA[neonify-hackthebox]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Ashiquethaha]]></dc:creator>
            <pubDate>Wed, 01 Jan 2025 06:46:18 GMT</pubDate>
            <atom:updated>2025-01-01T06:46:18.645Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Neonify HackTheBox" src="https://cdn-images-1.medium.com/max/1024/1*6cbdU7frBnHEa-HNsmTZ5A.png" /></figure><p>This is one of the easiest challenges that have done in HTB,reason for this write-up still is that it taught me that there might be some silly things that will keep us out of the FLAGs even though every thing else worked correctly. It reminded me to think like a <strong>Hacker</strong></p><p>On the web page, there is an input box that <strong><em>Neonifies </em></strong>all the texts, using regex it blocks other malicious texts too.</p><p>Using server side template injection <strong>SSTI</strong> we need to read the file that is, <strong>file.txt</strong> as given in related files (Download the file) provided by HTB.</p><p><strong>The code that does regex:</strong></p><pre>if params[:neon] =~ /^[0–9a-z ]+$/i</pre><p><strong>payload for SSTI:</strong></p><pre>&lt;%= File.open(&#39;flag.txt&#39;).read %&gt;</pre><p>I tried the payload multiple times, but there is something that isn’t working, finally I found that the payload that we enter should go inside a new line.</p><pre>neon = hello<br>&lt;%= File.open(&#39;flag.txt&#39;).read %&gt;</pre><p>Then url encoded all (including the neon parameter and payload) as a whole using burp url encoding within the repeater tab, still not working!</p><p>After that I wrote the first line and payload in two different lines and encoded both lines as a whole in burp decoder then it worked fine, I got the flag.<br><br><strong>This:</strong></p><pre>a<br>&lt;%= File.open(&#39;flag.txt&#39;).read %&gt;</pre><p><strong>To this:</strong></p><pre>%61%0a%3c%25%3d%20%46%69%6c%65%2e%6f%70%65%6e%28%27%66%6c%61%67%2e%74%78%74%27%29%2e%72%65%61%64%20%25%3e</pre><p>Find the Flag and submit it. Happy New Year, Happy Hacking.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a86ef5bb4f8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HackTheBox Insomnia Challenge Walkthrough]]></title>
            <link>https://medium.com/@ashiquethaha78/hackthebox-insomnia-challenge-walkthrough-0f1ba18450e3?source=rss-a64c98f6e162------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f1ba18450e3</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hack-the-box-writeup]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hack-the-box-walkthrough]]></category>
            <dc:creator><![CDATA[Ashiquethaha]]></dc:creator>
            <pubDate>Sat, 28 Sep 2024 15:29:48 GMT</pubDate>
            <atom:updated>2024-09-28T19:29:11.483Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v7-O2FL7UbYN-9pX7h0JRg.png" /><figcaption>Insomnia</figcaption></figure><h3>Exploitation</h3><p>- Found a login endpoint.<br>- Tried SQLi, usual auth bypass tricks didn’t work out.<br>- inspecting the source code….</p><p>- so we need to log in as administrator :</p><pre>if ($username == &quot;administrator&quot;) {<br>return view(&quot;ProfilePage&quot;, [<br>&quot;username&quot; =&gt; $username,<br>&quot;content&quot; =&gt; $flag,<br>]);<br>} else {<br>$content = &quot;Haven&#39;t seen you for a while&quot;;<br>return view(&quot;ProfilePage&quot;, [<br>&quot;username&quot; =&gt; $username,<br>&quot;content&quot; =&gt; $content,<br>]);<br>}</pre><ul><li>found a logic flaw in the code :</li></ul><pre>if (!count($json_data) == 2) {<br>return $this-&gt;respond(&quot;Please provide username and password&quot;, 404);<br>}</pre><p>!count($json_data) == 2 explanation:</p><ul><li>count($json_data) returns the no of elements in the $json_data array.</li><li>The ! operator negates the count, so if $json_data contains two elements, it becomes !2, which is false.</li><li>it checks if false == 2, it&#39;s <strong>always false</strong>.</li><li>let’s use this to log in as admin</li><li>create a user then login as that user, and capture req. then remove pass from params and give username administrator and get JWT, use it to login and get the flag.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P0y4XvO2YBhERf3thoYEbA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f1ba18450e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Race Condition vulnerabilities]]></title>
            <link>https://medium.com/@ashiquethaha78/race-condition-vulnerabilities-bbc7af5d7e3b?source=rss-a64c98f6e162------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbc7af5d7e3b</guid>
            <dc:creator><![CDATA[Ashiquethaha]]></dc:creator>
            <pubDate>Wed, 28 Feb 2024 05:09:04 GMT</pubDate>
            <atom:updated>2024-03-01T17:45:28.144Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*7mBV835igyv4jGjtjRwT7g.jpeg" /></figure><p>Race conditions happen when two sections of codes are meant to be executed in a sequence but unfortunately get out of sequence or order.</p><h3>Concurrency</h3><p>Concurrency is the ability to execute different parts of a program simultaneously without affecting the outcome of the program. This will improve the program’s performance as multiple parts of the program could be run at once.</p><p>concurrency has two types: <strong><em>Multiprocessing</em></strong>, <strong><em>Multithreading</em></strong></p><h3>Multiprocessing</h3><p>Multiprocessing in short is using multiple CPUs, (the hardware that executes instructions to perform simultaneous computation).</p><h3>Multithreading</h3><p>Multithreading is the ability of a single CPU to provide multiple threads( concurrent executions).<br>But threads don’t execute simultaneously, they take turns as threads become available.</p><p><strong><em>example</em></strong>: If one thread is suspended while waiting for user input, another can take over the CPU to execute its computations.</p><p>Arranging the sequence of execution of multiple threads is called <strong>scheduling</strong>. Different systems use different scheduling algorithms, some schedule tasks based on priority while another system might execute its tasks by giving out computational time in turns, regardless of priority.</p><p>This flexible scheduling is precisely what causes <strong>race conditions</strong>.</p><p>As the scheduling algorithm can swap between threads at any time, we can’t predict the sequence of threads executing each action.</p><h4>Example</h4><p>Two concurrent threads are trying to increase the value of a global variable by one, ie if the value of the global variable is 0 the answer should be 2(because two threads worked here).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4DjbVQDdSWoYl1tqGT-SdA.png" /><figcaption><strong><em>Normal Execution of Two Threads Operating on the Same Variable:</em></strong></figcaption></figure><p>But if the two threads are run simultaneously, without any consideration of conflicts that may occur, it will be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qWw3kW4IAkj9Wu6p2cAHwQ.png" /><figcaption><strong>Incorrect Calculation Due to a Race Condition</strong></figcaption></figure><p>Here the value of the variable becomes 1 where it should have been 2.</p><p>In summary, race conditions happen when the outcome of the execution of one thread depends on the outcome of another thread, and when two threads operate on the same resources without considering that other threads are also using those resources.</p><h3>Race Condition Becomes a Vulnerability</h3><p>This becomes a vulnerability when attackers can complete a sensitive action before a security check is completed.</p><h4>scenario:</h4><p>Imagine instead of the global variables in the previous example, threads are working on a bank money transfer.</p><p>Here bank has to perform three sub-tasks, to transfer money correctly.</p><p>1. Check the originating account has a high enough balance.<br>2. If so, add money to the destination account<br>3. Deduct the transferred amount from the originated account.</p><p>ie,</p><p>There are two bank accounts, Account A and Account B</p><p>Balance in Account A: $500<br>Balance in Account B: $0</p><p>We are initiating two money transfers from Account A to Account B at the same time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7m5Pfep5OTabfhp4cMAtFA.png" /><figcaption><strong>Normal Execution of Two Threads Operating on the Same Bank Account</strong></figcaption></figure><p>But when you can do the amount transfers simultaneously, you might be able to induce a race condition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N3gQRCkso1rtycKJTWT82Q.png" /><figcaption><strong>Faulty Transfer Results Due to a Race Condition</strong></figcaption></figure><p>The same methodology can be used for authentication bypass, to rig online votes etc.</p><h3>Prevention</h3><p>The key to avoiding race conditions is to protect the resources using a method called <strong>synchronisation</strong> or implementing mechanisms that ensure threads using the same resources won’t execute simultaneously.</p><h4>Resource locks</h4><p>They block other threads from operating on the same resource by locking a resource.</p><p>In the bank transfer example, thread 1 could lock the balance of accounts A and B before modifying them, so that thread 2 would have to wait for it to finish before accessing the resources.</p><h4>Least privilege</h4><p>Beyond synchronisation, following secure coding practices, like the principle of least privilege, can prevent race conditions from turning into more severe security issues.</p><p>The principle of least privilege means that applications and processes should be granted only the privileges they need to complete their tasks.</p><p>For example, when an application requires only read access to a file, it should not be granted any write or execute permissions. You should <br>grant applications precisely the permissions that they need instead.</p><p>This lowers the risks of complete system compromise during an attack.</p><h3>Hunting for Race Conditions</h3><h4>Find Features Prone to Race Conditions</h4><p>Most of the time, race conditions occur in features that deal with numbers, such as online voting, online gaming scores, bank transfers, e-commerce payments, and gift card balances.</p><p>Look for these features in an application and take note of the request involved in updating these numbers.</p><p>For example, let’s say that, in your proxy, you’ve spotted the request used to transfer money from your banking site.</p><h4>Send Simultaneous Requests</h4><p>You can then test for and exploit race conditions in the target by sending multiple requests to the server simultaneously</p><p>For example, if you have $500 in your bank account and want to see if you can transfer more money than you have,</p><p>You can simultaneously send multiple requests for transfer to the server via the curl command by using &amp; to chain multiple curl commands together, Or you can use Burpsuite.</p><h4>Check the Results</h4><p>Check if your attack has succeeded. In the example, if your destination account ends up with more than 500 additions after the simultaneous requests, your attack has succeeded, and you can determine that a race condition exists on the transfer balance endpoint.</p><p>Note that whether your attack succeeds depends on the server’s process scheduling algorithm, which is a matter of luck. However, the more requests you send within a short time frame, the more likely your attack will succeed.</p><p>Also, many tests for race conditions won’t succeed the first time, so it’s a good idea to try a few more times before giving up. This was just a basic overview of what Race Conditions are and how they can become a vulnerability. If you want to practice it and understand more advanced ways of exploiting the vulnerability in the real world, go to <a href="https://portswigger.net/web-security/race-conditions">Portswigger labs</a></p><p><em>reference: Bug Bounty Bootcamp by Vickie Li, The Web Application Hacker’s Handbook by Dafydd Stuttard Marcus Pinto</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbc7af5d7e3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>