Code Monkey home page Code Monkey logo

ngx_lua_waf's Introduction

##ngx_lua_waf

ngx_lua_waf是我刚入职趣游时候开发的一个基于ngx_lua的web应用防火墙。

代码很简单,开发初衷主要是使用简单,高性能和轻量级。

现在开源出来,遵从MIT许可协议。其中包含我们的过滤规则。如果大家有什么建议和想fa,欢迎和我一起完善。

###用途:

防止sql注入,本地包含,部分溢出,fuzzing测试,xss,SSRF等web攻击
防止svn/备份之类文件泄漏
防止ApacheBench之类压力测试工具的攻击
屏蔽常见的扫描黑客工具,扫描器
屏蔽异常的网络请求
屏蔽图片附件类目录php执行权限
防止webshell上传

###推荐安装:

推荐使用lujit2.1做lua支持

ngx_lua如果是0.9.2以上版本,建议正则过滤函数改为ngx.re.find,匹配效率会提高三倍左右。

###使用说明:

nginx安装路径假设为:/usr/local/nginx/conf/

把ngx_lua_waf下载到conf目录下,解压命名为waf

在nginx.conf的http段添加

	lua_package_path "/usr/local/nginx/conf/waf/?.lua";
    lua_shared_dict limit 10m;
    init_by_lua_file  /usr/local/nginx/conf/waf/init.lua; 
	access_by_lua_file /usr/local/nginx/conf/waf/waf.lua;

配置config.lua里的waf规则目录(一般在waf/conf/目录下)

    RulePath = "/usr/local/nginx/conf/waf/wafconf/"

绝对路径如有变动,需对应修改

然后重启nginx即可

###配置文件详细说明:

	RulePath = "/usr/local/nginx/conf/waf/wafconf/"
    --规则存放目录
    attacklog = "off"
    --是否开启攻击信息记录,需要配置logdir
    logdir = "/usr/local/nginx/logs/hack/"
    --log存储目录,该目录需要用户自己新建,切需要nginx用户的可写权限
    UrlDeny="on"
    --是否拦截url访问
    Redirect="on"
    --是否拦截后重定向
    CookieMatch = "on"
    --是否拦截cookie攻击
    postMatch = "on" 
    --是否拦截post攻击
    whiteModule = "on" 
    --是否开启URL白名单
    black_fileExt={"php","jsp"}
    --填写不允许上传文件后缀类型
    ipWhitelist={"127.0.0.1"}
    --ip白名单,多个ip用逗号分隔
    ipBlocklist={"1.0.0.1"}
    --ip黑名单,多个ip用逗号分隔
    CCDeny="on"
    --是否开启拦截cc攻击(需要nginx.conf的http段增加lua_shared_dict limit 10m;)
    CCrate = "100/60"
    --设置cc攻击频率,单位为秒.
    --默认1分钟同一个IP只能请求同一个地址100次
    html=[[Please go away~~]]
    --警告内容,可在中括号内自定义
    备注:不要乱动双引号,区分大小写

###检查规则是否生效

部署完毕可以尝试如下命令:

    curl http://xxxx/test.php?id=../etc/passwd
    返回"Please go away~~"字样,说明规则生效。

注意:默认,本机在白名单不过滤,可自行调整config.lua配置

###效果图如下:

sec

sec

###规则更新:

考虑到正则的缓存问题,动态规则会影响性能,所以暂没用共享内存字典和redis之类东西做动态管理。

规则更新可以把规则文件放置到其他服务器,通过crontab任务定时下载来更新规则,nginx reload即可生效。以保障ngx lua waf的高性能。

只记录过滤日志,不开启过滤,在代码里在check前面加上--注释即可,如果需要过滤,反之

###一些说明:

过滤规则在wafconf下,可根据需求自行调整,每条规则需换行,或者用|分割

	args里面的规则get参数进行过滤的
	url是只在get请求url过滤的规则		
	post是只在post请求过滤的规则		
	whitelist是白名单,里面的url匹配到不做过滤		
	user-agent是对user-agent的过滤规则


默认开启了get和post过滤,需要开启cookie过滤的,编辑waf.lua取消部分--注释即可

日志文件名称格式如下:虚拟主机名_sec.log

Copyright

Weibo神奇的魔法师
Forumhttp://bbs.linuxtone.org/
CopyrightCopyright (c) 2013- loveshell
LicenseMIT License

感谢ngx_lua模块的开发者@agentzh,春哥是我所接触过开源精神最好的人

