How can i block all access to a php file using mod_sec?
The file name has the form: sm6#.php, being # a random digit.
How can i block all access to a php file using mod_sec?
The file name has the form: sm6#.php, being # a random digit.
您可以使用简单的单一规则来做到这一点,例如:
SecRule REQUEST_LINE "@rx sm6[0-9]{1,}\.php" \
"phase:2,block,severity:2,msg:'Blocking access to sm6#.php files.'"
在这种情况下,{1,} 表示文件名中至少有 1 个数字(在数字 6 之后)。如果您愿意,您可以将其更改为 2、3、4 甚至 100。或者使用 {2,6} 将其限制为最少 2 位和最多 6 位。它使用 PCRE 模式匹配,所以这取决于你!
SecRule REQUEST_FILENAME "sm6\d+\.php" "phase:1,block,severity:2,msg:'Blocking access to sm6#.php files.'"
你不认为 mod_sec 对此过于强大吗?
只需使用.htaccess
.