Which capabilities to give a sandboxed free model
A sandbox only protects your game if it grants little. Why Network, DataStore, AssetRequire and AccessOutsideWrite let a backdoor back in.
What it looks like
The game uses script capabilities to sandbox a model it didn't write, such as a Creator Store prop or a sponsor's booth, but grants the sandbox far more than the model needs. Network, data stores, loading assets, running strings, reaching outside the sandbox or changing capabilities are the usual over-grants, often added one by one to silence "lacking capability" errors.
booth.Sandboxed = true booth.Capabilities = SecurityCapabilities.new( Enum.SecurityCapability.RunServerScript, Enum.SecurityCapability.Network, Enum.SecurityCapability.AccessOutsideWrite )
What an exploiter could do
If the model holds a backdoor, the sandbox is what stops it. With Network it can send the server's details out or fetch instructions. With DataStore it can read or change any player's saved data. With AssetRequire or LoadString it can run code its creator changes at will, and with AccessOutsideWrite it can reach the game's remotes, scripts and players. A sandbox that grants these gives the backdoor nearly the same reach as an unsandboxed one, while the team believes the model is contained.
How to fix it
- Start from no capabilities, add only what the model's scripts need to run, and test until the errors stop. Usually that's
RunServerScriptorRunClientScript,Basicand one or two ofUI,Physics,AudioorAnimation. - Never grant
Network,DataStore,AssetRequire,LoadString,CapabilityControlorAccessOutsideWriteto a model the team didn't write. If it seems to need one, read its scripts first, then move that work into the game's own code and talk to the model through aBindableEvent. - Set
SandboxedandCapabilitieson the model before it's parented where its scripts can run.
Vulnerable example
local ServerStorage = game:GetService("ServerStorage") local Workspace = game:GetService("Workspace") local fountain = ServerStorage.Toolbox.Fountain:Clone() fountain.Sandboxed = true fountain.Capabilities = SecurityCapabilities.new( Enum.SecurityCapability.RunServerScript, Enum.SecurityCapability.Basic, Enum.SecurityCapability.Physics, Enum.SecurityCapability.CreateInstances, Enum.SecurityCapability.AccessOutsideWrite, Enum.SecurityCapability.DataStore, Enum.SecurityCapability.AssetRequire ) fountain.Parent = Workspace
Fixed example
local ServerStorage = game:GetService("ServerStorage") local Workspace = game:GetService("Workspace") local fountain = ServerStorage.Toolbox.Fountain:Clone() fountain.Sandboxed = true fountain.Capabilities = SecurityCapabilities.new( Enum.SecurityCapability.RunServerScript, Enum.SecurityCapability.Basic, Enum.SecurityCapability.Physics, Enum.SecurityCapability.CreateInstances ) fountain.Parent = Workspace
The fountain only makes and moves water parts inside itself, so it gets nothing that reaches outside the model.
How to spot this in your own scripts, and the cases that only look like it, are part of the Luaudit check your AI runs.