Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.

Commit 3fc0bfb

Browse files
authored
Merge pull request #767 from lifeforms/phptags
Constrain PHP tag rule from XML false positives in 933100
2 parents 4f150d3 + 2e49b50 commit 3fc0bfb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

rules/REQUEST-933-APPLICATION-ATTACK-PHP.conf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,18 @@ SecRule TX:PARANOIA_LEVEL "@lt 1" "phase:2,id:933012,nolog,pass,skipAfter:END-RE
2828
#
2929

3030
#
31-
# [ Opening/Closing PHP Tag Found ]
31+
# [ PHP Open Tag Found ]
3232
#
33+
# Detects PHP open tags "<?" and "<?php".
3334
# http://www.php.net/manual/en/language.basic-syntax.phptags.php
3435
#
35-
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@pm <? <?php ?> [php] [\php]" \
36-
"msg:'PHP Injection Attack: Opening/Closing Tag Found',\
36+
# Care is taken to avoid false positives in XML declarations "<?xml..."
37+
#
38+
# Also detects "[php]", "[/php]" and "[\php]" tags used by some applications
39+
# to indicate PHP dynamic content.
40+
#
41+
SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx (?:<\?(?!xml\s)|<\?php|\[(?:/|\\\\)?php\])" \
42+
"msg:'PHP Injection Attack: PHP Open Tag Found',\
3743
phase:request,\
3844
ver:'OWASP_CRS/3.0.0',\
3945
maturity:'9',\

0 commit comments

Comments
 (0)