How to block malformed cookies?

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 1
Joined: 28 Jul 2015, 15:56

How to block malformed cookies?

28 Jul 2015, 16:08

Hello,

Can you help me create a rule that will block requests that have malformed cookies?

I would like to block requests with malformed cookies with no key, example:

HTTP_COOKIE:=true;

If possible, I would also be able to block requests with cookies with no keys if there are multiple cookies, example:

HTTP_COOKIE:MyCookie=TC; =true; AnotherCookie=YYl

Can you suggest RewriteCond and RewriteRule expressions?

Many thanks!

JBC

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: How to block malformed cookies?

29 Jul 2015, 05:53

Hello,

>I would like to block requests with malformed cookies with no key

Please try the following rule:

RewriteCond %{HTTP_COOKIE} ^(.+;)?(\s)?=.+
RewriteRule .? - [F]

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 17 guests