GHOSTNET›MOD-00 // FOUNDATIONS
MOD-01: TOR & DARK WEB →
MODULE 00 · FOUNDATIONS

FOUNDATIONS: ZERO TO OPERATOR

Operating systems · Linux command line · Networking · The web · Windows · Security concepts · Safe labs & the law · Learning paths

10
CHAPTERS
~3hr
TOTAL READ
BEGINNER
DIFFICULTY
MOD-00
IDENTIFIER
BEGINNER~11 min READCHAPTER 1 OF 10

How Computers and Operating Systems Work

KEY POINTS · THE QUICK VERSION
  • A computer is a CPU executing instructions on data held in memory; storage keeps data when the power is off, RAM does not.
  • The kernel is the privileged core of the OS. Programs run in user space and must ask the kernel, through system calls, to touch hardware, files or the network.
  • A process is a running program with its own virtual memory, a PID, an owner and a set of open files. Threads share one process's memory.
  • Every process runs as some user, and that user's identity decides what it may read, write and execute. Root (UID 0) on Linux and SYSTEM on Windows sit above normal checks.
  • Most attacks are about changing which user your code runs as, or reaching memory and files you were never meant to see. Understanding this model is the foundation for everything else.
Scan these first, then read below for the depth and examples — or jump straight to the lab.
WHAT YOU'LL OWN BY THE END
  • What a CPU, RAM and storage each do — and why it matters to an attacker
  • What an operating system and its kernel actually manage
  • What a system call is — the single gate between your program and the hardware
  • How processes, memory and files work, and where attacks hide inside them
  • The user and permission model — the lock-and-key system behind every hack and every defence

► Why Start Here

Every hack is just a computer doing exactly what it was told. Attackers win when they understand the machine better than the people who set it up. So before any tool, get the mental model: what a computer is, what the OS does, and how it decides who is allowed to do what.

► The Hardware in Plain Terms

Think of a computer as a kitchen. The CPU (Central Processing Unit) is the chef: it can only do simple things, such as add two numbers, compare them, copy a value from one place to another, or jump to a different instruction, but it does billions of them per second. Each simple operation is an instruction, and a program is just a long list of instructions. A modern CPU has several cores, which are independent chefs working in parallel, and each core holds a handful of tiny, ultra-fast storage slots called registers. One register, the instruction pointer, always holds the address of the next instruction to run. Remember that: much of exploit development (MOD-04) is about seizing control of that one register.

RAM (Random Access Memory) is the kitchen counter. It is fast, the chef can reach anything on it instantly, and it is wiped clean when the power goes off. Storage (an SSD or hard disk) is the pantry: much larger, much slower, and it keeps its contents without power. When you open a program, its instructions are copied from storage into RAM so the CPU can run them. Between the CPU and RAM sit several layers of cache, small pockets of very fast memory that keep recently used data close to the chef. Attacks such as Spectre and Meltdown abused the way caches and speculative execution leak timing information, so even these details matter to security.

ComponentAnalogySpeedSurvives Power Off?Security Relevance
CPU registersThe chef's handsFastestNoHijacking the instruction pointer = code execution
CPU cacheSpice rack beside the stoveVery fastNoSide-channel attacks (Spectre, Meltdown)
RAMThe counterFastNoHolds passwords, keys, tokens while in use; memory forensics
SSD / HDDThe pantrySlowYesFiles, logs, deleted-data recovery, disk forensics
◈ PICTURE IT — MTAANI EDITION

Think of RAM like the cash in a duka's till during the day: fast to reach, but counted out and emptied every closing time. Storage is the owner's bank account — slower to get to, but your money is still there tomorrow. Opening an app just carries it from the "bank" (storage) to the "till" (RAM) so the CPU can work fast. Cut the power and RAM vanishes like the till at closing — which is exactly why investigators rush to capture a machine's memory while it is still on (MOD-18).

► What an Operating System Does

Hardware on its own is useless to a normal program. A web browser does not know how to talk to a specific Wi-Fi chip or a specific SSD controller, and it should not have to. The operating system (OS) is the software layer that manages hardware and offers programs a clean, consistent interface to it. Linux, Windows, macOS, Android and iOS are all operating systems.

