CGI Security

Allowing scripts to run on your server can create large security holes. If the script receives information other than what you were expecting, a malicious user can at least read and/or destroy CGI-created data and at worst take the first (most difficult) step in gaining total access to the server.

The two biggest security holes are file i/o (reading from and writing to files) and sub-shells (where variables in the program can be interpreted as commands). The general way to avoid security holes is the same:

Don't trust anything the user sends back!

(and also for you administrators out there, never ever run a web server as root)

What to look out for


How to make scripts more secure


That's enough to give you some idea of what issues are involved and how to make your scripts more secure. Check out other CGI & WWW security pages at Yahoo.
Return to:
Introduction to CGI Programming with Perl
The Kitschen Sink