主机头

标题: nginx过滤无聊的pingback CC请求 [打印本页]

作者: admin    时间: 2016-5-15 03:26
标题: nginx过滤无聊的pingback CC请求
  1. if ($http_user_agent ~* (ApacheBench|pingback|WordPress|MJ12bot|AhrefsBot|360JK|PHP|php|Jorgee) ) {return 101;}
  2. if ($http_user_agent = "" ) {return 101;}
  3. if ( $request = "POST /reg.html HTTP/1.1" ) {return 400;}
  4. if ( $request = "POST / HTTP/1.1" ) {return 400;}
  5. if ( $request = "POST / HTTP/1.0" ) {return 400;}
  6. if ( $request = "POST // HTTP/1.0" ) {return 400;}
复制代码
nginx判断agent直接过滤掉一些低能的CC请求, 在这儿直接当个干货贴出来。

也让某些人以为拿小鸡鸡插进土里就**了地球的想法破灭。


代码实例加入nginx后重载或者重启,可以自己拿wordpress的pingback漏洞给自己测试一下,查看日志101状态的记录则是已经被拦截的。


状态码101也可以改成400,自己随意了。


类似低能的CC不用正眼看一下,老有人打打小白觉得好厉害得不行。

作者: admin    时间: 2016-5-15 03:26
过滤后的日志基本就长这样
  1. 107.170.247.241 - - [15/Apr/2016:10:06:42 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/4.5; http://www.rotaryclubchengdu.org; verifying pingback from 185.130.4.197"
  2. 107.170.247.241 - - [15/Apr/2016:10:06:43 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/4.5; http://www.rotaryclubchengdu.org; verifying pingback from 185.130.4.197"

  3. 107.170.247.241 - - [15/Apr/2016:10:06:58 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/4.5; http://www.rotaryclubchengdu.org; verifying pingback from 185.130.4.197"
  4. 198.104.59.63 - - [15/Apr/2016:10:06:59 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.5.1; http://www.guero.com"
  5. 92.51.134.237 - - [15/Apr/2016:10:07:00 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.0.4; http://www.onlinespiele24.at"
  6. 72.249.104.30 - - [15/Apr/2016:10:07:02 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.0; http://snapecast.com"
  7. 54.162.238.38 - - [15/Apr/2016:10:07:03 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.5.2; http://agilepoint.com"
  8. 72.249.104.30 - - [15/Apr/2016:10:07:03 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.0; http://snapecast.com"
  9. 208.78.97.111 - - [15/Apr/2016:10:07:05 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.0; http://circle-of-life.ca"
  10. 184.168.108.6 - - [15/Apr/2016:10:07:06 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.1.2; http://www.rbunited.com"
  11. 205.186.151.135 - - [15/Apr/2016:10:07:06 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.5.1; http://bradpowellonline.com"
  12. 67.219.60.120 - - [15/Apr/2016:10:07:07 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.1.3; http://easyhomefix.com"
  13. 208.78.97.111 - - [15/Apr/2016:10:07:07 +0800] "GET /login.php HTTP/1.0" 101 0 "-" "WordPress/3.0; http://circle-of-life.ca"
复制代码

作者: admin    时间: 2016-5-15 03:28
加入iptables




欢迎光临 主机头 (http://zhujitou.com/) Powered by Discuz! X2.5