Well as with any security concern, the level of protection is up to you.
Do you place your scripts in a protected area or do you just leave them out in the open for anyone to play with?
As with anything else, it's up to you to look after your own belongings. There is no hack proof script out there. So take care to put anything that would potentially allow a user to access certain features that may be detrimental in a restricted area where only authorized users are allowed.
If that's not possible, then you need to look at custom solutions rather than relying on free scripts that are public domain.
The real weakness here is that a public domain script, especially ones that are popular as they are easily exploited since the source code is easily gotten ahold of to analyze for vulnerability.
So as long as you use code that is free and not part of a real open source community project (such as a free script left to die on a script archive) then you are chancing a break in by the next script kiddie who finds your toys out in the open.