Interesting issue.
I used the Apache to nginx converter at:
https://timmehosting.de/htaccess-converter
to convert the Apache .htaccess rules to nginx rules and this is the result:
[ Moderator note: Code fixed, please wrap code in backticks or use the code button. Not blockquote. ]
if ($args ~* "\.\.\/"){set $rule_0 1;}
if ($args ~* "^.*\.(bash|git|hg|log|svn|swp|cvs)"){set $rule_0 1;}
if ($args ~* "etc/passwd"){set $rule_0 1;}
if ($args ~* "boot\.ini"){set $rule_0 1;}
if ($args ~* "ftp\:"){set $rule_0 1;}
if ($args ~* "http\:"){set $rule_0 1;}
if ($args ~* "https\:"){set $rule_0 1;}
if ($args ~* "(\<|<).*script.*(\>|>)"){set $rule_0 1;}
if ($args ~* "mosConfig_[a-zA-Z_]{1,21}(=|=)"){set $rule_0 1;}
if ($args ~* "base64_encode.*\(.*\)"){set $rule_0 1;}
if ($args ~* "^.*($&x).*"){set $rule_0 1;}
if ($args ~* "^.*(127\.0).*"){set $rule_0 1;}
if ($args ~* "^.*(globals|encode|localhost|loopback).*"){set $rule_0 1;}
if ($args ~* "^.*(request|concat|insert|union|declare).*"){set $rule_0 1;}
if ($args !~ "^loggedout=true"){set $rule_0 15$rule_0;}
if ($args !~ "^action=jetpack-sso"){set $rule_0 16$rule_0;}
if ($args !~ "^action=rp"){set $rule_0 17$rule_0;}
if ($http_cookie !~ "^.*wordpress_logged_in_.*$"){set $rule_0 18$rule_0;}
if ($http_referer !~ "^https://maps\.googleapis\.com(.*)$"){set $rule_0 19$rule_0;}
if ($rule_0 = "19181716151"){
break;
}
As indicated by the author of the converter tool, there may still be errors in the converter result provided.
Anyway it seems the logic behind the original nginx lines as produced by the iTSec plugin is definately not correct. But I’m not sure just replacing !~ with ~* will solve this properly … I would prefer the lines above (which keeps the Apache .htaccess and nginx logic in sync).
Also a rule for preventing access to the wp-config.php file is included in the iTSec plugin “Protect System Files” System Tweaks setting.
I thought I just mention it in case you didn’t know.
Oh, by the way interesting presentation. Thanks for sharing ??
dwinden