PXE (Preboot Execution Environment) Server

When you turn on a laptop

OSI Model

Seven levels:

  1. Physical
  2. Data Link
  3. Network
  4. Transport
  5. Session
  6. Presentation
  7. Application

Network Interface Card (NIC)

This is a hardware component of your computer — it's what allows you to connect to a network

It converts data into EM signals

The NIC is responsible for the first 2 layers of the OSI model.

Memory

Most NICs have a small amount of non-volatile memory

Network Boots tell the CPU to use the NIC's firmware, instead of the hardrive

Direct Memory Access

The NIC receives a packet from the network, verifies the checksum, and drops it into RAM. Once enough data has been stored in RAM, it tells the CPU to process the data

Promiscuous Mode

Tells the NIC to pass every packet it sees to the CPU, instead of just the ones addressed to its MAC address.

Serialization

Data from the CPU is taken and converted into a stream of electrical pulses or radio waves

Media Access Control (MAC)

Every NIC has a MAC address burned into its ROM.

The NIC listens to the wire and if it sees information directed to its MAC address, it knows to react

DORA Process

DHCP

TFTP

HTTP

TCP/IP Stack (Internet Protocol Suite)

It tells computers how to interact over a network

It's made up of a bunch of layers (a stack)

  1. Application
  2. how the user interacts with the network
  3. http, ssh, ftp, dns
  4. turns your data into a format that the network can understand

HTTP (hypertext transfer protocol)

The browser sends a GET or POST request to the server

HTTPS uses TLS/SSL to encrypt the HTTP data

Uses port 443

Internet Service Providers use caching proxies: if someone else on th network downloaded something, the ISP will retain a local copy in its cache

HTTP is very lightweight

SSH (Secure Shell)

Used for remote administration Creates a persistent, encrypted session.

Uses public/private keys

Once you have the SSH set up, you can send things through it

DNS (Domain Name System) When you type a URL, the system sends a DNS query for the corresponding IP address

FTP/SFTP (File Transfer Protocol)

HTTP wasn't originally designed for file transfer; FTP was

FTP is stateful

Original FTP sends everything in plain text, while SFTP uses SSH

FTP uses 2 connections:

  1. Commands
  2. Data

There are some issues with FTP

Because FTP was designed for file transfer, it has built-in tools for things like

Backing Up Files

Google Drive and Dropbox use HTTPS

Private servers often use SFTP

You use SFTP when you already have a secure shell set up

Source Port: a random large number assigned by your laptop to keep track of an outgoing request

Destination Port: A standardized number that tells the receiver where the received data belongs

There are 65,535 ports

Sockets: are IPs + ports

When you open different browser tabs, each tab gets its own port

Nmap Tool

Windows opens a bunch of ports by default, for things like Remote Procedure Calls (RPCs, port 135) and Server Message Blocks (SMBs, port 445)

RCP: when a program makes an RCP cal, the local system packages (marshals) the request, and sends it to the remote system. The remote system executes the task and sends the result back.

SMB: The language that Windows uses for file sharing, printer sharing, ect.

Windows computers are very noisy

EternalBlue was a powerful exploit of SMBs

SMBv1 driver (srv.sys)

SMB_COM_NT_TRANSACT uses dwords, while SMB_COM_TRANSACTION2_SECONDARY uses words.

Buffer Overflow

A buffer is a temporary storage area in RAM Many old programming languages, like C and C++ don't actually check if data is small enough to fit in a buffer. If the data is too large, it overflows into the neighbouring memory addresses.

The Return Address (RET) tells the CPU to return to the main program

Address Space Layout Randomization (ASLR) Every time the computer boots, it randomizes its addresses. This makes it harder for an attacker to know the address of their malicious code

No Operation Sled (NOP Sled) The shellcode has its first 1000 bytes NOPs; the malicious code is at the end. Then, if the return address gets changed to something that hits any of those NOPs, the CPU will slide along the address until it reaches the malicious code

Runtimes Programming languages like Python and Java have this: it checks to make sure that there are no buffer overflows. In a language like C, raw instructions are just sent to the CPU. The CPU doesn't know about buffers and their sizes, so it allows buffer overflows.

Garbage collectors are background processes inside of the runtime. They look for pieces of memory that the program is no longer using, to reclaim tem for future use

Runtime Bounds Checking: this is what handles buffer overflows

But Python is written in C

Memory-Safe Systems Languages Things like C — very low level — but memory safe

Resource Exhaustion (DoS) Regex DoS (ReDoS): the attacker sends a string to a regex checker that has exponential growth

Data Execution Prevention (DEP/NX) Marks the buffers as non-executable

Return-Oriented Programming (ROP) Instead of injecting their own code, attackers stitch together pieces of legitimate code in a computer's memory to perform an attack

Heap Grooming/Spraying

  1. Internet

  2. IP addresses

  3. IP, ICMP

  4. packages segments into packets and adds the source and destination IP addresses

  5. Network Access

  6. the hardware

  7. NIC and ethernet cable

  8. converts IP packets into frames and then into electrical or radio signals

  9. uses MAC addresses to move data between two pieces of hardware on the same local network.