CYS405 · Annotated SlidesChapter 8 — Web and Database Hacking
Chapter 8 · Annotated slides

Web and Database Hacking

Web server operations and why servers get compromised, DNS hijacking and amplification, directory traversal, MITM, cache poisoning, DoS, session hijacking with cookies, the web-server attack methodology, web application and session attacks, database vulnerabilities and attacks, and testing.

Slide text Study notes Highlight: key words Tips, tricks & traps Seen again elsewhere How it can come up
Slide 1: Slide 1
Exam weight Low

    Learning Objective

    • Perform system hacking, and web and database attacks.
    2
    Exam weight Low

      Key Concepts

      • Web server vulnerabilities, tools, and exploits
      • Web application vulnerabilities, tools, and exploits
      • Database attacks and attack tools
      3
      Exam weight Low

        Web Server Operations

        • A web server is a computer system that stores, processes, and delivers web pages to global clients via the Hypertext Transfer Protocol (HTTP).
        • In general, a client initiates a communication process through HTTP requests. When a client desires to access any resource such as web pages, photos, and videos, the client’s browser generates an HTTP request that is sent to the web server. Depending on the request, the web server collects the requested information/content from the data storage or application servers and responds to the client’s request with an appropriate HTTP response.
        • If a web server cannot find the requested information, then it generates an error message.
        4
        Exam weight Low

          Web Server Security Issues

          ❖ A web server is a hardware/software application that hosts websites and makes them

          accessible over the internet.

          ❖ A web server, along with a browser, successfully implements client-server model architecture

          in which the web server plays the server part in the model and the browser acts as the client.

          ❖ To host websites, a web server stores various web pages of the websites and delivers the

          web page upon request.

          ❖ Each web server has a domain name and the IP address associated with that domain name.

          ❖ A web server can host more than one website.

          ❖ Any computer can act as a web server if it has specific server software (a web server

          program) installed in it and is connected to the internet.

          ❖ Web servers are chosen based on their capability to handle server-side programming, security

          characteristics, publishing, search engine, and site-building tools.

          ❖ An attacker usually targets vulnerability that exists in the software component and

          configuration errors to compromise web servers.

          5
          Exam weight Low
            Slide 6: ▪ Organizations can defend most network-level and OS-level attacks by using
            Exam weight Low

              Common Goals behind Web Server Hacking

              Attackers perform web server attacks with certain goals in mind. These goals may be either technical or non-technical. For example, attackers may breach security of the web server and steal sensitive information for financial gains or only for the sake of curiosity. Following are some goals behind a web server attack:

              • Stealing credit cards or other sensitive credentials using phishing techniques
              • Integrating the server in a botnet in order to perform Denial of Service (DoS) or Distributed Denial of Service (DDoS) attack
              • Compromising a database
              • Obtaining closed-source applications
              • Hiding and redirecting traffic
              • Escalating privileges

              Some attacks are performed for personal reasons, rather than financial gains:

              For pure curiosity For completing a self-set intellectual challenge For damaging the target organization’s reputation

              7
              Exam weight Low

                Dangerous Security Flaws Affecting Web Server

                • Security Web server configuration by poorly trained system administrators may leave security vulnerabilities in the web server.
                • Inadequate knowledge, negligence, laziness, and inattentiveness toward security can pose the biggest threats to web server security.

                Following are some of the common oversights that make a web server vulnerable to attacks:

                • Not updating the web server with the latest patches
                • Using the same sys admin credentials everywhere
                • Allowing unrestricted internal and outbound traffic
                • Running unhardened applications and servers
                8
                Exam weight Low
                  Slide 9: Why Web Servers Are Compromised
                  Exam weight Low
                  1. Why web servers are compromised: default settings, unpatched software, misconfiguration, weak permissions, unnecessary services, poor input validation.
                  Slide 10: Shift Toward Web Layer Attacks
                  Exam weight Low

                    Webmaster’s Perspective

                    • Web servers may expose internal networks
                    • Risks include vulnerable scripts and backend code
                    • Open architecture allows server-side execution
                    • A single flaw can compromise the server
                    11
                    Exam weight Low

                      Network Administrator’s Perspective

                      • Poor configuration creates security gaps
                      • Weak authentication and access control
                      • Excessive privileges granted
                      • Misconfiguration is a major attack vector
                      12
                      Exam weight Low

                        End User’s Perspective

                        • Users assume web browsing is safe
                        • Malicious web content can deliver malware
                        • Client-side scripts can be exploited
                        • Compromised servers can attack users
                        13
                        Exam weight Low

                          Root Causes of Web Server Compromise

                          • Unpatched software
                          • Poor security configuration
                          • Vulnerable web applications
                          • Weak authentication
                          • Human error
                          14
                          Exam weight Low

                            Configuration & Human Factors

                            • Administrator negligence
                            • Lack of security awareness
                            • Default credentials
                            • Unnecessary services enabled
                            15
                            Exam weight Low

                              Key Security Principle

                              • A poorly configured web server can bypass firewalls
                              • Network security alone is insufficient
                              • Web server security is critical
                              16
                              Exam weight Low

                                Impact of Web Server Compromise

                                • Data theft and tampering
                                • Website defacement
                                • Malware distribution
                                • Privilege escalation
                                • Secondary attacks
                                17
                                Exam weight Low

                                  18
                                  Exam weight Low
                                    Slide 19: Improper or poor web design Source Code Example 1
                                    Exam weight Low

                                      Web Server Vulnerabilities

                                      • Buffer overflow
                                      • Denial of service (DoS) attack
                                      • Distributed denial of service (DDoS) attack
                                      • Banner information
                                      • Permissions
                                      • Error messages
                                      • Unnecessary features
                                      • User accounts
                                      • Structured Query Language (SQL) injections
                                      20
                                      Exam weight Low
                                        Slide 21: Slide 21
                                        Exam weight Low

                                          DNS Server Hijacking

                                          • Domain Name System (DNS) resolves a domain name to its corresponding IP address. A user queries the DNS server with a domain name, and it delivers the corresponding IP address. In a DNS server hijacking, an attacker compromises the DNS server and changes the mapping settings of the target DNS server to redirect toward a rogue DNS server so that it would redirect the user’s requests to the attacker’s rogue server. Thus, when the user types the legitimate URL in a browser, the settings will redirect to the attacker’s fake site.
                                          22
                                          Exam weight Low
                                          1. DNS server hijacking: attacker changes DNS records so users are sent to a malicious server.
                                          Slide 23: DNS Amplification Attack
                                          Exam weight High
                                          1. DNS amplification: spoofed small queries to open resolvers produce large replies aimed at the victim (DDoS).
                                          🎯 How this can come up · 1 question
                                          MCQ

                                          Spoofed DNS queries that make open resolvers flood a victim with large responses are:

                                          DNS Amplification Attack ( cont’d)

                                          24
                                          Exam weight Low
                                            Slide 25: Directory Traversal Attack
                                            Exam weight High
                                            1. Directory traversal: "../" sequences to read files outside the web root (../../etc/passwd).
                                            🎯 How this can come up · 1 question
                                            MCQ

                                            The request /view?file=../../../etc/passwd is a:

                                            Slide 26: Man-in-the-Middle/Sniffing Attack
                                            Exam weight Low

                                              Web Cache Poisoning Attack

                                              Web cache poisoning attacks the reliability of an intermediate web cache source.

                                              In this attack, the attackers swap cached content for a random URL with infected content. Users of the web cache source can unknowingly use the poisoned content instead of true and secured content when requesting the required URL through the web cache. An attacker forces the web server s cache to flush its actual cache content

                                              ’

                                              and sends a specially crafted request to store in cache. In this case, all the users of that web server cache will get malicious content until the servers flush the web cache.

                                              Web cache poisoning attacks are possible if the web server and application has HTTP Response-Splitting flaws.

                                              27
                                              Exam weight Low
                                              1. Web cache poisoning: inject malicious content into a cache so other users receive it.
                                              Slide 28: DoS/DDoS Attack
                                              Exam weight Low

                                                Session Hijacking with cookies

                                                29
                                                Exam weight Low
                                                1. Session hijacking with cookies: steal the session ID (sniffing, XSS) and replay it.
                                                Slide 30: Web Server Attack Methodology
                                                Exam weight Low
                                                  Slide 31: Banner Information
                                                  Exam weight Low
                                                  1. Banner information reveals server type and version: hide or change it.
                                                  Slide 32: Permissions
                                                  Exam weight Low

                                                    Unnecessary Features

                                                    • Servers should be purpose-built to the role they will fill in the organization.
                                                    • Anything not essential to this role should be eliminated
                                                    • Hardening removes features, services, and applications that are not necessary for a system to do its appointed job.
                                                    • If a feature or service is not needed, it should be disabled or, better yet, uninstalled.
                                                    33
                                                    Exam weight Low
                                                      Slide 34: User Accounts
                                                      Exam weight Low
                                                        Slide 35: Slide 35
                                                        Exam weight Low

                                                          Web Application Attacks

                                                          • Even if web servers are configured securely or are secured using network security measures such as firewalls, a poorly coded web application deployed on the web server may give a path to an attacker to compromise the web server’s security.
                                                          • If the web developers do not adopt secure coding practices while developing web applications, it may give attackers the chance to exploit vulnerabilities and compromise web applications and web server security. An attacker can perform different types of attacks on vulnerable web applications to breach web server security.
                                                          36
                                                          Exam weight High
                                                          1. Web app attacks: SQL injection, XSS, CSRF, parameter tampering, cookie poisoning, input validation flaws.
                                                          🎯 How this can come up · 1 question
                                                          MCQ

                                                          Injecting a script into a page that runs in other users’ browsers is:

                                                          Slide 37: Web Application Attacks (cont’d)
                                                          Exam weight Low
                                                            Slide 38: Session Management Issues
                                                            Exam weight Low
                                                            1. Session management issues: predictable IDs, IDs in URLs, no timeout, no regeneration after login.
                                                            Slide 39: Session Vulnerabilities
                                                            Exam weight Low
                                                              Slide 40: Encryption Weaknesses
                                                              Exam weight Low
                                                                Slide 41: Slide 41
                                                                Exam weight Low

                                                                  Database Attacks and Vulnerabilities Overview

                                                                  • Databases store critical and sensitive information
                                                                  • Often connected to web applications
                                                                  • A single weakness can expose entire systems
                                                                  • Databases are high-value attack targets
                                                                  42
                                                                  Exam weight Low

                                                                    Database Vulnerabilities

                                                                    • Weak or default passwords
                                                                    • Excessive user privileges
                                                                    • Unpatched database software
                                                                    • Insecure configuration
                                                                    • Lack of encryption
                                                                    43
                                                                    Exam weight Low

                                                                      Database Vulnerabilities (cont.)

                                                                      • Shared database accounts
                                                                      • Weak authentication mechanisms
                                                                      • No role-based access control
                                                                      • Open database ports
                                                                      • Poor backup protection
                                                                      44
                                                                      Exam weight Low

                                                                        Database Vulnerabilities (cont.)

                                                                        • Default settings left unchanged
                                                                        • Unnecessary database services enabled
                                                                        • Weak auditing and logging
                                                                        • Inadequate monitoring
                                                                        • Human configuration errors
                                                                        45
                                                                        Exam weight Low

                                                                          Database Attacks

                                                                          • SQL Injection
                                                                          • Credential brute-force attacks
                                                                          • Privilege escalation
                                                                          • Unauthorized data access
                                                                          • Data manipulation attacks
                                                                          46
                                                                          Exam weight High
                                                                          1. SQL injection: user input changes the query (' OR 1=1 --). Defense: parameterized queries, input validation, least privilege.
                                                                          Memory trick' OR '1'='1 makes the WHERE clause always true.
                                                                          🎯 How this can come up · 1 question
                                                                          MCQ

                                                                          The best defense against SQL injection is:

                                                                          Database Attacks (cont.)

                                                                          • Abuse of stored procedures
                                                                          • Exploitation of misconfigured permissions
                                                                          • Password cracking attacks
                                                                          • Bypassing authentication controls
                                                                          • Insider attacks
                                                                          47
                                                                          Exam weight Low

                                                                            Impact of Database Attacks

                                                                            • Data theft
                                                                            • Data tampering or deletion
                                                                            • Loss of confidentiality and integrity
                                                                            • Service disruption
                                                                            • Legal and reputational damage
                                                                            48
                                                                            Exam weight Low
                                                                              Slide 49: Locating Databases on the Network
                                                                              Exam weight Low
                                                                              1. Locate databases with port scans: 1433 MS SQL, 3306 MySQL, 1521 Oracle, 5432 PostgreSQL.
                                                                              Slide 50: Network Database Scanner
                                                                              Exam weight Low
                                                                                Slide 51: Database Server Password Cracking
                                                                                Exam weight Low

                                                                                  Locating Vulnerabilities in Databases

                                                                                  • Common vulnerabilities include:
                                                                                    • Used stored procedures
                                                                                    • Services account privilege issues
                                                                                    • Wear or poor authentication methods enabled
                                                                                    • No or limited audit log settings
                                                                                  52
                                                                                  Exam weight Low
                                                                                    Slide 53: Out of Sight, Out of Mind
                                                                                    Exam weight Low
                                                                                      Slide 54: Web Server Penetration Testing
                                                                                      Exam weight Low
                                                                                        Slide 55: Slide 55
                                                                                        Exam weight Low
                                                                                          Slide 56: Slide 56
                                                                                          Exam weight Low
                                                                                            Slide 57: Slide 57
                                                                                            Exam weight Low
                                                                                              Slide 58: Slide 58
                                                                                              Exam weight Low

                                                                                                Summary

                                                                                                • Web server vulnerabilities, tools, and exploits
                                                                                                • Web application vulnerabilities, tools, and exploits
                                                                                                • Database attacks and attack tools
                                                                                                59
                                                                                                Exam weight Low