System Hardening and Securing Individual Systems — Ethical Hacking 101

Bhavyansh @ DiversePixel
5 min readMay 11, 2024

--

Protecting individual systems from malware and unauthorized access is crucial for maintaining a strong security posture. This article delves into various aspects of system security, exploring common threats, mitigation techniques, and essential tools.

Photo by Michael Geiger on Unsplash

Malware: The Ever-Present Threat

Malware encompasses any software designed to harm or exploit a system. While viruses were once the primary concern, modern threats have evolved to employ various tactics.

  • Viruses: Programs that replicate by attaching themselves to other files and require user interaction to activate. Fileless malware operates solely in memory, making it difficult to detect and remove.
  • Ransomware: Malicious software that encrypts a victim’s data, demanding a ransom for its decryption.
  • Worms: Self-replicating malware that spreads across networks without user interaction.
  • Trojan Horses: Disguised as legitimate software, they perform malicious actions once installed. Remote Access Trojans (RATs) allow attackers to remotely control a compromised system.
  • Backdoors: Hidden entry points into a system, often created by developers for maintenance purposes but can be exploited by attackers.
  • Potentially Unwanted Programs (PUPs): Software with undesirable functionalities, such as adware, spyware, or bloatware.
  • Bots/Botnets: Networks of infected devices controlled by attackers for malicious purposes, often through command-and-control (C2) servers.
  • Keyloggers: Capture keystrokes to steal sensitive information like passwords and financial data.
  • Rootkits: Malware designed to gain root access and hide its presence from the operating system.
  • Logic Bombs: Code that triggers malicious actions based on specific conditions or a timer.

Addressing Weak Configurations

Secure configuration is vital for preventing vulnerabilities.

  • Cryptographic Solutions: Use strong encryption algorithms like AES and TLS v1.2 or higher. Avoid outdated protocols like WEP, DES, and SSL.
  • Default Settings: Change default passwords and usernames to prevent easy access for attackers.

Common Attacks and Mitigation Strategies

  • Zero-Day Attacks: Exploiting unknown vulnerabilities. Stay informed about the latest threats and patch systems promptly.
  • DNS Sinkholing: Redirecting DNS queries to malicious servers. Implement DNS security measures like DNSSEC.
  • Privilege Escalation: Attackers gaining higher levels of access than initially granted. Implement the principle of least privilege and monitor for suspicious activity.
  • Replay Attacks: Capturing and replaying network traffic for malicious purposes. Use sequence numbers and timestamps to prevent replay attacks.
  • Pointer/Object Dereference: Exploiting memory management errors to crash systems or execute arbitrary code. Implement secure coding practices and use memory-safe languages.
  • DLL Injection: Injecting malicious code into running processes. Monitor for suspicious DLL loading and use application whitelisting.
  • Resource Exhaustion: Depleting system resources to cause denial-of-service (DoS) attacks. Implement resource limits and monitor system performance.
  • Race Conditions: Exploiting timing issues in multithreaded applications. Use synchronization mechanisms to prevent race conditions.
  • Overflow Attacks: Injecting more data than a buffer can handle, causing it to overflow and potentially overwrite adjacent memory. Use bounds checking and input validation techniques.
  • Password Attacks: Cracking or guessing passwords. Enforce strong password policies and implement multi-factor authentication.

Tools for Password Attacks:

  • John the Ripper: A password cracking tool for offline attacks.
  • Cain and Abel: A password recovery tool for Windows.
  • Hydra: A network login cracker that supports various protocols.

Example of a Password Spraying Attack with Nmap and Hydra:

  1. nmap -Pn -p 3389 <target IP>: Scan for systems with Remote Desktop Protocol (RDP) enabled.
  2. hydra -l administrator -P /usr/share/wordlists/rockyou.txt rdp://<target IP>: Attempt to brute-force the RDP login using a common password list.

Bots and Botnets:

  • Bot: A single compromised device under attacker control.
  • Botnet: A network of bots used for coordinated attacks.
  • C2 Servers: Infrastructure used by attackers to control botnets.

