So I’m making an antivirus plugin, and I want it to not search for when the code is requiring a modulescript. It’s working all fine, also the way I’m doing this is string.match and patterns.
But the only issue is that people can do id+0 , id-0 , id*1 , id+1-1 and more.
How would I fix this?
I’m creating an antivirus plugin. And I only want it to search for viruses that are passing a number with require, so far it’s working completely fine.
The only issue is that it can easily be bypassed by using this:
It’d probably be best to create a sandboxed environment with a custom require function.
If you want to be lazy, you could just add something like to the top of the code
require = function() end
or like
allowedRequires = {
[123] = true,
[0xc0ff3bad] = true,
[789] = true
}
realRequire = require
require = function(id)
if allowedRequires[id] then
return realRequire(id)
end
end
-- code continues...
There might be ways around this though, so running your code in a properly sandboxed environment would probably be best