nginx_lua_waf 部署、测试记录

ngx_lua_waf

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

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

安装部署

系统版本:Centos6.5 x86_64github

一、openresty的配置web

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

二、配置ngx_lua_wafshell

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"

 三、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微信

 

一、GET+POST+COOKIE绕过cookie

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

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

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

 

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

相关文章
相关标签/搜索