ngx_lua_waf's People

Contributors

harston avatar loveshell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngx_lua_waf's Issues

出现了一个报错requesty body in temp file not supported

    [C]: in function 'get_post_args'
    /usr/local/nginx/conf/waf/waf.lua:53: in function </usr/local/nginx/conf/waf/waf.lua:1>, client: xx, server: xx.com, request: "POST /xx/doPostData HTTP/1.1", host: "xx.com"2014/11/28 14:55:43 [error] 6805#0: *5193969510 lua entry thread aborted: runtime error: /usr/local/nginx/conf/waf/waf.lua:53: requesty body in temp file not supported       stack traceback :           coroutine 0:

似乎fileExtCheck(ext)会过滤通过flash的上传

如题,启用后会拦截部分正常的文件上传请求(discuz的flash批量上传),但是同样的图片,有的时候拦截有的时候又不拦截,很是奇怪,但是基本拦截的全是JPG的

123.150.107.24 [2015-04-17 17:07:05] "POST /misc.php?mod=swfupload&action=swfupload&operation=upload&fid=201" "-" "Shockwave Flash" "file attack with ext JPG"
123.150.107.30 [2015-04-17 17:07:13] "POST /misc.php?mod=swfupload&action=swfupload&operation=upload&fid=201" "-" "Shockwave Flash" "file attack with ext JPG"
123.150.107.24 [2015-04-17 17:07:37] "POST /misc.php?mod=swfupload&action=swfupload&operation=upload&fid=201" "-" "Shockwave Flash" "file attack with ext JPG"
123.150.107.26 [2015-04-17 17:07:44] "POST /misc.php?mod=swfupload&action=swfupload&operation=upload&fid=201" "-" "Shockwave Flash" "file attack with ext JPG"
123.150.107.29 [2015-04-17 17:07:49] "POST /misc.php?mod=swfupload&action=swfupload&operation=upload&fid=201" "-" "Shockwave Flash" "file attack with ext JPG"
123.150.107.25 [2015-04-17 17:08:00] "POST /misc.php?mod=swfupload&action=swfupload&operation=upload&fid=201" "-" "Shockwave Flash" "file attack with ext JPG"
123.150.107.29 [2015-04-17 17:08:05] "POST /misc.php?mod=swfupload&action=swfupload&operation=upload&fid=201" "-" "Shockwave Flash" "file attack with ext JPG"

依旧是日志写入的问题请假

Mac OX 10.8.3 下 跑waf 能正常的执行匹配功能但是 无法写Log,查看nginx的Log和系统log也没有报错。。。。

Nginx的版本信息
/usr/local/nginx/sbin/nginx -V
nginx version: ngx_openresty/1.2.6.6
built by gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-cc-opt=-I/usr/local/Cellar/pcre/8.32/include --add-module=../ngx_devel_kit-0.2.18 --add-module=../echo-nginx-module-0.42 --add-module=../xss-nginx-module-0.03rc9 --add-module=../ngx_coolkit-0.2rc1 --add-module=../set-misc-nginx-module-0.22rc8 --add-module=../form-input-nginx-module-0.07 --add-module=../encrypted-session-nginx-module-0.02 --add-module=../srcache-nginx-module-0.19 --add-module=../ngx_lua-0.7.15 --add-module=../headers-more-nginx-module-0.19 --add-module=../array-var-nginx-module-0.03rc1 --add-module=../memc-nginx-module-0.13rc3 --add-module=../redis2-nginx-module-0.09 --add-module=../redis-nginx-module-0.3.6 --add-module=../auth-request-nginx-module-0.2 --add-module=../rds-json-nginx-module-0.12rc10 --add-module=../rds-csv-nginx-module-0.05rc2 --with-ld-opt='-Wl,-rpath,/usr/local/luajit/lib -L/usr/local/Cellar/pcre/8.32/lib' --with-http_ssl_module

修改了配置
--configuration
logpath='logs'
rulepath='conf/waf/wafconf/'
syslogserver='127.0.0.1'
filext=''

前端部署问题

这个waf 可以配置在Nginx反向代理和proxy_cache缓存搭 服务器上面 保护后端的web server服务器吗

post body 中如果有一个域填写的信息有 # 号,waf.lua 脚本无法分析 post body。

出错信息如下:

