By the end of this lesson you can
- Explain what the CPU, RAM and storage each do, and why RAM is volatile
- Follow the fetch, decode, execute cycle and say why the instruction pointer matters
- Convert between binary, decimal and hex, and identify a file by its magic bytes
- Describe the UEFI boot chain, Secure Boot and how bootkits attack it
The big picture: five parts, one idea
Every computer you will ever defend, from a ₹8,000 phone to a rack server in a Mumbai data centre, follows the same pattern. Something takes input, something processes it, something remembers it for now, something stores it for later, and something sends output.
The design most machines still use comes from the stored program idea described by John von Neumann and colleagues in 1945: program instructions and data live in the same memory, and the processor fetches both from there. That single decision is why a bug can make a computer treat attacker supplied data as instructions. Keep that thought; half of exploitation grows from it.
Why should a security learner care about hardware at all? Because every attack eventually lands somewhere physical: a value in a CPU register, a password sitting in RAM, a deleted file still on a disk, or malicious code hiding in firmware that runs before Windows even starts. Defenders who understand the machine know where to look.
The CPU: fetch, decode, execute, billions of times a second
The CPU (central processing unit) only ever does one simple loop. It fetches the next instruction from memory, decodes what it means, executes it, and moves on. A 3 GHz core has a clock that ticks three billion times per second, and modern cores finish several instructions per tick by working on many at once in a pipeline.
Parts worth knowing
- Control unit: reads instructions and directs everything else.
- ALU (arithmetic logic unit): adds, compares, does AND, OR, XOR. Encryption and hashing are mostly huge numbers of these simple operations.
- Registers: a handful of tiny storage slots inside the CPU. Two matter a lot in security: the instruction pointer (RIP on 64-bit x86) holds the address of the next instruction, and the stack pointer (RSP) tracks the top of the stack.
- Cores and threads: a 6 core CPU is six processors on one chip. Simultaneous multithreading (Intel calls it Hyper-Threading) lets one core run two instruction streams.
- Instruction set: the vocabulary a CPU understands. Laptops and servers mostly speak x86-64; phones, Apple M series Macs and many cloud servers speak ARM. Malware compiled for one will not run on the other without translation.
Memory: why RAM forgets and why that matters
Storage is arranged as a hierarchy. The closer to the CPU, the faster and smaller it is.
| Level | Typical size | Rough access time | Keeps data at power off? |
|---|---|---|---|
| Registers | a few hundred bytes | under 1 ns | No |
| L1 / L2 / L3 cache | KB to tens of MB | about 1 to 40 ns | No |
| RAM (DDR4, DDR5) | 8 to 64 GB on a PC | about 50 to 100 ns | No |
| NVMe SSD | 256 GB to several TB | tens of microseconds | Yes |
| Hard disk (HDD) | 1 TB and up | several milliseconds | Yes |
Numbers are typical orders of magnitude, not exact specs. The jump from RAM to a hard disk is roughly a hundred thousand times slower.
RAM is volatile: it needs power to hold data. Everything a running program uses lives there: the document you are typing, decrypted files, session tokens and, very often, passwords in plain form for a short time.
Storage: disks, partitions and the myth of delete
A hard disk stores bits magnetically on spinning platters. An SSD stores them as charge in flash memory cells, with no moving parts, which is why it is so much faster. Both present themselves to the OS as a long row of numbered blocks.
Partitions and partition tables
A disk is split into partitions, and a small table at the start records where each begins and ends.
| MBR (older) | GPT (modern) | |
|---|---|---|
| Introduced | 1983 with PC DOS 2.0 | with UEFI, in the 2000s |
| Max disk size | about 2 TiB with 512 byte sectors | about 9.4 ZB, effectively unlimited |
| Partitions | 4 primary (more via an extended partition) | 128 by default on Windows |
| Firmware | legacy BIOS | UEFI |
| Resilience | single copy at the start | backup header at the end of the disk, plus checksums |
Each partition is then formatted with a file system such as NTFS or ext4, which keeps an index of file names and where their blocks are. You will meet those in the next lesson.
Delete does not mean gone
When you delete a file, the file system usually just marks its blocks as free and removes the index entry. The bytes stay on the disk until something overwrites them. That is how forensic tools recover deleted photos and chats. SSDs complicate this: the TRIM command tells the drive which blocks are unused, and the drive may erase them in the background, so recovery from SSDs is much less reliable.
Binary and hex: the language under everything
A computer only stores two states, on and off, written as 1 and 0. One of these is a bit. Eight bits make a byte, which can hold 28 = 256 different values, from 0 to 255.
Each bit position is worth double the one to its right: 128, 64, 32, 16, 8, 4, 2, 1. To read 0100 0001, add the positions that are on: 64 + 1 = 65.
Why hexadecimal?
Long binary strings are hard to read, so we use base 16. Hex digits go 0 to 9 and then A to F (A = 10, F = 15). The trick is that one hex digit is exactly four bits, so a byte is always two hex digits: 0100 0001 becomes 0x41. Memory addresses, MAC addresses, colours on the web, hashes and file contents in a hex editor are all written this way.
| Decimal | Binary | Hex | Where you see it |
|---|---|---|---|
| 65 | 0100 0001 | 0x41 | ASCII letter A |
| 127 | 0111 1111 | 0x7F | first byte of every Linux ELF program |
| 255 | 1111 1111 | 0xFF | 255.255.255.0 subnet masks, maximum byte |
| 77 and 90 | 0100 1101 0101 1010 | 4D 5A | MZ, the first two bytes of every Windows .exe and .dll |
ASCII maps numbers to characters (65 is A, 97 is a, 48 is the digit 0). Unicode (usually stored as UTF-8) extends this to every script, including Devanagari, which matters for phishing because some letters from different scripts look identical.
File signatures: the extension can lie, the bytes rarely do
| File type | First bytes (hex) | As text |
|---|---|---|
| Windows program (.exe, .dll) | 4D 5A | MZ |
| Linux program (ELF) | 7F 45 4C 46 | .ELF |
| 25 50 44 46 | ||
| ZIP, and anything built on ZIP (.docx, .xlsx, .apk, .jar) | 50 4B 03 04 | PK.. |
| PNG image | 89 50 4E 47 | .PNG |
Boot process: from power button to login screen
Booting is a relay race. Each runner checks the next one and hands over control. Security depends on every hand-off being trustworthy, because whatever runs first can control everything after it.
| Legacy BIOS | UEFI | |
|---|---|---|
| Era | 1980s to about 2012 | standard on PCs since Windows 8 |
| Mode | 16-bit, tiny code size | 32 or 64-bit, much richer |
| Disk | MBR | GPT (MBR supported only through legacy compatibility mode, CSM) |
| Signature checks | none | Secure Boot |
| Windows 11 | not supported | required, with TPM 2.0 |
Flashcards: do you remember?
Tap a card to flip it. Try to answer in your head first; recalling is what makes it stick.
Quick quiz
Instant feedback on every answer. Score 70% or more to pass this lesson's quiz.
Q1Which component holds the data of programs that are running right now?
Running programs live in RAM. Storage keeps files when the power is off.
Q2An attachment is named marksheet.pdf but its first bytes are 4D 5A. What is it really?
4D 5A (MZ) is the signature of Windows executables. A real PDF starts with %PDF.
Q3Binary 1100 1000 is which decimal number?
128 + 64 + 8 = 200.
Q4Why do incident responders capture RAM before switching a suspicious machine off?
Memory is volatile. Fileless malware and live network connections exist only there.
Q5What did the BlackLotus bootkit (2023) show?
BlackLotus abused a vulnerable but still signed Windows boot component (CVE-2022-21894) to get past Secure Boot.
Q6Which statement about deleting a file on a hard disk is true?
That is why forensic recovery works, and why full disk encryption matters for discarded drives.
Hands-on lab
Lab: look inside your own machine
You need: A laptop or PC with VirtualBox installed, and an Ubuntu 24.04 LTS ISO (free from ubuntu.com). Windows steps use your own Windows PC.
Only on machines you own. Do this lab on your own VM or computer. Scanning, testing or accessing anyone else's system without written permission can be an offence under the Information Technology Act, 2000 (for example Sections 43 and 66).
Create a VM and choose the firmware type
In VirtualBox click New, pick the Ubuntu ISO, and give it 2 CPUs, 4 GB RAM and a 25 GB disk. Before the first boot open Settings, System, Motherboard (switch to Expert mode if you do not see it) and note whether Enable EFI is ticked. Install Ubuntu.
Take a snapshot
With the VM powered off, open the VM's Snapshots view and click Take. Name it
clean-install. You can now break anything and roll back in seconds.Check BIOS or UEFI from inside Linux
$ [ -d /sys/firmware/efi ] && echo UEFI || echo 'Legacy BIOS' $ sudo mokutil --sb-statemokutilreports whether Secure Boot is on (install it withsudo apt install mokutilif missing). Now power off, flip the EFI setting, and try booting again. A system installed in UEFI mode will not boot in legacy mode: you just saw why the firmware type matters.Flip it back before continuing.
Inspect CPU, RAM and disks
$ lscpu | head -20 $ free -h $ lsblk -f $ sudo fdisk -l /dev/sda | headFind the architecture (x86_64), number of CPUs, total RAM, and whether the disk label type is
gptordos(MBR).Read magic bytes
$ head -c 4 /bin/ls | xxd $ cp /bin/ls ~/holiday.pdf $ file ~/holiday.pdf $ head -c 4 ~/holiday.pdf | xxdThe copy is named like a PDF but
fileand the bytes7f45 4c46say ELF program. Delete it after:rm ~/holiday.pdf.Check your real Windows PC
On your own Windows machine press Win + R, run
msinfo32, and read BIOS Mode (UEFI or Legacy) and Secure Boot State. Turn on File name extensions in File Explorer if it is off.
You are done when: You can say your VM's firmware type, Secure Boot state, CPU architecture and partition table type, and you identified a file by its bytes instead of its name.
Key takeaways
- The CPU only fetches, decodes and executes. Whoever controls the instruction pointer controls the machine.
- RAM holds live secrets and live evidence; it disappears at power off.
- Deleted is not erased. Full disk encryption protects discarded and stolen drives.
- Hex is binary made readable: one hex digit per four bits. Trust magic bytes over file extensions.
- The boot chain is only as strong as its first link. Keep Secure Boot on and firmware updated.
Finished the sections, quiz and lab? Mark the lesson complete. Progress is saved only in this browser.