Try Hack Me (THM): Pre-Security Path →Part 1
First of all, I would like to thank Josh Mason for providing me a THM premium subs which has given me driven force to work more and learn more!!
Inspired by Josh Mason I decided to write a blog/write-up for the path I’ll be completing in the tenure of 6 months!! If everything goes according to plan I’ll be focusing first on Cyber Defense Path and then Offensive Pentesting after completion of Pre-Security Path.
I’ll always opt for the Pre-Requisite course first before actually getting into the real stuff. I might be knowing all the concepts and consider this a warm-up or able to learn even a small new basic concept, all the time given to Pre-requisite will we worth of!
Note: I’ll be briefly talking about the concepts not going it into details as it is a pre-requisite.
Getting into Pre-Requisite Path!!
The Path contains 5 sub-topics which we will discuss in detail down below. The sub-topics are:
- Cyber Security Introduction
- Network Fundamentals
- How The Web Works
- Linux Fundamentals
- Windows Fundamentals
This blog contains first 3 sub-topics i.e Cyber Security Introduction , Network Fundamentals and How the Web Works, other 2 sub topics will be covered in Part 2 i.e next blog.
Cyber Security Introduction
This sub-topic has the following rooms:
- Web Application Security
- Network Security
- Learning Road Map
Web Application Security:
It provides an easy scenario of Account Takeover using Password Reset Brute forcing. Obviously a task of no time. May be this is the way of exciting the user to learn hacking
It includes the importance of the Network Security , its costs and data breached.
Learning Road Map:
Roadmap to learn using paths starting from Complete Beginner to either Offensive or Cyber Defense.
This sub-topic has the following rooms:
- What is Networking?
- Intro to LAN
- OSI Model
- Packets and Frames
- Extending Your Network
What is Networking:
Network: An interconnection of multiple devices, also known as hosts, that are connected using multiple paths for the purpose of sending/receiving data or media.
Internet: It is one giant network that consists of many, many small networks within itself
Devices in the network can be identified either using logical address (IP address) or Physical Address of machine (MAC address)
Logical Address can be of two types (Public and Private IP)and can be represented in two formats (IPv4 and IPv6)
MAC (Media Access Control ) is a unique address assigned to network interface at the factory it was built at.
MAC address is a sixteen-character hexadecimal number (a base sixteen numbering system used in computing to represent numbers) split into two’s and separated by a colon, for example, a4:c3:f0:85:ac:2d. The first six characters represent the company that made the network interface, and the last six is a unique number.
Ping is one of the most fundamental network tools available to us. Ping uses ICMP (Internet Control Message Protocol) packets to determine the performance of a connection between devices.
Intro to LAN
- LAN Topologies:
LAN refers to Local Access Network topology, the design or look of network at hand
Star Topology is that devices are individually connected via a central networking device such as a switch or hub.
Bus Topology relies upon a single connection which is known as a backbone cable.
Ring Topology (also known as token topology) are connected directly to each other to form a loop.
Router is used to connect networks and pass data between them with the help of routing
Routing is the label given to the process of data travelling across networks. Routing involves creating a path between networks so that this data can be successfully delivered.
Switches are networked devices that combine several other devices, such as computers, printers, or any other networking-capable device that uses ethernet.
- A Primer on Subnetting
Subnetting is achieved by splitting up the number of hosts that can fit within the network, represented by a number called a subnet mask.
As we can recall, an IP address is made up of four sections called octets. The same goes for a subnet mask which is also represented as a number of 8 bytes (32 bits), ranging from 0 to 255 (0–255).
- The ARP Protocol
Recalling that devices can have two identifiers: a MAC address and an IP address from prior jobs, the ARP protocol, or Address Resolution Protocol for short, is the technology that allows devices to identify themselves on a network.
ARP protocol allows a device to associate its MAC address with an IP address on the network. Each device on a network will keep a log of the MAC addresses associated with other devices.
Working of ARP:
- The DHCP Protocol
IP addresses can be assigned manually, by physically inputting them into a device, or automatically, by using a DHCP (Dynamic Host Configuration Protocol) server, which is the most popular method.
It uses “DORA” method for assigning IP address to devices in a network:
- What is OSI Model
The OSI model (or Open Systems Interconnection Model) is an absolute fundamental model used in networking. This critical model provides a framework dictating how all networked devices will send, receive and interpret data.
For me , remembering OSI Model is simply “APST-NDP” from Application to Physical Layer
- Layer 7 → Application
Application layer is the layer in which protocols and rules are in place to determine how the user should interact with data sent or received.
Ex. HTTP, FTP , IRC, SSH ,DNS
- Layer 6 → Presentation
This layer acts as a translator for data to and from the application layer (layer 7). The receiving computer will also understand data sent to a computer in one format destined for in another format. For example, when you send an email, the other user may have another email client to you, but the contents of the email will still need to display the same.
Ex. SSL ,IMAP , JPEG
- Layer 5 → Session
The session layer (layer 5) synchronises the two computers to ensure that they are on the same page before data is sent and received. Once these checks are in place, the session layer will begin to divide up the data sent into smaller chunks of data and begin to send these chunks (packets) one at a time.
Ex. APIs, Sockets, Winsock
- Layer 4 →Transport
The transport layer (Layer 4) is responsible for delivery of an entire message from an application program on the source device to a similar application program on the destination device.
Ex. TCP , UDP
- Layer 3 →Network
The third layer of the OSI model (network layer) is where the magic of routing & re-assembly of data takes place (from these small chunks to the larger chunk). Firstly, routing simply determines the most optimal path in which these chunks of data should be sent.
Ex. IP , ICMP ,IGMP, IPSec
- Layer 2 → Data Link
The data link layer focuses on the physical addressing of the transmission. It receives a packet from the network layer (including the IP address for the remote computer) and adds in the physical MAC (Media Access Control) address of the receiving endpoint. Inside every network-enabled computer is a Network Interface Card (NIC) which comes with a unique MAC address to identify it.
Ex. Ethernet, Switch , Bridge
- Layer 1 → Physical
Physical Layer defines electrical and physical specifications for devices. The physical layer defines the relationship between a device and a transmission medium, such as a copper or optical cable.
Ex. Cable , Fibre, Repeaters
I loved this OSI Practical Game in the room :))
Packets and Frames
- What are Packets and Frames?
Packets and frames are little chunks of data that, when combined, constitute a bigger piece of data or message. In the OSI model, however, they are two different entities.A frame is at layer 2 →the data link layer, meaning there is no such information as IP addresses
TCP is connection-based, which means that TCP must establish a connection between both a client and a device acting as a server before data is sent.
Three-Way Handshake Process:
Any sent data is given a random number sequence and is reconstructed using this number sequence and incrementing by 1. Both computers must agree on the same number sequence for data to be sent in the correct order. This order is agreed upon during three steps:
- SYN — Client: Here’s my Initial Number Sequence (ISN) to SYNchronise with (0)
- SYN/ACK — Server: Here’s my Initial Number Sequence (ISN) to SYNchronise with (5,000), and I ACKnowledge your initial number sequence (0)
- ACK — Client: I ACKnowledge your Initial Number Sequence (ISN) of (5,000), here is some data that is my ISN+1 (5,000 + 1)
- TCP Closing a Connection:
To initiate the closure of a TCP connection, the device will send a “FIN” packet to the other device. Of course, with TCP, the other device will also have to acknowledge this packet.
Again the practical implementation in the room is just lit!!
Another protocol for exchanging data between devices is the User Datagram Protocol (UDP).
Unlike TCP, UDP is a stateless protocol that sends data without requiring a persistent connection between the two devices. The three-way handshake, for example, does not take place, and there is no synchronisation between the two devices.
The diagram below shows a normal UDP connection between two devices:
- Ports 101
It consists of list of known ports along with the description
Extending Your Network
- Introduction to Port Forwarding
Port forwarding is an essential component in connecting applications and services to the Internet.
Without port forwarding, applications and services such as web servers are only available to devices within the same direct network.
- Firewalls 101
A firewall is a device within a network responsible for determining what traffic is allowed to enter and exit in the network.
- Category of Firewalls:
Stateful: This type of firewall uses the entire information from a connection; rather than inspecting an individual packet, this firewall determines the behaviour of a device based upon the entire connection.
Stateless: This firewall type uses a static set of rules to determine whether or not individual packets are acceptable or not. For example, a device sending a bad packet will not necessarily mean that the entire device is then blocked.
- Trust me I have started liking the Practical Implementation in the rooms which are quite fun to play and easy to learn
- VPN → Virtual Private Network
A Virtual Private Network (VPN) is a technology that allows devices on different networks to interact securely over the Internet by establishing a dedicated path between them (known as a tunnel).
The devices that are connected through this tunnel create their own private network.
- Types of VPN Technologies
PPPT: The Point-to-Point Tunneling Protocol (PPTP) is the technology that allows the data from PPP to travel and leave a network.
PPP: This technology is used by PPTP to allow for authentication and provide encryption of data. VPNs work by using a private key and public certificate (similar to SSH). A private key & certificate must match for you to connect.
IPSec: nternet Protocol Security (IPsec) encrypts data using the existing Internet Protocol (IP) framework.
- VLAN → Virtual Local Area Network
A technology called VLAN (Virtual Local Area Network) allows specific devices within a network to be virtually split up.
This split means they can all benefit from things such as an Internet connection but are treated separately. This network separation provides security because it means that rules in place determine how specific devices communicate with each other. This segregation is illustrated in the diagram below:
In the context of the diagram above, the “Sales Department” and “Accounting Department” will be able to access the Internet, but not able to communicate with each other (although they are connected to the same switch).
Part 2 of Pre-requisite Path will be available soon!!