2014/04/08 17:10:05 [error] 7252#0: *2669795 lua entry thread aborted: runtime error: /usr/local/nginx/conf/conf.d/waf/waf.lua:52: requesty body in temp file not supported
stack traceback:
coroutine 0:
[C]: in function 'get_post_args'
/usr/local/nginx/conf/conf.d/waf/waf.lua:52: in function </usr/local/nginx/conf/conf.d/waf/waf.lua:1>, client: x.x.x.x, server: www.udee.cn, request: "POST /url HTTP/1.1", host: "www.udee.cn", referrer: ""

postmatch开启后无法正常上传

首先感谢您开发的ngx_lua_waf插件。
我下载了最新的代码包,并按照流程装好了这个插件,能正常启动和拦截,我主要应用在discuz x2程序上。
但发现一个问题(可能是因为我不懂配置您这个插件),我只要将config.lua中的postmatch设为on,会员就无法上传论坛附件(登陆访问我们的网站均正常),即使我把wafconf/post文件内容清空也是一样。目前只能将此项设为off,但这样防护效果肯定就打折扣了。
由于我不懂lua语法,因此想请问您是什么原因,感谢!

master分支 init.lua报错

你好,我下载了你的master分支,使用的是openresty,配置好后,根据你提供的测试地址,直接报错,麻烦看下什么问题?

2015/04/01 11:12:22 [error] 13860#0: 1 lua entry thread aborted: runtime error: /usr/local/openresty/nginx/conf/waf/init.lua:130: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
coroutine 0:
[C]: in function 'pairs'
/usr/local/openresty/nginx/conf/waf/init.lua:130: in function 'ua'
/usr/local/openresty/nginx/conf/waf/waf.lua:11: in function </usr/local/openresty/nginx/conf/waf/waf.lua:1>, client: 192.168.1.108, server: 192.
, request: "GET /test.php?id=../etc/passwd HTTP/1.1", host: "192.168.1.35:6110"

内存满了

你好 我在Linux+nginx上上了个模块 跑了几个星期 发现内存满了 请问有什么解决方法。

有空能否实现cookie验证和302跳转功能呢

我看了waf中的CookieMatch = "on",只是做cookie的过滤,能否根据ip对每个客户端发送一个随机的Cookie串来进行Cookie的验证呢。
另外对于一些Url访问如果超出限制,希望能通过302到指定地址,而不是返回403,不知道可不可以。

ngx_lua_waf 报错

防火墙日志里面没报错信息,nginx日志里面提示invalid value (boolean) at index 1 in table for 'concat' ,请问有解决方法吗? 我们公司在使用的时候是通过添加whiteurl跳过这个报错,我想问的是为什么会出现这种报错,有更好的处理办法吗?

日志问题

Hi loveshell!

不要意思,打扰一下,我的问题其实和前面某人的一样,日志没法写,

我把那段lua通过ffi调C的程序,拿出来,在本机(Mac 10.8)跑了下,如果文件没创建,则不行,如果我自己已经创建了文件,则该文件也只能写入,不能追加,看来是C的open的写文件模式的问题。表示努力在看。

不过看前面的,好像CentOS是可以,晕。

Ps.为什么不采用lua的文件读写,而去使用C的IO呢?速度么?

感觉如果这个模块都是C来写,而中间的配置文件是lua,感觉会更好..

主要前面的那个issue已经closed掉了, 所以我新开个issue来问问。

这是个很赞的模块...

虚心请教下loveshell关于ngx_lua_waf配置文件如何配置比较妥当

HI loveshell:

首先非常感谢你分享该软件:

是这样的,最近我们网站遭到黑客注入攻击,所有站点目录都被植入恶意代码,甚至页面内容都换掉。
于是找到了这个软件,配置上去了,然后遇到些问题,恶意传参是拦截掉了,但是发现我们网站后台更新甚至用户发布产品也没法更新,也一起被拦截掉。

于是我又仔细看了说明文件,说明文件可能是老版本的,和现在新版下载下来文件,说明文件有点对不上,能否恳求作者能否把配置文件做详细说明教程一下,具体应该怎么配置比较妥当,怎么配置才能防止客户正常提交表单不会被屏蔽掉。
ps:我现在暂时凭感觉把UrlDeny和postMatch, off掉了,后台更新暂时没问题。

还有由于我刚从事运维不久,经验还不丰富,希望可以的话,能否留个联系方式,我想等你有空的时候,请教请教你。

waf.ini another need fix part.

