<?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/"
	>

<channel>
	<title>My Security Planet &#187; ModSecurity Blog</title>
	<link>http://rgaucher.info/planet/</link>
	<description>My Security Planet &#187; ModSecurity Blog</description>
	<generator>Gregarius 0.5.4</generator>
	<language>en</language>
	<item>
		<title>ModSecurity Blog: WASC WHID Bi-Annual Report for 2010</title>
		<link>http://blog.modsecurity.org/2010/09/wasc-whid-bi-annual-report-for-2010.html</link>
		<pubDate>Thu, 09 Sep 2010 13:22:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/09/wasc-whid-bi-annual-report-for-2010.html</guid>
		<content:encoded><![CDATA[	<p>
  The Web Hacking Incident Database (WHID) is a project dedicated to maintaining a record of web application-related security incidents. WHID’s purpose is to serve as a tool for raising awareness of web application security problems and to provide information for statistical analysis of web application security incidents. Unlike other resources covering web site security – which focus on the technical aspect of the incident – the WHID focuses on the impact of the attack. Breach Security Labs is a WHID project contributor.
</p>
<p>
  <br />
  <br />
</p>Report Summary Findings
<p>
  An analysis of the Web hacking incidents from the first half of 2010 performed by Trustwave’s SpiderLabs Security Research team shows the following trends and findings:
</p>
<ul>
  <li>A steep rise in attacks against the financial vertical market is occurring in 2010, and is currently the no. 3 targeted vertical at 12 percent. This is mainly a result of cybercriminals targeting small to medium businesses’ (SMBs) online banking accounts.
  </li>
  <li>Corresponding to cybercriminals targeting online bank accounts, the use of Banking Trojans (which results in stolen authentication credentials) made the largest jump for attack methods (Banking Trojans + Stolen Credentials).
  </li>
  <li>Application downtime, often due to denial of service attacks, is a rising outcome.
  </li>
  <li>Organizations have not implemented proper Web application logging mechanisms and thus are unable to conduct proper incident response to identify and correct vulnerabilities. This resulted in the no. 1 “unknown” attack category.
  </li>
</ul>
<p>
  <br />
  <br />
</p>
<p>
  WHID Top 10 Risks for 2010
</p>
<p>
  As part of the WHID analysis, here is a current Top 10 listing of the&nbsp;<a href="http://projects.webappsec.org/Threat-Classification">application weaknesses</a>&nbsp;that are actively being exploited (with example attack method mapping in parentheses). Hopefully this data can be used by organizations to re-prioritize their remediation efforts.
</p>
<table>
  <tr>
    <td></td>
    <td>
      <p>
        WHID&nbsp;Top 10 for 2010
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        1
      </p>
    </td>
    <td>
      <p>
        Improper Output Handling (XSS and Planting of Malware)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        2
      </p>
    </td>
    <td>
      <p>
        Insufficient Anti-Automation (Brute Force and&nbsp;DoS)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        3
      </p>
    </td>
    <td>
      <p>
        Improper Input Handling (SQL Injection)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        4
      </p>
    </td>
    <td>
      <p>
        Insufficient Authentication (Stolen Credentials/Banking Trojans)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        5
      </p>
    </td>
    <td>
      <p>
        Application&nbsp;Misconfiguration&nbsp;(Detailed&nbsp;error messages)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        6
      </p>
    </td>
    <td>
      <p>
        Insufficient Process Validation&nbsp;(CSRF and DNS Hijacking)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        7
      </p>
    </td>
    <td>
      <p>
        Insufficient&nbsp;Authorization (Predictable Resource Location/Forceful Browsing)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        8
      </p>
    </td>
    <td>
      <p>
        Abuse of Functionality (CSRF/Click-Fraud)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        9
      </p>
    </td>
    <td>
      <p>
        Insufficient Password Recovery (Brute Force)
      </p>
    </td>
  </tr>
  <tr>
    <td>
      <p>
        10
      </p>
    </td>
    <td>
      <p>
        Improper&nbsp;Filesystem&nbsp;Permissions (info Leakages)
      </p>
    </td>
  </tr>
</table>
<p>
  Download the full report and Join the live Trustwave Webinar Sept. 16th:&nbsp;<a href="https://www.trustwave.com/WHID2010">Web Hacking Incidents Revealed: Trends, Stats and How to Defend</a>&nbsp;(registration required).
</p> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: Advanced Feature of the Week: Real-time Blacklist Lookups</title>
		<link>http://blog.modsecurity.org/2010/09/advanced-feature-of-the-week-real-time-blacklist-lookups.html</link>
		<pubDate>Tue, 07 Sep 2010 10:58:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/09/advanced-feature-of-the-week-real-time-blacklist-lookups.html</guid>
		<content:encoded><![CDATA[	<p>
  This week's feature is the effective use of <a href="http://www.modsecurity.org/documentation/modsecurity-apache/2.5.12/modsecurity2-apache-reference.html#N11DCA">Real-time Blacklist lookups</a> (@rbl).
</p>Reference Manual<code>rbl</code>
<p>
  <em>Description:</em>&nbsp;Look up the parameter in the RBL given as parameter. Parameter can be an IPv4 address, or a hostname.
</p>
<p>
  Example:
</p>
<pre>
SecRule REMOTE_ADDR "<em>@rbl</em> sc.surbl.org"
</pre><em>OWASP ModSecurity CRS</em>
<p>
  <em>The OWASP ModSecurity CRS includes limited use of the @rbl operator within the optional_rules/modsecurity_crs_42_comments_spam.conf file:</em>
</p>
<pre>
<em>#
# Comment spam is an attack against blogs, guestbooks, wikis and other types of
# interactive web sites that accept and display hyperlinks submitted by
# visitors. The spammers automatically post specially crafted random comments
# which include links that point to the spammer's web site. The links
# artificially increas the site's search engine ranking and may make the site
# more noticable in search results.
#

SecRule IP:PREVIOUS_RBL_CHECK "@eq 1" "phase:1,t:none,pass,nolog,skipAfter:END_RBL_LOOKUP"
 SecRule REMOTE_ADDR "@rbl sbl-xbl.spamhaus.org" "phase:1,t:none,pass,nolog,auditlog,msg:'RBL Match for SPAM Source',tag:'AUTOMATION/MALICIOUS',severity:'2',setvar:'tx.msg=%{rule.msg}',setvar:tx.automation_score=+%{tx.warning_anomaly_score},setvar:tx.anomaly_score=+%{tx.warning_anomaly_score},setvar:tx.%{rule.id}-AUTOMATION/MALICIOUS-%{matched_var_name}=%{matched_var},setvar:ip.spammer=1,expirevar:ip.spammer=86400,setvar:ip.previous_rbl_check=1,expirevar:ip.previous_rbl_check=86400,skipAfter:END_RBL_CHECK"

 SecAction "phase:1.t:none,nolog,pass,setvar:ip.previous_rbl_check=1,expirevar:ip.previous_rbl_check=86400"
SecMarker END_RBL_LOOKUP

SecRule IP:SPAMMER "@eq 1" "phase:1,t:none,pass,nolog,auditlog,msg:'Request from Known SPAM Source (Previous RBL Match)',tag:'AUTOMATION/MALICIOUS',severity:'2',setvar:'tx.msg=%{rule.msg}',setvar:tx.automation_score=+%{tx.warning_anomaly_score},setvar:tx.anomaly_score=+%{tx.warning_anomaly_score},setvar:tx.%{rule.id}-AUTOMATION/MALICIOUS-%{matched_var_name}=%{matched_var}"

SecMarker END_RBL_CHECK
</em>
</pre>
<p>
  <em>The goal of this ruleset is to run an @rbl check once for each IP address and then save the response in a TX variable for 1 day. &nbsp;This is used to limit the number of @rbl lookups that the web server needs to do as there is a latency hit for executing the DNS queries.</em>
</p><br />
<br />
So What?
<p>
  <em>Why use Real-time Blacklist Lookups anyways? &nbsp; What we are talking about here is <em>IP Reputation</em>. &nbsp;Has this client been identified as bad by other web sites? &nbsp;It is sort of like the <a href="http://www.tsa.gov/approach/secure_flight.shtm">"No Fly" lists</a> that the Department of Homeland Security makes available to airlines. &nbsp;It is a method of sharing information about clients so that you can decided if you want to allow this client access to your site at all or perhaps treat them differently (such as with increased logging). &nbsp;Real-time block lists (RBL) are community-based, central repositories for IP Reputation. RBLs are most commonly used to identify web-based comment spam. If you run a blog or user-forum site, wouldn't you like to know if the current client has already been identified as a spammer?</em>
</p>
<p>
  While @rbl is a useful feature, there is a caution with its usage - it is a severe performance hit and can cause increased latency for clients. &nbsp;Whereas the @geoLookup operator accessed a local DB, @rbl checks occur in real-time over the network and utilize the DNS infrastructure. &nbsp;For the same reason that most web admins disable real-time client resolution in logging, running a DNS lookup on each client request can cause severe delays. &nbsp;
</p><em><em><em><em><em><em><em><em><em>@rbl Tips</em></em></em></em></em></em></em></em></em>
<p>
  <em>Here are a few recommended tips for using @rbl.</em>
</p><em>DNS Caching</em>
<p>
  <em>Implement a local caching DNS server like <a href="http://www.corpit.ru/mjt/rbldnsd.html">rbldnsd</a> so that your @rbl checks issue DNS queries to the local system first.</em>
</p><em>Use ModSecurity Persistent Storage</em>
<p>
  <em>Alternatively, you can use ModSecurity to save rbl responses in the IP persistent storage collection. &nbsp;This is what the CRS modsecurity_crs_42_comment_spam.conf file does. &nbsp;The persistent data is cached for 1 day.</em>
</p><em>Choose your RBL carefully</em>
<p>
  <em>Make sure that you choose your RBL carefully. &nbsp;You not only want to ensure that the RBL category is appropriate for your site but also that the accuracy of the list is good.</em>
</p>
<p>
  <br />
  <br />
</p> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: Advanced Feature of the Week: Transformation Functions</title>
		<link>http://blog.modsecurity.org/2010/08/advanced-feature-of-the-week-transformation-functions.html</link>
		<pubDate>Tue, 31 Aug 2010 15:47:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/08/advanced-feature-of-the-week-transformation-functions.html</guid>
		<content:encoded><![CDATA[	<p>
  This week's feature is the effective use of <a href="http://www.modsecurity.org/documentation/modsecurity-apache/2.5.12/modsecurity2-apache-reference.html#transformation-functions">Transformation functions</a>.
</p>Reference Manual
<p>
  This excerpt is taken from the updated Reference Manual section of Ivan Ristic's book <a href="https://www.feistyduck.com/books/modsecurity-handbook/index.html">ModSecurity Handbook</a>.
</p>
<p>
  Transformation functions are used to alter input data before it is used in matching (i.e., operator execution). The input data is never modified, actually—whenever you request a trans- formation function to be used, ModSecurity will create a copy of the data, transform it, and then run the operator against the result.
</p>
<blockquote>
  <p>
    <em>Note</em>
  </p>
</blockquote>
<blockquote>
  <p>
    <em>There are no default transformation functions, as there were in the first generation of ModSecurity (1.x).</em>
  </p>
</blockquote>
<p>
  In the following example, the request parameter values are converted to lowercase before matching:
</p>
<pre>
SecRule ARGS "xp_cmdshell" <em>"t:lowercase"</em><br />
</pre>
<p>
  Multiple transformation actions can be used in the same rule, forming a transformation pipeline. The transformations will be performed in the order in which they appear in the rule.
</p>
<p>
  In most cases, the order in which transformations are performed is very important. In the following example, a series of transformation functions is performed to counter evasion. Per- forming the transformations in any other order would allow a skillful attacker to evade detection:
</p>
<pre>
SecRule ARGS "(asfunction|javascript|vbscript|data|mocha|livescript):"  
</pre>
<pre>
<em>"t:none,t:htmlEntityDecode,t:lowercase,t:removeNulls,t:removeWhitespace"</em><br />
</pre>
<blockquote>
  <p>
    <em>Warning</em>
  </p>
  <p>
    <em>It is currently possible to use SecDefaultAction to specify a default list of transfor- mation functions, which will be applied to all rules that follow the SecDefaultAction directive. However, this practice is not recommended, because it means that mistakes are very easy to make. It is recommended that you always specify the transformation&nbsp;functions that are needed by a particular rule, starting the list with t:none (which clears the possibly inherited transformation functions).</em>
  </p>
</blockquote><em>OWASP ModSecurity CRS</em>
<p>
  <em>The OWASP ModSecurity CRS makes extensive use of transformation functions. &nbsp;Each rule applies a specific transformation pipeline that was developed from user feedback and testing and aims to avoid false negative issues. &nbsp;The following example rule is taken from the modsecurity_crs_41_sql_injection.conf file:</em>
</p>
<pre>
<em>SecRule REQUEST_FILENAME|ARGS_NAMES|ARGS|XML:/* "bunionb.{1,100}?bselectb" 
 "phase:2,rev:'2.0.8',capture,t:none,t:urlDecodeUni,t:htmlEntityDecode,t:lowercase,t:replaceComments,t:compressWhiteSpace,ctl:auditLogParts=+E,pass,nolog,auditlog,msg:'SQL Injection Attack',id:'959047',tag:'WEB_ATTACK/SQL_INJECTION',tag:'WASCTC/WASC-19',tag:'OWASP_TOP_10/A1',tag:'OWASP_AppSensor/CIE1',tag:'PCI/6.5.2',logdata:'%{TX.0}',severity:'2',setvar:'tx.msg=%{rule.msg}',setvar:tx.sql_injection_score=+%{tx.critical_anomaly_score},setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},setvar:tx.%{rule.id}-WEB_ATTACK/SQL_INJECTION-%{matched_var_name}=%{tx.0}"
</em>
</pre>
<p>
  <em>The goal of this transformation pipeline is to try and counter-act typical evasion attempts that are used by SQL Injection attacks (which we describe more in depth in the following section).</em>
</p><br />
<br />
So What?
<p>
  Why are transformation functions so important? &nbsp;One word - EVASIONS. &nbsp;We have blogged about the term <a href="http://blog.modsecurity.org/2010/04/impedance-mismatch-and-base64.html">Impedance Mismatch</a> <a href="http://blog.modsecurity.org/2007/02/dealing-with-im.html">many times</a> in the <a href="http://blog.modsecurity.org/2005/03/external-web-ap.html">past</a>. &nbsp;The issue is that there are many ways in which an attacker may be able to alter the format of an inbound payload, so that it may not match an input validation filtering scheme, however it is still functionally equivalent code and will be executed by the back-end application.
</p>
<p>
  <em>Example SQL Injection Evasion Techniques:</em>
</p>
<pre>
<em>delete from -- lowercase</em>
</pre>
<pre>
<em>DELETE FROM -- upper-case</em>
</pre>
<pre>
<em>deLeTe fRoM -- mixed-case</em>
</pre>
<pre>
<em>Delete From -- more than 1 space between keywords</em>
</pre>
<pre>
<em>DELETEtFROM -- t represents a TAB character<br /><br /></em>
</pre>
<pre>
<em>DELETE/* random data */ FROM -- use of SQL Comments</em>
</pre><em>Example Transformation Execution</em>
<p>
  <em>Let's take a look at an example SQL Injection attack payload:</em>
</p>
<pre>
<em>http://localhost/vulnerable_app.php?foo=1'%20UniOn%09(/*blah%20blah%20blah*/SeLeCt%20%20%20%20%20%20%20'1','2',PASSword%20from%20USERS)%20--%20-a<br /><br /></em>
</pre>
<p>
  <em>This payload has a number of the same evasion techniques described in the previous section. &nbsp;Let's take a look at the modsecurity debug log (set to level 9) and see how the transformation pipeline used in CRS rule id 959047 handles the payload:</em>
</p>
<pre>
<em>[31/Aug/2010:11:34:17 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) urlDecodeUni: "1' UniOnt(/*blah blah blah*/SeLeCt '1','2',PASSword from USERS) -- -a"
[31/Aug/2010:11:34:17 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) htmlEntityDecode: "1' UniOnt(/*blah blah blah*/SeLeCt '1','2',PASSword from USERS) -- -a"
[31/Aug/2010:11:34:17 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) lowercase: "1' uniont(/*blah blah blah*/select '1','2',password from users) -- -a"
[31/Aug/2010:11:34:17 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) replaceComments: "1' uniont( select '1','2',password from users) -- -a"
[31/Aug/2010:11:34:17 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) compressWhitespace: "1' union ( select '1','2',password from users) -- -a"
[31/Aug/2010:11:34:17 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][4] Transformation completed in 36 usec.
[31/Aug/2010:11:34:17 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][4] Executing operator "rx" with param "\bunion\b.{1,100}?\bselect\b" against ARGS:foo.
[31/Aug/2010:11:34:17 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] Target value: "1' union ( select '1','2',password from users) -- -a"<br /><br /></em>
</pre>
<p>
  <em>As you can see from the debug_log, the ARGS:foo parameter payload data was normalized to remove the evasion techniques before the payload was inspected by the @rx operator.</em>
</p><em>Evading Transformation Pipelines</em>
<p>
  <em>While transformation pipelines work fairly well at identifying most evasion attacks, they are by no means perfect. &nbsp;In fact, attackers may abuse the fact that ModSecurity only applies the specified operator only once, at the end of the transformation pipeline. &nbsp;Here is an example attack payload that indeed evaded previous versions of the CRS which were only inspecting more generic payloads such as REQUEST_URI:</em>
</p>
<pre>
<em>http://localhost/vulnerable_app.php?foo=%2f*&amp;bar=%E2%80%98+UNION+SELECT+*+FROM+user+%26%23x2f*<br /><br /></em>
</pre>
<p>
  <em>The evasion trick this payload is attempting is to spread the SQL C-style comment across multiple parameter payloads. &nbsp;Let's look at how the previous CRS rule would have processed this REQUEST_URI payload and applied the transformation pipeline:</em>
</p>
<pre>
<em>[31/Aug/2010:11:56:15 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) urlDecodeUni: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 UNION SELECT * FROM user /*"
[31/Aug/2010:11:56:15 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) htmlEntityDecode: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 UNION SELECT * FROM user /*"
[31/Aug/2010:11:56:15 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) lowercase: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 union select * from user /*"
[31/Aug/2010:11:56:15 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) replaceComments: "/vulnerable_app.php?foo= "
[31/Aug/2010:11:56:15 --0400] [localhost/sid#10080d708][rid#1025d2aa0][/vulnerable_app.php][9] T (0) compressWhitespace: "/vulnerable_app.php?foo= "
</em>
</pre>
<p>
  <em>Opps... As you can see, once the replaceComments transformation function is applied, it effectively removes the SQLi payload before the operator is applied. &nbsp;This is a perfect example of Impedance Mismatch, were the WAF is normalizing data in a different way as the target application.</em>
</p>
<p>
  <em>So, how do we combat this evasion issue?</em>
</p><em>multiMatch Action</em>
<p>
  <em>By default, operators are only applied once after the entire transformation pipeline is completed. &nbsp;This is a sound approach for normal everyday use as it strikes a balance between detecting attacks and not adversely affecting performance. &nbsp;Keep in mind that there is a latency cost each time that ModSecurity has to apply an operator to data. &nbsp;</em>
</p>
<p>
  <em>There is a seldom used action called&nbsp;<a href="http://www.modsecurity.org/documentation/modsecurity-apache/2.5.12/modsecurity2-apache-reference.html#N11987">multiMatch</a>&nbsp;and its purpose is to change when operators are applied to data. &nbsp;</em>
</p>
<p>
  <em>With multiMatch, the operator is actually applied to data each time that the individual transformation function alters the data. &nbsp;With this approach, it is now possible to detect the previous SQL Injection bypass attempt. &nbsp;Here is how the multiMatch operator execution looks now:</em>
</p>
<pre>
<em>[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Executing operator "rx" with param "\bunion\b.{1,100}?\bselect\b" against REQUEST_URI_RAW.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][9] Target value: "/vulnerable_app.php?foo=%2f*&amp;bar=%E2%80%98+UNION+SELECT+*+FROM+user+%26%23x2f*"
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Operator completed in 1 usec.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][9] T (0) urlDecodeUni: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 UNION SELECT * FROM user /*"
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Transformation completed in 42 usec.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Executing operator "rx" with param "\bunion\b.{1,100}?\bselect\b" against REQUEST_URI_RAW.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][9] Target value: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 UNION SELECT * FROM user /*"
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Operator completed in 1 usec.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][9] T (0) htmlEntityDecode: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 UNION SELECT * FROM user /*"
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Transformation completed in 78 usec.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Executing operator "rx" with param "\bunion\b.{1,100}?\bselect\b" against REQUEST_URI_RAW.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][9] Target value: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 UNION SELECT * FROM user /*"[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Operator completed in 0 us
ec.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][9] T (0) lowercase: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 union select * from user /*"
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Transformation completed in 109 usec.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][4] Executing operator "rx" with param "\bunion\b.{1,100}?\bselect\b" against REQUEST_URI_RAW.
[31/Aug/2010:16:22:45 --0400] [localhost/sid#10080d708][rid#1040020a0][/vulnerable_app.php][9] Target value: "/vulnerable_app.php?foo=/*&amp;bar=xe2x80x98 union select * from user /*"
</em>
</pre>
<p>
  <em>In order to balance out the latency hit and its chance for higher false positives, we have implemented use of the multiMatch action into the <a href="http://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project">OWASP ModSecurity Core Rule Set</a> by only conditionally using it if the Admin configures the PARANOID_MODE variable in the modsecurity_crs_10_config.conf file. &nbsp;When this is set, many of the rules will then inspect more generic variables and use the multiMatch action. &nbsp;As indicated by the name, PARANOID_MODE is mainly meant for people who want to get more aggressive with detection and have a higher tolerance for false positives.</em>
</p>
<p>
  <em>Transformation Function Tips</em>
</p>
<p>
  <em>Here are a few recommended tips for using transformation functions.</em>
</p>
<p>
  Start with t:none
</p>
<p>
  Due to the fact that transformation functions pipelines are cumulative, it is possible that you could unintentionally inherit transformation functions from a previous SecDefaultAction. &nbsp;It is therefore good practice to start each transformation function pipeline with "t:none" as this will clear out any existing ones.
</p>
<p>
  Choose the right transformations
</p>
<p>
  There is no "one size fits all" magic transformation function pipeline. &nbsp;You need to analyze what type of attack you are targeting and then identify the methods in which attackers may try evade detection. &nbsp;For instance, the transformation pipelines for detecting Cross-site Scripting (XSS) is much different then what you would use for SQL Injection.
</p>
<p>
  Beware of performance
</p>
<p>
  The larger the payload is, the longer it will take to complete the transformation pipeline. &nbsp;This is not that big of a concern for inbound request data as they are generally small in size. &nbsp;Where you can run into higher latency hits is when you are attempting to inspect outbound data (RESPONSE_BODY variable). &nbsp;It is for this reason that you should try to limit the use of transformations when inspecting RESPONSE_BODY and instead specify mixed-case within your regular expression.
</p>
<p>
  <br />
  <br />
</p>
<p>
  <br />
  <br />
</p>
<p>
  <br />
  <br />
</p> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: OWASP ModSecurity CRS Project Promoted to Release Quality</title>
		<link>http://blog.modsecurity.org/2010/08/owasp-modsecurity-crs-project-promoted-to-release-quality.html</link>
		<pubDate>Mon, 30 Aug 2010 10:03:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/08/owasp-modsecurity-crs-project-promoted-to-release-quality.html</guid>
		<content:encoded><![CDATA[	<p>
  I am excited to announce that the OWASP ModSecurity Core Rule Set (CRS) has completed its official review and has been promoted to a <a href="http://www.owasp.org/index.php/Category:OWASP_Project#tab=Release_Quality_Projects">Release Quality Project</a>! &nbsp;I want to thank both Ivan Ristic and Leonardo Cavallari Militelli who served as project reviewers.
</p>
<p>
  While this is certainly exciting news and will help to further promote ModSecurity and the Core Rule Set, there is still much work left to be done on the project. &nbsp;We will be expanding the CRS documentation, re-organizing the rules to more accurately categorize the quality of the rules (with relation to false positive potential), as well as, cross-referencing rules with the <a href="http://www.owasp.org/index.php/Category:OWASP_AppSensor_Project">OWASP AppSensor project</a>.
</p>
<p>
  Keep your eyes open as we are just getting started with the CRS.
</p> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: OWASP ModSecurity Core Rule Set (CRS) v2.0.8 Released</title>
		<link>http://blog.modsecurity.org/2010/08/owasp-modsecurity-core-rule-set-crs-v208-released.html</link>
		<pubDate>Fri, 27 Aug 2010 14:50:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/08/owasp-modsecurity-core-rule-set-crs-v208-released.html</guid>
		<content:encoded><![CDATA[	<pre>
Greetings everyone,<br />I wanted to announce the availability of the OWASP ModSecurity CRS v2.0.8. <br />
DOWNLOADING -<br /><a href="http://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project#tab=Download">Download page</a><br />You can also use the util/rules-updater.pl script to auto-download the latest ZIP archive (see the rules-updater-example.conf file for Repo data).<br />
TESTING -<br />We have integrated the new CRS into the Demo page to help facilitate community testing -<br /><a href="http://www.modsecurity.org/demo/">[www.modsecurity.org]</a><br />
CHANGES -<br />--------------------------<br />Version 2.0.8 - 08/27/2010<br />--------------------------<br />
Improvements:<br />- Updated the PHPIDS filters<br />- Updated the SQL Injection filters to detect boolean attacks (1- Updated the SQL Injection filters to account for different quotes<br />- Added UTF-8 encoding validation support to the modsecurity_crs_10_config.conf file<br />- Added Rule ID 950109 to detect multiple URL encodings<br />- Added two experimental rules to detect anomalous use of special characters<br />
Bug Fixes:<br />- Fixed Encoding Detection RegEx (950107 and 950108)<br />- Fixed rules-updater.pl script to better handle whitespace<br />  <a href="https://www.modsecurity.org/tracker/browse/MODSEC-167">[https:]</a><br />- Fixed missing pass action bug in modsecurity_crs_21_protocol_anomalies.conf<br />  <a href="https://www.modsecurity.org/tracker/browse/CORERULES-55">[https:]</a><br />- Fixed the anomaly scoring in the modsecurity_crs_41_phpids_filters.conf file<br />  <a href="https://www.modsecurity.org/tracker/browse/CORERULES-54">[https:]</a><br />- Updated XSS rule id 958001 to improve the .cookie regex to reduce false postives<br />  <a href="https://www.modsecurity.org/tracker/browse/CORERULES-29">[https:]</a>  

</pre> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: Advanced Feature of the Week: Validating Byte Ranges</title>
		<link>http://blog.modsecurity.org/2010/08/advanced-feature-of-the-week-validating-byte-ranges.html</link>
		<pubDate>Tue, 24 Aug 2010 14:41:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/08/advanced-feature-of-the-week-validating-byte-ranges.html</guid>
		<content:encoded><![CDATA[	<p>
  We are starting a new blog post series here on the ModSecurity site called "<em>Advanced Feature of the Week</em>" where we will be highlighting many of ModSecurity's really cool capabilities. &nbsp;These are the features that seldom used or fully understood by the average ModSecurity user however can provide detection of sophisticated attacks if used properly. &nbsp;It is our goal with these blog posts to help shed light on these unique features and to provide some real-world, in-the-trenches gotchas for successful usage of these features.
</p>
<p>
  This blog post series will have the following major topic sections -
</p>
<p>
  1) ModSecurity Reference Manual Information
</p>
<p>
  Provide reference manual data.
</p>
<p>
  2) Use Within the OWASP Core Rule Set (CRS)
</p>
<p>
  Outline if/when/how the CRS is utilizing this feature.
</p>
<p>
  3) So What?
</p>
<p>
  Will provide some context as to why you as a user should even care about this capability. &nbsp;What advanced attack/vulnerability is this attempting to catch.
</p>
<p>
  This week's feature is on the use of the&nbsp;<a href="http://www.modsecurity.org/documentation/modsecurity-apache/2.5.12/modsecurity2-apache-reference.html#N11E29">@validateByteRange</a>&nbsp;operator.
</p>Reference Manual<code>validateByteRange</code>
<p>
  <em>Description:</em>&nbsp;Validates the byte range used in the variable falls into the specified range.
</p>
<p>
  Example:
</p>
<pre>
SecRule ARGS:text "<em>@validateByteRange</em> 10, 13, 32-126"
</pre>
<p>
  <em>Note</em>
</p>
<p>
  You can force requests to consist only of bytes from a certain byte range. This can be useful to avoid stack overflow attacks (since they usually contain "random" binary content). Default range values are 0 and 255, i.e. all byte values are allowed. This directive does not check byte range in a POST payload when&nbsp;<code>multipart/form-data</code>&nbsp;encoding (file upload) is used. Doing so would prevent binary files from being uploaded. However, after the parameters are extracted from such request they are checked for a valid range.
</p>
<p>
  validateByteRange is similar to the ModSecurity 1.X SecFilterForceByteRange Directive however since it works in a rule context, it has the following differences:
</p>
<ul>
  <li>
    <p>
      You can specify a different range for different variables.
    </p>
  </li>
  <li>
    <p>
      It has an "event" context (id, msg....)
    </p>
  </li>
  <li>
    <p>
      It is executed in the flow of rules rather than being a built in pre-check.
    </p>
  </li>
</ul>
<p>
  ASCII Byte Range Chart
</p>
<table>
  <tr>
    <td>
      æ<br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      backspace<br />
      <br />
      tab<br />
      <br />
      linefeed<br />
      <br />
      <br />
      <br />
      <br />
      <br />
      c return<br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      space<br />
      <br />
      !<br />
      <br />
      "<br />
      <br />
      #<br />
      <br />
      $<br />
      <br />
      %<br />
      <br />
      &amp;<br />
      <br />
      '<br />
      <br />
      (<br />
      <br />
      )<br />
      <br />
      *<br />
      <br />
      +<br />
      <br />
      ,<br />
      <br />
      -<br />
      <br />
      .<br />
      <br />
      /<br />
      <br />
    </td>
    <td>
      00<br />
      <br />
      01<br />
      <br />
      02<br />
      <br />
      03<br />
      <br />
      04<br />
      <br />
      05<br />
      <br />
      06<br />
      <br />
      07<br />
      <br />
      08<br />
      <br />
      09<br />
      <br />
      10<br />
      <br />
      11<br />
      <br />
      12<br />
      <br />
      13<br />
      <br />
      14<br />
      <br />
      15<br />
      <br />
      16<br />
      <br />
      17<br />
      <br />
      18<br />
      <br />
      19<br />
      <br />
      20<br />
      <br />
      21<br />
      <br />
      22<br />
      <br />
      23<br />
      <br />
      24<br />
      <br />
      25<br />
      <br />
      26<br />
      <br />
      27<br />
      <br />
      28<br />
      <br />
      29<br />
      <br />
      30<br />
      <br />
      31<br />
      <br />
      32<br />
      <br />
      33<br />
      <br />
      34<br />
      <br />
      35<br />
      <br />
      36<br />
      <br />
      37<br />
      <br />
      38<br />
      <br />
      39<br />
      <br />
      40<br />
      <br />
      41<br />
      <br />
      42<br />
      <br />
      43<br />
      <br />
      44<br />
      <br />
      45<br />
      <br />
      46<br />
      <br />
      47<br />
      <br />
    </td>
    <td>
      0<br />
      <br />
      1<br />
      <br />
      2<br />
      <br />
      3<br />
      <br />
      4<br />
      <br />
      5<br />
      <br />
      6<br />
      <br />
      7<br />
      <br />
      8<br />
      <br />
      9<br />
      <br />
      :<br />
      <br />
      ;<br />
      <br />
      <br />
      =<br />
      <br />
      &gt;<br />
      <br />
      ?<br />
      <br />
      @<br />
      <br />
      A<br />
      <br />
      B<br />
      <br />
      C<br />
      <br />
      D<br />
      <br />
      E<br />
      <br />
      F<br />
      <br />
      G<br />
      <br />
      H<br />
      <br />
      I<br />
      <br />
      J<br />
      <br />
      K<br />
      <br />
      L<br />
      <br />
      M<br />
      <br />
      N<br />
      <br />
      O<br />
      <br />
      P<br />
      <br />
      Q<br />
      <br />
      R<br />
      <br />
      S<br />
      <br />
      T<br />
      <br />
      U<br />
      <br />
      V<br />
      <br />
      W<br />
      <br />
      X<br />
      <br />
      Y<br />
      <br />
      Z<br />
      <br />
      [<br />
      <br />
      <br />
      <br />
      ]<br />
      <br />
      ^<br />
      <br />
      _<br />
      <br />
    </td>
    <td>
      48<br />
      <br />
      49<br />
      <br />
      50<br />
      <br />
      51<br />
      <br />
      52<br />
      <br />
      53<br />
      <br />
      54<br />
      <br />
      55<br />
      <br />
      56<br />
      <br />
      57<br />
      <br />
      58<br />
      <br />
      59<br />
      <br />
      60<br />
      <br />
      61<br />
      <br />
      62<br />
      <br />
      63<br />
      <br />
      64<br />
      <br />
      65<br />
      <br />
      66<br />
      <br />
      67<br />
      <br />
      68<br />
      <br />
      69<br />
      <br />
      70<br />
      <br />
      71<br />
      <br />
      72<br />
      <br />
      73<br />
      <br />
      74<br />
      <br />
      75<br />
      <br />
      76<br />
      <br />
      77<br />
      <br />
      78<br />
      <br />
      79<br />
      <br />
      80<br />
      <br />
      81<br />
      <br />
      82<br />
      <br />
      83<br />
      <br />
      84<br />
      <br />
      85<br />
      <br />
      86<br />
      <br />
      87<br />
      <br />
      88<br />
      <br />
      89<br />
      <br />
      90<br />
      <br />
      91<br />
      <br />
      92<br />
      <br />
      93<br />
      <br />
      94<br />
      <br />
      95<br />
      <br />
    </td>
    <td>
      `<br />
      <br />
      a<br />
      <br />
      b<br />
      <br />
      c<br />
      <br />
      d<br />
      <br />
      e<br />
      <br />
      f<br />
      <br />
      g<br />
      <br />
      h<br />
      <br />
      i<br />
      <br />
      j<br />
      <br />
      k<br />
      <br />
      l<br />
      <br />
      m<br />
      <br />
      n<br />
      <br />
      o<br />
      <br />
      p<br />
      <br />
      q<br />
      <br />
      r<br />
      <br />
      s<br />
      <br />
      t<br />
      <br />
      u<br />
      <br />
      v<br />
      <br />
      w<br />
      <br />
      x<br />
      <br />
      y<br />
      <br />
      z<br />
      <br />
      {<br />
      <br />
      |<br />
      <br />
      }<br />
      <br />
      ~<br />
      <br />
      <br />
      <br />
      €<br />
      <br />
      <br />
      <br />
      ‚<br />
      <br />
      ƒ<br />
      <br />
      „<br />
      <br />
      …<br />
      <br />
      †<br />
      <br />
      ‡<br />
      <br />
      ˆ<br />
      <br />
      ‰<br />
      <br />
      Š<br />
      <br />
      ‹<br />
      <br />
      Œ<br />
      <br />
      <br />
      <br />
      Ž<br />
      <br />
      <br />
      <br />
    </td>
    <td>
      96<br />
      <br />
      97<br />
      <br />
      98<br />
      <br />
      99<br />
      <br />
      100<br />
      <br />
      101<br />
      <br />
      102<br />
      <br />
      103<br />
      <br />
      104<br />
      <br />
      105<br />
      <br />
      106<br />
      <br />
      107<br />
      <br />
      108<br />
      <br />
      109<br />
      <br />
      110<br />
      <br />
      111<br />
      <br />
      112<br />
      <br />
      113<br />
      <br />
      114<br />
      <br />
      115<br />
      <br />
      116<br />
      <br />
      117<br />
      <br />
      118<br />
      <br />
      119<br />
      <br />
      120<br />
      <br />
      121<br />
      <br />
      122<br />
      <br />
      123<br />
      <br />
      124<br />
      <br />
      125<br />
      <br />
      126<br />
      <br />
      127<br />
      <br />
      128<br />
      <br />
      129<br />
      <br />
      130<br />
      <br />
      131<br />
      <br />
      132<br />
      <br />
      133<br />
      <br />
      134<br />
      <br />
      135<br />
      <br />
      136<br />
      <br />
      137<br />
      <br />
      138<br />
      <br />
      139<br />
      <br />
      140<br />
      <br />
      141<br />
      <br />
      142<br />
      <br />
      143<br />
      <br />
    </td>
    <td>
      <br />
      <br />
      ‘<br />
      <br />
      ’<br />
      <br />
      “<br />
      <br />
      ”<br />
      <br />
      •<br />
      <br />
      –<br />
      <br />
      —<br />
      <br />
      ˜<br />
      <br />
      ™<br />
      <br />
      š<br />
      <br />
      ›<br />
      <br />
      œ<br />
      <br />
      <br />
      <br />
      ž<br />
      <br />
      Ÿ<br />
      <br />
      <br />
      <br />
      ¡<br />
      <br />
      ¢<br />
      <br />
      £<br />
      <br />
      <br />
      <br />
      ¥<br />
      <br />
      |<br />
      <br />
      §<br />
      <br />
      ¨<br />
      <br />
      ©<br />
      <br />
      ª<br />
      <br />
      «<br />
      <br />
      ¬<br />
      <br />
      ¯<br />
      <br />
      ®<br />
      <br />
      ¯<br />
      <br />
      °<br />
      <br />
      ±<br />
      <br />
      ²<br />
      <br />
      ³<br />
      <br />
      ´<br />
      <br />
      µ<br />
      <br />
      ¶<br />
      <br />
      ·<br />
      <br />
      ¸<br />
      <br />
      ¹<br />
      <br />
      º<br />
      <br />
      »<br />
      <br />
      ¼<br />
      <br />
      ½<br />
      <br />
      ¾<br />
      <br />
      ¿<br />
      <br />
    </td>
    <td>
      144<br />
      <br />
      145<br />
      <br />
      146<br />
      <br />
      147<br />
      <br />
      148<br />
      <br />
      149<br />
      <br />
      150<br />
      <br />
      151<br />
      <br />
      152<br />
      <br />
      153<br />
      <br />
      154<br />
      <br />
      155<br />
      <br />
      156<br />
      <br />
      157<br />
      <br />
      158<br />
      <br />
      159<br />
      <br />
      160<br />
      <br />
      161<br />
      <br />
      162<br />
      <br />
      163<br />
      <br />
      164<br />
      <br />
      165<br />
      <br />
      166<br />
      <br />
      167<br />
      <br />
      168<br />
      <br />
      169<br />
      <br />
      170<br />
      <br />
      171<br />
      <br />
      172<br />
      <br />
      173<br />
      <br />
      174<br />
      <br />
      175<br />
      <br />
      176<br />
      <br />
      177<br />
      <br />
      178<br />
      <br />
      179<br />
      <br />
      180<br />
      <br />
      181<br />
      <br />
      182<br />
      <br />
      183<br />
      <br />
      184<br />
      <br />
      185<br />
      <br />
      186<br />
      <br />
      187<br />
      <br />
      188<br />
      <br />
      189<br />
      <br />
      190<br />
      <br />
      191<br />
      <br />
    </td>
    <td>
      À<br />
      <br />
      Á<br />
      <br />
      Â<br />
      <br />
      Ã<br />
      <br />
      Ä<br />
      <br />
      Å<br />
      <br />
      Æ<br />
      <br />
      Ç<br />
      <br />
      È<br />
      <br />
      É<br />
      <br />
      Ê<br />
      <br />
      Ë<br />
      <br />
      Ì<br />
      <br />
      Í<br />
      <br />
      Î<br />
      <br />
      Ï<br />
      <br />
      Ð<br />
      <br />
      Ñ<br />
      <br />
      Ò<br />
      <br />
      Ó<br />
      <br />
      Ô<br />
      <br />
      Õ<br />
      <br />
      Ö<br />
      <br />
      <br />
      <br />
      Ø<br />
      <br />
      Ù<br />
      <br />
      Ú<br />
      <br />
      Û<br />
      <br />
      Ü<br />
      <br />
      Ý<br />
      <br />
      Þ<br />
      <br />
      ß<br />
      <br />
      à<br />
      <br />
      á<br />
      <br />
      â<br />
      <br />
      ã<br />
      <br />
      ä<br />
      <br />
      å<br />
      <br />
      æ<br />
      <br />
      ç<br />
      <br />
      è<br />
      <br />
      é<br />
      <br />
      ê<br />
      <br />
      ë<br />
      <br />
      ì<br />
      <br />
      í<br />
      <br />
      î<br />
      <br />
      ï<br />
      <br />
    </td>
    <td>
      192<br />
      <br />
      193<br />
      <br />
      194<br />
      <br />
      195<br />
      <br />
      196<br />
      <br />
      197<br />
      <br />
      198<br />
      <br />
      199<br />
      <br />
      200<br />
      <br />
      201<br />
      <br />
      202<br />
      <br />
      203<br />
      <br />
      204<br />
      <br />
      205<br />
      <br />
      206<br />
      <br />
      207<br />
      <br />
      208<br />
      <br />
      209<br />
      <br />
      210<br />
      <br />
      211<br />
      <br />
      212<br />
      <br />
      213<br />
      <br />
      214<br />
      <br />
      215<br />
      <br />
      216<br />
      <br />
      217<br />
      <br />
      218<br />
      <br />
      219<br />
      <br />
      220<br />
      <br />
      221<br />
      <br />
      222<br />
      <br />
      223<br />
      <br />
      224<br />
      <br />
      225<br />
      <br />
      226<br />
      <br />
      227<br />
      <br />
      228<br />
      <br />
      229<br />
      <br />
      230<br />
      <br />
      231<br />
      <br />
      232<br />
      <br />
      233<br />
      <br />
      234<br />
      <br />
      235<br />
      <br />
      236<br />
      <br />
      237<br />
      <br />
      238<br />
      <br />
      239<br />
      <br />
    </td>
    <td>
      ð<br />
      <br />
      ñ<br />
      <br />
      ò<br />
      <br />
      ó<br />
      <br />
      ô<br />
      <br />
      õ<br />
      <br />
      ö<br />
      <br />
      ÷<br />
      <br />
      ø<br />
      <br />
      ù<br />
      <br />
      ú<br />
      <br />
      û<br />
      <br />
      ü<br />
      <br />
      ý<br />
      <br />
      þ<br />
      <br />
      ÿ<br />
      <br />
      <br />
      <br />
    </td>
    <td>
      240<br />
      <br />
      241<br />
      <br />
      242<br />
      <br />
      243<br />
      <br />
      244<br />
      <br />
      245<br />
      <br />
      246<br />
      <br />
      247<br />
      <br />
      248<br />
      <br />
      249<br />
      <br />
      250<br />
      <br />
      251<br />
      <br />
      252<br />
      <br />
      253<br />
      <br />
      254<br />
      <br />
      255<br />
      <br />
    </td>
  </tr>
</table>
<p>
  <br />
  <br />
</p>OWASP ModSecurity CRS
<p>
  Use of @validateByteRange in the OWASP ModSecurity CRS (from the end of the modsecurity_crs_20_protocol_violations.conf file) -
</p>
<pre>
#
# Restrict type of characters sent
# NOTE In order to be broad and support localized applications this rule
# only validates that NULL Is not used.
#
# The strict policy version also validates that protocol and application 
# generated fields are limited to printable ASCII. 
#
# -=[ Rule Logic ]=-
# This rule uses the @validateByteRange operator to look for Nul Bytes.
# If you set Paranoid Mode - it will check if your application use the range 32-126 for parameters.
#
# -=[ References ]=-
# http://i-technica.com/whitestuff/asciichart.html
#

SecRule ARGS|ARGS_NAMES|REQUEST_HEADERS|!REQUEST_HEADERS:Referer "@validateByteRange 1-255" 
 "phase:2,rev:'2.0.8',pass,nolog,auditlog,msg:'Invalid character in request',id:'960901',tag:'PROTOCOL_VIOLATION/EVASION',tag:'WASCTC/WASC-28',tag:'OWASP_TOP_10/A1',tag:'OWASP_AppSensor/CIE3',tag:'PCI/6.5.2',severity:'4',t:none,t:urlDecodeUni,setvar:'tx.msg=%{rule.msg}',tag:'http://i-technica.com/whitestuff/asciichart.html',setvar:tx.anomaly_score=+%{tx.notice_anomaly_score},setvar:tx.protocol_violation_score=+%{tx.notice_anomaly_score},setvar:tx.%{rule.id}-PROTOCOL_VIOLATION/EVASION-%{matched_var_name}=%{matched_var}"

SecRule TX:PARANOID_MODE "@eq 1" "chain,phase:2,rev:'2.0.8',pass,nolog,auditlog,msg:'Invalid character in request',id:'960018',tag:'PROTOCOL_VIOLATION/EVASION',tag:'WASCTC/WASC-28',tag:'OWASP_TOP_10/A1',tag:'OWASP_AppSensor/CIE3',tag:'PCI/6.5.2',severity:'4',t:none,t:urlDecodeUni,tag:'http://i-technica.com/whitestuff/asciichart.html'"
 SecRule REQUEST_URI|REQUEST_BODY|REQUEST_HEADERS_NAMES|REQUEST_HEADERS|!REQUEST_HEADERS:Referer|TX:HPP_DATA 
 "@validateByteRange 32-126" 
 "t:none,t:urlDecodeUni,setvar:'tx.msg=%{rule.msg}',setvar:tx.anomaly_score=+%{tx.notice_anomaly_score},setvar:tx.protocol_violation_score=+%{tx.notice_anomaly_score},setvar:tx.%{rule.id}-PROTOCOL_VIOLATION/EVASION-%{matched_var_name}=%{matched_var}"
</pre>
<p>
  As you can see, the CRS is, by default, only restricting the existence of Nul Bytes. &nbsp;If the user initiates the PARANOID_MODE variable, however, the CRS will restrict down the allowed byte range to only allow 32-126 which are the normal printable characters for US ASCII (space character through the tilde character).
</p>So What?
<p>
  Why would you need to use @validateByteRange to restrict anything more than Nul Bytes? &nbsp;The short answer is because of the potential of Impedance Mismatches between a security inspection system (IDS, IPS or WAF) and the target web application. &nbsp;The process of data normalization or canonicalization and how the destination web application handles best-fit mappings can cause issues with bypasses. &nbsp;Here is a great recent references for this issue.
</p>
<ul>
  <li>
    <a href="http://hackademix.net/2010/08/17/lost-in-translation-asps-homoxssuality/">Lost In Translation</a>&nbsp;- Giorgia Maone (of the NoScript FF extension fame) outlines how ASP classic web apps attempt to do best-fit mappings of non-ASCII Unicode characters. &nbsp;One example issue is the following XSS payload
  </li>
</ul>
<pre>
%u3008scr%u0131pt%u3009%u212fval(%uFF07al%u212Frt(%22XSS%22)%u02C8)%u2329/scr%u0131pt%u2A
</pre>This payload should be correctly decoded to this -
<pre>
〈scrıpt〉ℯval(＇alℯrt(”XSS”)ˈ)〈/scrıpt〉<br />
</pre>
<p>
  ASP classic, however, will try and do best-fit mapping and actually will normalize the data into working JS code -
</p>
<pre>
eval('alert("XSS")')<br />
</pre>The issue that this raises, for security inspection, is that the inbound payload will most likely not match most XSS regular expression payloads however the application itself will modify it into executable code!
<p>
  So, this brings us to today's advanced ModSecurity feature - @validateByteRange. &nbsp;By restricting the allowed character byte ranges, you can help to identify when unexpected character code points are used. &nbsp;If the payload above is sent, you should receive an alert message similar to the following -
</p>
<pre>
Message: Found 3 byte(s) in REQUEST_URI outside range: 32-126. [file "/usr/local/apache/conf/modsec_current/base_rules/modsecurity_crs_20_protocol_violations.conf"] [line "251"] [id "960018"] [rev "2.0.6"] [msg "Invalid character in request"] [severity "WARNING"] [tag "PROTOCOL_VIOLATION/EVASION"] [tag "WASCTC/WASC-28"] [tag "OWASP_TOP_10/A1"] [tag "OWASP_AppSensor/CIE3"] [tag "PCI/6.5.2"] [tag "http://i-technica.com/whitestuff/asciichart.html"]
</pre>
<p>
  <br />
  <br />
</p> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: What's up @ ModSecurity?</title>
		<link>http://blog.modsecurity.org/2010/08/whats-up-modsecurity.html</link>
		<pubDate>Wed, 11 Aug 2010 11:54:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/08/whats-up-modsecurity.html</guid>
		<content:encoded><![CDATA[	<p>
  Since Black Hat and DEFCON we have been busying building teams and aligning objectives over here at <a href="https://www.trustwave.com/spiderlabs">Trustwave's SpiderLabs</a>. We are committed to driving innovation into the development of ModSecurity for the future.
</p>
<p>
  Here are are few things that we having going on right now:
</p>
<ul>
  <li>Website Updates - We are in the process of refreshing the website to reflect its new home within SpiderLabs but also clean out any dusty content and replace it with fresh new material. Look for phases of changes over the next several weeks.
  </li>
  <li>Recruiting - We are actively looking to hire full-time developers for ModSecurity. Those developers will be part of the SpiderLabs research team. If you or anyone you know is interested, please let us know.
  </li>
  <li>Internal Development Team - We have formed a team of people within SpiderLabs that will be actively contributing to ModSecurity. This team is comprised of many very experienced individuals including many OWASP, Black Hat and DEFCON researchers/speakers in the area of web application security. This team is excited to breath new life into this project.
  </li>
  <li>End User Survey - In the next few weeks, we will be sending out a survey to the ModSecurity mailing lists to ask for feedback on features to include in the next release.
  </li>
  <li>Blog Updates - Each week we'll be writing about an Advance Feature in ModSecurity that the community and end users may not be aware of. The idea is here is that with increased usage of these advanced, we'll get better feedback on how to improve the product.
  </li>
  <li>Twitter - We have just linked this blog to the ModSecurity <a href="http://twitter.com/ModSecurity">Twitter</a> account. Follow us!
  </li>
</ul> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: ModSecurity Has a New Home</title>
		<link>http://blog.modsecurity.org/2010/07/modsecurity-has-a-new-home.html</link>
		<pubDate>Fri, 23 Jul 2010 02:00:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/07/modsecurity-has-a-new-home.html</guid>
		<content:encoded><![CDATA[	<p>
  As many of you already know, about a month ago <a href="https://www.trustwave.com/">Trustwave</a> acquired <a href="http://www.breach.com/">Breach Security</a>, the then owner and sponsor of the ModSecurity project. Trustwave's <a href="https://www.trustwave.com/spiderLabs.php">Spider Labs</a> will now be leading the project. Within Spider Labs and the highly capable people there, ModSecurity will be able to thrive.
</p>
<p>
  And so, it is with mixed feelings that I also announce that I am stepping down from the project. I have enjoyed working on ModSecurity with Breach for the past 3 1/2 years, but it is time for me to move on to another exciting project (more on that later). While I may be stepping down as a leader, I am not leaving, just changing roles. I plan to stay an active member of the community and to contribute where I can. I expect to see a lot of innovation from ModSecurity in the near future and I look forward to see where ModSecurity will go with all its new resources.
</p>
<p>
  Cheers to ModSecurity's new home in Spider Labs and to a successful future!
</p>
<p>
  P.S. -- I'll be around at Black Hat/DEFCON next week in Vegas if anyone wants to hook up.
</p> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: ModSecurity Happy Hour @ Black Hat USA</title>
		<link>http://blog.modsecurity.org/2010/07/modsecurity-happy-hour-black-hat-usa.html</link>
		<pubDate>Wed, 21 Jul 2010 10:50:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/07/modsecurity-happy-hour-black-hat-usa.html</guid>
		<content:encoded><![CDATA[	<p>
  ModSecurity Community,
</p>
<p>
  We will be hosting a ModSecurity happy hour during Black Hat USA. It is open to anyone who contributes, uses or wants to learn more about the project. You'll also get a chance to meet the members of Trustwave's <a href="http://www.trustwave.com/spiderlabs">SpiderLabs</a> team that will be supporting the ModSecurity project moving forward.&nbsp;
</p>
<ul>
  <li>What: ModSecurity Happy Hour
  </li>
  <li>Where: munchbar @ Caesar's Palace LV (next to Sports Bar &amp; Pure Night Club)
  </li>
  <li>When: Wednesday, July 28th, 2010 - 4:00-6:00 PM
  </li>
</ul>
<p>
  There will be appetizers, drinks, and Nintendo Wii action!
</p>
<p>
  Look forward to meeting you next week!
</p><a href="http://twitter.com/c7five">Nicholas J. Percoco</a>
<p>
  Senior Vice President, <a href="http://twitter.com/SpiderLabs">SpiderLabs</a>
</p>
<p>
  Trustwave
</p> ]]></content:encoded>
</item>
<item>
		<title>ModSecurity Blog: Impedance Mismatch and Base64</title>
		<link>http://blog.modsecurity.org/2010/04/impedance-mismatch-and-base64.html</link>
		<pubDate>Thu, 22 Apr 2010 02:43:00 -0500</pubDate>
		<guid>http://blog.modsecurity.org/2010/04/impedance-mismatch-and-base64.html</guid>
		<content:encoded><![CDATA[	<p>
  There was a recent <a title="Fooling B64_Encode(Payload) on WAFs and filters" href="http://blog.mindedsecurity.com/2010/04/fooling-b64encodepayload-on-wafs-and.html">blog article</a> stating that ModSecurity can be bypassed by adding invalid characters to Base64 encoded data. Well, this is somewhat correct, but I am not sure I'd call it a bypass. It is really "<a title="Dealing with Impedance Mismatch" href="http://blog.modsecurity.org/2007/02/dealing-with-im.html">Impedance Mismatch</a>" as it depends on the decoder you are using in your app. PHP's decoder is ignoring characters (RFC-2045) and ModSecurity is doing what Apache does for HTTP Basic Auth and not allowing the extra characters (RFC-4648)
</p>
<p>
  The article's example is roughly this:
</p>
<pre>
1) Take an attack string: &lt;script&gt;alert(1)&lt;/script&gt;
2) Base64 encode it to: PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==
3) Now add an illegal character: P.HNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==
4) Notice that most decoders will not work, but PHP's will (act surprised)<br />
</pre>
<p>
  PHP will apparently just skip the invalid characters (RFC-2045) and so something like this (article's example, not mine) will of course fail:
</p>
<pre>
SecRule ARGS:b64 "alert" "t:base64decode,log,deny,status:501"<br />
</pre>
<p>
  The Base64 decoder in ModSecurity is based off the RFC-4648 implementation of Base64. There are many other <a title="Base64" href="http://en.wikipedia.org/wiki/Base64">variants</a>. Well, as it turns out it is important to know a bit more about your platform on which your app is based and the above trivial rule is just not going to cut it.
</p>
<p>
  For PHP and possibly others you will need to go a little further and validate the character set first using a positive rule. Something like this is going to be required for the article's example:
</p>
<pre>
SecRule ARGS:b64 "!^[A-Za-z0-9+/]*={0,2}$" 
  "phase:2,t:none,log,deny,status:403,msg:'Invalid Base64 Encoding'"
SecRule ARGS:b64 "alert" 
  "phase:2,t:none,t:base64decode,log,deny,status:403,msg:'Badness in b64'"
</pre>
<p>
  And now you get some better coverage:
</p>
<pre>
# For PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==
ModSecurity: Access denied with code 403 (phase 2). Pattern match "alert" 
at ARGS:b64. [file "test.conf"] [line "3"] [msg "Badness in b64"] 
[hostname "myhost"] [uri "/foo"] [unique_id "S8-4-X8AAQEAACGOJcoAAAAA"]

# For P.HNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==
ModSecurity: Access denied with code 403 (phase 2). Match of 
"rx ^[A-Za-z0-9\\+/]*={0,2}$" against "ARGS:b64" required. 
[file "test.conf"] [line "1"] [msg "Invalid Base64 Encoding"] 
[hostname "myhost"] [uri "/foo"] [unique_id "S8-5BX8AAQEAACJSKBYAAA@i"]
</pre>
<p>
  Though I am picking on PHP a bit here, this may be true in many other areas if you have decoders/parsers that accept out-of-the-norm data. You really do have to know your apps to write targeted rules like the example in this article. You cannot detect encodings like Base64 generically and I would not expect to find such a rule as this in a generic rule set such as <a title="ModSecurity Core Rule Set Project" href="http://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project">ModSecurity's CRS</a>.
</p>
<p>
  Edited: Added details on which RFCs I was referring to and removed blame on PHP after further investigation as it really is just an issue with multiple variants of base64.
</p> ]]></content:encoded>
</item>


</channel>
</rss>
