<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx</link><description>Web services are the most attractive target for hackers because even a pre-school hacker can bring down a server by repeatedly calling a web service which does expensive work. Ajax Start Pages like Pageflakes are the best target for such DOS attack because</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>clean credit</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1729942</link><pubDate>Mon, 05 Oct 2009 15:59:15 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1729942</guid><dc:creator>clean credit</dc:creator><description>&lt;p&gt;I only wish I had found it sooner.&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1729942" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1698882</link><pubDate>Thu, 09 Jul 2009 02:55:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1698882</guid><dc:creator>KiwiCoder</dc:creator><description>&lt;p&gt;I created the following to replace the Profile.IsFirstVisit&lt;/p&gt;
&lt;p&gt;		public bool IsFirstVisit()&lt;/p&gt;
&lt;p&gt;		{&lt;/p&gt;
&lt;p&gt;			if (Session[&amp;quot;IsFirstVisit&amp;quot;] == null)&lt;/p&gt;
&lt;p&gt;			{&lt;/p&gt;
&lt;p&gt;				Session[&amp;quot;IsFirstVisit&amp;quot;] = &amp;quot;false&amp;quot;;&lt;/p&gt;
&lt;p&gt;				return true;&lt;/p&gt;
&lt;p&gt;			}&lt;/p&gt;
&lt;p&gt;			else&lt;/p&gt;
&lt;p&gt;			{&lt;/p&gt;
&lt;p&gt;				return false;&lt;/p&gt;
&lt;p&gt;			}&lt;/p&gt;
&lt;p&gt;		}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1698882" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1652939</link><pubDate>Mon, 03 Nov 2008 18:42:17 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1652939</guid><dc:creator>James</dc:creator><description>&lt;p&gt;I need help! Someone threatened to ddos my site! What should i do?!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1652939" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1650681</link><pubDate>Mon, 13 Oct 2008 10:29:07 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650681</guid><dc:creator>Aristos</dc:creator><description>&lt;p&gt;This is a joke or a bug ?&lt;/p&gt;
&lt;p&gt; &amp;nbsp;if( context.Request.Browser.Crawler ) &lt;/p&gt;
&lt;p&gt;return false; &amp;lt;----&lt;/p&gt;
&lt;p&gt;you do not won crawlers on your site ?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650681" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1650673</link><pubDate>Mon, 13 Oct 2008 07:57:32 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650673</guid><dc:creator>omar</dc:creator><description>&lt;p&gt;Don&amp;#39;t want to do the calculation on each and every call. Only where expensive operations are performed.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650673" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1650666</link><pubDate>Mon, 13 Oct 2008 07:05:30 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650666</guid><dc:creator>Psul</dc:creator><description>&lt;p&gt;Why you didn&amp;#39;t write this ddos-protection code in HttpModule. It will be faster to process request and denie them (if ddos detected) on HttpModule level, isn&amp;#39;t it?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650666" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1647949</link><pubDate>Tue, 16 Sep 2008 18:31:28 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1647949</guid><dc:creator>omar</dc:creator><description>&lt;p&gt;As the cache is in-memory cache, the Hit object is referenced as By Ref. So, making any modification to the object updates the actual object inside the cache.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1647949" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1647946</link><pubDate>Tue, 16 Sep 2008 18:14:55 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1647946</guid><dc:creator>Andrew</dc:creator><description>&lt;p&gt;Hi Omar, &lt;/p&gt;
&lt;p&gt;Thanks for the info, I was wondering why you dont replace the cached item after updating the HitInfo.Hit? Is the object in cache a different copy of the object that is incremented?&lt;/p&gt;
&lt;p&gt;&amp;quot;if( hit.Hits == 1 )&lt;/p&gt;
&lt;p&gt; &amp;nbsp;context.Cache.Add(key, hit, null, DateTime.Now.AddMinutes(DURATION), &lt;/p&gt;
&lt;p&gt; &amp;nbsp;System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);&amp;quot;&lt;/p&gt;
&lt;p&gt;Why not &lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;if (hit.Hits &amp;gt; 1) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Cache.Remove(key);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Cache.Add(&amp;lt;all those params&amp;gt;);&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1647946" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1646596</link><pubDate>Wed, 03 Sep 2008 08:43:56 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646596</guid><dc:creator>omar</dc:creator><description>&lt;p&gt;Please read this para:&lt;/p&gt;
&lt;p&gt;&amp;quot;Of course you can put in some Cisco firewall and prevent DOS attack. You will get guaranty from your hosting provider that their entire network is immune to DOS and DDOS (Distributed DOS) attacks. What they guaranty is network level attack like TCP SYN attacks or malformed packet floods etc. There is no way they can analyze the packet and find out a particular IP is trying to load the site too many times without supporting cookie or trying to add too many widgets. These are called application level DOS attack which hardware cannot prevent. It must be implemented in your own code.&amp;quot;&lt;/p&gt;
&lt;p&gt;You cannot add logics like someone is trying to add too many widgets on your Firewall/Hardware/Routers.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646596" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1646594</link><pubDate>Wed, 03 Sep 2008 08:33:40 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646594</guid><dc:creator>J</dc:creator><description>&lt;p&gt;Denial of Service Attack Prevention should be done at Hardware/Firewall leve, NOT in your web-application. &lt;/p&gt;
&lt;p&gt;It is too expensive and error-prone to do it in your application. FireWalls/Hardware/Routers are adept at doing such a thing.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646594" width="1" height="1"&gt;</description></item><item><title>WHAT AM I MISSING?</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1646228</link><pubDate>Fri, 29 Aug 2008 21:52:53 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1646228</guid><dc:creator>Joe</dc:creator><description>&lt;p&gt;&amp;gt;&amp;gt;It&amp;#39;s a custom boolean property that I added to Profile.&lt;/p&gt;
&lt;p&gt;1. What is a &amp;quot;Profile?&amp;quot; What is a &amp;quot;HitInfo?&amp;quot; What is a &amp;quot;Profile.IsFirstVisit?&amp;quot; Are these things just pulled out of thin air? These things are unknown in MSDN.&lt;/p&gt;
&lt;p&gt;2. Also, why is a &amp;quot;var&amp;quot; being used in C#?&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;var hit =(HitInfo)(context.Cache[key] ?? &lt;/p&gt;
&lt;p&gt;new HitInfo());&lt;/p&gt;
&lt;p&gt;3. What class does OnInit derive from?&lt;/p&gt;
&lt;p&gt;Am I the only one that cannot compile this example at all?&lt;/p&gt;
&lt;p&gt;Do you have a downloadable file Omar? What references did you set up?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1646228" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1644284</link><pubDate>Mon, 11 Aug 2008 18:25:21 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1644284</guid><dc:creator>Tarek</dc:creator><description>&lt;p&gt;Can someone give me more info. on the following:&lt;/p&gt;
&lt;p&gt;Profile.Isfirstvist?? &lt;/p&gt;
&lt;p&gt;Do we have to create this property.. It is not a profile property..&lt;/p&gt;
&lt;p&gt;Where we getting the hitinfo() class from? I cant seem to find its source..&lt;/p&gt;
&lt;p&gt;Any help is greatly appreciated..&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1644284" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1637873</link><pubDate>Thu, 26 Jun 2008 11:23:44 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637873</guid><dc:creator>omar</dc:creator><description>&lt;p&gt;Waleed,&lt;/p&gt;
&lt;p&gt;ASP.NET does not handle requests to static files like JS, CSS, html etc unless you have Wildcard mapping turned on. So, this code only protects calls going to ASP.NET&lt;/p&gt;
&lt;p&gt;Peter Tran,&lt;/p&gt;
&lt;p&gt;You can take out the Crawler check. My intention was to prevent crawler. But that prevents valid crawlers as well. You can also check if the Crawler name is &amp;quot;Unknown&amp;quot;.&lt;/p&gt;
&lt;p&gt;mlb,&lt;/p&gt;
&lt;p&gt;Proxies that hide user's IP and uses the public IP of the proxy will be treated as one IP. So, you just adjust the threshold values in such a way that it allows such proxies, but also prevents request floods.&lt;/p&gt;
&lt;p&gt;Google Me,&lt;/p&gt;
&lt;p&gt;This prevents Application level DDOS to some extent. It saves your application from burning out CPU/DISK. As the check is minimal code, it takes much less CPU then actually executing a page or some functionality.&lt;/p&gt;
&lt;p&gt;Network level DOS attacks are protected by Firewalls.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637873" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1637687</link><pubDate>Wed, 25 Jun 2008 21:02:54 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637687</guid><dc:creator>Google Me</dc:creator><description>&lt;p&gt;This isn&amp;#39;t DDOS prevention.&lt;/p&gt;
&lt;p&gt;Your web server still has to accept the connection and work with it, thereby being busy.&lt;/p&gt;
&lt;p&gt;So an attacker can still lock up your web server.&lt;/p&gt;
&lt;p&gt;For a better DDOS prevention you have to work at the firewall level - but it&amp;#39;s still not perfect.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637687" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1637665</link><pubDate>Wed, 25 Jun 2008 19:48:26 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637665</guid><dc:creator>mlb</dc:creator><description>&lt;p&gt;Hello Omar, question:&lt;/p&gt;
&lt;p&gt;What about if it&amp;#39;s a company using only one IP address(external) behind a router doing NAT? Employees try to access the webapp and will they be denied to access it?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637665" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1614468</link><pubDate>Mon, 05 May 2008 22:22:02 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1614468</guid><dc:creator>Peter Tran</dc:creator><description>&lt;p&gt;Great article. &amp;nbsp;However, I am trying to understand why your code does not allow search engines in? &amp;nbsp;Your code returns false for &amp;#39;not valid&amp;#39; when checking for context.Request.Browser.Crawler. &amp;nbsp;Doesn&amp;#39;t that prevent search engines from indexing your page? &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1614468" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1593400</link><pubDate>Fri, 18 Apr 2008 05:14:33 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1593400</guid><dc:creator>Waleed Eissa</dc:creator><description>&lt;p&gt;Hi Omar,&lt;/p&gt;
&lt;p&gt;Thanks for your article, I wonder though whether there&amp;#39;s any built-in features in IIS that could help stop DOS attacks. Your code is very good but the problem is that you have to make ASP.NET handle all files as the attack could be done by trying to download any type of files, images, js files .. etc&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1593400" width="1" height="1"&gt;</description></item><item><title>通过程序使你的网站预防DOS攻击的能力  --提高站点的安全性</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1386821</link><pubDate>Sat, 08 Dec 2007 14:17:03 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1386821</guid><dc:creator>jecray</dc:creator><description>&lt;p&gt;如果不对客户端采取访问控制策略，一个网站很容易被DOS攻击。因此有必要采取措施。本文简单的介绍了如何通过程序预防dos攻击。&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1386821" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1230217</link><pubDate>Fri, 05 Oct 2007 01:24:48 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1230217</guid><dc:creator>Abishek Bellamkonda</dc:creator><description>&lt;p&gt;IP addresses can be faked. As a matter of fact MAC addresses can b faked too. I don't know any solution that can really prevent DOS. Also organised DOS attack spread across a continent would be worst.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1230217" width="1" height="1"&gt;</description></item><item><title>re: Prevent Denial of Service (DOS) attacks in your web application</title><link>http://msmvps.com/blogs/omar/archive/2007/03/24/prevent-denial-of-service-dos-attacks-in-your-web-application.aspx#1230213</link><pubDate>Fri, 05 Oct 2007 00:59:56 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1230213</guid><dc:creator>Abishek Bellamkonda</dc:creator><description>&lt;p&gt;Mate, you write very interesting stuff. You do realise that if someone wants to do a DOS badly, you cannot stop it right?&lt;/p&gt;
&lt;p&gt;Apart from shutting the machine.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1230213" width="1" height="1"&gt;</description></item></channel></rss>