fixed ghxx exploit
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
--:Minify:--
|
||||
local kernel = ...
|
||||
|
||||
local timeout=false
|
||||
kernel.processes.keventd = function()
|
||||
while true do
|
||||
local event = {kernel.computer:getMachineEvent()}
|
||||
@@ -13,6 +14,12 @@ kernel.processes.keventd = function()
|
||||
end
|
||||
end
|
||||
kernel.io.pushEvent("raw", table.unpack(event))
|
||||
timeout=false
|
||||
else
|
||||
timeout=true
|
||||
end
|
||||
if timeout then
|
||||
sleep(.05)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2,17 +2,28 @@
|
||||
local args={...}
|
||||
local kernel=args[1]
|
||||
kernel._G=_G
|
||||
kernel._U=setmetatable({},{
|
||||
__index = kernel._G,
|
||||
__newindex = function(t,k,v)
|
||||
if kernel.config.allowGlobalOverwrites or kernel.allowGlobalOverwrites then
|
||||
rawset(t,k,v)
|
||||
return
|
||||
end
|
||||
error("Attempt to modify global variable '"..k.."'",2)
|
||||
end,
|
||||
__metatable = false
|
||||
})
|
||||
|
||||
local function fixstupidghxxexploit(tbl)
|
||||
return setmetatable({},{
|
||||
__index = function(t,k)
|
||||
if type(tbl[k])=="table" then
|
||||
return fixstupidghxxexploit(tbl[k])
|
||||
else
|
||||
return tbl[k]
|
||||
end
|
||||
end,
|
||||
__newindex = function(t,k,v)
|
||||
if kernel.config.allowGlobalOverwrites or kernel.allowGlobalOverwrites then
|
||||
rawset(tbl,k,v)
|
||||
return
|
||||
end
|
||||
error("Attempt to modify global variable '"..k.."'",2)
|
||||
end,
|
||||
__metatable = false
|
||||
})
|
||||
end
|
||||
|
||||
kernel._U=fixstupidghxxexploit(kernel._G)
|
||||
kernel.allowGlobalOverwrites=true
|
||||
kernel._U._G=kernel._U
|
||||
kernel.allowGlobalOverwrites=false
|
||||
@@ -39,7 +39,7 @@ function sys.spawn(func, name, envars, args, tgid)
|
||||
status="R",
|
||||
pid=id,
|
||||
tgid=tgid or kernel.currentTask.tgid,
|
||||
user=kernel.user,
|
||||
username=kernel.username,
|
||||
uid=kernel.uid,
|
||||
fd={},
|
||||
exit="",
|
||||
@@ -86,7 +86,7 @@ function sys.getTask(pid)
|
||||
status=task.status,
|
||||
pid=task.pid,
|
||||
tgid=task.tgid,
|
||||
user=task.user,
|
||||
username=task.username,
|
||||
uid=task.uid,
|
||||
exit=task.exit,
|
||||
sleep=task.sleep,
|
||||
@@ -302,7 +302,7 @@ function kernel.main()
|
||||
end
|
||||
if task.status == "R" then
|
||||
kernel.currentTask = task
|
||||
kernel.user = task.user
|
||||
kernel.username = task.username
|
||||
kernel.uid = task.uid
|
||||
kernel.process = task.name
|
||||
N = N + 1
|
||||
@@ -331,14 +331,14 @@ function kernel.main()
|
||||
if elapsed >= Tmax then Tmax_hit = Tmax_hit + 1 end
|
||||
|
||||
-- handle task results
|
||||
if ret[1] == "error" then
|
||||
if ret[1] == "error" or ret[1]==false then
|
||||
kernel.log("processHandlerException: "..ret[2], "ERROR", 2)
|
||||
task.status = "Z"
|
||||
task.exit = "processHandlerException: "..ret[2]
|
||||
elseif ret[1] == "timeout" then
|
||||
task.ivs=task.ivs+1
|
||||
task.syscallReturn = {}
|
||||
elseif ret[1] == "success" then
|
||||
elseif ret[1] == "success" or ret[1] == true then
|
||||
task.vs=task.vs+1
|
||||
if ret[2]=="syscall" then
|
||||
if kernel.syscalls[ret[3]] then
|
||||
|
||||
@@ -25,7 +25,7 @@ kernel.tasks["1"] = {
|
||||
status="R",
|
||||
pid=1,
|
||||
tgid=1,
|
||||
user="root",
|
||||
username="root",
|
||||
uid=0,
|
||||
fd={},
|
||||
envars={},
|
||||
|
||||
Reference in New Issue
Block a user