tail /var/log/nginx/error.log
2015/07/28 16:19:12 [error] 3042#0: *19459 lua entry thread aborted: runtime error: /usr/local/nginx/conf/waf/waf.lua:73: invalid value (boolean) at index 1 in table for 'concat'
stack traceback:
coroutine 0:
[C]: in function 'concat'
/usr/local/nginx/conf/waf/waf.lua:73: in function </usr/local/nginx/conf/waf/waf.lua:1>, client: 172.16.16.162, server: xxxxx.com, request: "POST /xxxx.svc HTTP/1.1", host: "xxxxx.com"
2015/07/28 16:23:08 [error] 3041#0: *19966 lua entry thread aborted: runtime error: /usr/local/nginx/conf/waf/waf.lua:73: invalid value (boolean) at index 1 in table for 'concat'
stack traceback:
coroutine 0:
[C]: in function 'concat'
/usr/local/nginx/conf/waf/waf.lua:73: in function </usr/local/nginx/conf/waf/waf.lua:1>, client: 172.16.16.x, server: ywfw.qbjggzy.com, request: "POST /xxxxxx.svc HTTP/1.1", host: "xxxxx.com"

fix method just see this:

3b12567

please fix it.

by softbug.

默认配置无法过滤Cookie

在config.lua中
CookieMatch="on"

在init.lua中
CookieCheck = optionIsOn(cookieMatch)

大小写问题会导致CookieCheck 一直为false,cookie检测就会失效了。

vhost的单独设置问题

init_by_lua_file和access_by_lua_file能否写在server标签里面,这样方便每个vhost有自己的独立的过滤列表.

上传文件post请求被拦截

上传图片时候,图片内容log打印出来是乱码,匹配的规则显示:rule=../
有的图片是正常的,有些图片被拦截,这是bug么?

POST提交会报错

2013/12/18 22:43:20 [error] 32488#0: *735 lua entry thread aborted: runtime error: /usr/local/openresty/nginx/conf/waf/waf.lua:52: requesty body in temp file not supported
stack traceback:
coroutine 0:
[C]: in function 'get_post_args'
/usr/local/openresty/nginx/conf/waf/waf.lua:52: in function </usr/local/openresty/nginx/conf/waf/waf.lua:1>, client:

how to debug?

Hello,
我从master分支下载了最新的代码,看到里面有过滤user agent的配置,
于是我使用curl -A "nmap" test.com 传入agent为nmap,但是没有被拦截,也没有日志记录,
想问一下如何debug这些代码? 谢谢

补充: 我是将nginx作为前端,将请求proxy_pass到后端apache的。

errr.log: lua tcp socket read timed out

error.log 出现以下日志:
2014/01/17 16:01:18 [error] 6959#0: *33513418 lua tcp socket read timed out, client: 220.176.36.15, server: www.xxx.com, request: "POST //common/%3C!DOCTYPE%20html%20PUBLIC%20%22-//W3C//DTD%20XHTML%201.0%20Transitional//EN%22%20%22http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22%3E%3Chtml%20xmlns=%22http://www.w3.org/1999/xhtml%22%3E%3Chead%3E%3Cmeta%20http-equiv=%22Content-Type%22%20content=%22text/html;%20charset=utf-8%22%20/%3E%3Ctitle%3E%E7%81%AB%E7%BB%92%E4%B8%8A%E7%BD%91%E4%BF%9D%E6%8A%A4%3C/title%3E%3Cstyle%3E.tip-box%7Bwidth:698px;border:1px%20solid%20 HTTP/1.1", host: "xxx.xxx.com", referrer: "http://xxx.xxx.com//common/ResourceUpload.jsp?fileTotalMax=5&inputFileShow=5&ifrParent=ifrUploadPhoto"
2014/01/17 16:01:21 [error] 6959#0: *33513418 lua tcp socket read timed out, client: 220.176.36.15, server: www.xxx.com, request: "POST //common/%3C!DOCTYPE%20html%20PUBLIC%20%22-//W3C//DTD%20XHTML%201.0%20Transitional//EN%22%20%22http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22%3E%3Chtml%20xmlns=%22http://www.w3.org/1999/xhtml%22%3E%3Chead%3E%3Cmeta%20http-equiv=%22Content-Type%22%20content=%22text/html;%20charset=utf-8%22%20/%3E%3Ctitle%3E%E7%81%AB%E7%BB%92%E4%B8%8A%E7%BD%91%E4%BF%9D%E6%8A%A4%3C/title%3E%3Cstyle%3E.tip-box%7Bwidth:698px;border:1px%20solid%20 HTTP/1.1", host: "xxx.xxx.com", referrer: "http://xxx.xxx.com//common/ResourceUpload.jsp?fileTotalMax=5&inputFileShow=5&ifrParent=ifrUploadPhoto"
2014/01/17 16:01:24 [error] 6959#0: *33513418 lua tcp socket read timed out, client: 220.176.36.15, server: www.xxx.com, request: "POST //common/%3C!DOCTYPE%20html%20PUBLIC%20%22-//W3C//DTD%20XHTML%201.0%20Transitional//EN%22%20%22http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22%3E%3Chtml%20xmlns=%22http://www.w3.org/1999/xhtml%22%3E%3Chead%3E%3Cmeta%20http-equiv=%22Content-Type%22%20content=%22text/html;%20charset=utf-8%22%20/%3E%3Ctitle%3E%E7%81%AB%E7%BB%92%E4%B8%8A%E7%BD%91%E4%BF%9D%E6%8A%A4%3C/title%3E%3Cstyle%3E.tip-box%7Bwidth:698px;border:1px%20solid%20 HTTP/1.1", host: "xxx.xxx.com", referrer: "http://xxx.xxx.com//common/ResourceUpload.jsp?fileTotalMax=5&inputFileShow=5&ifrParent=ifrUploadPhoto"

