<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0">
    <title>ModSecurity Blog</title>
    
    <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/" />
    <id>tag:typepad.com,2003:weblog-1607292</id>
    <updated>2009-05-01T08:46:38-07:00</updated>
    
    <generator uri="http://www.typepad.com/">TypePad</generator>
    <link rel="self" href="http://feeds.feedburner.com/ModSecurityBlog" type="application/atom+xml" /><entry>
        <title>ModSecurity Training at Blackhat USA 2009</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2009/05/modsecurity-training-at-blackhat-usa-2009.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2009/05/modsecurity-training-at-blackhat-usa-2009.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-66246491</id>
        <published>2009-05-01T08:46:38-07:00</published>
        <updated>2009-05-01T08:46:38-07:00</updated>
        <summary>Just a quick note to let everyone know that a 2-day ModSecurity training class was added to the upcoming Blackhat USA 2009 conference in Las Vegase - http://www.blackhat.com/html/bh-usa-09/train-bh-usa-09-categories-appsec.html. This class will be focused on the ModSecurity Rules Language and using...</summary>
        <author>
            <name>Ryan Barnett</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Just a quick note to let everyone know that a 2-day ModSecurity training class was added to the upcoming Blackhat USA 2009 conference in Las Vegase - <a href="http://www.blackhat.com/html/bh-usa-09/train-bh-usa-09-categories-appsec.html">http://www.blackhat.com/html/bh-usa-09/train-bh-usa-09-categories-appsec.html</a>.  This class will be focused on the ModSecurity Rules Language and using it for virtual patching purposes.  We will have a hands-on lab on day 2 that covers the OWASP Securing WebGoat with ModSecurity project data.  This will expand upon the Blackhat Federal presentation that I gave earlier this year - <a href="http://www.blackhat.com/html/bh-dc-09/bh-dc-09-speakers.html#Barnett">http://www.blackhat.com/html/bh-dc-09/bh-dc-09-speakers.html#Barnett</a>.  So, if you want to get your hands dirty using the latest and greatest features of ModSecurity, including Content Injection and Lua, then this class is for you!</p></div>
