Skip to content

Security Issues associated with Debug Library Functions debug.getinfo and debug,traceback #354

@GINUGEORGE

Description

@GINUGEORGE

Security Issues associated with Debug Library Functions debug.getinfo and debug,traceback

WRT https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-19391

debug.getinfo has a type confusion issue that leads to arbitrary memory write or read operations, because certain cases involving valid stack levels and > options are mishandled.

NOTE: The LuaJIT project owner states that the debug libary is unsafe by definition and that this is not a vulnerability. When LuaJIT was originally developed, the expectation was that the entire debug library had no security guarantees and thus it made no sense to assign CVEs. However, not all users of later LuaJIT derivatives share this perspective.

WRT https://www.lua.org/pil/23.html

Unlike the other libraries, you should use the debug library with parsimony. First, some of its functionality is not exactly famous for performance. Second, it breaks some sacred truths of the language, such as that you cannot access a local variable from outside the function that created it.

WRT http://lua-users.org/wiki/DebugLibraryTutorial

6.10 – The Debug Library

This library provides the functionality of the debug interface to Lua programs. You should exert care when using this library. Several of its functions violate basic assumptions about Lua code (e.g., that variables local to a function cannot be accessed from outside; that userdata metatables cannot be changed by Lua code; that Lua programs do not crash) and therefore can compromise otherwise secure code. Moreover, some functions in this library may be slow.

Also Refer LuaJIT/LuaJIT#526.

As per the above excerpts, debug library functions should be avoided using in Production Environments. But in the turbo lua source code, we can see that certain debug library functions such as debug.getinfo and debug.traceback have been used in the below mentioned files :

debug.traceback - https://github.com/kernelsauce/turbo/blob/master/turbo/ioloop.lua#L524

debug.getinfo - https://github.com/kernelsauce/turbo/blob/master/turbo/log.lua#L284

Is it safe to use these functions in the Production Environment ? Please justify the usage and share your suggestions/inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions