CGI: Common Gateway Interface
CGI: Common Gateway Interface
 Common Gateway Interface – Basics of CGI Program – CGI Environment Variables
–
 Custom Database Query Scripts
 Server-Side Security Issues – E-Mail Security
Introduction
 CGI stands for Common Gateway Interface.
 It is a technology that enables a web browser to submit forms and
connect to programs over a web server.
 It is the best way for a web server to send forms and connect to
programs on the server. CGI can also be described as a set of
standards or rules where a program or script can send data back to the
webserver where it can be processed.
How CGI works?
Features of CGI
 It is a very well defined and supported standard.
 CGI scripts are generally written in either Perl, C, or
maybe just a simple shell script.
 CGI is a technology that interfaces with HTML.
 CGI is the best method to create a counter because it is
currently the quickest
 CGI standard is generally the most compatible with
today’s browsers
Advantages of CGI
 The advanced tasks are currently a lot easier to perform in
CGI than in Java.
 It is always easier to use the code already written than to
write your own.
 CGI specifies that the programs can be written in any
language, and on any platform, as long as they conform to
the specification.
 CGI-based counters and CGI code to perform simple tasks are
available in plenty.
Disadvantages of CGI
 In Common Gateway Interface each page load incurs overhead by
 having to load the programs into memory.
 Generally, data cannot be easily cached in memory between page loads.
 There is a huge existing code base, much of it in Perl.
 CGI uses up a lot of processing time.
CGI Environment Variables
Key Value
DOCUMENT_ROOT The root directory of your server
HTTP_COOKIE The visitor's cookie, if one is set
HTTP_HOST The hostname of the page being attempted
HTTP_REFERER The URL of the page that called your program
HTTP_USER_AGENT The browser type of the visitor
HTTPS "on" if the program is being called through a secure server
PATH The system path your server is running under
QUERY_STRING The query string (see GET, below)
REMOTE_ADDR The IP address of the visitor
REMOTE_HOST The hostname of the visitor (if your server has reverse-name-
lookups on; otherwise this is the IP address again)
CGI Environment Variables
Key Value
REMOTE_PORT The port the visitor is connected to on the web server
REMOTE_USER The visitor's username (for .htaccess-protected pages)
REQUEST_METHO
D
GET or POST
REQUEST_URI The interpreted pathname of the requested document or CGI (relative
to the document root)
SCRIPT_FILENAMEThe full pathname of the current CGI
SCRIPT_NAME The interpreted pathname of the current CGI (relative to the
document root)
SERVER_ADMIN The email address for your server's webmaster
SERVER_NAME Your server's fully qualified domain name (e.g. www.cgi101.com)
SERVER_PORT The port number your server is listening on
SERVER_SOFTWA
E
The server software you're using (e.g. Apache 1.3)
Connecting to
Database
Server Side Security Issues
 1. Code Injection
 2. Data Breach
 3. Malware Infection
 4. Distributed Denial of Service Attack
 5. Malicious Insiders
Cyber Attacks
 Malware Attack
 Phishing Attack
 Man-in-the-middle Attack
 Unsecured WiFi
 Stealing Passwords
 Password Attack
Safe Security Practices
 Firewall
 Honeypots
 Unique Alpha Numeric Passwords
 Antivirus
 Avoiding Mail from unknown senders
Impact of a Cyber Attack
 Advanced Persistent Threat (APT)
 Denial of Service Attack
 Distributed Denial of Service Attack
 SQL Injection Attack
Email Security
 Email security is the term for any procedure that protects email content and
accounts against unauthorized access. Email service providers have email security
measures in place to secure client accounts and information from hackers.
 Email is popular with hackers as a tool for spreading malware, spam, and
phishing attacks.
 They use deceptive messages to trick recipients into sharing sensitive information,
resulting in identity theft.
 They lure people into opening attachments or clicking hyperlinks that install malware
(such as email viruses) on the user’s device.
 Email is also a main entry point for attackers looking to access an enterprise network
and breach valuable company data.

