openresty / openresty/lua-nginx-module
Lua VM crash when using ngx.exec(), unsafe uri
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
See crash point: ngx_http_lua_control.c.
this code return NGX_HTTP_INTERNAL_SERVER_ERROR; causes the VM to crash.
detail:
- version openresty-1.9.7.3 and ngx_lua-0.10.0
- system log
Oct 28 15:11:18 f02 kernel: nginx[14476]: segfault at 140d92420 ip 00007fe7f20ee40d sp 00007fff66396f20 error 4 in libluajit-5.1.so.2[7fe7f20e5000+c1000]
Oct 28 15:11:39 f02 kernel: nginx[14489]: segfault at 141380a48 ip 00007fe7f20ee40d sp 00007fff66396ea0 error 4 in libluajit-5.1.so.2[7fe7f20e5000+c1000]
Oct 28 15:11:59 f02 kernel: nginx[14486]: segfault at 141eb8f10 ip 00007fe7f20ee40d sp 00007fff66396ea0 error 4 in libluajit-5.1.so.2[7fe7f20e5000+c1000]
- nginx log
2016/11/02 17:24:22 [error] 21115#0: *60 unsafe URI "/error_page/../" was detected *******
- configure
location / {
content_by_lua_block {
ngx.log(ngx.ERR, "/error_page/ ")
return ngx.exec("/error_page/../")
}
}
- test command
wget http://localhost/ -SO/dev/null
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/ngx_http_lua_control.c at lines 110-112 and reproduce the report using the shown location block, unsafe URI, and wget command. Review the nginx and system logs while tracing the ngx.exec() path. Done means the unsafe URI request no longer crashes the Lua VM or nginx.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua, nginx
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100