Stage 3 of 7 · about 10–16 hours · beginner · checked 2026-11-26

Operating systems

Goal. You can explain the parts of Windows and Linux that matter for defence (processes, services, users, the registry, scheduled jobs and logs) and notice when a process tree looks wrong.

Why it matters#

Attackers have to run something, stay somewhere and act as someone. All three happen on an operating system and leave traces there. If you do not know what normal looks like, you cannot recognise abnormal.

What you will learn#

Processes, on any system#

A process is a running program with an ID (PID), a parent process that started it, a user it runs as, a command line and an executable file on disk. Parents and children form a process tree. Attackers can rename a file, but the question "why did that program start this one?" is much harder to disguise.

Windows: the normal process tree#

After start-up, a Windows machine looks roughly like this (simplified):

Text
System
└── smss.exe                 session manager
    ├── csrss.exe            one per session
    ├── wininit.exe          session 0 (services)
    │   ├── services.exe     Service Control Manager
    │   │   ├── svchost.exe  many instances, hosting services
    │   │   └── other services
    │   └── lsass.exe        handles sign-in; holds credentials
    └── winlogon.exe         your interactive session
        └── userinit.exe     runs logon tasks, then exits
            └── explorer.exe the desktop; your programs start here

Some of these have a parent that has already exited, so a tool may show explorer.exe, wininit.exe, winlogon.exe or csrss.exe with no visible parent. That is normal.

Things worth knowing by heart:

Process Expect Worry if
services.exe One copy, child of wininit.exe There are two, or another parent
lsass.exe One copy, child of wininit.exe It has odd children, or unknown programs read its memory
svchost.exe Child of services.exe, started with -k and a group name, from C:\Windows\System32 Another parent, another folder, no -k
explorer.exe In C:\Windows, one per signed-in user Running from a user folder
Word, Excel, browsers Children of explorer.exe They start cmd.exe, powershell.exe or script hosts

Check three things together: the name, the path and the parent. A file called scvhost.exe, or svchost.exe running from a temporary folder, is imitating a system process. These are strong clues, not proof: updaters and management tools sometimes do strange things. Parent information can also be faked by a skilled attacker.

Windows: services, tasks and the registry#

A service is a program that runs in the background, often before anyone signs in, often with high rights. A scheduled task runs a program at a time or on an event. Both are legitimate and both are favourite ways for an attacker to persist.

The registry is a database of settings, organised as keys and values. The main roots are HKEY_LOCAL_MACHINE (HKLM, the whole machine) and HKEY_CURRENT_USER (HKCU, one user). Programs listed under a Run key, such as HKCU\Software\Microsoft\Windows\CurrentVersion\Run, start at logon.

Windows: users and rights#

Accounts are local (on one machine) or domain (managed centrally, see stage 4). Each has a SID, a unique identifier. SYSTEM is the most powerful local account. Administrators can change the system; UAC asks before a program uses those rights. Least privilege means giving each account only what it needs.

Windows: event logs#

Windows records events in channels such as Security, System, Application and PowerShell's own. Each event has an Event ID. A starter set:

ID Log Meaning
4624 Security A successful logon (the logon type says how: 2 interactive, 3 network, 10 remote desktop)
4625 Security A failed logon
4672 Security Special privileges assigned to a new logon
4688 Security A process was created (needs auditing enabled; command line needs a further setting)
4720 Security A user account was created
1102 Security The audit log was cleared
7045 System A service was installed
4104 PowerShell Operational Script block logging recorded code

Not everything is on by default. Sysmon, a free Microsoft Sysinternals tool, records far more detail, including process creation with parent and command line (event 1). The install steps are in the minimal detection lab.

Linux: processes and users#

Linux processes also form a tree, starting from PID 1, which on most current distributions is systemd. ps -ef --forest shows it. Details of each process live under /proc/<PID>/.

Every user has a numeric ID. root is user 0 and can do anything. Ordinary users gain rights for one command with sudo. Accounts are listed in /etc/passwd, password hashes in /etc/shadow (readable only by root), and group membership in /etc/group. Files have read, write and execute permissions for owner, group and others. A setuid program runs with its owner's rights, which is why an unexpected one matters.

Linux: services, schedules and logs#

  • systemd starts services from unit files and can also run them on timers. systemctl list-units --type=service and systemctl list-timers show them.
  • cron runs scheduled commands from /etc/crontab, /etc/cron.d/ and each user's crontab -l.
  • SSH keys that may sign in as a user are listed in ~/.ssh/authorized_keys.
  • Logs: journalctl reads systemd's journal. Many distributions also write text files under /var/log: sign-in and sudo activity is in auth.log on Debian and Ubuntu, and secure on Red Hat family systems. Some newer installations keep only the journal.

Web servers, databases and applications keep their own logs too. Shell history files are easy to edit, so never treat them as a complete record.

What looks odd on Linux#

A web server process starting a shell; a program running from /tmp or /dev/shm; a new cron entry or unit file nobody recognises; a new key in authorized_keys. The same question applies: why would that parent do that?

Do this#

  1. Walk your process tree (1 hour). On Windows, run Process Explorer from Sysinternals. Find each process in the table above and note its path, parent and user.
  2. Look at persistence (1 hour). Run Autoruns from Sysinternals and look at Logon, Services and Scheduled Tasks. Explain three entries. Do not disable things you do not understand.
  3. Generate and find events (1–2 hours). In a test machine, sign in with a wrong password, then correctly, then create a local user and delete it. Find each event in Event Viewer.
  4. Do the same on Linux (2 hours). In a Linux virtual machine, create a user, use sudo, fail an SSH sign-in to the machine itself and add a harmless cron job. Find the evidence of each.

Resources#

Free first

Paid or needs an account

  • Windows Internals (paid book, Microsoft Press) - for later, when you want the depth.

Checkpoint#

You are ready to move on when you can:

Go deeper (optional)#

  • Read about Windows access tokens and logon sessions.
  • Explore Linux auditd, which records system calls and file access in detail.

0 / 5 checkpoints ticked

View this page on GitHub