PROBLEMRULE #1; SecRule REQUEST_URI "^/(|(.*)/)(lpt1|lpt2|lpt3|lpt4)(/|\.|\?|$)" "t:none,t:htmlEntityDecode,t:lowercase,t:removeWhitespace,block,msg:'X',id:'1000'"
PROBLEMRULE #2; SecRule REQUEST_URI "^(.*)//(.*)$" "t:none,t:removeWhitespace,block,msg:'X',id:'1001'"
// I also tried those, but no success.
SecRule REQUEST_URI "//"
SecRule REQUEST_URI "^/(.*)/(lpt1|lp...
这两件事不会按预期工作。其他规则运行良好。我想阻止类似的请求:
// (too many slash, NOT blocked)
/////////// (too many slash, NOT blocked)
/lpt1 (Apache returns 403, NOT from modsec. Error log: "Forbidden: (web-dir)/lpt1 doesn't point to a file or directory")
/lpt1/blah (Apache returns 403, NOT from modsec. "doesn't point to a file or directory")
/somedir/lpt4.txt (Same as above)
/somedir/lpt4 (Same as above)
/somedir/////// (* SUCCESSFULLY blocked)
我相信这些正则表达式是可以的,所以我很想知道为什么 mod_security2 不会阻止这些请求。我想阻止使用 mod_sec2,而不是 apache。
环境:Windows Test Web 服务器 | mod_sec2 | 阿帕奇 2.4
To moderators:
Sorry for creating another question,
because my email has been hacked and I lost my password.
Please delete http://security.stackexchange.com/questions/47000/why-these-2-regexp-wont-work-as-expected
I use THIS ONE to continue question.
对之前的问题:
REQUEST_URI 变量不包括域或协议。您的意思是在该 URL 的末尾添加更多内容吗?
是的,我知道。我希望 mod_sec2 拒绝“GET ////////”(如上例所示)。如果我点击浏览器 hxxp: // something.mysite.com////////// REQUEST_URI 变为“///////”,则应应用 id:1001。我对吗?
是否为被 Mod Security 成功阻止的请求记录了规则 ID?
如果 mod_security 规则成功应用,我可以在我的 apache 的错误日志中看到 mod_sec 错误(当然包括命中 ID 号。)
“/somedir/lpt4”和其他东西,被apache阻止,而不是被mod_security阻止。(没有来自 mod_security 的日志)
LTP1?
http://www.hanselman.com/blog/NamingAFileAReservedNameInTheWindowsVistaOperatingSystem.aspx 我想让 mod_sec 拒绝这些丑陋的内部命令,所以我创建了一个规则(id:1000)。
PS“RewriteRule”对我来说不是一个选项。我想使用 mod_sec2 来做到这一点。