nginx_lua_waf 部署、测试记录

ngx_lua_waf

ngx_lua_waf是一个基于lua-nginx-module(openresty)的web应用防火墙

源码:https://github.com/loveshell/ngx_lua_waf

安装部署

系统版本:Centos6.5 x86_64

1、openresty的配置

yum -y install pcre pcre-devel
wget https://openresty.org/download/openresty-1.9.15.1.tar.gz
tar -zxvf openresty-1.9.15.1.tar.gz 
cd openresty-1.9.15.1
./configure 
gmake && gmake install

2、配置ngx_lua_waf

git clone https://github.com/loveshell/ngx_lua_waf.git
在nginx.conf的http段添加
  lua_package_path "/usr/local/openresty/nginx/conf/ngx_lua_waf/?.lua";
  lua_shared_dict limit 10m;
  init_by_lua_file /usr/local/openresty/nginx/conf/ngx_lua_waf/init.lua;
  access_by_lua_file /usr/local/openresty/nginx/conf/ngx_lua_waf/waf.lua;

配置config.lua里的waf规则目录(一般在ngx_lua_waf/wafconf/目录下)
  RulePath = "/usr/local/openresty/nginx/conf/ngx_lua_waf/wafconf"
  attacklog = "on"
  logdir = "/usr/local/nginx/logs/waf"

 3、waf日志配置

#将nginx.conf首行的”# user nobody;”的”#”注释去掉,重新启动nginx服务
user nobody
#将防护日志目录所属user和group修改为nobody,目录权限可设为700也可以写入
cd /usr/local/nginx/conf
chown -R nobay.nobady waf //chmod 700 waf

Bypass WAF

1、GET+POST+COOKIE绕过

 这种姿势是有限定条件的,目前只在ASPX环境测试成功

条件:使用Request.Params["id"]来获取参数, 三种方式可以进行参数传递:(1). Form (2). ?id= (3).cookie

获取到参数拼接起来,通过HPP可成功Bypass

关于我:一个网络安全爱好者,致力于分享原创高质量干货,欢迎关注我的个人微信公众号:Bypass--,浏览更多精彩文章。

原文地址:https://www.cnblogs.com/xiaozi/p/7440613.html