访问日志貌似是这样的:
220.176.36.15 - - [16/Jan/2014:12:17:23 +0800] "POST //common/ResourceUpload.jsp?fileTotalMax=5&inputFileShow=5&ifrParent=ifrUploadPhoto HTTP/1.1" 200 1757 "resourceStatus=-1&sucessCount=0&failCount=5&Id=24320953&dateTimeLong=1389845842755&loginName=&fileType=image&webPath=24320%2F24320953%2F&ciphertext=2d02ac82668e006b80b31bcec7d66522&resourceMsg=%C9%CF%B4%AB%D2%EC%B3%A3%A3%AC%C3%BB%D3%D0%CE%C4%BC%FE%B3%C9%B9%A6%C9%CF%B4%AB%A3%A1" "http://upload.xxx.com/UploadFile?Id=24320953&dateTimeLong=1389845842755&ciphertext=2d02ac82668e006b80b31bcec7d66522&smallImg=1&sw=120&sh=120&fileSizeMax=307200&fileCount=5" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)" "-"

好像一直在死循环

nginx 500

Hi loveshell:
nginx 日志中报如下错误,是哪儿的问题 ?
lua entry thread aborted: runtime error: /etc/nginx/waf.lua:14: bad argument #1 to 'unescape_uri' (string expected, got table)
望告知,感谢!

如何看规则已生效

hi,loveshell

我按照readme的介绍配置了lua_waf,怎么看规则已经生效了呢?log目录也建了,但是ms没有日志,权限已赋,谢谢

一段不明白的代码,变量总是true

local boundary = get_boundary()
if boundary then
local len = string.len
local sock, err = ngx.req.socket()
if not sock then
return
end
ngx.req.init_body(128 * 1024)
sock:settimeout(0)
local content_length = nil
content_length=tonumber(ngx.req.get_headers()['content-length'])
local chunk_size = 4096
if content_length < chunk_size then
chunk_size = content_length
end
local size = 0
while size < content_length do
local data, err, partial = sock:receive(chunk_size)
data = data or partial
if not data then
return
end
ngx.req.append_body(data)
size = size + len(data)
local less = content_length - size
if less < chunk_size then
chunk_size = less
end
end
ngx.req.finish_body()
if body(data) then
return true
end
上面这段boundary if块不知道是用什么用的,我post的时候总是会进入到这里来,然后我调试了一下,主要是读取post内容的,然后用body方法检查post的数据是否符合规则,我的调试后的理解是这样的,但是这里明显有一个错误,就是在while块里面data是个临时变量,出了while肯定会是nil ,这样body方法就会报错了。希望说明下这个data,或者这一整段代码的作用

提几个需求建议。。

因为时差关系,昨天睡觉了。今天起来看昨天那个issue就被关掉了。。。
用了waf 一天多了,感觉还是有几个需要增强的地方

  1. 对query_string做过滤。这个用途比较广
    比如现在很多网站用nginx 来check refer来防盗链。我发现很多盗链的采用
    http://*/jpg?0.190819083 这样类似的方式来破解盗链。
  2. 可以针对query_string之类的做白名单
    3.增加learning模式。比如开启后可以搜集网站上被访问过的php以及query_string,然后生成过滤规则。只要对不在规则内的php访问即deny
    4.性能优化。。。。
    5.上传文件误杀改进。。。

