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

Commit 496d313

Browse files
committed
Block uploads of files with .phps extension
(cherry picked from commit 4a2cc78)
1 parent 9137c64 commit 496d313

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
6363
#
6464
# [ PHP Script Uploads ]
6565
#
66-
# Block file uploads with PHP extensions (.php, .php5, .phtml etc).
66+
# Block file uploads with filenames ending in PHP related extensions
67+
# (.php, .phps, .phtml, .php5 etc).
6768
#
6869
# Many application contain Unrestricted File Upload vulnerabilities.
6970
# https://www.owasp.org/index.php/Unrestricted_File_Upload
@@ -80,7 +81,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|ARGS_NAME
8081
# X_Filename, or X-File-Name to transmit the file name to the server;
8182
# scan these request headers as well as multipart/form-data file names.
8283
#
83-
SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phtml)\.*$" \
84+
SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phps|phtml)\.*$" \
8485
"msg:'PHP Injection Attack: PHP Script File Upload Found',\
8586
phase:2,\
8687
ver:'OWASP_CRS/3.0.0',\
@@ -588,8 +589,8 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
588589
#
589590
# [ PHP Script Uploads: Superfluous extension ]
590591
#
591-
# Block file uploads with PHP extensions (.php, .php5, .phtml etc)
592-
# anywhere in the name, followed by a dot.
592+
# Block file uploads with PHP related extensions (.php, .phps, .phtml,
593+
# .php5 etc) anywhere in the name, followed by a dot.
593594
#
594595
# Example: index.php.tmp
595596
#
@@ -606,7 +607,7 @@ SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_F
606607
#
607608
# This rule is a stricter sibling of rule 933110.
608609
#
609-
SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phtml)\..*$" \
610+
SecRule FILES|REQUEST_HEADERS:X-Filename|REQUEST_HEADERS:X_Filename|REQUEST_HEADERS:X-File-Name "@rx .*\.(?:php\d*|phps|phtml)\..*$" \
610611
"msg:'PHP Injection Attack: PHP Script File Upload Found',\
611612
phase:2,\
612613
ver:'OWASP_CRS/3.0.0',\

0 commit comments

Comments
 (0)