Skip to content

Lua VM crash when using ngx.exec(), unsafe uri #905

@jayce

Description

@jayce

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions