Category: security

ASLR (Address Space Layout Randomization)

ASLR (Address Space Layout Randomization) is a security feature that randomizes the memory addresses used by key data areas of a process β€” such as the stack, heap, libraries, and executable code.

πŸ” Purpose:

To make it harder for attackers to predict memory locations during an exploit (e.g., buffer overflow, return-oriented programming).

Without ASLR, attackers can rely on fixed addresses to inject or jump to malicious code.
With ASLR, every reboot or process restart changes memory layout, invalidating most static exploits.

How ASLR Works

Memory RegionWhat’s RandomizedExample
Executable baseProgram’s load address/bin/bash loads at different addresses each run
StackStack start addressPrevents predictable stack-smashing offsets
HeapHeap baseStops heap spraying reliability
Shared librarieslibc, etc.Mapped at different offsets each run

ASLR Compliance Meaning

Being ASLR compliant means:

  1. The OS supports ASLR, and
  2. The application, driver, or firmware image is built and linked to use ASLR.

In other words:

The binary and its runtime environment both must support and not disable ASLR.

Windows

  • ASLR is enabled system-wide via /DYNAMICBASE linker flag.
  • You can verify by running:

dumpbin /headers myapp.exe | find "Dynamic base"

β†’ If Dynamic base is listed β†’ ASLR enabled.

Policies: Controlled via Exploit Protection or Group Policy.

Windows 10+ also support Force ASLR for all executables.

Linux

  • Controlled via /proc/sys/kernel/randomize_va_space
    • Value Meaning
    • 0 ASLR disabled
    • 1 Conservative randomization
    • 2 Full randomization

With value 1, Linux randomizes these user-space memory areas:

Memory areaRandomized with value 1?Notes
mmap base addressYesAffects shared libraries and memory mappings created with mmap()
Shared librariesYesBecause shared libraries are usually loaded through mmap()
StackYesMain thread stack location is randomized
VDSO pageYesKernel-provided virtual syscall page is randomized
Heap / brk areaUsually NoFull heap randomization needs value 2

randomize_va_space = 1
stack + mmap/libs + VDSO randomized

randomize_va_space = 2
stack + mmap/libs + VDSO + heap/brk randomized

Root of Trust (RoT)

Root of Trust (RoT) is the foundational security component you trust absolutely in a system. Everything else’s security is built on top of it.

A Root of Trust is a small, highly trusted piece of hardware, firmware, or software that:

  • Is implicitly trusted
  • Cannot be modified (or is extremely hard to)
  • Starts the chain of trust for security operations

A Root of Trust typically performs three core functions:

1. Root of Trust for Measurement (RTM)

  • Measures (hashes) the next component before it runs
  • Example: measuring bootloader firmware

2. Root of Trust for Verification (RTV)

  • Verifies signatures or integrity before allowing execution
  • Example: secure boot verifying OS signatures

3. Root of Trust for Storage (RTS)

  • Securely stores secrets like cryptographic keys
  • Example: hardware key storage

Chain of Trust (important concept)

Root of Trust
↓
Firmware
↓
Bootloader
↓
OS Kernel
↓
Applications

Each layer:

  • Verifies or measures the next layer
  • Extends trust forward

Difference between BitLocker and Measurement

1. BitLocker – Encryption & Access Control

Purpose: Protects data at rest.

What it does:

  • BitLocker is a full-disk encryption feature in Windows.
  • It encrypts the entire drive using AES-based encryption.
  • The decryption key is released only if the platform passes integrity checks (via TPM measurements or PIN/password).
  • Prevents data theft if the drive is stolen or accessed offline.

Key point:

BitLocker protects what’s on the disk (data confidentiality).

How TPM is involved:

  • TPM stores a Volume Master Key (VMK) encryption key.
  • On boot, TPM compares PCR (Platform Configuration Register) measurements (firmware, bootloader, etc.) with expected values.
  • If they match, TPM releases the decryption key to Windows to unlock the disk.
  • If not, the user must enter a recovery key β†’ this prevents booting on tampered or different hardware.

2. Measurement – Platform Integrity (TPM PCRs)

Purpose: Protects system trustworthiness.

What it does:

  • Measurement means recording the hash of each boot component (BIOS, Option ROMs, Bootloader, OS Loader, etc.) into TPM PCR registers.
  • These measurements are done by firmware (BIOS/UEFI) and bootloaders.
  • They build a chain of trust from power-on to OS handoff.

Key point:

Measurement protects what’s running (system integrity).

Used for:

  • Secure Boot / Measured Boot
  • Remote Attestation (e.g., verifying system state over a network)
  • Policy decisions β€” like whether TPM will release BitLocker keys.

🧠 BitLocker vs. Measurement (Summary Table)

FeatureBitLockerMeasurement (TPM PCRs)
PurposeDisk encryptionPlatform integrity
ProtectsData on diskBoot-time code & configuration
LayerOS-levelFirmware / TPM-level
Uses TPMTo store/release encryption keyTo store hashes (PCRs)
TriggerDisk accessBoot sequence
PreventsOffline data theftBoot-level tampering
VerificationUnlocks disk only if PCRs matchRecords system state for verification
Depends onTPM & OSTPM & firmware

🧭 Example Scenario:

  1. On boot, BIOS, Bootloader, and OS are measured β†’ hashes stored in PCRs.
  2. TPM compares current PCRs to baseline values.
  3. If they match β†’ TPM releases BitLocker key β†’ disk decrypted β†’ OS loads.
  4. If mismatch β†’ TPM refuses β†’ BitLocker recovery required.

Thus:

