Basic LAN Security — Ethical Hacking 101

Bhavyansh @ DiversePixel
5 min readMay 13, 2024

--

Photo by Dan Nelson on Unsplash

Data Security: Protecting Information at All Stages

Data security focuses on safeguarding information throughout its lifecycle, including:

  • Data at Rest: Data stored on devices or in databases. Encryption and access controls are crucial for protecting data at rest.
  • Data in Use/Computation: Data actively being processed by applications or systems. Techniques like secure enclaves and homomorphic encryption protect data during computations.
  • Data in Transit: Data transmitted over networks. Encryption and secure communication protocols are essential for protecting data in transit.

Encryption: Shielding Data

Encryption transforms data into an unreadable format, ensuring confidentiality and integrity.

Symmetric Encryption:

  • Uses the same key for both encryption and decryption.
  • Efficient for large amounts of data.
  • Examples: DES, Blowfish, 3DES, AES, RC4.

Asymmetric Encryption:

  • Employs a pair of keys: a public key for encryption and a private key for decryption.
  • Slower than symmetric encryption, but ideal for secure key exchange and digital signatures.
  • Examples: RSA, ECC.

Cryptographic Systems:

  • Symmetric Block Algorithms: Divide data into fixed-size blocks and encrypt them individually.
  • Streaming Ciphers: Encrypt data one bit at a time.
  • Block Modes: Enhance the security of block ciphers by chaining the encryption of successive blocks. Examples: CBC, CFB, OFB.

Digital Certificates: Establishing Trust

Digital certificates bind a public key to an entity’s identity, verified by a trusted third party (Certificate Authority). They enable secure communication and authentication.

Types of Certificates:

  • Web Certificates: Secure websites using HTTPS.
  • Email Certificates: Encrypt and digitally sign emails.
  • Code-Signing Certificates: Verify the authenticity and integrity of software.
  • User Certificates: Authenticate users for access to systems or applications.

The OSI Model and Layer 2 Attacks

The OSI model provides a framework for understanding network communication, with each layer having specific functionalities and vulnerabilities.

  • Layer 2 (Data Link Layer): Responsible for MAC addresses and local network communication.
  • ARP (Address Resolution Protocol): Maps IP addresses to MAC addresses. Vulnerable to attacks like ARP spoofing and MAC flooding.

Mitigations for Layer 2 Attacks:

  • Static ARP Entries: Manually configure ARP entries to prevent spoofing.
  • MAC Address Filtering: Limit network access based on MAC addresses.
  • Spanning Tree Protocol (STP): Prevents switching loops and broadcast storms.

Network Planning and Segmentation

Effective network design enhances security and performance.

  • Zero Trust: A security model that assumes no implicit trust and verifies every access request.
  • Network Segmentation: Dividing a network into smaller, isolated segments to limit the impact of security breaches.
  • DMZ (Demilitarized Zone): A separate network segment for hosting public-facing servers.

Advanced Network Security Solutions:

  • Load Balancers: Distribute network traffic across multiple servers for improved performance and availability.
  • Server Clustering: Group servers together to provide high availability and fault tolerance.
  • Jump Servers: Provide secure access to private networks from the internet.
  • Honeypots: Decoy systems designed to attract and analyze attacker behavior.
  • Code Analysis: Identifying vulnerabilities in software through static and dynamic analysis tools.

Firewalls: Gatekeepers of Network Traffic

Firewalls control incoming and outgoing network traffic based on predefined rules.

  • Packet Filtering Firewalls: Operate at OSI Layer 4, filtering traffic based on protocols, ports, and IP addresses.
  • Content/URL Filtering Firewalls: Operate at OSI Layer 7, inspecting packet payloads and filtering based on URLs or content types.
  • Web Application Firewalls (WAFs): Protect web applications from attacks like XSS, SQL injection, and directory traversal.

Proxy Servers: Intermediaries for Network Traffic

Proxy servers act as intermediaries between clients and servers, providing various functionalities.

  • Forward Proxy: Fetches content on behalf of internal users, enhancing security and privacy.
  • Reverse Proxy: Protects internal servers from direct exposure to the internet.

Network Address Translation (NAT):

  • Allows multiple devices to share a single public IP address.
  • Provides a layer of security by masking internal IP addresses.

IPsec: Securing Network Communications

IPsec is a suite of protocols for securing network traffic through encryption and authentication.

  • IPsec Tunnel Mode: Encrypts entire IP packets, used for site-to-site VPNs.
  • IPsec Transport Mode: Encrypts only the payload of IP packets, used for host-to-host communication.

SD-WAN and SASE: Modern Network Security

  • SD-WAN (Software-Defined Wide Area Network): Provides dynamic path selection and traffic prioritization for improved network performance.
  • SASE (Secure Access Service Edge): Combines SD-WAN with cloud-based security services like FWaaS, ZTNA, and SWG for comprehensive network protection.

VPNs: Secure Remote Access

VPNs create encrypted tunnels for secure remote access to networks. Common VPN protocols include:

  • L2TP/IPsec: A secure tunneling protocol often used for remote access VPNs.
  • TLS: Provides secure communication over HTTPS, often used for clientless VPN solutions.

Intrusion Detection Systems (IDS):

  • Monitor network traffic for suspicious activity and generate alerts.
  • Snort: An open-source IDS that can be customized with rules to detect specific threats.

Example of configuring a Snort rule to detect ICMP traffic:

  1. Edit the Snort configuration file: sudo nano /etc/snort/snort.conf
  2. Define a new rule in a local rules file: sudo nano /etc/snort/rules/local.rules:
    alert icmp any any -> $HOME_NET any (msg:"Testing ICMP"; sid:1000001; classtype:icmp-event;)
  3. Test the rule: sudo snort -T -i eth0 -c /etc/snort/snort.conf
  4. Run Snort in IDS mode: sudo snort -A console -q -c /etc/snort/snort.conf

Disk Redundancy and Encryption

  • RAID (Redundant Array of Inexpensive Disks): Provides data redundancy and improved performance by grouping multiple disks together.
  • Disk Encryption: Protects data at rest by encrypting entire disks or volumes.

Example of creating a software RAID 1 (mirroring) in Linux:

  1. Identify the disks: sudo lsblk — scsi and sudo fdisk -l
  2. Partition the disks: sudo fdisk /dev/sdb and sudo fdisk /dev/sdc (create partitions of type fd for Linux RAID)
  3. Create the RAID array: sudo mdadm — create /dev/md1 — level=1 — raid-devices=2 /dev/sdb1 /dev/sdc1
  4. Format the RAID device: sudo mkfs -t ext4 /dev/md1
  5. Mount the RAID device: sudo mount /dev/md1 /mountpoint

Endpoint Security

  • EDR (Endpoint Detection and Response): Provides advanced threat detection and response capabilities on endpoints.
  • Host-Based Firewalls: Filter incoming and outgoing traffic on individual systems.
  • Anti-malware Software: Detects and removes malware from systems.

Physical Security

  • Access Controls: Restrict physical access to systems and data centers.
  • Disk Encryption: Protect data on lost or stolen devices.
  • TPM (Trusted Platform Module): Provides hardware-based security features, including secure boot and storage for cryptographic keys.

Conclusion

Securing individual systems requires a layered approach, combining various technologies and best practices to mitigate risks and protect valuable information. By understanding the threats, implementing appropriate security controls, and utilizing the right tools, organizations can create a robust defense against cyberattacks and ensure the confidentiality, integrity, and availability of their data and systems.

--

--

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