<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" >

<channel>
	<title>Kaushal Bhavsar</title>
	<atom:link href="https://kaushalbhavsar.com/updates/feed/" rel="self" type="application/rss+xml" />
	<link>https://kaushalbhavsar.com</link>
	<description>Diary of a Tech Geek</description>
	<lastBuildDate>Tue, 04 Jul 2023 07:04:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<itunes:subtitle>Kaushal Bhavsar</itunes:subtitle>
	<itunes:summary>Diary of a Tech Geek</itunes:summary>
	<itunes:explicit>clean</itunes:explicit>
	<item>
		<title>Preventing Direct IP Access in CloudFlare</title>
		<link>https://kaushalbhavsar.com/updates/preventing-direct-ip-access-in-cloudflare/</link>
					<comments>https://kaushalbhavsar.com/updates/preventing-direct-ip-access-in-cloudflare/#respond</comments>
		
		<dc:creator><![CDATA[Kaushal Bhavsar]]></dc:creator>
		<pubDate>Tue, 04 Jul 2023 07:04:28 +0000</pubDate>
				<category><![CDATA[Updates]]></category>
		<guid isPermaLink="false">https://kaushalbhavsar.com/?p=2906</guid>

					<description><![CDATA[Recently, I was going through my LinkedIn feed and I found a post by Jake M. In the post, the author suggests a way to bypass Cloudflare&#8217;s protection and directly access the origin server. They propose using the &#8216;Forgot Password&#8217; feature of a web app to find the server&#8217;s IP address. If that fails, they [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Recently, I was going through my LinkedIn feed and I found <a href="https://www.linkedin.com/feed/update/urn:li:activity:7080187072707207170/" target="_blank" rel="noopener">a post by Jake M</a>. </p>



<p>In the post, the author suggests a way to bypass Cloudflare&#8217;s protection and directly access the origin server. They propose using the &#8216;Forgot Password&#8217; feature of a web app to find the server&#8217;s IP address. If that fails, they recommend sending an email to a non-existent address to receive a bounce notification with the server&#8217;s IP. That will expose the server IP and it&#8217;s possible to bypass Cloudflare&#8217;s security measures unless additional restrictions are in place. </p>



<p>Here&#8217;s how both scenarios can be visualized: <br></p>



<figure class="wp-block-image aligncenter size-full"><img fetchpriority="high" decoding="async" width="352" height="359" src="https://kaushalbhavsar.com/wp-content/uploads/2023/07/image.png" alt="" class="wp-image-2907" srcset="https://kaushalbhavsar.com/wp-content/uploads/2023/07/image.png 352w, https://kaushalbhavsar.com/wp-content/uploads/2023/07/image-294x300.png 294w" sizes="(max-width: 352px) 100vw, 352px" /><figcaption class="wp-element-caption">Scenario 1 &#8211; Using &#8216;Forgot Password&#8217; to expose Origin Server IP</figcaption></figure>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="622" height="153" src="https://kaushalbhavsar.com/wp-content/uploads/2023/07/image-1.png" alt="" class="wp-image-2908" srcset="https://kaushalbhavsar.com/wp-content/uploads/2023/07/image-1.png 622w, https://kaushalbhavsar.com/wp-content/uploads/2023/07/image-1-300x74.png 300w" sizes="(max-width: 622px) 100vw, 622px" /><figcaption class="wp-element-caption">Scenario 2 &#8211; Using &#8216;Bounce Email&#8217; to expose Origin Server IP</figcaption></figure>



<p>The author&#8217;s research very well points out a configuration vulnerability that is really difficult to visualize. If the Origin Server IP is exposed, there is no point in having CloudFlare. And this is the same issue with any Cloud Firewall / CDN that works in Proxy mode. </p>



<p></p>



<h2 class="wp-block-heading">Suggested Workaround</h2>



<p>As suggested in the comments, the most popular workaround would be to use a 3rd party email server. In that way when the mail server&#8217;s IP address is exposed, the Origin Server IP is still hidden behind the proxy. </p>



<p>However, what if someone wants to use the mail server on the same server? Is there no way out? </p>



<h2 class="wp-block-heading">Actual Workaround &#8211; Bypass Prevention</h2>



<p>Let&#8217;s look at the situation from a different perspective. </p>



<p>Our Origin Server IP is exposed via a mail server. We may circumvent this issue by moving the mail server out of our hosting infrastructure. </p>



<p>But the fact is, there might be more than one way to expose the Origin Server IP! And we may not have discovered all of them, while attackers might have. So it&#8217;s best to assume that the IP will be exposed anyway, and work on a strategy that prevents any incident based on the exposure. The solution can be called &#8216;Bypass Prevention&#8217;. </p>



<p>Bypass Prevention is very simple &#8211; we disable direct IP access to the web application hosted on the server. To do that, we need to simply restrict the access to IP range of CloudFlare. </p>



<p>For that, we need the current Cloudflare IP ranges list. <a href="https://www.cloudflare.com/en-in/ips/" target="_blank" rel="noopener">Visit the Cloudflare IP Lists page</a> or utilize their API to obtain the latest IP range list. </p>



<p>Once we have the list, we can use the .htaccess file to provide Bypass Prevention functionality. </p>



<p>To configure IP restrictions in the .htaccess file, follow these steps:</p>



<ol class="wp-block-list">
<li>Create or edit your .htaccess file in the root directory of your website.</li>



<li>Add the following lines to the file:</li>
</ol>



<pre class="wp-block-code"><code># Block direct access to all files except from Cloudflare IPs
&lt;Files *>
    Order Deny,Allow
    Deny from all
    # Whitelist Cloudflare IP ranges
    Allow from 103.21.244.0/22
    Allow from 103.22.200.0/22
    # Add more IP ranges here if needed
&lt;/Files>
</code></pre>



<ol class="wp-block-list" start="3">
<li>Replace the example IP ranges (<code>103.21.244.0/22</code> and <code>103.22.200.0/22</code>) with the actual Cloudflare IP ranges you obtained from the sources mentioned earlier.</li>



<li>Save the .htaccess file.</li>
</ol>



<p>These rules will deny access to all files on the website for requests from IP addresses outside the specified Cloudflare IP ranges. Only requests originating from Cloudflare IPs will be allowed.</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://kaushalbhavsar.com/updates/preventing-direct-ip-access-in-cloudflare/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>23/06/2023 &#8211; BUGSKAN Chronicles Part 1</title>
		<link>https://kaushalbhavsar.com/updates/23-06-2023-bugskan-chronicles-part-1/</link>
					<comments>https://kaushalbhavsar.com/updates/23-06-2023-bugskan-chronicles-part-1/#respond</comments>
		
		<dc:creator><![CDATA[Kaushal Bhavsar]]></dc:creator>
		<pubDate>Fri, 23 Jun 2023 05:14:36 +0000</pubDate>
				<category><![CDATA[Updates]]></category>
		<guid isPermaLink="false">https://kaushalbhavsar.com/?p=2894</guid>

					<description><![CDATA[Starting a startup is every geek&#8217;s dream. Admit it, we all want a &#8220;company&#8221; of our own. It&#8217;s like a brand we build for ourselves, just like every fashion designer dreams of their private label or every waiter dreams of his own restaurant. Dreaming isn&#8217;t bad &#8211; unless we have a dream, there&#8217;s no worth [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Starting a startup is every geek&#8217;s dream. Admit it, we all want a &#8220;company&#8221; of our own. It&#8217;s like a brand we build for ourselves, just like every fashion designer dreams of their private label or every waiter dreams of his own restaurant. </p>



<p>Dreaming isn&#8217;t bad &#8211; unless we have a dream, there&#8217;s no worth living. But dreams have to be backed up with execution, and when we go to execute, we find out how naive that dream is. </p>



<h2 class="wp-block-heading">The decision to shift to cybersecurity</h2>



<p>Before BUGSKAN I was running a software development company with a small team of 5. However, I was always interested in security. In fact, I started by career by &#8220;cleaning&#8221; viruses from computers while I was still at college. I also used to manage servers on AWS and Azure for our customers and I knew security was the big thing in the next decade or so. Later, I moved to software development. </p>



<p>Running a software company was difficult then (and it is even more difficult at this moment, but more on this later), and honestly, I was getting bored. I wanted a new career. So, I created a poll titled &#8220;What do you think I am good at?&#8221; and messaged the link to about 20 people who knew me for the last 5-10 years. The most popular options were &#8220;Security&#8221; and &#8220;Teaching&#8221;. Since my financial calculation for running a training center did not turn out so well, I decided to go with Security &#8211; it was my passion and I was also pursuing my PhD in this area. </p>



<p></p>



<h2 class="wp-block-heading">I had previous experience</h2>



<p>In 2015, when I was going through this process, I was actually working at a Deep-Tech startup as a CTO and the pay was good. But the CEO/Founder was a brute. He was a bachelor and used to eat-sleep-whatever in the office. I was &#8220;just married&#8221; and I needed family time. Plus, we had creative differences. At one point of time in the investor meeting, the investor asked when they will see ROI or even any revenue. We were building something related to storage performance optimization and the code was supposed to be done in native C/C++ but I had no clue how to get it working (in fact it still isn&#8217;t working) so I suggested that while we figure out our main product, we can start selling &#8220;optimized VPS&#8221; and get revenues coming. <br>The investor was okay with it but the CEO was not. And that created a gap between him and me. I rarely received any credit for the suggestions I made, even if they were actually implemented. One day the CEO asked me for a 1-1 and said I was too slow for the company. At that point, I knew I had to quit. </p>



<p>During this short stint, I learned about product planning, management, investor relations, and many other concepts which I may have never learned in my software development consultancy. </p>



<h2 class="wp-block-heading">The return to consulting</h2>



<p>Just when I had left the previous company, one of my friends, who was now a CTO of a US-based product company, had a security incident. I reached out to him and offered him some help, and did a basic security audit for free. The next thing I remember is signing an NDA and a contract with the company for a security audit. I was ready to roll! I loved talking to their developers since I was one of them, and knowledge of security made me a great combo. At that time, I was also watching Mr. Robot. The company in Mr. Robot was &#8220;All Safe Systems&#8221; and I was really inspired by the operations of the company.</p>



<p>I took that as an inspiration and borrowing branding concepts from by customer, I registered &#8220;bugskan.com&#8221;. </p>



<p>Soon, I started taking &#8220;Dev Sec&#8221; sessions (DevSecOps was still not a thing yet) and enjoyed the attention I received. But there was a problem &#8211; the US office of my first client stopped renewing my contract. I got to know that &#8220;periodic audits are expensive&#8221;. The fact was, they were rapidly growing and the list of endpoints were growing so they needed a &#8220;fix-price annual contract&#8221;. </p>



<p>I looked at the problem &#8211; the entire security audit industry worked in &#8220;man-hour&#8221; pricing which was retrospectively priced to suit the customer budget. This made security audits for small companies unaffordable. </p>



<p>I decided to put an end to this &#8211; a Security-as-a-service platform with fixed monthly cost per application. That&#8217;s what BUGSKAN was going to be!</p>



<h2 class="wp-block-heading">The launch</h2>



<p>We created the first version and launched it online. Our platform allowed website owners to scan their web applications for security vulnerabilities. The basic free report checked for OWASP Top 10 vulnerabilities and a deep scan required paid service. At that time, I was competing with Tinfoil Security, Detectify, and so on.</p>



<div class="wp-block-uagb-image uagb-block-d767dbcf wp-block-uagb-image--layout-default wp-block-uagb-image--effect-static wp-block-uagb-image--align-none"><figure class="wp-block-uagb-image__figure"><img loading="lazy" decoding="async" srcset="https://kaushalbhavsar.com/wp-content/uploads/2023/06/748_10153981229051894_5284482055903158815_n.jpg " sizes="auto, (max-width: 480px) 150px" src="https://kaushalbhavsar.com/wp-content/uploads/2023/06/748_10153981229051894_5284482055903158815_n.jpg" alt="" class="uag-image-2899" width="960" height="718" title="" loading="lazy"/></figure></div>



<p>The project was selected as a case study for using open-source technologies on Azure and I was invited to showcase the same at Microsoft Openness Days, Hyderabad. I got feedback from senior tech architects and developers who were also facing similar problems in their daily routines. I was excited &#8211; finally, I had the product market fit, I thought. </p>



<div class="wp-block-uagb-image uagb-block-5d8db70f wp-block-uagb-image--layout-default wp-block-uagb-image--effect-static wp-block-uagb-image--align-none"><figure class="wp-block-uagb-image__figure"><img loading="lazy" decoding="async" srcset="https://kaushalbhavsar.com/wp-content/uploads/2022/12/10399568_10153980841801894_1659058591376713968_n.jpeg " sizes="auto, (max-width: 480px) 150px" src="https://kaushalbhavsar.com/wp-content/uploads/2022/12/10399568_10153980841801894_1659058591376713968_n.jpeg" alt="" class="uag-image-2523" width="960" height="718" title="" loading="lazy"/><figcaption class="uagb-image-caption">Me with new friends at Hyderabad</figcaption></figure></div>



<p>At one point, we had about 30 daily free scans. Despite that, we were not seeing any takes for the paid product and the company was surviving from my consulting revenue only. </p>



<h2 class="wp-block-heading"> The Pivot</h2>



<p class="has-text-align-left">I was frantically looking for insights, and for some platform that does not have large user interaction, it meant I needed to reach out to my users personally instead of running an analytics script. One of the users for Mahendra Sharma, CTO of Matrubharti &#8211; India&#8217;s largest ebook platform. After training their development team I was sitting with Mahendra Sharma and he told me the golden words: </p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>You send us a report but our developers will never fix each bug. I want something automatic that I can control </p>
</blockquote>



<p>This got my head spinning and I went to the whiteboard AGAIN. This was December 2016, almost a year after I started BUGSKAN. If we are doing something, and not getting results, we are doing something wrong, I thought. I remembered my research on ModSecurity in 2011 while I was teaching &#8211; ModSecurity has something called &#8220;Virtual Patching&#8221; that allows a quick fix for the vulnerability. <br>The VP is not a solution, it is just a bandage to stop infection while the wound is healing, but it happens at the click of a button so &#8211; this seemed a perfect addition to our arsenal. </p>



<p>So we registered bugshield.io domain and started working on a WAF-as-a-service platform with vulnerability scanning and automatic virtual patching. This meant more time in research and development. This also meant, less time for consulting. </p>



<p>In all, this pivot turned out to be really expensive&#8230; but how? I will share in the next part. Thanks for reading!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://kaushalbhavsar.com/updates/23-06-2023-bugskan-chronicles-part-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>19/06/2013 &#8211; My Return to the Blogosphere</title>
		<link>https://kaushalbhavsar.com/updates/turning-a-new-page-my-return-to-the-blogosphere/</link>
					<comments>https://kaushalbhavsar.com/updates/turning-a-new-page-my-return-to-the-blogosphere/#respond</comments>
		
		<dc:creator><![CDATA[Kaushal Bhavsar]]></dc:creator>
		<pubDate>Mon, 19 Jun 2023 11:21:51 +0000</pubDate>
				<category><![CDATA[Updates]]></category>
		<guid isPermaLink="false">https://kaushalbhavsar.com/?p=2884</guid>

					<description><![CDATA[Hi, reader&#8230; You may be knowing from the past or maybe you just landed here from a search engine. Either way, I feel excited to share my journey with you. My name is Kaushal Bhavsar &#8211; I am a Ph.D. in Computer Science with a specialization in security. Like most geeks, I am passionate about [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Hi, reader&#8230;</p>



<p>You may be knowing from the past or maybe you just landed here from a search engine. Either way, I feel excited to share my journey with you. </p>



<p>My name is Kaushal Bhavsar &#8211; I am a Ph.D. in Computer Science with a specialization in security. Like most geeks, I am passionate about new technology and like sharing what I learn. </p>



<p>A decade ago, blogging was my passion. I used to blog about anything and everything I experienced in life. But I forgot blogging &#8211; why? </p>



<p></p>



<h3 class="wp-block-heading">Fast forward &gt;&gt; Present day </h3>



<p>While I am thinking why my blog looks empty, it reminds me of the key events that happened in the past ten years that got me in this situation</p>



<ol class="wp-block-list">
<li><strong>I got married</strong> &#8211; Now before you frown upon me like, &#8220;How dare you use your life partner as an excuse to do something you were to lazy to do!&#8221;, let me tell you &#8211; my partner gives me sufficient time to use the computer. She knows that it&#8217;s my &#8220;second wife&#8221; and she has well accepted the fact that sometimes, tech can get too much on my head and I forget everything else around me. The problem is me &#8211; I became introverted and secretive. I probably didn&#8217;t want to share too much of my life, and the content creation became increasingly lesser from that point.  I guess, this was a behavioural change as I began a new phase in life. Even today, I would not want to share &#8220;everything&#8221; that happens around me, but at least I can share a good part of what is helpful to my readers!</li>



<li><strong>We got a child</strong> &#8211; So this is where I was busy most of the time.  We (obviously, me and my wife) were done changing his diapers a long time ago but still, the child was our focus and in fact, we even lost focus from ourselves (and that&#8217;s how we realized that we look horrible now &#8211; but that&#8217;s for another post). Our every day was centered around the child &#8211; partly because it was exciting to recollect how we might have grown up some 25-30 years ago. </li>



<li><strong>I was working on a startup</strong> &#8211; It was called BUGSKAN (more about what went wrong with it, later). We made tools and tech to automate security operations for developers. This was while we were raising a 2-year-old child. So practically, I had two children &#8211; one was genetic and another was ideological. And then, at one point I had a team of 10 people including interns while I was running a one-man show both at home and work. Believe me, it is much tougher than it sounds. </li>



<li><strong>My mother expired</strong> &#8211; This was a year before COVID-19 started. I was off for a client meeting and she just collapsed while reaching a hospital. This was just a day after I fired my entire team so it was extremely difficult to handle two major setbacks in life. I was really shocked (all of us were) and we took about two years to come over the fact.</li>



<li><strong>We were infected by COVID-19</strong> &#8211; For those of you who have been infected, you know how this feels like. Living for 14 days in the same house and being unable to talk to our child (we used to do video calls to the &#8220;ground floor&#8221;) gave me a faint picture of what an unhealthy life would look like. The experience was life-changing on a negative note. </li>



<li><strong>I finally finished my Ph.D. Thesis</strong> &#8211; Well, this deserves a separate blog post altogether so I am not going to write anything here. But I realized there&#8217;s something called &#8220;Post Ph.D. Depression&#8221; which you don&#8217;t know until you get out of it.</li>
</ol>



<h2 class="wp-block-heading">What now? </h2>



<p>Well, now that I have given an update on what I have been up to for the last few years, I am going to restart blogging. In my journey till now, I have developed my interest in the wide spectrum of machine learning and the use of AI in cybersecurity, along with scientific research. I will be blogging on cybersecurity, startups, machine learning, and wellness based on what I have learned so far.</p>



<p>Until the next post, this is Kaushal Bhavsar signing off <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://kaushalbhavsar.com/updates/turning-a-new-page-my-return-to-the-blogosphere/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
