Securing Resources   «Prev  Next»

Lesson 5 Common gateway interface scripts
Objective Protect your system by ensuring the security of CGI scripts.

Common Gateway Interface (CGI)

Common Gateway Interface (CGI) scripts are often the source of security holes.
Even when these are written properly, a hacker can use seemingly benign scripts to defeat your system's security. Take great care in writing these scripts, and examine them closely for problems that may occur because the script
  1. Reads or writes files on the host
  2. Runs with set-user-id privileges
  3. Does not call out explicit path names

Securing CGI scripts

To further protect your system’s security when using CGI scripts whether implemented with Java, ASP, Cold Fusion, Net.Data, perl or C++:
  1. Isolate the operating system on its own hard drive or partition
  2. Place the Web server program on the second partition
  3. Move all the HTML files to another partition
  4. Assign read-only privileges to the drive containing the HTML content
  5. Place the scripts (such as CGI, Internet Services Application Programming Interface (ISAPI) and Perl scripts) on another partition
  6. Allow the scripts to be executed, but forbid writing to the drive

Internet Services Application Programming Interface (ISAPI)

A method developed by Microsoft to write programs that communicate with Web servers through OLE.

Cold Fusion Server

Allaire's Cold Fusion Server and Microsoft ASP have had significant security holes that allow users to execute arbitrary code, sometimes gaining administrative access. Most of these problems lie with installing servers and services and then leaving default settings. Similar problems exist with ODBC implementations.

Using partitions

A hacker will often try to place a trojan horse[1] in the directory that contains a Web server's scripts. Then the hacker need only execute the script from any Web browser.

By isolating the scripts in a specific drive or partition, you can restrict access to the entire hard drive.
Furthermore, if a partition is read-only, a hacker cannot copy files onto it, or copy or alter any of the files of the partition.
This placement is a specific example of how you can layer security techniques to create a matrix of secure systems, devices, and resources.<
Unlike other Web servers, security in the Internet Information Server is mostly predicated on the parameters of the Windows NT Server operating system. If you use this server, activate all auditing procedures and augment your security by allowing the operating system to automatically reset permissions when you are not using the server.
[1]Trojan: A file or program that purports to operate in a legitimate way, but which also has an alternative, secret operation, such as emailing sensitive company information to a hacker. A trojan horse is a specific program that destroys information on a hard drive.