Exploring Common Web Server Attacks
Systems are constantly being attacked, and IT security professionals need to be aware of common attacks so that they know what to protect against. Many of the common security certifications (such as the CompTIA Security+, and (ISC)2 SSCP and CISSP) require you to have a basic knowledge of different types of attacks. After all, before you can start focusing on protection against threats, you need to know what the threats are.
DoS and DDoS
A denial of service (DoS) attack is an attack from a single entity that attempts to prevent a system from responding to normal requests for service. A distributed denial of service (DDoS) attack is a DoS attack from multiple entities. When successful, the attacked system is unable to respond to the majority of legitimate service requests. The SYN flood attack (described later in this article) is a common DoS attack.
Systems accessible via the Internet are the primary targets of DoS and DDoS attacks. For example, attackers may want to disrupt a company’s ecommerce business, so they attack the company’s web servers. If they are successful, the company loses direct revenue during the attack. They also see indirect losses as customers become disillusioned with the company’s security or availability and shop elsewhere. Some attackers launch DDoS attacks on systems as a diversion as they are accessing other systems to steal data.
One of the classic DoS attacks is the SYN flood attack, which disrupts the TCP three-way handshake. To understand the attack, it’s best to first understand how the TCP handshake works. TCP provides guaranteed delivery of information, and it starts by ensuring that a session can be established between two systems.
TCP uses flags embedded within packets as descriptors for the packet. The SYN (synchronize) flag requests a session, the SYN/ACK (synchronize and acknowledge) flags acknowledge the request, and the ACK (acknowledge) flag establishes the session. Figure 1 shows the overall process of the TCP handshake as these three packets are sent between two systems. This three-way handshake is used between systems on internal networks and on the Internet all the time.
Figure 1 TCP three-way handshake
The SYN flood attack withholds the third packet, preventing sessions from being completed. This attack is also called a half-open connection attack, since the session is incomplete. Imagine someone extending his hand to shake with you. You extend your hand and then at the last instant, they pull their hand away. If they did it repeatedly, you probably wouldn’t continue to extend your hand in return.
However, a computer system isn’t so smart. In the SYN flood attack, the attacker floods a system with SYN packets, as shown in Figure 2, and each time the computer receives a SYN packet, it responds with a SYN/ACK packet.
Figure 2 SYN flood attack
Not only does the server send back the SYN/ACK packet, but it also keeps sessions open waiting for the incomplete sessions to be completed. If a server is flooded with multiple SYN packets it can overwhelm the server and in some instances, it can cause a server to crash. If a system limits how many incomplete sessions it allows (such as ten every three minutes), this prevents new legitimate connections.
A single attacker can launch a SYN flood attack as a DoS attack on a system. Bot herders can also direct zombies within a botnet to launch individual SYN flood attacks resulting in massive DDoS attacks on systems.
Many firewalls include floodguards that help mitigate the effects of a SYN flood attack.
A ping flood attack provides a simple example of a DDoS attack. Bot herders can direct zombies within a botnet to send simple ping requests to a system. When a system receives a ping request, it responds with a ping reply. If thousands of zombies flood a system with pings, the system can get overwhelmed as it tries to respond to these requests.
One common method of combating a ping flood attack is to block ICMP traffic. Since the ping uses ICMP, a system ignores these attacks by blocking ICMP. This follows a basic server hardening principle of disabling or removing unneeded services. In this case, a company may determine that ICMP is not necessary for the function of a server, and they block it using a firewall filter.
In other networks, active intrusion detection systems and intrusion prevention systems (IDSs and IPSs) allow ICMP traffic but set a threshold (such as no more than 10 pings in 20 seconds). Once the threshold is reached, the IDS/IPS disables ICMP for a period (such as 30 minutes). This prevents attacks from ever gaining any traction.
A port scan attempts to discover running services on a system based on the open ports. Since most systems follow the well-known port recommendations of IANA, any well-known ports that are open provide a good indication of services running on the system.
For example, if a port scan determines that a system is listening on ports 80 and 443, it’s very likely that this system is running the HTTP and HTTPS protocols. Since web servers primarily use these protocols, it’s very likely this system is a web server. Other techniques (such as packet sniffing) determine the operating system and type of web server software a system is running.
Many tools are available that an attacker can use to scan a system for open ports. Many tools allow attacks to program the scan to look for specific open ports. For example, if attackers want to locate mail servers, they can program these tools to scan for ports 25, 110, and 143 (the ports for SMTP, POP3, and IMAP4).
Attackers use sniffers or protocol analyzers to capture and analyze packets. If data is sent across a network in clear text, an attacker can capture the data packets and use a sniffer to read the data. In other words, a sniffer can eavesdrop on electronic conversations. A popular sniffer is Wireshark, and it’s available as a free download. It’s also used by administrators for legitimate purposes.
One of the challenges for an attacker is to gain access to the network to capture the data. If attackers have physical access to a router or switch, they can connect the sniffer and capture all traffic going through the system. Strong physical security measures help mitigate this risk.
Wireless sniffers such as Kismet can capture traffic transmitted over the air. The best protection is strong wireless security, such as WPA2.
Social Engineering Attacks
The simplest attacks are social engineering attacks, where an attacker simply asks unsuspecting users for their secrets. For example, an attacker can leave a message on a user’s phone and claim that their credit card has had some suspicious activity and encourage the person to call back. When the person calls back, they are prompted to enter credit card information such as the number, expiration, and the secret code. The message lets the person know that based on their confirmation, the credit card is verified and there’s no problem. However, the person just gave all their credit card information, and the card will soon have several fraudulent charges.
Tailgating is another social engineering example. An attacker without a required access card can access secured spaces simply by following closely behind someone with an access card. Sometimes all they need is a friendly smile to take advantage of someone else’s courtesy.
While social engineering was previously limited to nontechnical means (such as just talking), some social engineering attacks use technical methods today. For example, phishing emails attempt to trick a user into responding and giving up valuable information such as their username and password, or clicking on a malicious link that can install malware on their system in a drive-by attack.
Many social engineers use pretexts to trick their victims. For example, an attacker may want to send a phishing email to an executive in a whaling attack. (A whaling attack is a phishing email against a high-level executive.) The attacker could learn the executive’s name through public information, but not know the executive’s email address. In the first pretext, the attacker calls up a company employee posing as a customer and obtains an employee’s email address. This helps the attacker determine how email addresses are formatted (such as firstname.lastname@example.org). In a follow-on pretext, the attacker calls someone else posing as a business associate of the executive. The attacker explains he needs to email important information to the executive, but he seems to have written down the email incorrectly. After repeating the email address with a minor misspelling, a helpful employee may provide the correct email information without giving it a second thought.
If you’re preparing for a security based certification exam, you should have a good understanding of basic attacks. While this article doesn’t them all, it does cover many. Good luck!