Measurement ensures the platform is trusted, and BitLocker uses that trust to release encryption keys.

Next-Generation Firewall (NGFW) with Layer 7 Filtering in Embedded Systems

A Next-Generation Firewall (NGFW) extends beyond traditional packet filtering (Layer 3/4) by providing application-level (Layer 7) visibility and control. In embedded systems β€” such as IoT gateways, industrial controllers, or edge servers β€” integrating NGFW capabilities presents unique challenges due to limited CPU, memory, and power. Layer 7 filtering inspects the application data payload, not just IP/port.
It can:

1. What Layer 7 Filtering Means

Enforce policy based on app, user, or content type β€” e.g. β€œblock social media APIs” or β€œallow only JSON over HTTPS from whitelisted domains.”

Identify protocols like HTTP, MQTT, CoAP, Modbus, OPC-UA, etc.

Detect specific application actions (e.g., login, file upload, API calls).

2. NGFW Core Components for Embedded Systems

To achieve this in a constrained environment, the NGFW must include:

ComponentPurposeLightweight Options
Deep Packet Inspection (DPI) EngineParses protocol layers, identifies appsnDPI, L7-filter, Suricata-lite
Stateful Packet Inspection (SPI)Tracks connection statesNetfilter conntrack (Linux)
Application IdentificationUses pattern matching and heuristicsnDPI, AppID library
Content Filtering / IDSDetects malicious payloadsSnort ruleset subset, Suricata rules
Policy EngineEnforces rules per app/user/deviceCustom rule parser or iptables/nftables extensions
TLS/SSL Inspection (optional)For HTTPS visibilityOpenSSL proxy or embedded MITM TLS proxy


3. Example Embedded Software Stack

A realistic embedded NGFW architecture could look like this:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Management UI / CLI β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Policy & Rule Engine β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ AppID + DPI Engine β”‚
β”‚ (nDPI / custom) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ SPI / Connection Table β”‚
β”‚ (conntrack) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Packet I/O (DPDK/eBPF) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Network Drivers / NIC β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

On Linux-based embedded platforms, this stack could run on:

  • OpenWRT / Yocto Linux
  • ARM-based SoCs (Cortex-A53, NXP Layerscape, NVIDIA Jetson, etc.)
  • DPDK or XDP/eBPF for high-performance packet processing


4. Optimization Techniques
To make NGFW features viable in embedded devices:

Maintain a protocol whitelist to minimize parsing workload

Use zero-copy packet paths (DPDK or AF_XDP)

Offload flow classification to smart NICs (like NVIDIA BlueField)

Implement hardware-assisted encryption (AES-NI, ARM Crypto Extensions)

Employ incremental DPI (scan only first few packets per flow)

5. Example Open Source Projects to Build On

FrameworkUse CaseNotes
nDPILightweight DPI engineC library, used by ntopng
SuricataIDS/IPS with Layer 7 supportCan be trimmed for embedded use
Zeek (Bro)Application traffic analysisToo heavy for small systems, ok for edge
OpenWRT + nftablesBase platform for embedded firewallExtensible with Lua/C modules

6. Example Use Cases

  • Industrial IoT gateway blocking unknown MQTT brokers
  • Edge compute node enforcing API access policies
  • 5G small-cell or MEC node filtering HTTP/REST telemetry
  • Smart camera gateway isolating unauthorized cloud uploads

Preboot DMA vulnerability – CVE-2023-5410

DMA is direct memory access, used by lot of peripherals to transfer to and fro data without CPU involvement. Recent servers and consumer products increased the security of DMA. Recent OS enables secure DMA transfer. A potential security vulnerability has been reported in the system BIOS , which might allow memory tampering when the BIOS is in POST. Recent BIOS provide an option to disable Preboot DMA in their setup to allow older peripherals which has older firmware to service and not secure DMA capable. CVE ID is CVE-2023-5410.

Applying the firmware patches and enabling the preboot DMA security is much relevant in server and consumer products for the below reasons.

  1. This can be part of a NIST compliance in future products. Certain customer segments may not buy a product if it is not NIST compliant to the latest NIST version. e.g:- Government and finance organizations.
  2. Operating systems like Windows and Linux may add dependency on preboot DMA security as a prerequisite for enabling DMA security. Right now no valid way to relate between the Preboot and OS DMA security. Future it can be a requirement in operating systems installation and use.

Source: NVD – CVE-2023-5410

Source: HP PC BIOS Pre-boot DMA Protection Security Update

Kernel and pre-boot DMA Protection

Kernel Direct Memory Access (DMA) Protection is a Windows security feature that protects against external peripherals from gaining unauthorized access to memory. PCIe hot plug devices attach classes of external peripherals, including graphics cards, to their devices with the plug-and-play ease of USB. These devices are DMA-capable, and can access system memory and perform read and write operations without the need for the system processor’s involvement. This makes them susceptible to drive-by DMA attacks.

pre-boot DMA Protection enables equivalent DMA protection at the system BIOS level.

When DMA Protection is enabled
1. No devices can do DMA to the DMA protected device between BIOS POST complete and OS driver load.
2. During BIOS POST also the EFI device driver will make sure the device will work on a DMA remapped region.
3. Some OS will make sure the driver is loaded only when the system is unlocked.

Drive-by DMA attacks are attacks that occur while the owner of the system isn’t present and usually take just a few minutes, with simple-to-moderate attacking tools (affordable, off-the-shelf hardware and software), that don’t require the disassembly of the device. In supply chain the attacker can install a temporary off-the-shelf hardware and exploit the system BIOS.

Source: Kernel DMA Protection – Windows Security