You can bypass “attempt to run function in a different lua vm” for parallel and serial by using bindableevents and bindablefunctions by cloning a module and parenting it to an actor and then requiring it
I believe that this error is the same reason that you need to use BindableFunctions for interacting with Core Scripts through StarterGui:SetCore. This isn’t a security vulnerability from my understanding, but rather that Luau VMs cannot call functions defined in other VMs because of technical limitations, and Bindables call the function through the correct VM instead.
The way that I’m doing it shouldn’t be possible normally, you shouldn’t be able to use bindable functions and bindable events to bypass that limitation set, you’re introducing a function from a completely separate Luau VM and running it in another Luau VM.
Like look here for example, when i try to do it this way, it provides me with the Attempt to load a function from a different Lua VM error, while the one I’m reporting does not and runs the function anyway.
local BF = Instance.new("BindableFunction")
BF.OnInvoke = function(F,...)
return F(...)
end
return function(...)
print(_G.Value)
return BF:Invoke(...)
end
Shows:
Whereas,
_G.Value = 42
print(_G.Value)
local actorScript = script.ActorScript:Clone()
local actor = Instance.new("Actor")
actorScript.Parent = actor
actor.Parent = workspace
task.wait()
actor:SendMessage("Run")
and Module (now a Script called ActorScript),
if not script.Parent:IsA("Actor") then
return
end
script.Parent:BindToMessageParallel("Run", function()
print(_G.Value)
end)
Gives:
, because the original script calling :ConnectParallel did not do so under an Actor, you simply called the function indirectly in the same VM through the Module and BindableFunction. You never entered a new VM or the Parallel Phase, which also does not support calling BindableFunction:Invoke
Modules do not run in a different VM from the requiring script, although script:GetActor() returns the actor and task.desynchronize/synchronize appear to work, it doesn’t actually run in a different VM, like @5eri_n states.
I guess you could report the ability to desynchronize as a bug, but it doesn’t appear to be a vulnerability.
As @5eri_n has mentioned, the ModuleScript is actually using the same VM as the function that is being called.
So, as far as I can tell, the behavior being reported is actually as designed. I think this report can be safely closed as “By Design”.
Although if there are any special edge cases (@averlst mentioned “the ability to desynchronize as a bug”) that are still considered suspicious, they may potentially indicate a bug. So please do let me know if there are even more elaborate repro cases that are potentially indicative of a bug.