Mitigation Techniques:

  • Use intrusion detection systems (IDS) to detect and block malicious traffic.
  • Monitor DNS queries for suspicious activity, such as lookups for C2 domains.
  • Utilize threat intelligence platforms to identify and block known malicious IP addresses and domains.

Disk RAID Levels: Enhancing Data Availability

RAID (Redundant Array of Independent Disks) combines multiple physical disks into a logical unit for improved performance and data redundancy.

  • RAID 0 (Striping): Data is split across multiple disks for faster access, but offers no redundancy.
  • RAID 1 (Mirroring): Data is duplicated across multiple disks, providing high availability but lower storage efficiency.
  • RAID 5 (Striping with Parity): Data is striped across multiple disks with parity information, allowing recovery from a single disk failure.
  • RAID 6 (Striping with Double Parity): Similar to RAID 5 but with an additional parity block, tolerating two disk failures.
  • RAID 10 (Mirroring and Striping): Combines RAID 1 and RAID 0 for both performance and redundancy.

Example of Creating a Software RAID 1 in Linux:

  1. sudo fdisk -l: Identify the disks to be used in the RAID array.
  2. sudo fdisk /dev/sdb: Create a new partition on the first disk.
  3. Repeat step 2 for the second disk.
  4. sudo mdadm — create /dev/md0 — level=1 — raid-devices=2 /dev/sdb1 /dev/sdc1: Create the RAID 1 array.
  5. sudo mkfs -t ext4 /dev/md0: Format the RAID array with the desired filesystem.
  6. sudo mkdir /data: Create a mount point for the RAID array.
  7. sudo mount /dev/md0 /data: Mount the RAID array.

Physical Security: The First Line of Defense

Physical security measures are essential for preventing unauthorized access to systems and data.

  • Access Control: Implement physical access controls, such as locks, key cards, and security cameras, to restrict access to sensitive areas.
  • Device Security: Disable unnecessary ports and services, such as USB ports, to prevent unauthorized data transfer or malware introduction.
  • TPM (Trusted Platform Module): A hardware chip that provides secure storage for cryptographic keys and enhances platform integrity.

Endpoint Security Solutions

  • EDR (Endpoint Detection and Response): Monitors endpoint activity for malicious behavior and provides tools for incident response.
  • HIDS (Host Intrusion Detection System): Detects intrusions on a host system by analyzing logs and system activity.
  • HIPS (Host Intrusion Prevention System): Proactively blocks malicious activity on a host system.
  • NGFW (Next-Generation Firewall): Provides advanced security features beyond traditional firewalls, including intrusion detection and prevention, application control, and deep packet inspection.

Data Encryption: Protecting Sensitive Information

Encryption protects data confidentiality and integrity. Various levels of encryption can be implemented:

  • Full Disk Encryption (FDE): Encrypts the entire hard drive, protecting all data at rest.
  • File/Folder Encryption: Encrypts specific files or folders for granular control.
  • Volume Encryption: Encrypts entire logical volumes.
  • Database Encryption: Protects data stored in databases.
  • Record-Level Encryption: Encrypts individual records within a database.

Redundancy: Ensuring High Availability

Redundancy minimizes downtime in case of hardware failures.

  • RAID: Provides data redundancy and fault tolerance.
  • NIC Teaming: Combines multiple network interfaces for increased bandwidth and failover capability.
  • UPS (Uninterruptible Power Supply): Provides backup power in case of outages.
  • Dual Power Supplies: Ensures continuous power supply even if one power supply fails.

Conclusion

Securing individual systems requires a multi-layered approach encompassing malware protection, vulnerability management, access control, data encryption, and redundancy. By implementing best practices and utilizing appropriate tools, organizations can effectively mitigate risks and maintain a secure computing environment. Remember, cybersecurity is an ongoing process, requiring continuous vigilance and adaptation to evolving threats.

--

--

Bhavyansh @ DiversePixel
Bhavyansh @ DiversePixel

Written by Bhavyansh @ DiversePixel

Hey I write about Tech. Join me as I share my tech learnings and insights. 🚀

No responses yet