#CompTIA Security+ 501 exam Chapter08 Protecting Against Attacks and Vulnerabilities Part 1
Posted by Superadmin on November 16 2018 16:04:10

Protecting Against Attacks and Vulnerabilities

 

In this chapter, we are going to look at attacks and vulnerabilities. Each type of attack will have its own unique characteristics. This module is probably the most heavily tested module in the Security+ exam. This chapter needs to be thoroughly understood as sometimes those type of attack questions are very vague, so if you do not understand the concepts fully, you may not understand what is being asked. 

We will cover the following exam objectives in this chapter:

 

Protecting Against Attacks and Vulnerabilities

 

In this chapter, we are going to look at attacks and vulnerabilities. Each type of attack will have its own unique characteristics. This module is probably the most heavily tested module in the Security+ exam. This chapter needs to be thoroughly understood as sometimes those type of attack questions are very vague, so if you do not understand the concepts fully, you may not understand what is being asked. 

We will cover the following exam objectives in this chapter:

 

 

Virus and malware attacks

 

In today's world, viruses and malware and rife; there are many different variants and we will look at each of these in turn:

Figure 1: Ransomware

Trojans attack the /System 32 and the SysWOW64 directory by placing a .dll file there.

For example, Ghost RAT is a remote access Trojan that was originally designed by threat actors in China. A user clicks on a link and a dropper program called server.exe installs Ghost RAT with a svchost.dll that then allows the attacker to take control of the computer. It can then log keystrokes, download and upload files, and run a webcam and microphone feeds.

In a Linux environment, a rootkit virus attacks the /usr/bin directory.

 

 

Social engineering attacks

 

Social engineering attacks rely on someone's personality as they try to exploit them. There are various social engineering attacks; let's look at each of them and the principles of why they are effective:

Figure 2: Phishing attack

Figure 3: Hoax virus

This email said that this cute little bear was a virus and it should be deleted, as anti-virus software from anti-virus vendors would not find it; this was true as it was not a virus. It was an operating system file and to delete it would damage your computer. The reason why this attack worked was the bear was there and the anti-virus did pick it up on a scan, therefore it looked real. Another example of a hoax would be purchasing fake anti-virus software that does not work.

From: Ian Neil (CEO)

To: All Staff

Subject: UPDATE YOUR FINANCIAL DETAILS

Dear All

The finance team are moving to a new finance application and have told me that personnel within the company have not updated their bank details. You need to click on this link and update your details: http://update.details.wehackyou.com.

Failure to do so by the end of play today will result in disciplinary action against those individuals that do not comply:

Kind Regards

Ian Neil

Chief Executive Officer

An email from your CEO, a high-level executive, or the HR manager telling you to fill in a form or click on a link is a social engineering authority attack.

Allowing a fireman into your server room is a social engineering urgency attack.

 

 

Common attacks

 

If you are going to gain the CompTIA Security+ qualification, you need to know the different types of attacks that you may encounter; there are numerous attacks and you need to know each of these, their characteristics, and how they can be prevented. Let's look at each of these in turn.

 

 

Application/service attacks

 

A SYN flood attack is where only the first two parts of the three-way handshake have taken place, leaving your computer is a state of limbo. DDoS has a high volume of these.

Figure 4: DDOS attack

Figure 5: Man-in-the-middle

For example, a hacker is imitating the conversations of both parties for gaining access to funds. The attacker intercepts a public key and with this he can put in his own credentials to trick the people on both sides into believing that they are talking to each other in a secure environment. While online shopping from home or a mobile device, the victims think that they are buying goods from a legitimate source but instead their money is being stolen.

Exam tip:Kerberos prevents replay attacks as it uses updated sequence numbers and time stamps.

A POODLE attack is a MIM downgrade attack using SSL 3.0 in CBC mode.

Figure 6: Zero day exploit

The only way to detect a zero day exploit is when you have taken a baseline of your computer previously, then you can check the changes since the baseline; this will identify a zero day exploit. If you have no previous baseline, then you will not detect it.

A zero day virus cannot be traced or discovered by any security device as it may take up to five days before a patch or update is released.

Figure 7: DNS poisoning

If we look at Figure 7, Computer A has already been to the legitimate website called Web 1, and its proper IP address of 1.1.1.1 has been placed in its DNS cache. When DNS resolution is performed, the DNS cache is searched first then the hosts file is next, followed by the internal DNS server. The attacker has now deleted the entry for Web 1 and inserted his entry for Web 1 with an IP address of 2.2.2.2. Now, when the user enters the URL www.web1.com, the only entry in the DNS cache is Web1 2.2.2.2 and the user is diverted to a website that looks like the legitimate website. When he enters his card details to make a purchase, his account is emptied.

 

 

Programming attacks

 

Programming attacks are when we use scripts or overload the expected characters or integers expected. Let's look at these in turn:

Exam tip:
In a Christmas tree attack, the URG, PUSH, and FIN flags are all set to 1, meaning that they are open. As URG is set to 1, it says that this packet has a high priority over other traffic.

print "<html>"

print "Latest comment:"

print database.latestComment

print "</html>"

<html>

Latest comment:

<script> (Javascript code is placed here) </script>

</html>

 

 

Example 1—JavaScript—creating a money variable

 

JavaScript can use the command var that means variable; an example would be to set a variable for money then allocate it a value of 300.00. You can see we use var for the variable and then use money as its label. In the next row, we use the money variable and give it a value of 300.00:

<script type="text/javascript">
<!——
var money;
money = 300.00;
//-->
</script>

 

 

Example 2—Javascript—setting the day of the month

 

We will use Javascript to set the day of the month; you will notice the Javascript code between the html tags <script> to start the script and <\script> to end the script. The command var is very common in Javascript:

<!DOCTYPE html>
<html>
<body>
<p>Click the button to display the date after changing the day of the month.< /p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>

function myFunction() {
var d = new Date();
d.setDate (15);
document.getElementById("demo").innerHTML = d;
}
</script>
</body>
</html>

A XSS attack can be identified by looking for the command var and for a variable with the html tags <script> and </script>. Scripts with var are likely to be Javascript. It is a very popular exam topic:

Figure 8: Buffer overflow

In the example here, we are going to set up a buffer to be a maximum of 64 characters, then we are going to use strcpy to copy strings of data. A string of data is used to represent a number of text characters. The problem that arises is that strcpy cannot limit the size of characters being copied. In the example here, if the string of data is larger than 64 characters, then a buffer overflow will occur:

int fun (char data [256]) {
int i
char tmp [64];
strcpy (tmp, data);
}

Exam tip:Strcpy could create a buffer overflow as it cannot limit the size of the characters.

 

 

Hijacking related attacks

 

In this section, we will look at attacks where he hacker hijacks either a device, cookie, or a piece of software. Let's look at these in turn:

Input validation could prevent SQL injection, buffer overflow, and integer overflow attacks.

A stored procedure could prevent a SQL injection attack as it is a pre-written script that is executed and cannot be altered when executed.

 

 

Driver manipulation

 

Device drivers allow an operating system such as Windows to talk to hardware devices such as printers. Sophisticated attackers may dive deep into the device drivers and manipulate them so that they undermine security on your computer. They could also take control of the audio and video of the computer, they could stop your anti-virus software from running, or your data could be exposed to someone else. There are two main techniques for driver manipulating, and these are as follows:

 

 

Cryptographic attacks

 

There are a variety of cryptographic attacks, and we will now look at these in turn; you need to know these thoroughly for the Security+ exam. We will start with the birthday attack and finish with key stretching: