pk.org: Computer Security/Lecture Notes

Command Injection and Containment

Terms we covered

Paul Krzyzanowski – 2026-10-25

Injection and Database Queries

These terms describe injection and the structure of database queries:

Interpreter
A component that parses input and carries out the operations it describes.
Injection
Causing untrusted input to be interpreted as instructions instead of data.
Command injection
Making a program’s interpreter execute attacker-supplied commands through untrusted input.
SQL injection
Changing a database command through input inserted into its SQL text.
Blind SQL injection
Extracting data through response differences or timing without seeing query results.
Second-order injection
Injection triggered when previously stored input is used unsafely in a later command.
Operator injection
Supplying a query operator where a program expects an ordinary data value.
Parameterized query
A query that supplies its structure separately from its data values.
Prepared statement
Another name for a parameterized query.
Stored procedure
A routine defined in a database and invoked by name with arguments.

Shells and Hidden Interpreters

These terms concern command parsing and execution of input as code:

Shell command injection
Making a shell execute unintended commands embedded in an application’s input.
Metacharacter
A character with special meaning in an interpreter’s syntax.
Command substitution
Replacing a command expression with the output of running that command.
Argument vector
A list of separate arguments supplied directly to a program.
Argument injection
Making a program interpret untrusted input as unintended options or additional arguments.
Deserialization
Reconstructing values or objects from a stored or transmitted representation.

Input Handling

These terms describe ways to check, transform, and separate input:

Validation
Accepting or rejecting input according to permitted types, ranges, or formats.
Sanitization
Transforming input by removing or escaping characters that would change its interpretation.
Structural separation
Supplying data separately from the command syntax that determines operations.
Allowlist
A set of permitted values or operations, with everything else rejected.
Denylist
A set of forbidden values or operations, with everything else permitted.
Escaping
Encoding special characters so an interpreter treats them as literal data.
Canonicalization
Converting equivalent representations of input into one standard form.

Paths and Race Conditions

These terms describe file naming and changes between checking and using a resource:

Path resolution
Following pathname components and links to identify a filesystem object.
Path traversal
Using an input path to reach files outside the intended directory.
Path equivalence
Different path strings resolving to the same filesystem object.
Symbolic link
A filesystem object containing a path that redirects name resolution.
Hard link
An additional directory entry referring to the same underlying file.
Time-of-check to time-of-use (TOCTOU) race condition
A name’s binding changing between a check and the use that relies on it.
Atomic operation
An operation that takes effect as one indivisible action.
File descriptor
A process’s handle to an opened file or other kernel-managed resource.

Environment, Libraries, and Packages

These terms concern how names and launch settings select code to run:

Environment variable
A named value passed to a program as part of its execution environment.
Search path
An ordered list of locations searched for an executable, library, or other resource.
Library injection
Making a program load and execute library code controlled by an attacker.
Library preloading (LD_PRELOAD)
Loading a shared library early so its definitions can override other library functions.
Function interposition
Replacing or wrapping a function a program expects from a shared library.
DLL sideloading
Loading an attacker’s dynamic-link library through a trusted program’s library search.
Dependency confusion
Substituting a public package for an intended private package with the same name.
Typosquatting
Registering a misleadingly similar package name to attract mistaken installations.

Containment Principles

These terms describe how authority is limited and which components enforce those limits:

Containment
Restricting what a process can see, do, and consume, enforced from outside it.
Sandbox
An execution environment that enforces restrictions on the code running inside it.
Principle of Least Privilege
Granting a program only the authority required for its job.
Privilege separation
Dividing a program into components with different levels of authority.
Confused deputy
A program tricked into using its authority for an unauthorized caller.
Trusted computing base (TCB)
The components whose correctness is required for a system’s security guarantees.
Attack surface
Interfaces and code exposed to hostile input or activity.
Defense in depth
Combining multiple defenses to reduce reliance on any single protection.

Filesystem and System-Call Restrictions

These mechanisms restrict filesystem views, kernel operations, and resource access:

chroot
Changing the root directory used for a process’s filesystem path resolution.
FreeBSD jail
An isolated environment with restricted administration and process visibility, sharing the host kernel.
System-call filtering
Allowing or denying kernel requests according to a process’s policy.
System call monitor
A separate process that inspects and approves another process’s system calls.
seccomp-BPF
Linux system-call filtering based on call numbers and integer argument values.
AppArmor
Linux mandatory access control that restricts programs using profiles and pathname rules.
AppArmor profile
A program-specific set of rules defining the resource access AppArmor permits.

Language and Application Sandboxes

These terms describe runtime restrictions, app permissions, and browser components:

Language runtime
Software that implements a language’s execution rules and supports running its programs.
Language sandbox
Restrictions enforced through a runtime’s execution rules and exposed interfaces.
Application sandbox
Operating-system restrictions on an application’s access to data and shared resources.
Install-time permission
Authorization requested when an application is installed.
Runtime permission
Authorization granted during app use for access to a protected resource.
Entitlement
A platform-authorized declaration of an application’s permitted capabilities.
Browser process
The privileged browser component that holds the user’s authority and serves the renderers.
Renderer process
A browser process that parses pages, lays them out, and executes scripts.

Namespaces, Resources, and Privileges

These Linux mechanisms separate resource views, limit consumption, and divide administrative authority:

Namespace
A separate view of a class of kernel-managed resources for selected processes.
User namespace
Separate user and group identities with administrative authority scoped to that namespace.
Control group (cgroup)
Resource accounting and configured limits for a group of Linux processes.
Fork bomb
Repeated process creation intended to exhaust system resources.
Linux capability
A separately grantable privilege that represents part of root’s administrative authority.

Containers

These terms describe application environments that share a kernel:

Container
An application environment whose processes share the host kernel.
Container image
Files and execution settings used to create a container’s environment.
Container runtime
Software that creates and manages a container’s execution environment.
Rootless runtime
Container management software that runs without host-root privileges.
Container escape
Gaining access beyond the restrictions enforced on a container.

Virtual Machines

These terms describe isolation beneath the operating system and virtualized resources:

Virtual machine (VM)
A software-defined computer that runs its own guest operating system.
Hypervisor (virtual machine monitor)
Software that runs virtual machines and controls their access to physical resources.
Guest operating system
An operating system running inside a virtual machine.
Trap and emulate
Running a guest kernel deprivileged so its privileged instructions trap to the hypervisor.
VM exit
The processor’s switch from guest to hypervisor when a sensitive event occurs.
Type 1 hypervisor
A hypervisor that directly controls the machine’s hardware.
Type 2 hypervisor
A hypervisor hosted by a conventional operating system.
Emulated device
Software that reproduces a hardware device’s interface for a guest.
Paravirtualized device
A virtualization-specific device interface used by a matching guest driver.
Device passthrough
Assigning a physical device directly to a guest virtual machine.
Virtualization-based security (VBS)
Using a hypervisor to protect selected operating-system assets from the main kernel.