Safe Programming

Now that you’ve looked at some of the common holes that can make it easy for crackers to break into your server, look at some good programming practices that can help ensure that your scripts are secure.

Running Shell Commands Without Using the Shell

I warned you of the dangers of using shell commands within your CGI scripts, and especially of the dangers of using user input in shell commands. Now I’m going to show you a method by which you can still run shell commands without running the risk of having the shell’s command-line parser examine the command you want to execute.

The risks associated with using shell commands involve the shell’s command-line parser. When the shell receives a command line, it interprets some characters ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.