The heart of the OS is the kernel. The kernel runs in a privileged CPU mode (often called ring 0 or kernel mode) where it can touch any memory and any device. Everything else, including your browser, your shell and even most system tools, runs in user space (ring 3), where the CPU itself blocks direct hardware access. When a user-space program wants to open a file, send a network packet or start another program, it must politely ask the kernel through a system call (syscall). The kernel checks whether the request is allowed, does the work, and returns the result. This boundary is the single most important security wall in a computer: a bug that lets user code run inside the kernel gives the attacker total control.

THE LAYERS OF A RUNNING SYSTEM
+-----------------------------------------------------------+
|  USER SPACE  (ring 3)                                     |
|    bash    firefox    sshd    python3    nginx            |
|       |        |        |        |         |              |
|       +--------+---- system calls ---------+              |
|                (open, read, write, execve, socket ...)    |
+-----------------------------------------------------------+
|  KERNEL SPACE  (ring 0)                                   |
|    process scheduler   memory manager   file systems      |
|    network stack       device drivers   security checks   |
+-----------------------------------------------------------+
|  HARDWARE                                                 |
|    CPU cores    RAM    SSD    network card    USB         |
+-----------------------------------------------------------+

Here is a peek under the hood. Do not worry about the exact text — you are not expected to type any of this yet. Just look at it the way you would watch a mechanic open an engine: you are seeing that a conversation happens, not memorising the parts.

👁 WATCH THIS · you don't need to run it yet — just read along
A PROGRAM TALKING TO THE KERNEL (JUST READ IT)
$ strace -e trace=openat,read,write cat /etc/hostname
openat(AT_FDCWD, "/etc/hostname", O_RDONLY) = 3     <- "open this file, please"
read(3, "ghost-lab\n", 131072)              = 10     <- "now read it"
write(1, "ghost-lab\n", 10)                 = 10     <- "print it to the screen"
ghost-lab
+++ exited with 0 +++
What you're seeing: The command cat /etc/hostname just prints one tiny file (the computer's name, "ghost-lab"). Watch the three polite requests it makes to the kernel: open the file (the kernel hands back ticket number 3), read from that ticket, then write what it got to your screen. Three back-and-forths just to show one word — that is all a "system call" is: a program asking the kernel to do something it is not allowed to do by itself.
↪ You'll start running commands like this yourself from MOD-02 (Linux). For now, the only takeaway is: even printing one file is a conversation with the kernel.

► Processes, Threads and Virtual Memory

A program is a file on disk; a process is that program actually running. Same recipe, different meals.

KEY POINTS
  • PID — every process has a unique Process ID. Open three terminals and you get three bash processes from one file
  • Owner — every process runs as some user, and that decides what it may touch
  • Thread — a separate line of work inside a process; threads share memory (fast, but one can corrupt the others)
  • Virtual memory — each process thinks it owns all the RAM; the kernel keeps them walled off from one another
  • Stack / heap / code — the regions of a process's memory. Overwrite the stack's saved return address and you control where the CPU jumps next — that one sentence is the whole classic buffer overflow (MOD-04)
  • Dumping another process's memory (e.g. Windows LSASS, MOD-05) needs high privilege: you must ask the kernel to break the wall for you
◈ PICTURE IT — MTAANI EDITION

A matatu route — say Route 46 to Ng'ando — is the program: the plan, written down. A specific matatu actually plying that route right now is the process. Ten matatus can run Route 46 at once, just like ten processes run from one program file — each with its own passengers (memory) and its own conductor deciding who boards (the user it runs as). Forcing your way onto someone else's matatu to see their passengers is memory dumping; the kernel is the traffic marshal who normally won't allow it.

👁 WATCH THIS · you don't need to run it yet — just read along
A RUNNING PROGRAM YOU CAN LOOK AT (JUST READ IT)
$ ps -o pid,ppid,user,cmd -p $$
    PID    PPID USER     CMD
   2314    2301 ghost    -bash       <- this is your shell, running as "ghost"

$ ls /proc/2314/
cmdline  cwd  environ  exe  fd  maps  status  ...   <- live info the kernel keeps
What you're seeing: Each line is just the computer answering a question. First: "which process am I in?" — it's bash (your command line), process number 2314, started by the user "ghost". Then it shows that Linux keeps live information about every running process inside a special folder called /proc. You don't need to remember the commands — just notice that a running program is something you can look at and ask questions about.
↪ You'll use ps and friends comfortably after ↪ MOD-02 Linux — here, just read.

