Skip to content
Pwnversity
FUND-WINDOWS-SISTEMAbasic · 15 min · upd. 2026-11

Windows: Processes, Services, Registry and Networking

When you land on a Windows machine, files and users are only half the story. The other half is what’s running: which services exist, which account they run as, what starts by itself at logon or every hour, and which ports are listening. That’s where the privileged programs you can hijack show up, along with the credentials someone left in a scheduled task. And on the defensive side, knowing what’s normal is the only way to notice what isn’t.

Every process has a PID, a parent process that started it, and runs with the identity (the token) of an account. A handful of processes exist on every Windows machine and are worth knowing by heart:

Process What it does What’s normal
wininit.exe Starts session 0 (the services session) One. Launches services.exe and lsass.exe
services.exe The service manager (SCM) One. Parent of every svchost.exe
svchost.exe Container that hosts one or more services Many, and that’s fine. Always children of services.exe
lsass.exe Validates credentials and builds logon tokens One. Heavily protected: touching it is what an EDR watches for
csrss.exe Console and window subsystem One per session
winlogon.exe Logon, logoff and the lock screen One per interactive session
explorer.exe The user’s desktop and file explorer One per user with a graphical session

To spot a fake process posing as a legitimate one, check three things:

  • Path: the real ones live in C:\Windows\System32. An lsass.exe in C:\Users\Public or C:\Windows\Temp is a red flag.
  • Number of instances: two lsass.exe or two services.exe at once is not normal.
  • Parent: an svchost.exe whose parent isn’t services.exe is not what it claims to be. Anyone can pick a name; faking the path and the process tree is much harder.
Command What it shows
tasklist Processes with PID and memory
tasklist /svc Which services each process hosts (handy for svchost.exe)
tasklist /v Adds the user each process runs as
Get-Process The same in PowerShell, as objects
Get-CimInstance Win32_Process Includes ParentProcessId, path (ExecutablePath) and command line

A service is a program that starts without anyone logging on and is managed by the SCM (services.exe). It’s the Windows counterpart of a systemd daemon. Each service has an executable, a startup type and an account it runs as:

Startup type Meaning
Automatic Starts with the system
Automatic (Delayed Start) Starts with the system, a little after everything else
Manual Only when someone or something requests it
Disabled Cannot start
Account What it is
LocalSystem It’s SYSTEM: the highest level on the machine. Many services run this way
NT AUTHORITY\LocalService Minimal local rights; on the network it appears as anonymous
NT AUTHORITY\NetworkService Minimal local rights; on the network it uses the computer account
A user account Typical of third-party software (databases, backups)

A service that runs as LocalSystem and whose executable or folder you can modify is a direct privilege escalation. So is a path with spaces and no quotes in BINARY_PATH_NAME: Windows tries to run each piece of the path in turn. This is covered in Windows privilege escalation.

The registry is the hierarchical database where Windows keeps almost all of its configuration: what Linux spreads across /etc. It’s organised in keys (like folders) that hold values (name, type and data).

Hive What it contains
HKLM (HKEY_LOCAL_MACHINE) Machine-wide configuration, for every user
HKCU (HKEY_CURRENT_USER) The current user’s configuration
HKU (HKEY_USERS) Every loaded user profile (HKCU is one of them)
HKCR (HKEY_CLASSES_ROOT) Which program opens each file type, plus COM registrations

On disk, the registry lives in files called hives:

File What it stores
C:\Windows\System32\config\SAM Local accounts and their hashes
C:\Windows\System32\config\SYSTEM System configuration; holds the key needed to decrypt the SAM
C:\Windows\System32\config\SOFTWARE Installed software and its settings
C:\Users\<user>\NTUSER.DAT Each user’s HKCU

While the system is running these files are locked: you can’t simply copy them, not even as an administrator.

The Run keys launch programs at logon and are among the first things checked when hunting for persistence:

  • HKLM\Software\Microsoft\Windows\CurrentVersion\Run (every user)
  • HKCU\Software\Microsoft\Windows\CurrentVersion\Run (current user only)

Task Scheduler is Windows’ cron: it runs programs at a set time, at boot, at logon or when an event fires, and every task has an account it runs as. schtasks /query /fo LIST /v lists them all in detail (program, account, next run) and Get-ScheduledTask does the same in PowerShell. As with services, a task that runs as SYSTEM and executes something you can modify is a privilege escalation.

Command What it shows Linux equivalent
ipconfig /all IP, mask, gateway, MAC, DHCP and DNS servers ip a + resolvectl
route print Routing table; 0.0.0.0 is the default route ip route
arp -a ARP cache: who’s on your network ip neigh
ipconfig /displaydns · /flushdns View and clear the DNS cache resolvectl
netstat -ano Connections and ports, with the owning PID ss -tunap
Get-NetTCPConnection -State Listen Listening ports, as objects ss -tlnp
Test-NetConnection IP -Port 445 Is that remote port open? nc -zv

The hosts file is at C:\Windows\System32\drivers\etc\hosts and, just like on Linux, it takes precedence over DNS.

Two remote access services you’ll see constantly:

Service Port What it gives you Who can log in
RDP 3389/tcp Full graphical desktop Administrators and the Remote Desktop Users group
WinRM 5985/tcp (HTTP) · 5986/tcp (HTTPS) Remote PowerShell Administrators and the Remote Management Users group

Windows Firewall has three profiles depending on the network the machine is connected to: Domain (the corporate network), Private (home, trusted network) and Public (the most restrictive). netsh advfirewall show allprofiles or Get-NetFirewallProfile show which ones are active.

