Backdoor prevention?

Is there any way to prevent those require(assetid) MainModule script exploits? Currently running into a issue with them and don’t know the proper way to patch them. This is my script on how I currently do them. Is there anything I can do to improve? Because right now all I do if figure out the model it spawns and then just destroy it from the game.

--> Services
local Players = game:GetService("Players")

workspace.ChildAdded:Connect(function(object)
	if object.Name == "a" then
		for _, children in object:GetChildren() do
			children:Destroy()
		end
		object:Destroy()
	end
end)
1 Like

Identify what plugins are inserting them in the first place.

You have a malicious plugin or model installed.

1 Like

They are more like command bar executables, like people who have an executer or access to developer console command bar. Heres an image showcasing what I mean

1 Like

You can prevent them completely by identifying the malicious plugin or model causing them. Most likely its a malicious plugin someone in your development team is using or something weird you inserted.

You can’t prevent them by simply looking for strings such as require(id) using in-game code. This is for two reasons, one is that in-game code can’t see script contents, the other is that those people use very creative ways to run require(id) so they avoid regex detection.

1 Like

run this in the command bar, it will print all of the requiring of asset IDs. You could change it to remove them:

for _, script in next, game:GetDescendants(), nil do
    --modules dont count as base scripts
    if not script:IsA("BaseScript") and not script:IsA("ModuleScript") then continue end

    if string.match(script.Source, "require%(%d+%)") then
        print("Requiring of asset ID found in script", script:GetFullName())
    end
end

this could at least help you locate the malicious items, and also whether it’s a plugin or not.

2 Likes