PS:乌云上这个貌似还没修正掉?
http://wooyun.org/bugs/wooyun-2010-0104525

关于复杂规则嵌套的问题

现在的匹配规则的时候,比方说是args规则文件中的规则,只要是匹配上了就会拦截。但是如果args中有些规则是必须满足一定条件,才会生效的。这种情况下,有没有好的解决办法呢?例如:必须是http1.0协议下才会生效的规则,在http1.1的时候是无用的。我现在想的是,对特殊的嵌套规则,在函数中做特殊处理。但感觉不是很好,并且这样做感觉重用性不是很高,不知道您是否有解决的办法呢?

内存泄露问题

为什么我的nginx加入waf支持后内存增长的厉害,把能off的都off了还是老样子,求指教

post的时候,是不是文字太多就会有错误。

@loveshell 感谢你的辛苦劳动。
我是把这个WAF安装在discuz X3.1前面的,论坛GBK编码,clone这里最新的代码。
但最近发现当用户发贴时,字数超过4-5千时,就老是出现500错误。
hack目录下的日志也没有任何记录。
后来我禁了waf,用同样的文章发表成功。

你好,我们服务器出现了一个这样的报错( runtime error:'unescape' (string expected, got boolean))

2014/09/10 15:26:46 [error] 20410#0: *1005323490 lua entry thread aborted: runtime error: /usr/local/nginx/conf/waf/init.lua:136: bad argument #1 to 'unescape' (string expected, got boolean)
stack traceback:
coroutine 0:
[C]: in function 'unescape'
/usr/local/nginx/conf/waf/init.lua:136: in function 'body'
/usr/local/nginx/conf/waf/waf.lua:47: in function </usr/local/nginx/conf/waf/waf.lua:1>,
request: "POST /action/appAction.php HTTP/1.1",

2014/09/10 12:36:10 [error] 20411#0: *1004436654 lua entry thread aborted: runtime error: /usr/local/nginx/conf/waf/init.lua:136: bad argument #1 to 'unescape' (string expected, got boolean)
stack traceback:
coroutine 0:
[C]: in function 'unescape'
/usr/local/nginx/conf/waf/init.lua:136: in function 'body'
/usr/local/nginx/conf/waf/waf.lua:47: in function </usr/local/nginx/conf/waf/waf.lua:1>, request: "POST /action/appAction.php HTTP/1.1"

偶尔会发生,我们一直很困扰这个问题。

nginx报错

默认通过sh安装,虚拟机搭建的centos6.5 nginx转发流程到testphp.vulnweb.com,使用的是WVS扫描

不影响使用,就是想咨询一下,非常感谢
nginx错误日志
[error] 9137#0: _5980 lua entry thread aborted: runtime error: /usr/local/nginx/conf/waf/waf.lua:73: invalid value (boolean) at index 1 in table for 'concat'
stack traceback:
coroutine 0:
[C]: in function 'concat'
/usr/local/nginx/conf/waf/waf.lua:73: in function </usr/local/nginx/conf/waf/waf.lua:1>, client: 192.168.60.1, server: testphp.vulnweb.com, request: "POST //xmlrpc.php HTTP/1.1", host: "192.168.60.128
WAF的日志中记录
192.168.60.1 [2015-06-19 16:13:03] "POST testphp.vulnweb.com//xmlrpc" ""1.0"?>

]> " "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.63 Safari/537.36" "(?:etc\/\W_passwd)"

init.lua:169: in function 'denycc' 开启CC攻击防御报错

[C]: in function 'get'
/usr/local/nginx/modules/ngx_lua_waf-master/init.lua:169: in function 'denycc'
/usr/local/nginx/modules/ngx_lua_waf-master/waf.lua:5: in function </usr/local/nginx/modules/ngx_lua_waf-master/waf.lua:1>, client: 192.168.33.1, server: openresty.mkfree.com, request: "GET /lua-waf-cc HTTP/1.1", host: "openresty.mkfree.com"
2013/11/28 15:21:25 [error] 8294#0: *401 lua entry thread aborted: runtime error: /usr/local/nginx/modules/ngx_lua_waf-master/init.lua:169: bad argument #1 to 'get' (string expected, got nil)
stack traceback:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.