Cybersecurity Overview
- File size
- 17.1KB
- Lines of code
- 564
Cybersecurity Overview
Definitions
- Data lifecycle: stages that data goes through from creation to deletion or archiving (generation, collection, processing, storage, management, analysis, visualization, interpretation)
- Data integrity: assurance that data is accurate, complete, consistent and uncorrupted throughout its lifecycle
- Data confidentiality: ensuring data is protected from unauthorized access and disclosure
- Encryption: Conversion of readable information to an unreadable format using an algorithm and key, used to ensure data confidentiality
- Hashing: One-way mathematical function that irreversibly transforms data to a fixed-size character string, used to ensure data integrity
- Red team: Group that acts as malicious actors, simulating real-world attacks that identify and exploit vulnerabilities in an organization's defenses
- Blue team: Group that acts as the targetted organisation, defending their systems and networks against the Red team's attacks
- Purple team: Group that acts as both the Red and Blue team, improving an organisation's security posture with offensive and defensive measures
- Pentesting: A.K.A penetration testing, a simulated cyber attack by ethical hackers to evaluate an organisation's system vulnerabilities and security posture
Cyber attacks
There are 7 main types of cyber attacks.
flowchart TD;
A[Cyber Attacks] --> B[Phishing Attacks 🎣]
A --> C[Malware Attacks 💻]
A --> D[Denial of Service Attacks â›”]
A --> E[Identity-Based Attacks 🧟]
A --> F[Code Injection Attacks 💉]
A --> G[Man-in-the-Middle Attacks 🖕]
A --> H[Supply Chain Attacks 🚚]
B --> J[Spear Phishing]
B --> K[Whaling]
B --> L[Vishing]
B --> M[Smishing]
C --> N[Viruses]
C --> O[Worms]
C --> P[Trojan Horses]
C --> Q[Ransomware]
D --> R[DoS]
D --> S[DDoS]
D --> T[Application Layer Attacks]
E --> U[Credential Harvesting]
E --> V[Business Email Compromise]
F --> W[SQL Injection]
F --> X[Cross-Site Scripting]
G --> Y[Rogue Access Points]
G --> Z[Eavesdropping]
H
Phishing 🎣
Malicious actors trick individuals into revealing SENSITIVE information by impersonating as a trustworthy entity.
Specific variants include
- SPEAR PHISHING: Targeted phishing aimed at specific individuals or organizations.
- WHALING: A type of spear phishing that targets high-profile individuals like executives.
- VISHING: Voice phishing conducted through phone calls.
- SMISHI: Phishing via SMS messages.
Malware 💻
Malicious software that harms devices or networks.
Specific variants include
- VIRUSES: Self-replicating programs that spread to other systems.
- WORMS: Viruses that do not require human interaction to spread.
- TROJAN HORSES: Malicious software disguised as legitimate applications.
- RANSOMWARE: Encrypts data and demands payment for decryption.
Denial of Service â›”
- A.K.A DoS.
- Make a service unavailable by overwhelming it with traffic.
Specific variants include
- DISTRIBUTED DENIAL OF SERVICE: A.K.A DDoS. Uses multiple compromised systems to launch an attack.
- APPLICATION LAYER ATTACKS: Targets specific applications to exploit vulnerabilities.
Identity-Based attacks 🧟
Stealing personal information to gain unauthorized access.
- CREDENTIAL HARVESTING: Malicious actors collect login credentials en masse.
- BUSINESS EMAIL COMPROMISE: A.K.A BEC. Involves impersonating a trusted source to deceive customers or employees into transferring funds or data.
Code Injection 💉
Feeding programs malicious code to manipulate data and execute unauthorized commands.
- SQL INJECTION: Inserting malicious SQL queries through input fields.
- CROSS-SITE SCRIPTING: A.K.A XSS. Injecting scripts into web pages viewed by users.
Man-in-the-Middle attacks 🖕
- A.K.A MitM attacks.
- Malicious actors intercept and alter communication between two parties without their knowledge.
Typically arises from
- ROGUE ACCESS POINTS mimicking legitimate networks, created by the malicious actors.
- EAVESDROPPING on existing unsecured connections.
Supply Chain attacks 🚚
- Exploit supply chain vulnerabilities.
- Can target both SOFTWARE and HARDWARE components.
Securing data
The 2 main methods to secure data are encryption and hashing.
Overview
Encryption
- Susceptible to COMPROMISED KEYS due to poor management
- Susceptible to WEAK ENCRYPTION ALGORITHMS
- Commonly used for data confidentiality IN TRANSIT (during communication) and AT REST (storage)
Hashing
- Susceptible to COLLISION ATTACKS where different data inputs produce the same hash value
- Susceptible to BRUTE-FORCE ATTACKS if weak hash functions are used
- Commonly used for data integrity checks
Encryption
[!TIP]
Remember to runpip install pycryptodometo run the worked examples below.
Symmetric Encryption
- Relies on ONE key for encryption and decryption
- Sender and receiver must both have the key
- Typically fast
- More efficient for encrypting large volumes of data
- Requires secure key management
- Used to protect data from being read by unwanted actors
- REVERSIBLE since encryption is a TWO-WAY process
sequenceDiagram
participant Sender
participant Receiver
participant Key Generator
Sender->>Key Generator: Generate shared secret key
Key Generator-->>Sender: Provide key
Key Generator-->>Receiver: Provide key
Sender->>Sender: Encrypt data using key
Sender->>Receiver: Send encrypted data
Receiver->>Receiver: Decrypt data using key
| Encryption method | Requirements | Characteristics | Python implementation |
|---|---|---|---|
| AES | Shared secret key | Fast, secure, supports key sizes of 128, 192, or 256 bits |
|
| DES | Shared secret key | 56-bit key, considered weak due to vulnerabilities |
|
| 3DES | Shared secret key | Applies DES three times for enhanced security |
|
| RC4 | Shared secret key | Stream cipher, fast but not recommended for secure use |
|
Asymmetric Encryption
- Relies on TWO keys
- PUBLIC key for encryption
- PRIVATE key for decryption
- Sender has their own public and private key pair
- encrypts messages with the RECEIVER's public key
- decryptes messages with their private key
- Receiver has their own public and private key pair
- decrypts messages with their private key
- encrypts messages with the SENDER's public key
- Each party's PUBLIC keys are made known to the other, their PRIVATE keys are kept secret
- Typically slower than symmetric encryption
- More secure for encrypting small volumes of data
- Allows secure communication without sharing private key
- Used to protect data from being read by unwanted actors
- REVERSIBLE since encryption is a TWO-WAY process
sequenceDiagram
participant Sender
participant Receiver
participant Sender Key Generator
participant Receiver Key Generator
Sender->>Sender Key Generator: Generate public and private key
Sender Key Generator-->>Sender: Provide keys
Receiver->>Receiver Key Generator: Generate public and private key
Receiver Key Generator-->>Receiver: Provide keys
Receiver->>Sender: Send public key
Sender->>Receiver: Send public key
Sender->>Sender: Encrypt data using recepient's public key
Sender->>Receiver: Send encrypted data
Receiver->>Receiver: Decrypt data using their own private key
| Encryption method | Requirements | Characteristics | Python implementation |
|---|---|---|---|
| RSA | Public and private key pair | Uses large prime numbers for security |
|
| ECC | Public and private key pair | Shorter keys with strong security |
|
| DSA | Public and private key pair | Used for digital signatures |
|
Hashing
- Relies on HASH functions to map input data to a fixed-size hash value (message digest)
- Sender and receiver must BOTH ensure data integrity by computing and comparing the hash values based off their data
- Data is intact if hash values MATCH
- Typically faster than both symmetric and asymmetric encryption
- Requires collision management since hash functions can produce the SAME hash value for different inputs
- Used to verify if data has been altered during transit
- IRREVERSIBLE since hashing is a ONE-WAY function
sequenceDiagram
participant Sender
participant Receiver
participant Hash Function
Sender->>Hash Function: Input data
Hash Function-->>Sender: Generate hash value
Sender->>Receiver: Send input data and hash value
Receiver->>Hash Function: Input data
Hash Function-->>Receiver: Generate hash value
Receiver->>Receiver: Compare received hash with generated hash
| Hashing method | Requirements | Characteristics | Python implementation |
|---|---|---|---|
| MD5 | No special requirements | Produces a 128-bit hash, fast but vulnerable to collisions |
|
| SHA-1 | No special requirements | Produces a 160-bit hash, faster than SHA-2 but less secure |
|
| SHA-256 | No special requirements | Part of the SHA-2 family, produces a 256-bit hash, widely used for security |
|
| BLAKE2 | No special requirements | Faster than MD5 and SHA-2, customizable output size |
|
| RIPEMD-160 | No special requirements | Produces a 160-bit hash, designed for cryptographic security |
|
| Scrypt | No special requirements | Password hashing function designed to be computationally intensive |
|
| Bcrypt | No special requirements | Password hashing function with built-in salting and adjustable cost factor |
|
| Argon2 | No special requirements | Password hashing function that won the Password Hashing Competition (PHC) |
|
More on
- The Pigeonhole Principle by baeldung
- Cryptographic Attacks by Codecademy
- Types Of Cyber Attacks by Fortinet
- Friendly Intro to Hardware Security Modules (HSMs) by Studying With Alex
- Intro to Encryption, in Friendly Terms: Cryptography, AES, Man In The Middle, and HTTPS by Studying With Alex
- Password Storage Tier List: encryption, hashing, salting, bcrypt, and beyond by Studying With Alex
- Get Started in Cybersecurity 2025 (A Guide) by Grant Collins
- Guide to becoming a Cyber Security Expert by roadmap.sh