Operating Systems Basics
Operating Systems Basics
In some instances, the kernel still communicates with the hardware directly, so it is not completely independent of the HAL. The HAL also
needs the kernel to perform some functions.
1.2.3 Windows File Systems
exFAT :
This is a simple file system supported by many different operating systems.
FAT has limitations to the number of partitions, partition sizes, and file sizes that it can address, so it is not usually used for hard drives
(HDs) or solid-state drives (SSDs) anymore.
Both FAT16 and FAT32 are available to use, with FAT32 being the most common because it has many fewer restrictions than FAT16.
NOTE : When formatting a partition, the previous data may still be recoverable because not all the data is completely removed. The free
space can be examined, and files can be retrieved which can compromise security. It is recommended to perform a secure wipe on a drive
that is being reused. The secure wipe will write data to the entire drive multiple times to ensure there is no remaining data.
In the NTFS file system, a file with an ADS is identified after the filename and a colon, for example, Testfile.txt:ADS. This filename indicates
an ADS called ADS is associated with the file called Testfile.txt. An example of ADS is shown in the command output.
In the output:
The first command places the text “Alternate Data Here” into an ADS of the file Testfile.txt called “ADS”.
After that, dir, shows that the file was created, but the ADS is not visible.
The next command shows that there is data in the Testfile.txt:ADS data stream.
The last command shows the ADS of the Testfile.txt file because the r switch was used with the dir command.
The BIOS initialization phase starts with hardware checks and a power-on self-test (POST), ending when the system disk is found. The
BIOS then looks for the master boot record (MBR), which loads the operating system.
UEFI, in contrast, uses .efi files stored in the EFI System Partition (ESP) for booting, offering more visibility and security by storing boot
code in firmware.
Regardless of the firmware, Bootmgr.exe loads after a valid Windows installation is found. It switches the system to protected mode and
reads the Boot Configuration Database (BCD), which indicates whether the system is resuming from hibernation or starting fresh. If
hibernating, Winresume.exe loads the Hiberfil.sys file. For a cold start, Winload.exe creates a hardware record in the registry and ensures
that drivers are digitally signed using Kernel Mode Code Signing (KMCS).
Winload.exe then loads Ntoskrnl.exe to start the Windows kernel and HAL. The Session Manager Subsystem (SMSS) reads the registry,
prepares the user environment, and starts the Winlogon service for user logon.
HKEY_LOCAL_MACHINE
HKEY_CURRENT_USER
Registry entries like Run, RunOnce, RunServices, RunServicesOnce, and Userinit define which services and applications start, based
on their entry type. While these can be manually added, it’s safer to use the Msconfig.exe tool to view and modify startup options.
Opening Msconfig via the search box brings up the System Configuration window, which contains five tabs with various configuration
options.
General
Three different startup types can be chosen here. Normal loads all drivers and services. Diagnostic loads only basic drivers and
services. Selective allows the user to choose what to load on startup.
Boot
Any installed operating system can be chosen here to start. There are also options for Safe boot, which is used to troubleshoot startup.
Services
All the installed services are listed here so that they can be chosen to start at startup.
Startup
All the applications and services that are configured to automatically begin at startup can be enabled or disabled by opening the task
manager from this tab.
**Tools**
Many common operating system tools can be launched directly from this tab.
1.2.8 Processes, Threads, and Services
A process is any program that is currently executing. Each process that runs is made up of at least one thread. A thread is a part of the
process that can be executed. The processor performs calculations on the thread.
All threads of a process share the same address space, meaning they cannot access the address space of other processes, which helps
prevent corruption. Windows supports multitasking, allowing multiple threads to run simultaneously, limited by the number of processors.
Some Windows processes are services—background programs that support the OS and applications. They can start automatically at boot,
be manually started, stopped, restarted, or disabled.
Each process in a 32-bit Windows computer supports a virtual address space that enables addressing up to 4 gigabytes. Each process in a
64-bit Windows computer supports a virtual address space of 8 terabytes.
Each user space process runs in a private address space, separate from other user space processes. When the user space process needs
to access kernel resources, it must use a process handle. This is because the user space process is not allowed to directly access these
kernel resources. The process handle provides the access needed by the user space process without a direct connection to it.
AMMap, part of the Windows Sysinternals Suite, is a powerful tool for analyzing memory allocation. It provides detailed insights into how
Windows distributes system memory among the kernel, processes, drivers, and applications.
1.2.10 The Windows Registry
The registry is a hierarchical database where the highest level is known as a hive, below that there are keys, followed by subkeys. Values
store data and are stored in the keys and subkeys. A registry key can be up to 512 levels deep.
NOTE : New hives cannot be created. The registry keys and values in the hives can be created, modified, or deleted by an account with
administrative privileges.
Administrator
Administrator Command Prompt
The Guest account should remain disabled, as it has no password and provides a temporary, limited-access environment.
Windows simplifies user management with groups, assigning predefined permissions to members. Users can belong to multiple groups, with
"explicitly deny" permissions taking precedence. Groups like "Performance Log Users" enable specific tasks. Local users and groups are
managed via lusrmgr.msc
Windows also uses domains to set permissions. A domain is a network service where users, groups, computers, and security settings are
managed by domain controllers (DCs). Each user and computer must authenticate against a DC to log in and access resources. Security
settings from the DC override local settings by default.
1.3.3 CLI and PowerShell
These are the types of commands that PowerShell can execute:
cmdlets - These commands perform an action and return an output or object to the next command that will be executed.
**PowerShell scripts - These are files with a .ps1** extension that contain PowerShell commands that are executed.
**PowerShell functions -** These are pieces of code that can be referenced in a script.
**General -** Summary information about the local computer and WMI
**Backup/Restore -** Allows manual backup of statistics gathered by WMI
**Security -** Settings to configure who has access to different WMI statistics
**Advanced -** Settings to configure the default namespace for WMI
Some attacks today use WMI to connect to remote systems, modify the registry, and run commands. WMI helps them to avoid detection
because it is common traffic, most often trusted by the network security devices and the remote WMI commands do not usually leave
evidence on the remote host. Because of this, WMI access should be strictly limited.