► Files and File Systems

A file system is the scheme the OS uses to organise data on storage into named files and folders (directories). Linux commonly uses ext4, XFS or Btrfs; Windows uses NTFS; macOS uses APFS. Underneath the names, a file system keeps metadata about every file: its size, owner, permissions, and timestamps for when it was created, modified and accessed. On Linux each file is described by an inode, a record holding that metadata and pointers to the data blocks.

Linux follows a famous design idea: everything is a file. Ordinary documents are files, but so are devices (your disk is /dev/sda or /dev/nvme0n1), kernel information (/proc and /sys), and even network connections, which a process holds through numbered handles called file descriptors. Descriptors 0, 1 and 2 are always standard input, standard output and standard error. This uniformity is powerful: the same small tools that read text files can read process details or device information, which is why the command line (next chapter) is so effective.

TIP
Timestamps are evidence. Defenders build timelines from file modification and access times, and attackers sometimes alter them (a technique called timestomping). You will see both sides in the malware and red team modules.

► Users and the Permission Model

An OS is a shared building; the permission model is its lock-and-key system.

KEY POINTS
  • User account — every person or service has one, identified by a number: UID on Linux, SID on Windows
  • Groups — bundle users so you can grant access to many at once
  • Every process runs as a user; every file is owned by a user and group
  • On each access the kernel checks identity against the file's permissions and allows or denies — millions of times a day
  • Super-user skips most checks: root (UID 0) on Linux; Administrator and the even-higher SYSTEM account on Windows
  • Services run as low-privilege accounts (like www-data) so a hacked service only hands over limited rights
◈ PICTURE IT — MTAANI EDITION

Picture a plot (apartment block). Each tenant has a key to their own door only — that is a user and their permissions. The caretaker holds a master key to the shared areas — a group privilege. The landlord has every key and answers to no one — that is root / SYSTEM. Nearly every attack in the later modules is one quiet move: a tenant trying to become the landlord.

ConceptLinuxWindows
User identifierUID (number, root = 0)SID (e.g. S-1-5-21-...-1001)
Super-userrootAdministrator, and above it SYSTEM
Account database/etc/passwd and /etc/shadowSAM registry hive (local), Active Directory (domain)
Typical service accountwww-data, mysql, nobodyLocalService, NetworkService, virtual service accounts
Run one command as adminsudoRun as administrator (UAC prompt)
KernelLinux kernel (monolithic, modules)NT kernel (ntoskrnl.exe)

► How This Maps to Attacks

With just this model, you can already describe most of offensive security — one line each:

THE WHOLE GAME, IN FIVE MOVES
  • Initial access — get your code running as some user on the target
  • Privilege escalation — climb from a low user (like www-data) to root/SYSTEM via a misconfig or kernel bug
  • Credential access — read secrets from files or memory you should not reach
  • Persistence — arrange to run again after a reboot (for example, as a service)
  • Defenders watch processes, files, users and syscalls for exactly these moves — every later module goes deep on one
NOTE
Keep three questions in your head on every system you touch: Who am I running as? What can this user read, write and execute? Which processes run as someone more powerful than me? The lab for this module trains exactly those reflexes.
RECAP · CHECK YOURSELF
  • A computer is a CPU executing instructions on data held in memory; storage keeps data when the power is off, RAM does not.
  • The kernel is the privileged core of the OS. Programs run in user space and must ask the kernel, through system calls, to touch hardware, files or the network.
  • A process is a running program with its own virtual memory, a PID, an owner and a set of open files. Threads share one process's memory.
  • Every process runs as some user, and that user's identity decides what it may read, write and execute. Root (UID 0) on Linux and SYSTEM on Windows sit above normal checks.
  • Most attacks are about changing which user your code runs as, or reaching memory and files you were never meant to see. Understanding this model is the foundation for everything else.
Read to the end to count this chapter
▸ READY TO PRACTISE
You've now covered enough for Lab steps 1–2 of 20. Try them in the lab while it's fresh.
OPEN LAB ▸
⚡ TEST YOURSELF
End-of-chapter quiz
A dozen questions — recall and practical. Graded, earns up to 20 XP.
READY TO PRACTICE?
MOD-00 Interactive Lab
20 steps · 300 XP · Real commands · Flag captures
LAUNCH LAB →
MOD-01: TOR & DARK WEB →