Engineering

Demystifying Cyber Attacks: A Comprehensive Exploration of Common Threats

A brief guide to the latest cyber threats, test codes and safeguards available

Mohit Mishra
Building Fynd
Published in
8 min readJun 20, 2023

--

In today’s digital landscape, the threat of cyber attacks looms larger than ever before. Understanding the different types of cyber-attacks is essential for individuals and organisations to safeguard their sensitive information and digital assets. In this comprehensive guide, we will delve into the various techniques employed by cybercriminals to compromise systems and networks. By familiarising ourselves with these threats, we can take proactive measures to fortify our defences.

Common Types of Cyber Attacks

Common Types of Cyber Attacks
Common types of cyber attacks.

Malware Attacks

Malware attacks are a common type of cyber attack that involves the use of malicious software to gain unauthorised access to a system or network. Malware can take many forms, including viruses, worms, and ransomware. Malware can be spread through various methods, such as email attachments, infected websites, and software downloads. The impact of malware attacks can range from minor inconvenience to serious data breaches and financial losses.

Types of Malwares
Various Types of Malware.

Key principles involved in carrying out the attack

  • Malware refers to malicious software designed to disrupt, damage, or gain unauthorised access to systems or networks.
  • Viruses are self-replicating programs that attach themselves to clean files and spread when the infected files are executed.
  • Worms are standalone programs that self-replicate and spread across networks without needing to attach to host files.
  • Ransomware encrypts a victim’s files and demands a ransom in exchange for the decryption key.
  • Technical principles involved include exploiting vulnerabilities, leveraging social engineering, and employing various infection vectors such as email attachments, infected websites, or removable media.

Safeguards available

  • Use robust antivirus software and keep it updated to detect and block known malware strains.
  • Regularly update your operating system and software applications to patch security vulnerabilities that malware can exploit.
  • Exercise caution when downloading files or clicking on links from untrusted sources, as they may contain malware. Educate yourself and your team on safe browsing habits and avoiding suspicious websites.
How to stay safe form malware attacks?
Ways to stay safe from Malware attacks.

Phishing Attacks

Phishing attacks are a type of social engineering attack that involve the use of fraudulent emails, SMS messages, or voice calls to trick users into revealing sensitive information or downloading malware. Phishing attacks can be difficult to detect, but there are indicators to look out for, such as suspicious URLs and poor grammar and spelling. Preventive measures include using anti-phishing software and educating users on how to recognize and avoid phishing attempts.

Common vectors of phishing attack.
Common vectors of a Phishing attack.

Key principles involved in carrying out the attack

  • Social engineering techniques manipulate victims through psychological manipulation, trust exploitation, and impersonation.
  • Common methods include fraudulent emails, spoofed websites, and fake login forms to steal credentials.
  • Technical principles involved include email spoofing, domain impersonation, and the creation of deceptive web pages.
Constituents of a phishing attack.
Constituents of a Phishing attack.

Sample code

import smtplib

def phishing_attack():
# create a fraudulent email
sender = 'fakeemail@gmail.com'
recipient = 'targetemail@gmail.com'
message = 'Please click on this link to reset your password: http://maliciouswebsite.com'
# send the email
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(sender, 'password')
server.sendmail(sender, recipient, message)
server.quit()

Safeguards available

  • Be vigilant and sceptical of unsolicited emails, especially those requesting sensitive information. Verify the authenticity of the sender and check for any signs of phishing attempts, such as spelling mistakes or suspicious URLs.
  • Never click on links or download attachments from untrusted sources. Instead, manually type URLs into your browser or use bookmarks to access trusted websites.
  • Enable Multi-Factor Authentication (MFA) whenever possible to add an extra layer of security to your accounts, making it harder for attackers to gain unauthorised access.
How to stay safe from Phishing attacks?
How to stay safe from Phishing attacks?

Denial-of-Service (DoS) and Distributed Denial-of-Service (DDoS) Attacks

DoS and DDoS attacks involve overwhelming a target system or network with traffic to the point where it becomes unavailable to users. DoS attacks are carried out by a single attacker, while DDoS attacks involve multiple attackers. These attacks can be mitigated through various strategies, such as using firewalls and intrusion detection systems.

Difference between DoS and DDoS attacks.
Difference between DoS and DDoS attacks.

Key principles involved in carrying out the attack

  • DDoS attacks utilise multiple compromised devices to generate a massive volume of traffic, leading to service disruption.
  • Attackers exploit vulnerabilities in network protocols or exhaust server resources with excessive requests.
  • Technical principles involved include flooding the target with traffic, exploiting bandwidth limitations, or overwhelming server resources.
Constituents of DoS/DDoS attack.
Constituents of DoS/DDoS attack.

Sample code

import socket
def dos_attack():
# create a socket and connect to the target system
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('targetsystem.com', 80))
# send a flood of requests to overwhelm the system
while True:
s.sendall(b'GET / HTTP/1.1\r\nHost: targetsystem.com\r\n\r\n')

Safeguards available

  • Implement a robust network infrastructure with adequate bandwidth capacity to handle increased traffic during potential attacks.
  • Deploy network monitoring and intrusion detection systems to identify and mitigate DDoS attacks in real-time.
  • Utilise Content Delivery Networks (CDNs) or cloud-based DDoS protection services that can help absorb and filter malicious traffic, preventing it from reaching your network.
Ways to prevent DoS/DDoS attacks.
Ways to prevent DoS/DDoS attacks.

Man-in-the-Middle (MitM) Attacks

MitM attacks involve intercepting communications between two parties to steal sensitive information or modify the communication. Examples of MitM attacks include session hijacking and Secure Sockets Layer (SSL) / Transport Layer Security (TLS) interception. MitM attacks can be prevented through the use of encryption and secure communication protocols.