</content>


    </entry>
    <entry>
        <title>ModSecurity Vulnerabilities Fixed</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2009/03/modsecurity-vulnerabilities-fixed.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2009/03/modsecurity-vulnerabilities-fixed.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-63968525</id>
        <published>2009-03-12T00:29:30-07:00</published>
        <updated>2009-03-12T00:29:30-07:00</updated>
        <summary>ModSecurity versions 2.5.8 and 2.5.9 have been released to fix two vulnerabilities which could be used to cause a denial of service (DoS). The first vulnerability is fixed in version 2.5.8 and the second (as it was disclosed after version...</summary>
        <author>
            <name>Brian Rectanus</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="ModSecurity" />
        
        
<content type="xhtml" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>ModSecurity versions 2.5.8 and 2.5.9 have been released to fix two vulnerabilities which could be used to cause a denial of service (DoS).  The first vulnerability is fixed in version 2.5.8 and the second (as it was disclosed after version 2.5.8 was already frozen) is fixed in version 2.5.9.  Because of this, the 2.5.8 release should be disregarded in favor of 2.5.9.  Both vulnerabilities, however, have workarounds until ModSecurity can be upgraded/patched.</p><h3>Vulnerability in the PDF XSS engine</h3><p>The ModSecurity PDF XSS protection engine prior to version 2.5.8 would allow a NULL pointer to be dereferenced when a non-GET request was used to generate a PDF.  This would cause Apache to crash and allow for a denial of service (Low Risk).</p><p>As a workaround, you should disable PDF XSS protection (the default), such as in the following example, until an update to ModSecurity is in place.</p><pre wrap=""><code class="literal">SecPdfProtect Off</code></pre><h3>Vulnerability in the multipart request parser</h3><p>The ModSecurity multipart request parser prior to version 2.5.9 would allow a NULL pointer to be dereferenced under some circumstances when a zero length part header name is used.  This would cause Apache to crash and allow for a denial of service (Med-High Risk).</p><p>As a workaround, you should disable multipart/form-data parsing and add a rule to detect exploitation, as in the following example, until an update to ModSecurity is in place.</p><pre class="log" id="log" wrap="">###<br /># BEGIN TEMPORARY WORKAROUND<br />#<br /># Force URLENCODED processing so that the vulnerability is bypassed<br /># and the REQUEST_BODY target variable is populated, but at the <br /># expense of no longer being able to parse multipart form arguments.<br />SecRule REQUEST_HEADERS:Content-Type "multipart/form-data" \<br /> "phase:1,t:none,t:lowercase,nolog,pass,ctl:requestBodyProcessor=URLENCODED"<br />#<br /># Deny any multipart requests with a zero length header name<br />SecRule REQUEST_HEADERS:Content-Type "multipart/form-data" \<br /> "chain,phase:2,t:none,t:lowercase,deny,msg:'ModSecurity DoS attempt - NULL part header name'"<br />SecRule REQUEST_BODY "(?m:^--.*\\x0d\\x0a?:.*\\x0d\\x0a?--)" "t:none"<br />#<br /># END TEMPORARY WORKAROUND<br />###<br /></pre><p>More details can be found in the CHANGES file within the released source packages.  Special thanks to those at Red Hat and Internet Security Auditors for disclosing the vulnerabilities.</p><p>Both of these are excellent examples of how ModSecurity can be used to provide a <a href="http://blog.modsecurity.org/2007/08/virtual-patchin.html" target="_blank" title="Virtual Patching">virtual patch</a> before an upgrade and/or proper patch can be applied -- even a vulnerability within ModSecurity itself.</p><p /></div>
</content>


    </entry>
    <entry>
        <title>Why Did Our Web Application Crash? Leveraging WAF Logging Data</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2009/01/building-qa-test-cases-from-waf-data.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2009/01/building-qa-test-cases-from-waf-data.html" thr:count="2" thr:updated="2009-02-09T06:06:30-08:00" />
        <id>tag:typepad.com,2003:post-61016918</id>
        <published>2009-01-15T09:26:21-08:00</published>
        <updated>2009-01-15T09:26:21-08:00</updated>
        <summary>More Than A Blocking Device Unfortunately, most people have pigeon-holed WAFs as only "Attack Blocking Devices" and that is but one use-case option. This Blog post will highlight another interesting use-case/benefit of a web application firewall - capturing full HTTP...</summary>
        <author>
            <name>Ryan Barnett</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Web Application Firewalls" />
        
        
<content type="html" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;&lt;strong&gt;More Than&amp;#0160;A Blocking Device&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, most people have pigeon-holed WAFs as only &amp;quot;Attack Blocking Devices&amp;quot; and that is but one use-case option.&amp;#0160;&amp;#0160;This&amp;#0160;Blog post will&amp;#0160;highlight another interesting use-case/benefit of a web application firewall - capturing full HTTP transactional logging when web applications generate error conditions.&amp;#0160; Due to the fact that a WAF is constantly monitoring live communications between clients and web applications, it is able to identify if or when a web application generates&amp;#0160;errors.&amp;#0160; This may of course be caused by an actual attack in the reqest payload, however I can speak from personal experience in working with both Breach customers and the ModSecurity users in stating that many times applications bomb out due to either a back-end communication problem or from abnormal, non-malicious&amp;#0160;client input.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why Are These Errors Occuring?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A typical scenario is that a normal client is interacting with web application and they receive a 500 level responst status code from the web application and they have no idea why.&amp;#0160; If this were to happen to a large number of clients and/or if these were reported to the site owners, the next step would be for administrators to try and trouble-shoot and figure out what happened to cause the failure.&amp;#0160; The sad reality is that&amp;#0160;web application exception handling and logging mechanisms are sorely&amp;#0160;lacking.&amp;#0160; How is an administrator supposed to conduct analysis to identify what happened when all&amp;#0160;they have are terse or cryptic error message such as the following Apache error_log&amp;#0160;entry -&amp;#0160;&lt;/p&gt;
&lt;p class="MsoPlainText" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="3"&gt;&lt;span style="FONT-SIZE: 11px; FONT-FAMILY: Arial"&gt;&lt;font face="Courier"&gt;[Sat&amp;#0160;Jan 11 08:52:42 2009] [notice] child pid 24906 exit signal Segmentation fault (11)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Review of the access_log data shows the following -&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier"&gt;&lt;span style="FONT-SIZE: 11px; FONT-FAMILY: Courier"&gt;202.99.11.91&amp;#0160;- [11/Jan/2009:08:52:42 +0200] &amp;quot;POST /service/soap/GetItemRequest HTTP/1.1&amp;quot; 500 21364 &amp;quot;-&amp;quot; &amp;quot;Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.13) Gecko/20080325 Fedora/2.0.0.13-1.fc8 Firefox/2.0.0.13&amp;quot;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;This request seems to match up with the time stamp of the error_log entry, however unfortunately, the request uses the POST request method which means that there was data passed in the request body that is not logged by the Common Log Format (CLF).&amp;#0160; Good luck figuring out what caused the problem with this data...&amp;#0160; &lt;/p&gt;
&lt;p&gt;Detailed server-side error and&amp;#0160;debug logging mechanisms&amp;#0160;are commonly disabled due to performance/disk space&amp;#0160;reasons, in favor of allowing the web application to include detailed stack dump data within the error pages presented to clients.&amp;#0160; This is not an ideal situation&amp;#0160;as non-malicious clients probably won&amp;#39;t know what to do with&amp;#0160;these technical details, while malicious clients&amp;#0160;may leverage the data to fine tune an attack.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Capturing Critical Transaction Data&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The audit logging capabilties of web application firewalls allow them to&amp;#0160;address the two deficiencies outlined above: 1) Capturing the full request data, and 2) Capturing the full application response.&amp;#0160;&amp;#0160;By inspecting the full transactional data, it can be&amp;#0160;determined if the inbound request was malicious or not and&amp;#0160;any detailed application error message can be&amp;#0160;reviewed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Shortening Trouble-shooting Time&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In my&amp;#0160;previous life, I was the head of operational security for a government client&amp;#39;s web applications.&amp;#0160;&amp;#0160;The approach that&amp;#0160;I found successful when introducing a web application firewall&amp;#0160;to operational&amp;#0160;personnel was&amp;#0160;to demonstrate to them how the&amp;#0160;auditing capabilities could help them to expedite their trouble-shooting steps.&amp;#0160; Believe me, when your job requirements are tied to system uptime, this can be a life saver.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Helping QA/Security Testing&lt;/strong&gt;&amp;#0160; &lt;/p&gt;
&lt;p&gt;If the cause of the application error was traced to some abnormality in the client&amp;#39;s request, then it is a good idea to utilize that same request data as a part of future QA unit tests to ensure that the updated software correctly handles it.&amp;#0160; &lt;/p&gt;
&lt;p&gt;The&amp;#0160;web application firewall audit logs that capture &amp;quot;real&amp;quot; attacks lauched at your site are also very useful for security testing future software.&amp;#0160;&amp;#0160;If you have ever been responsible for QA/Security testing of web applications, then you are familiar with the with the challenges of developing a comprehensive set of attack or abuse test cases.&amp;#0160; These audit logs can help your organization create a repository of attack data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Data Sharing Is The Key&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;They key take away from this post is that web application firewalls gather a wealth of information that could be utilized by other business units.&amp;#0160; Therefore, it is critical that processes are setup to share this information.&lt;/p&gt;&lt;/div&gt;
</content>


    </entry>
    <entry>
        <title>Fixing Both Missing HTTPOnly and Secure Cookie Flags</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2008/12/fixing-both-missing-httponly-and-secure-cookie-flags.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2008/12/fixing-both-missing-httponly-and-secure-cookie-flags.html" thr:count="1" thr:updated="2008-12-29T05:00:06-08:00" />
        <id>tag:typepad.com,2003:post-60287586</id>
        <published>2008-12-22T06:07:13-08:00</published>
        <updated>2008-12-22T06:07:13-08:00</updated>
        <summary>In a previous post I showed how you can use both ModSecurity and Apache together to identify/modify SessionIDs that are missing the HTTPOnly flag. I received some feedback where people were asking how to accomplish the same thing but for...</summary>
        <author>
            <name>Ryan Barnett</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="ModSecurity Rules" />
        
        
<content type="html" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;In &lt;a href="http://blog.modsecurity.org/2008/12/helping-protect-cookies-with-httponly-flag.html"&gt;a previous post&lt;/a&gt; I showed how you can use both ModSecurity and Apache together to&amp;#0160;identify/modify SessionIDs that are missing the HTTPOnly flag.&amp;#0160; I received some feedback where people were asking how to accomplish the same thing but for the &amp;quot;Secure&amp;quot; cookie flag which instructs the browser to *only* send the SessionID back over an SSL connection.&amp;#0160; &lt;/p&gt;
&lt;p&gt;If you are only interested in addressing the missing &amp;quot;Secure&amp;quot; cookie flag, then you can simply take the example from the previous post and edit it slightly to swap out &amp;quot;httponly&amp;quot; with &amp;quot;secure&amp;quot;.&amp;#0160; If, however, you want to try and address both of these issues together, then you will need to change the rule set approach a bit so that it works correctly.&amp;#0160; This is because there are now three different scenarios you have to account for -&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Missing HTTPOnly flag 
&lt;li&gt;Missing Secure flag (if the SessionID is being sent over an SSL connection) 
&lt;li&gt;Missing both HTTPOnly and Secure flags &lt;/li&gt;
&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;With this in mind, here is an updated rule set that will handle both missing HTTPOnly and Secure cooking flags.&lt;/p&gt;
&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;#&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# First we want to capture Set-Cookie SessionID data for later inspection&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;SecRule RESPONSE_HEADERS:/Set-Cookie2?/ &amp;quot;(?i:(j?sessionid|(php)?sessid|(asp|jserv|jw)?session[-_]?(id)?|cf(id|token)|sid))&amp;quot; &amp;quot;phase:3,t:none,pass,nolog,setvar:tx.sessionid=%{matched_var}&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;/span&gt;&amp;#0160;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;#&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# We now check the saved SessionID data for the HTTPOnly flag and set an Apache&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# ENV variable if it is missing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;SecRule TX:SESSIONID &amp;quot;!(?i:\;? ?httponly;?)&amp;quot; &amp;quot;phase:3,t:none,setenv:httponly_cookie=%{matched_var},pass,log,auditlog,msg:&amp;#39;AppDefect: Missing HttpOnly Cookie Flag.&amp;#39;&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;/span&gt;&amp;#0160;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;#&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# Next we check the saved SessionID data for the Secure flag (if this is an SSL session)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# and set an Apache ENV variable if it is missing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;SecRule SERVER_PORT &amp;quot;@streq 443&amp;quot; &amp;quot;chain,phase:3,t:none,pass,log,auditlog,msg:&amp;#39;AppDefect: Missing Secure Cookie Flag.&amp;#39;&amp;quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#0160;&lt;/span&gt;SecRule TX:SESSIONID &amp;quot;!(?i:\;? ?secure;?)&amp;quot; &amp;quot;t:none,setenv:secure_cookie=%{matched_var}&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;/span&gt;&amp;#0160;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;#&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# The final check is to see if BOTH of the HTTPOnly and Secure cookie flags are missing &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# and set an Apache ENV variable if they are missing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;SecRule TX:SESSIONID &amp;quot;!(?i:\;? ?httponly;?)&amp;quot; &amp;quot;chain,phase:3,t:none,pass,log,auditlog,msg:&amp;#39;AppDefect: Missing HttpOnly and Secure Cookie Flag.&amp;#39;&amp;quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#0160;&lt;/span&gt;SecRule SERVER_PORT &amp;quot;@streq 443&amp;quot; &amp;quot;chain,t:none&amp;quot;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#0160; &lt;/span&gt;SecRule TX:SESSIONID &amp;quot;!(?i:\;? ?secure;?)&amp;quot; &amp;quot;t:none,setenv:secure_httponly_cookie=%{matched_var}&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;/span&gt;&amp;#0160;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;#&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# This last section executes the Apache Header command to&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;# add the appropriate Cookie flags&amp;#0160;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;Header set Set-Cookie &amp;quot;%{httponly_cookie}e; HTTPOnly&amp;quot; env=httponly_cookie&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;Header set Set-Cookie &amp;quot;%{secure_cookie}e; Secure&amp;quot; env=secure_cookie&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;Header set Set-Cookie &amp;quot;%{secure_httponly_cookie}e; Secure; HTTPOnly&amp;quot; env=secure_httponly_cookie&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p class="MsoNormal" dir="ltr" style="MARGIN: 0in 0in 0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;"&gt;&lt;font face="Arial"&gt;These rules will both alert and fix these cookie issues.&amp;#0160; You may want to switch the actions to &amp;quot;nolog&amp;quot; so that you are not flooded with alerts.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;
</content>


    </entry>
    <entry>
        <title>Helping Protect Cookies with HTTPOnly Flag</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2008/12/helping-protect-cookies-with-httponly-flag.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2008/12/helping-protect-cookies-with-httponly-flag.html" thr:count="3" thr:updated="2009-03-28T17:00:44-07:00" />
        <id>tag:typepad.com,2003:post-60229268</id>
        <published>2008-12-19T13:15:45-08:00</published>
        <updated>2008-12-19T13:15:45-08:00</updated>
        <summary>If you are unfamiliar with what the HTTPOnly cookie flag is or why your web apps should use it, please refer to the following resources - Mitigating Cross-site Scripting With HTTP-only Cookies - http://msdn.microsoft.com/en-us/library/ms533046.aspx OWASP HTTPOnly Overview - http://www.owasp.org/index.php/HTTPOnly The...</summary>
        <author>
            <name>Ryan Barnett</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Web Security" />
        
        
<content type="xhtml" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>If you are unfamiliar with what the HTTPOnly cookie flag is or why your web apps should use it, please refer to the following resources -</p>
<ul>
<li>Mitigating Cross-site Scripting With HTTP-only Cookies - <a href="http://msdn.microsoft.com/en-us/library/ms533046.aspx">http://msdn.microsoft.com/en-us/library/ms533046.aspx</a> 
<li>OWASP HTTPOnly Overview - <a href="http://www.owasp.org/index.php/HTTPOnly">http://www.owasp.org/index.php/HTTPOnly</a> </li>
</li></ul>
<p>The bottom line is this - while this cookie option flag does absolutely nothing to prevent XSS attacks, it does significanly help to prevent the #1 XSS attack goal which is stealing SessionIDs.  While HTTPOnly is not a "silver bullet" by any means, the potential ROI of implement it is quite large.  Notice I said "potential" as in order to provide the intended protections, two key players have to work together -</p>
<ul>
<li>Web Applications - whose job it is to append the "HTTPOnly" flag onto all Set-Cookie response headers for SessionIDs, and 
<li>Web Browsers - whose job it is to identify and enforce the security restrictions on the cookie data so that javascript can not access the contents. </li>
</li></ul>
<p>The current challenges to realizing the security benefit of the HTTPOnly flag is that universal adoption in both web apps and browsers is still not there yet.  For example, depending on your web app platform, you may not have an easy mechanism to implementing this feature.  For example - in Java you could following the example provided here on the OWASP site - <a href="http://www.owasp.org/index.php/HTTPOnly#Using_Java_to_Set_HTTPOnly">http://www.owasp.org/index.php/HTTPOnly#Using_Java_to_Set_HTTPOnly</a>, however this doesn't work well for the JSESSIONID as it is added by the framework.  Jim Manico has been fighting the good fight to try and get Apache Tomcat developers to implement his patch to add in HTTPOnly support - <a href="http://manicode.blogspot.com/2008/08/httponly-in-tomcat-almost.html">http://manicode.blogspot.com/2008/08/httponly-in-tomcat-almost.html</a>.  The point is that with so many different web app development platforms, it isn't going to be easy to find support for this within every web app that you have to secure...</p>
<p>As for browsers - they too have sporadic, non-consistent adoption of HTTPOnly.  It was for this reason that the OWASP Intrinsic Security group has started an RFC Spec for HTTPOnly - <a href="http://groups.google.com/group/ietf-httponly-wg">http://groups.google.com/group/ietf-httponly-wg</a>.  Hopefully this group will get some traction with the various browser developers.</p>
<p>So, at this point you might be asking yourself - Ryan, that is interesting news and all, but why is this being posted on the ModSecurity site?  What can a web application firewall do to help with this issue?  I would then in turn reply - Great question, I am glad that you asked. ;)</p>
<p>One of my pet peevs with the web application security space is the stigma that is associated with a WAF.  Most everyone only focuses in on the negative security and blocking of attacks aspects of the typical WAF deployment and they fail to realize that WAFs are a highly specialized tool for HTTP.  Depending on your circumstances, you may not ever intend to do blocking.  There are many other use-cases for WAFs and how they can help, in this case as a tactical response tool to help address an underlying vulnerability  In this case, we could monitor when back-end/protected web applications are handing out SessionIDs that are missing the HTTPOnly flag.  This could raise an alert that would notify the proper personnel that they should see if editing the web language code is possible to add this feature in.  A rule to do this with ModSecurity would look like this -</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p><font face="Courier"># Identifies SessiondIDs without HTTPOnly flag<br />#<br />SecRule RESPONSE_HEADERS:/Set-Cookie2?/ "!(?i:\;? ?httponly;?)" "chain,phase:3,t:none,pass,log,auditlog,msg:'AppDefect: Missing HttpOnly Cookie Flag.'"<br />  SecRule MATCHED_VAR "(?i:(j?sessionid|(php)?sessid|(asp|jserv|jw)?session[-_]?(id)?|cf(id|token)|sid))" "t:none"</font></p></blockquote>
<p>While this rule is pretty useful for identifying and alerting of the issue, many organizations would like to take the next step and try and fix the issue.  If the web application does not have a way to add in the HTTPOnly cookie flag option internally, you can actually leverage ModSecurity+Apache for this purpose.  ModSecurity has the ability to set environmental data that Apache reads/acts upon.  In this case, we can modify our previous rule slightly to use the "setenv" action and then we add an additional Apache "header" directive that will actually overwrite the data with new Set-Cookie data that includes the HTTPOnly flag -</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p><font face="Courier"># Identifies SessiondIDs without HTTPOnly flag and sets the "http_cookie" ENV<br /># Token for Apache to read<br />SecRule RESPONSE_HEADERS:/Set-Cookie2?/ "!(?i:\;? ?httponly;?)" "chain,phase:3,t:none,pass,<strong>nolog</strong>"<br />  SecRule MATCHED_VAR "(?i:(j?sessionid|(php)?sessid|(asp|jserv|jw)?session[-_]?(id)?|cf(id|token)|sid))" "t:none,<strong>setenv:http_cookie=%{matched_var}"</strong></font></p>
<p><font face="Courier"><strong># Now we use the Apache Header directive to set the new data<br /></strong></font><br /><font face="Courier"><strong>Header set Set-Cookie "%{http_cookie}e; HTTPOnly" env=http_cookie</strong></font></p></blockquote>
<p>The end result of this ruleset is that ModSecurity+Apache can transparently add on the HTTPOnly cookie flag on the fly to any Set-Cookie data that you define.  Thanks goes to Brian Rectanus from Breach for working with me to get the Header directive syntax correct.</p>
<p><em><strong>One note of warning</strong> - make sure that you understand how the web application is handling setting SessionIDs meaning if they are created server-side vs. client-side (in javascript).  This rule set will work fine if the SessionIDs are generated server-side.  If they are created client-side, however, this will disrupt session management.</em></p>
<p>Hopefully the data presented here will help people who would like to have the security benefit of this flag however are running into challenges with implementing it within the app.<br /></p></div>
</content>


    </entry>
    <entry>
        <title>Leaving ModSecurity</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2008/12/stepping-down-as-modsecurity-project-leader.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2008/12/stepping-down-as-modsecurity-project-leader.html" thr:count="3" thr:updated="2008-12-15T16:11:05-08:00" />
        <id>tag:typepad.com,2003:post-60028716</id>
        <published>2008-12-15T04:21:43-08:00</published>
        <updated>2008-12-15T04:21:43-08:00</updated>
        <summary>Deciding to leave a job is rarely easy, but leaving your job and the project you've nurtured for six years is very difficult. In a few weeks' time I will no longer be working for Breach Security and, as a...</summary>
        <author>
            <name>Ivan Ristic</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="ModSecurity" />
        
        
<content type="xhtml" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Deciding to leave a job is rarely easy, but leaving your job and the
project you've nurtured for six years is very difficult. In a few
weeks' time I will no longer be working for Breach Security and, as a
consequence, I will be joining the ModSecurity community as a user. I leave ModSecurity in the capable hands of Brian Rectanus, who has been taking care of it for some time now.</p><p>
It's been an exciting journey, starting ModSecurity and growing it for
all these years. It's been a pleasure working with the community and
helping others solve their problems. It's been hard at times, but that
made it all the more interesting.</p><p>Finally, I would like to take this opportunity to thank every single ModSecurity user, because we, all together, made ModSecurity what it is. I couldn't have done it without you.</p></div>
</content>


    </entry>
    <entry>
        <title>ModSecurity's Source Code Repository Is Now Open</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2008/10/modsecuritys-source-code-repository-is-now-open.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2008/10/modsecuritys-source-code-repository-is-now-open.html" thr:count="3" thr:updated="2008-11-26T12:00:38-08:00" />
        <id>tag:typepad.com,2003:post-57737107</id>
        <published>2008-10-29T10:50:31-07:00</published>
        <updated>2008-10-29T10:50:31-07:00</updated>
        <summary>I spent the last week importing ModSecurity's source code repository into subversion at Source Forge. I am proud to announce that a read-only version of ModSecurity's subversion repository is now publicly available. In addition to this, Atlassian has graciously given...</summary>
        <author>
            <name>Brian Rectanus</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="ModSecurity" />
        
        
<content type="xhtml" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>I spent the last week importing ModSecurity's source code repository into subversion at Source Forge. I am proud to announce that a read-only version of ModSecurity's subversion repository is now <a href="http://sourceforge.net/svn/?group_id=68846" target="_blank" title="ModSecurity Public SVN Repository Access">publicly available</a>. In addition to this, Atlassian has graciously given the ModSecurity project a license to use their software. We are currently using Jira to <a href="https://www.modsecurity.org/tracker/" target="_blank" title="ModSecurity Issue Tracker">track reported issues</a>, FishEye to <a href="https://www.modsecurity.org/fisheye/browse/modsecurity" target="_blank" title="ModSecurity Public SVN View">track and analyze the code repository</a> and have plans to add Confluence (a wiki) in the near future. Together, these tools allow users to test and apply fixes immediately as well as monitor the progress of reported issues and the progress of ModSecurity as a whole.</p><p>This is a big step forward for the ModSecurity project. The project is becoming much more open and feels more like an Open Source project should. Please take some time to look at the new tools. Comments are always welcome.</p></div>
</content>


    </entry>
    <entry>
        <title>Securing WebGoat using ModSecurity</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2008/10/securing-webgoat-using-modsecurity.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2008/10/securing-webgoat-using-modsecurity.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-57723985</id>
        <published>2008-10-29T07:05:39-07:00</published>
        <updated>2008-10-29T07:05:39-07:00</updated>
        <summary>This year, the OWASP's Summer of Code event contains one project that's of particular interest to me (and possibly to you, consider that you're following this blog): Securing WebGoat Using ModSecurity. If you've even seen WebGoat (a learning sandbox that...</summary>
        <author>
            <name>Ivan Ristic</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="ModSecurity" />
        
        
<content type="xhtml" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>This year, the <a href="http://www.owasp.org/index.php/OWASP_Summer_of_Code_2008">OWASP's Summer of Code</a> event contains one project that's of particular interest to me (and possibly to you, consider that you're following this blog): <a href="http://www.owasp.org/index.php/Category:OWASP_Securing_WebGoat_using_ModSecurity_Project">Securing WebGoat Using ModSecurity</a>. If you've even seen <a href="http://www.owasp.org/index.php/Category:OWASP_WebGoat_Project">WebGoat</a> (a learning sandbox that contains samples of many application security issues) then you know how difficult it might be to secure. It's true; it's probably the worst-case scenario for ModSecurity, because it's not your typical application, and it contains a number of problems that require the understanding of application state to exploit (and thus protect too). So we should all congratulate Stephen Evans for pulling through and reaching the end of the project.</p><p>I find the project interesting because it stretches the boundaries of what ModSecurity can do. For example, one of the features Stephen relied heavily on is the Lua scripting language, which is currently marked as experimental. As we are currently working on the design for ModSecurity 3, Stephen's feedback is going to be very useful to us.</p><p>If this sort of thing is indeed of interest to you then you need to know that <a href="http://www.owasp.org/index.php/OWASP_EU_Summit_2008_Training#Securing_WebGoat_with_ModSecurity">Stephen will be sharing his experiences</a> during the <a href="http://www.owasp.org/index.php/OWASP_EU_Summit_2008">OWASP Summit in Portugal</a> next week. If you'll be attending the summit (or even if you can schedule a trip on short notice) do consider attending.</p></div>
</content>


    </entry>
    <entry>
        <title>ModSecurity at ApacheCon US 2008</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2008/10/modsecurity-at.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2008/10/modsecurity-at.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-56806403</id>
        <published>2008-10-10T05:01:18-07:00</published>
        <updated>2008-10-10T05:01:18-07:00</updated>
        <summary>In a few weeks' time I will present my favourite talk, Web Intrusion Detection with ModSecurity, at the ApacheCon US 2008 in New Orleans: Intrusion detection is a well-known network security technique--it introduces monitoring and correlation devices to networks, enabling...</summary>
        <author>
            <name>Ivan Ristic</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="ModSecurity" />
        
        
<content type="html" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;In a few weeks' time I will present my favourite talk, Web Intrusion Detection with ModSecurity, at the &lt;a href="http://us.apachecon.com/c/acus2008"&gt;ApacheCon US 2008&lt;/a&gt; in New Orleans:

&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;
Intrusion detection is a well-known network security technique--it
introduces monitoring and correlation devices to networks, enabling
administrators to monitor events and detect attacks and anomalies in
real-time. Web intrusion detection does the same but it works on the
HTTP level, making it suitable to deal with security issues in web
applications. This session will start with an overview of web intrusion
detection and web application firewalls, discussing where they belong
in the overall protection strategy. The second part of the talk will
discuss ModSecurity and its capabilities. ModSecurity is an open source
web application firewall that can be deployed either embedded (in the
Apache HTTP server) or as a network gateway (as part of a reverse proxy
deployment). Now in it's sixth year of development, ModSecurity is
mature, robust and flexible. Due to its popularity and wide usage it is
now positioned as a de-facto standard in the web intrusion detection
space. &lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;This is the same talk I presented at &lt;a href="http://eu.apachecon.com/eu2008"&gt;ApacheCon Europe 2008&lt;/a&gt; in Amsterdam and the &lt;a href="http://www.owasp.org/index.php/OWASP_NYC_AppSec_2008_Conference"&gt;OWASP AppSec US 2008&lt;/a&gt;
conference in New York, and it's getting better every time I do it. This
is going to be my first ApacheCon in the US and I am really looking
forward to it. It's the place to be if you are involved in any way with
the projects of the Apache Software Foundation.&lt;/p&gt;

&lt;p align=center&gt;&lt;img border="0" alt="Apacheconus2008speaker" title="Apacheconus2008speaker" src="http://breach.typepad.com/photos/uncategorized/2008/10/10/apacheconus2008speaker.jpg" /&gt;
&lt;/p&gt;&lt;/div&gt;
</content>


    </entry>
    <entry>
        <title>ModProfiler Presentation at OWASP AppSec Israel 2008</title>
        <link rel="alternate" type="text/html" href="http://blog.modsecurity.org/2008/09/modprofiler-pre.html" />
        <link rel="replies" type="text/html" href="http://blog.modsecurity.org/2008/09/modprofiler-pre.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-55461210</id>
        <published>2008-09-11T06:05:56-07:00</published>
        <updated>2008-09-11T06:05:56-07:00</updated>
        <summary>I will be giving the updated version of our ModProfiler presentation this Sunday (14th) at the OWASP Israel 2008 conference. ModProfiler has seen a release or two since Black Hat (where it was announced) so I can now speak with...</summary>
        <author>
            <name>Ivan Ristic</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="ModSecurity" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Positive security model" />
        
        
<content type="xhtml" xml:lang="en-GB" xml:base="http://blog.modsecurity.org/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>I will be giving the updated version of our <a href="http://www.modsecurity.org/projects/modprofiler/">ModProfiler</a> presentation this Sunday (14th) at the <a href="http://www.owasp.org/index.php/OWASP_Israel_2008_Conference">OWASP Israel 2008</a> conference. ModProfiler has seen a release or two since Black Hat (where it was announced) so I can now speak with more experience about some of the challenges of automated positive model generation.</p>

<p>Ofer (who is organising the conference, by the way) will be speaking about <a href="http://www.owasp.org/index.php/AppSecEU08_Trends_in_Web_Hacking_Incidents:_What%27s_hot_for_2008">What's Hot in 2008</a>, which is always an interesting and well-attended talk.</p>
<p>The conference schedule looks great, but, judging from the presenters' names alone, I doubt many will be in English. (Not that it matters, as I will have to spend the afternoon working, back at Breach Security's offices in Herzliya.) This conference is the first time that I've seen anyone discussing database firewalls (let alone an open source one) at an application security conference: Yuli Stremovsky will be discussing <a href="http://www.greensql.net/">GreenSQL</a>. We should have that sort of thing more often. In case you're interested, another similar project is <a href="http://www.odsms.org">Open Database Security and Monitoring Solutions</a> (ODSMS).</p></div>
</content>


    </entry>
 
</feed><!-- ph=1 --><!-- nhm:from_kauri -->
