fully fixed ghxx exploit
This commit is contained in:
@@ -3,15 +3,16 @@ local args={...}
|
|||||||
local kernel=args[1]
|
local kernel=args[1]
|
||||||
kernel._G=_G
|
kernel._G=_G
|
||||||
|
|
||||||
local function fixstupidghxxexploit(tbl)
|
local function readonly(tbl)
|
||||||
return setmetatable({}, {
|
return setmetatable({}, {
|
||||||
__index = function(t,k)
|
__index = function(_, key)
|
||||||
if type(tbl[k])=="table" then
|
local value = tbl[key]
|
||||||
return fixstupidghxxexploit(tbl[k])
|
if type(value) == "table" then
|
||||||
else
|
return readonly(value)
|
||||||
return tbl[k]
|
|
||||||
end
|
end
|
||||||
|
return value
|
||||||
end,
|
end,
|
||||||
|
|
||||||
__newindex = function(t,k,v)
|
__newindex = function(t,k,v)
|
||||||
if kernel.config.allowGlobalOverwrites or kernel.allowGlobalOverwrites then
|
if kernel.config.allowGlobalOverwrites or kernel.allowGlobalOverwrites then
|
||||||
rawset(tbl,k,v)
|
rawset(tbl,k,v)
|
||||||
@@ -19,11 +20,40 @@ local function fixstupidghxxexploit(tbl)
|
|||||||
end
|
end
|
||||||
error("Attempt to modify global variable '"..k.."'",2)
|
error("Attempt to modify global variable '"..k.."'",2)
|
||||||
end,
|
end,
|
||||||
__metatable = false
|
|
||||||
|
__pairs = function()
|
||||||
|
local function iter(_, key)
|
||||||
|
local nextKey, value = next(tbl, key)
|
||||||
|
if type(value) == "table" then
|
||||||
|
value = readonly(value)
|
||||||
|
end
|
||||||
|
return nextKey, value
|
||||||
|
end
|
||||||
|
return iter, tbl, nil
|
||||||
|
end,
|
||||||
|
|
||||||
|
__ipairs = function()
|
||||||
|
local i = 0
|
||||||
|
return function()
|
||||||
|
i = i + 1
|
||||||
|
local value = tbl[i]
|
||||||
|
if value == nil then return end
|
||||||
|
if type(value) == "table" then
|
||||||
|
value = readonly(value)
|
||||||
|
end
|
||||||
|
return i, value
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
__len = function()
|
||||||
|
return #tbl
|
||||||
|
end,
|
||||||
|
|
||||||
|
__metatable = false,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
kernel._U=fixstupidghxxexploit(kernel._G)
|
kernel._U=readonly(kernel._G)
|
||||||
kernel.allowGlobalOverwrites=true
|
kernel.allowGlobalOverwrites=true
|
||||||
kernel._U._G=kernel._U
|
kernel._U._G=kernel._U
|
||||||
kernel.allowGlobalOverwrites=false
|
kernel.allowGlobalOverwrites=false
|
||||||
Reference in New Issue
Block a user