Hey, this is now patched. This should no longer be used in games as Celery patched this detection.
We all heard of the new Celery
exploit, and the detection made by my good friend @Unlimited_Objects!
So I found another incredible detection, but this time it involves MessageBusService and Weak Tables!
Celery devs are unaware of weak tables and garbage collection, so we can use that to our advantage.
To detect it, we will abuse the fact that Celery doesn’t remove references after hooking functions in their Init Script! This means we can check if they reference that, and well, detect Celery.
while true do
local MessageBusService = game:GetService("MessageBusService") --> Get MessageBusService
local OurWeakTable = setmetatable({MessageBusService}, { __mode = "v" }) --> Checks if MessageBusService is referenced
MessageBusService = nil --> Remove the reference, so normally, no scripts are referencing it
task.wait(4.5) --> Wait for garbage collection! Very Important! (This can be done more efficiently but this is just a showcase, not a guide on how to make anti-exploits)
if OurWeakTable[1] then --> If the value didn't get garbage collected, it means Celery is attached (Init Script ran)!
warn("Detected!")
end
end
Keep in mind that this is a very simple detection! I have approximately 4-5 Celery detections ATM, due to how gracefully they secure the exploit (and their Init Script).
For people saying “They can hook the setmetatable”, “They can hook the GetService”, or “They can hook the task.wait”, I’m not going to explain to you how to make an anti-exploit, this is meant to be added to an anti-exploit. Also hooking those functions (if not done correctly) would just crash/make the game unplayable (CoreGuis freezing for example)
Also, This isn’t the best way to do weak tables, but this is just a showcase of how it can be done!
Finally: This detection requires you to not reference MessageBusService
anywhere in your game (If you have no idea whether you are referencing it or not, you probably don’t reference it)