Control Filesystem Permissions Users need to execute CGI scripts, but there is no reason for them to have read or write permissions. Safe CGI programs provide a powerful mechanism for enhancing the quality and usefulness of your Web page. They also open the door for hackers to exploit your script to do their dirty work. The biggest danger with CGI programs, is letting a string sent from the browser be interpreted by a Unix shell on the server. This can happen quite innocently.
Most people code CGI mail programs that put the delivery address on the form as an argument.
For C programs scrubString can be used to clean up strings for safe use with the shell. For Perl programmers there is a Perl version of scrubString.