Description
PCRE is one of the most popular regex libraries available out there. It is heavily used in ModSecurity although it may be optional on 3.1 where Hyperscan and RE2 are likely to be added to the soup as well.
ModSecurity assumes that the one who is written the rules are not an attacker, rather someone that is trying to protect the application. Unfortunately, some times, not-so-experienced users may have a problem writing the rules which leads to undesired or unexpected behavior.
A clear example of that is while the user accesses a variable that is not yet set on a given phase; Assuming that it was filled and had an empty value. Another example is while the user accesses a key that wasn't set on a collection, leading to always having an empty value. Those will be addressed soon on v3 error handler — blog post on its way.
Other examples were already fixed on v3 as part of the usability up taken:
- Uses MULTIPART_MISSING_SEMICOLON instead of MULTIPART_SEMICOLON_MISSING SpiderLabs/owasp-modsecurity-crs#995 - Uses MULTIPART_MISSING_SEMICOLON instead of MULTIPART_SEMICOLON_MISSING
- Missing quote at the end of the rule 920200 SpiderLabs/owasp-modsecurity-crs#559 - Missing quote at the end of the rule 920200
- Missing quote at the end of the rule 920201 SpiderLabs/owasp-modsecurity-crs#558 - Missing quote at the end of the rule 920201
- Missing quote at the end of the rule 920450 SpiderLabs/owasp-modsecurity-crs#557 - Missing quote at the end of the rule 920450
- Missing quote at the end of the rule 920202 SpiderLabs/owasp-modsecurity-crs#556 - Missing quote at the end of the rule 920202
- Adds missing comma in the action list of rule #912120 SpiderLabs/owasp-modsecurity-crs#555 - Adds missing comma in the action list of rule #912120
Those may lead to unexpected behavior on v2 and silent fail.
On #2071 a subject that was discussed back on 2013 reappear in the surface [#267]. Should ModSecurity apply restrictions on the regex match? The implications are described at #2071.
To illustrate the problem we have: #56, #267, #1176, #1481, and #1290
The main objective of this issue is to incite a discussion on how to handle it well, focused on the regular user.