WSL (Windows Subsystem for Linux) lets you run Linux distributions on Windows. WSL 1 translated Linux calls into Windows calls; WSL 2 runs a real Linux kernel inside a lightweight virtual machine, and it’s what Docker Desktop uses. During an assessment, a user’s WSL distribution is one more place to look for SSH keys, Bash history and credentials.

Ventana de terminal
C:\> sc.exe qc Spooler
[SC] QueryServiceConfig SUCCESS
SERVICE_NAME: Spooler
TYPE : 110 WIN32_OWN_PROCESS (interactive)
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : C:\Windows\System32\spoolsv.exe
LOAD_ORDER_GROUP : SpoolerGroup
TAG : 0
DISPLAY_NAME : Print Spooler
DEPENDENCIES : RPCSS
: http
SERVICE_START_NAME : LocalSystem

What matters in this output: BINARY_PATH_NAME is what gets executed (no spaces, so no quoting problem), START_TYPE says it starts automatically, and SERVICE_START_NAME : LocalSystem says it runs as SYSTEM. If you could write to that executable, you’d have SYSTEM.

Ventana de terminal
# Running services, with their account and path
PS C:\> Get-CimInstance Win32_Service | Where-Object State -eq 'Running' |
Select-Object Name, StartName, PathName | Format-Table -AutoSize
# Who is the parent of each svchost.exe?
PS C:\> Get-CimInstance Win32_Process -Filter "Name='svchost.exe'" |
Select-Object ProcessId, ParentProcessId, ExecutablePath
Ventana de terminal
:: Which program owns port 8443?
C:\> netstat -ano | findstr LISTENING | findstr :8443
TCP 0.0.0.0:8443 0.0.0.0:0 LISTENING 4120
C:\> tasklist /FI "PID eq 4120"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
tomcat9.exe 4120 Services 0 210,344 K

The last column of netstat -ano is the PID; tasklist /FI turns that PID into a program name. It’s Windows’ ss -tlnp in two steps.

Ventana de terminal
:: What runs at logon
C:\> reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Run
C:\> reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run
:: Search for the word "password" in HKLM string values (slow)
C:\> reg query HKLM /f password /t REG_SZ /s
:: Scheduled tasks in detail
C:\> schtasks /query /fo LIST /v
Ventana de terminal
# The registry as if it were a drive
PS C:\> Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Run
PS C:\> Set-Location HKLM:\Software; Get-ChildItem
# Non-Microsoft tasks, with the account they run as
PS C:\> Get-ScheduledTask | Where-Object TaskPath -notlike '\Microsoft\*' |
Select-Object TaskName, TaskPath, @{n='RunAs';e={$_.Principal.UserId}}
# Networking
PS C:\> Get-NetTCPConnection -State Listen | Sort-Object LocalPort |
Select-Object LocalAddress, LocalPort, OwningProcess
PS C:\> Test-NetConnection 192.168.56.10 -Port 5985
Concept What to remember
Legitimate process In System32, with the expected number of instances and parent.
svchost.exe Many is normal; its parent is always services.exe.
lsass.exe Exactly one. Validates credentials: it’s what an EDR watches.
tasklist /svc · /v Services inside each process · user of each process.
LocalSystem A service with that account runs as SYSTEM.
sc.exe qc BINARY_PATH_NAME = what it runs · SERVICE_START_NAME = which account.
sc in PowerShell 5.1 It’s Set-Content. Use sc.exe.
HKLM · HKCU Machine · current user.
SAM + SYSTEM Local hashes + the key to decrypt them. Locked while running.
Run keys What starts at logon.
schtasks /query /fo LIST /v Windows’ crontab, with each task’s account.
netstat -ano + tasklist /FI "PID eq …" Port → PID → program.
3389 · 5985/5986 RDP · WinRM.
Firewall Domain, Private, Public. Blocks inbound ping.
  1. You see two lsass.exe processes on a machine. What do you check and why?

    Answer

    The path and parent of each. The legitimate lsass.exe is unique, lives in C:\Windows\System32 and is started by wininit.exe. A second lsass.exe, or one outside that folder, is almost certainly a program impersonating it.

  2. sc.exe qc on a service shows SERVICE_START_NAME : LocalSystem and a BINARY_PATH_NAME in a folder your user can write to. What does that mean?

    Answer

    You can replace the executable and, when the service starts (or when you restart it, if you’re allowed to), your program will run as SYSTEM. It’s a privilege escalation.

  3. You type sc query in PowerShell and don’t get the list of services. Why?

    Answer

    Because in Windows PowerShell 5.1 sc is the alias for Set-Content (PowerShell 7 removed it). You need to type sc.exe query, or use Get-Service.

  4. Why isn’t copying C:\Windows\System32\config\SAM enough to get the local hashes?

    Answer

    Because the file is locked while the system is running, and even if you get it, the hashes are encrypted with a key stored in the SYSTEM hive. You need both.

  5. Port 8443 is listening and you don’t know what it is. Which two commands do you use?

    Answer

    netstat -ano to see the PID that owns the port and tasklist /FI "PID eq <pid>" to find out which program it is. In PowerShell, Get-NetTCPConnection -LocalPort 8443 and Get-Process -Id <pid>.

  6. A Windows host on the network doesn’t answer ping. Do you assume it’s down?

    Answer

    No. Windows Firewall blocks inbound ping by default. Scan it anyway without relying on ICMP discovery, for example with nmap -Pn.

  7. What’s the difference between the Run keys in HKLM and HKCU?

    Answer

    The HKLM one applies to every user on the machine and requires administrator rights to write to. The HKCU one only affects the current user, who can modify it themselves.