CGI.pptx

  • 1.
  • 2.
    CGI: Common GatewayInterface  Common Gateway Interface – Basics of CGI Program – CGI Environment Variables –  Custom Database Query Scripts  Server-Side Security Issues – E-Mail Security
  • 3.
    Introduction  CGI standsfor Common Gateway Interface.  It is a technology that enables a web browser to submit forms and connect to programs over a web server.  It is the best way for a web server to send forms and connect to programs on the server. CGI can also be described as a set of standards or rules where a program or script can send data back to the webserver where it can be processed.
  • 4.
  • 6.
    Features of CGI It is a very well defined and supported standard.  CGI scripts are generally written in either Perl, C, or maybe just a simple shell script.  CGI is a technology that interfaces with HTML.  CGI is the best method to create a counter because it is currently the quickest  CGI standard is generally the most compatible with today’s browsers
  • 7.
    Advantages of CGI The advanced tasks are currently a lot easier to perform in CGI than in Java.  It is always easier to use the code already written than to write your own.  CGI specifies that the programs can be written in any language, and on any platform, as long as they conform to the specification.  CGI-based counters and CGI code to perform simple tasks are available in plenty.
  • 8.
    Disadvantages of CGI In Common Gateway Interface each page load incurs overhead by  having to load the programs into memory.  Generally, data cannot be easily cached in memory between page loads.  There is a huge existing code base, much of it in Perl.  CGI uses up a lot of processing time.
  • 9.
    CGI Environment Variables KeyValue DOCUMENT_ROOT The root directory of your server HTTP_COOKIE The visitor's cookie, if one is set HTTP_HOST The hostname of the page being attempted HTTP_REFERER The URL of the page that called your program HTTP_USER_AGENT The browser type of the visitor HTTPS "on" if the program is being called through a secure server PATH The system path your server is running under QUERY_STRING The query string (see GET, below) REMOTE_ADDR The IP address of the visitor REMOTE_HOST The hostname of the visitor (if your server has reverse-name- lookups on; otherwise this is the IP address again)
  • 10.
    CGI Environment Variables KeyValue REMOTE_PORT The port the visitor is connected to on the web server REMOTE_USER The visitor's username (for .htaccess-protected pages) REQUEST_METHO D GET or POST REQUEST_URI The interpreted pathname of the requested document or CGI (relative to the document root) SCRIPT_FILENAMEThe full pathname of the current CGI SCRIPT_NAME The interpreted pathname of the current CGI (relative to the document root) SERVER_ADMIN The email address for your server's webmaster SERVER_NAME Your server's fully qualified domain name (e.g. www.cgi101.com) SERVER_PORT The port number your server is listening on SERVER_SOFTWA E The server software you're using (e.g. Apache 1.3)
  • 11.
  • 12.
    Server Side SecurityIssues  1. Code Injection  2. Data Breach  3. Malware Infection  4. Distributed Denial of Service Attack  5. Malicious Insiders
  • 13.
    Cyber Attacks  MalwareAttack  Phishing Attack  Man-in-the-middle Attack  Unsecured WiFi  Stealing Passwords  Password Attack
  • 14.
    Safe Security Practices Firewall  Honeypots  Unique Alpha Numeric Passwords  Antivirus  Avoiding Mail from unknown senders
  • 15.
    Impact of aCyber Attack  Advanced Persistent Threat (APT)  Denial of Service Attack  Distributed Denial of Service Attack  SQL Injection Attack
  • 16.
    Email Security  Emailsecurity is the term for any procedure that protects email content and accounts against unauthorized access. Email service providers have email security measures in place to secure client accounts and information from hackers.  Email is popular with hackers as a tool for spreading malware, spam, and phishing attacks.  They use deceptive messages to trick recipients into sharing sensitive information, resulting in identity theft.  They lure people into opening attachments or clicking hyperlinks that install malware (such as email viruses) on the user’s device.  Email is also a main entry point for attackers looking to access an enterprise network and breach valuable company data.