Functioning of Man in the Middle Attack.
Functioning of Man in the Middle attack.

Key principles involved in carrying out the attack

  • Attackers position themselves between the sender and recipient, capturing or modifying the data transmitted.
  • Techniques include Address Resolution Protocol (ARP) spoofing, Domain Name System (DNS) spoofing, or exploiting insecure Wi-Fi networks.
  • Technical principles involved include eavesdropping, session hijacking, and tampering with data packets.
Constituents of Man in the Middle attack.
Constituents of Man in the Middle attack.

Sample code

import ssl
import socket

def mitm_attack():
# create a socket and connect to the target system
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('targetsystem.com', 443))
# wrap the socket in SSL/TLS encryption
context = ssl.create_default_context()
s = context.wrap_socket(s, server_hostname='targetsystem.com')
# intercept and modify the communication
s.sendall(b'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<html><body><h1>Modified Content</h1></body></html>')

Safeguards available

  • Use secure communication protocols, such as HTTPS, which encrypts data in transit and helps prevent interception by attackers.
  • Keep your web browser updated and don’t use untrusted browser extensions or key-loggers.
  • Use good antivirus with Web Protection enabled.
  • Implement proper network segmentation and access controls to limit the attack surface and minimise the potential for MitM attacks.
  • Regularly update and patch software and firmware to address any known vulnerabilities that attackers could exploit.
Ways to stay safe from Man in the Middle attack.
Ways to stay safe from Man in the Middle attack.

SQL Injection Attacks

SQL injection attacks involve exploiting vulnerabilities in web applications to gain unauthorised access to a database. These attacks can be prevented through best practices such as input validation and parameterised queries.

How does an SQL Injection attack work?
How does an SQL Injection attack work?

Key principles involved in carrying out the attack

  • Attackers inject malicious SQL queries into input fields to manipulate the database and retrieve sensitive information.
  • Vulnerable code or poorly sanitised user inputs provide opportunities for attackers.
  • Technical principles involved include understanding SQL syntax, identifying injection points, and crafting malicious queries.

Sample code

import sqlite3

def sql_injection_attack():
# create a malicious SQL query
query = "SELECT * FROM users WHERE username = 'admin' OR 1=1; --' AND password = 'password'"
# execute the query on the target database
conn = sqlite3.connect('targetdatabase.db')
cursor = conn.cursor()
cursor.execute(query)
results = cursor.fetchall()

Safeguards available

  • Employ parameterised queries or prepared statements in your web application’s code to prevent SQL injection attacks.
  • Implement input validation and sanitisation techniques to filter out potentially malicious user inputs.
  • Regularly update and patch your web application frameworks and libraries to fix any known vulnerabilities that could be exploited for SQL injection attacks.
How to avoid SQL injection attacks?
How to avoid SQL Injection attacks?

Cross-Site Scripting (XSS) Attacks

XSS attacks involve injecting malicious code into a website to steal sensitive information or modify the content of the website. XSS attacks can be prevented through various techniques, such as input validation and output encoding.

How does Cross-Site Scripting attack work?
How does Cross-Site Scripting attack work?

Key principles involved in carrying out the attack

  • XSS attacks enable malicious scripts to execute in users’ browsers by injecting code into web pages.
  • Attackers exploit vulnerabilities in websites that allow user-generated content without proper validation or sanitisation.
  • Scripts can steal user data, redirect to malicious sites, or perform actions on behalf of the user.
  • Technical principles involved include injecting malicious scripts, understanding web application vulnerabilities, and bypassing client-side security measures.

Sample code

import requests

def xss_attack():
# inject a script into a vulnerable website
payload = "<script>alert('XSS Attack!');</script>"
response = requests.post('http://vulnerablewebsite.com/comment', data={'comment': payload})

Safeguards available

  • Implement input validation and output encoding to ensure that user-generated content is sanitised before displaying it on web pages.
  • Use security headers, such as Content Security Policy (CSP), to restrict the execution of untrusted scripts and mitigate XSS vulnerabilities.
  • Regularly scan and test your web applications for XSS vulnerabilities using specialised security tools or engaging in penetration testing.

Advanced Persistent Threats (APTs)

APTs are a type of cyber attack that involves a prolonged and targeted effort to gain unauthorised access to a system or network. APTs are characterised by their use of advanced techniques and their focus on specific targets. Examples of high-profile APT attacks include the SolarWinds attack and the Equifax data breach.

Insider Threats

Insider threats involve the use of authorised access to a system or network to carry out malicious activities. Insider threats can be motivated by various factors, such as financial gain or revenge. Preventive measures include background checks and access controls.

Zero-Day Exploits

Zero-day exploits involve the use of vulnerabilities in software that are unknown to the software vendor. These exploits can be difficult to detect and defend against, but vulnerability management and response strategies can help mitigate the impact of these attacks.

Emerging threats and future trends

Emerging cyber attack vectors include AI-driven attacks and Internet of Things-based attacks. The potential impact of emerging technologies on cyber attacks is significant, and it is important to stay updated and prepared for future threats.

Conclusion

In conclusion, cyber-attacks are a significant threat in today’s digital landscape, and it is important to be aware of the different types of attacks and how to defend against them. By implementing proactive defence measures and staying updated on emerging threats and future trends, organisations can better protect themselves from cyber-attacks. Follow Building Fynd to learn more about such new and exciting stuff.

--

--

Hello there! I'm a tech writer @Fynd who distills complex concepts into accessible content. Follow me as I make the arcane comprehensible.