Cyber Security • Foundations and Threat Landscape

Core Security Principles — Explain least privilege, defense-in-depth, and secure-by-default principles

Three foundational design principles that shape every secure system, from operating-system kernels to cloud architectures.

A protected digital shield with binary code and a secure lock for cyber security
Inside this lesson 10 sections 5 questions 8 figures

SECTION 1

Historical Context & Motivation

The discipline of computer security did not emerge in a vacuum; it grew out of decades of painful lessons learned from system compromises, military research, and the rapid expansion of networked computing. In the earliest mainframe era, systems were physically isolated and shared among trusted users, so access control was rudimentary at best. As time-sharing operating systems appeared in the 1960s, researchers quickly realized that granting every user full access to every resource was a recipe for accidental—and eventually deliberate—damage. The foundational security principles we study today, least privilege, defense-in-depth, and secure-by-default, were articulated precisely because early systems lacked them and suffered the consequences.

1967 • Ware Report

Willis Ware's RAND report identified fundamental vulnerabilities in multi-user mainframes, arguing that hardware and software controls were both necessary—an early articulation of layered defense.

1975 • Saltzer & Schroeder Principles

Jerome Saltzer and Michael Schroeder published "The Protection of Information in Computer Systems," formally defining least privilege, fail-safe defaults (a precursor to secure-by-default), and several other design principles still cited today.

1988 • Morris Worm

The Morris Worm exploited excessive Unix process privileges and weak defaults, infecting roughly 10% of the Internet and demonstrating the catastrophic cost of ignoring least privilege and secure defaults.

2001 • Code Red / Nimda Era

A wave of Internet worms exploited default-enabled services in Windows IIS. Microsoft's subsequent "Trustworthy Computing" initiative institutionalized secure-by-default and defense-in-depth across its product line.

2020s • Zero Trust Architectures

Modern Zero Trust frameworks—adopted by NIST (SP 800-207) and major cloud providers—represent the logical culmination of all three principles: never trust, always verify, minimize blast radius.

The recurring pattern across five decades is unmistakable: every major security failure can be traced back to a violation of one or more of these three principles. The question that motivates this lesson is straightforward yet profound—how do we architect systems that remain resilient even when individual components fail or are compromised? The answer lies in understanding least privilege, defense-in-depth, and secure-by-default not as isolated rules, but as an interlocking design philosophy.

SECTION 2

Core Principles & Definitions

Each of the three core security principles addresses a different facet of system resilience. Least privilege constrains what any single entity can do; defense-in-depth ensures that no single protective mechanism is a point of failure; and secure-by-default dictates that the out-of-the-box configuration should be the safest possible state. Together, they form a triad that security engineers invoke at every layer of the stack—from kernel system calls to API gateway configurations.

1

Least Privilege

Every subject (user, process, service) should operate with the minimum set of permissions necessary to complete its task—no more, no less. Permissions should be granted just-in-time and revoked immediately after use.
2

Defense-in-Depth

Security controls are arranged in multiple independent layers so that the failure of one layer does not result in total compromise. Layers may be administrative, technical, or physical.
3

Secure-by-Default

The initial configuration of a system should deny all access and disable optional features unless explicitly enabled by an administrator. The safest state should require zero user action.
4

How They Interlock

Least privilege limits blast radius if a layer is breached. Defense-in-depth provides redundancy. Secure-by-default ensures that freshly deployed components do not inadvertently widen the attack surface.
✦

KEY TAKEAWAY

Think of these three principles like the safety systems in a modern automobile. Least privilege is the seatbelt—it constrains the driver to the minimum freedom needed to operate safely. Defense-in-depth is the combination of crumple zones, airbags, ABS, and traction control—multiple independent mechanisms, each designed to catch what the others miss. Secure-by-default is the fact that the car starts in 'Park' with the parking brake engaged—the safest state requires no deliberate action from the user.

SECTION 3

Visual Explanation — The Security Triad in Action

Defense-in-Depth: Concentric Security LayersPHYSICAL LAYER (fences, badges, locks)NETWORK LAYER (firewalls, IDS/IPS, segmentation)HOST LAYER (OS hardening, endpoint protection)APPLICATION LAYER (input validation, auth)DATA(encrypted at rest & in transit)Secure-by-Default:Every layer startsdeny-allLeast PrivilegeEach layer grants onlythe minimum accessneeded to traverse it.An attacker must penetrate every ring; a single breach does not reach the data.
The concentric-ellipse diagram illustrates defense-in-depth as nested rings—physical, network, host, application, and data—each independently guarded. The callout boxes show how least privilege constrains traversal at every ring, while secure-by-default ensures each ring starts in a deny-all posture.

In the diagram above, the outermost ring represents physical security controls—badge readers, CCTV, locked server rooms—and each inner ring adds a logically independent layer. An attacker who bypasses the perimeter firewall in the network layer still faces OS-level hardening, application-level authentication, and data-layer encryption. This layered architecture is the essence of defense-in-depth. Notice that least privilege operates within each ring—a network firewall rule permits only the specific ports and protocols required, rather than allowing all traffic—and secure-by-default ensures that every ring begins in its most restrictive configuration, requiring explicit administrative action to open access.

SECTION 4

How the Principles Work — Formal Reasoning

While these principles are often taught qualitatively, we can formalize their impact with simple probabilistic reasoning. Consider a system protected by n independent layers, each with probability pᵢ of being breached. If an attacker must penetrate all layers in sequence, the overall probability of total compromise decreases multiplicatively—a direct consequence of defense-in-depth.

DEFENSE-IN-DEPTH BREACH PROBABILITY

P(totalbreach)=p1×p2×p3×…×pnP(total breach) = p₁ × p₂ × p₃ × … × pₙ

Where pᵢ is the probability that layer i is independently breached, and layers are assumed to fail independently. With n layers each at pᵢ = 0.1, the total breach probability is 10⁻ⁿ.

LEAST PRIVILEGE — BLAST RADIUS

BlastRadius=∣AccessibleResources∣/∣TotalResources∣Blast Radius = |Accessible Resources| / |Total Resources|

The blast radius quantifies the fraction of the system an attacker can compromise through a single breached identity. Least privilege minimizes this ratio by ensuring |Accessible Resources| → minimum needed for the task.

SECURE-BY-DEFAULT — ATTACK SURFACE

AttackSurface=Σ(enabledservices×exposedinterfaces×privilegelevel)Attack Surface = Σ (enabled services × exposed interfaces × privilege level)

Each enabled service with an exposed interface adds to the attack surface. Secure-by-default minimizes this sum by setting enabled services to zero and requiring explicit opt-in, effectively reducing the initial attack surface to a baseline minimum.

⚠

Independence Assumption

The multiplicative formula above assumes that layers fail independently. In practice, shared vulnerabilities (e.g., a single-vendor stack) can introduce correlated failures. This is why defense-in-depth practitioners advocate for diversity of mechanisms—using controls from different vendors, different technologies, and different architectural paradigms—to approximate the independence assumption as closely as possible.

SECTION 5

Detailed Breakdown — Applying Each Principle Across the Stack

Understanding where each principle applies requires mapping them to concrete layers of a modern technology stack. The diagram below illustrates how least privilege, defense-in-depth, and secure-by-default manifest at the user, application, operating system, network, and physical levels.

Principles Mapped to the Technology StackLeast PrivilegeDefense-in-DepthSecure-by-DefaultUSER LEVELRole-based access control (RBAC)Just-in-time elevated accessUSER LEVELMFA + password + biometricSecurity awareness trainingUSER LEVELNew accounts = read-onlyMFA enforced at sign-upAPPLICATION LEVELScoped API tokensMicroservice-level permissionsAPPLICATION LEVELWAF + input validation + SASTRuntime app self-protectionAPPLICATION LEVELHTTPS-only, HSTS preloadedCORS deny by defaultOS LEVELNon-root containers / sandboxesSELinux / AppArmor profilesOS LEVELKernel hardening + ASLR + DEPHost-based IDSOS LEVELUnnecessary services disabledFirewall default-denyNETWORK LEVELMicro-segmented VLANsPer-service ACLsNETWORK LEVELFirewall + IPS + DPI + VPNDNS filtering + TLS inspectionNETWORK LEVELAll ports closed by defaultOutbound deny-all egressEach row represents a stack layer; each column shows how a specific principle is applied at that layer.
This matrix maps each of the three core principles to four layers of a technology stack—user, application, OS, and network—illustrating that the principles are not abstract ideals but concrete, implementable controls at every level.
PrincipleKey Implementation ExamplesCommon Violation
Least PrivilegeRBAC, scoped OAuth tokens, non-root containers, IAM policies with deny-by-defaultGranting an application a database admin role when it only needs SELECT on one table
Defense-in-DepthWAF + input validation + parameterized queries; MFA + session management + anomaly detectionRelying solely on a perimeter firewall with no internal segmentation or host hardening
Secure-by-DefaultCloud security groups deny all inbound, HSTS preloaded, new user accounts read-onlyShipping software with a default admin password of 'admin' or debug mode enabled

Principle implementations and their most common violations

SECTION 6

Worked Example — Securing a Cloud-Based Web Application

Consider a scenario in which your team is deploying a new e-commerce microservice to AWS. The service needs to read product data from a DynamoDB table, write order records to another DynamoDB table, and send notification emails via SES. Let us apply all three principles systematically to harden this deployment.

Securing an E-Commerce Microservice Deployment

  1. 1

    Step 1 — Apply Least Privilege to the IAM Role

    Instead of attaching the AWS-managed AmazonDynamoDBFullAccess policy, we craft a custom IAM policy that grants dynamodb:GetItem and dynamodb:Query on arn:aws:dynamodb:*:*:table/Products, and dynamodb:PutItem only on arn:aws:dynamodb:*:*:table/Orders. SES is scoped to ses:SendEmail with a condition restricting the 'From' address. The service cannot delete tables, scan other tables, or send emails from arbitrary addresses.
    Blast radius minimized: if the service is compromised, the attacker can only read products and write orders—not exfiltrate or destroy other data.
  2. 2

    Step 2 — Layer Defense-in-Depth Controls

    We implement controls at multiple independent layers. Network layer: the service runs in a private VPC subnet; only an Application Load Balancer (ALB) in a public subnet can route traffic to it. Application layer: AWS WAF rules on the ALB block SQL injection and XSS payloads; the application code uses parameterized queries. Host layer: the container runs as a non-root user with a read-only filesystem. Data layer: DynamoDB tables use AWS-managed KMS encryption at rest and TLS in transit.
    Four independent layers: bypassing the WAF still leaves parameterized queries, network isolation, OS-level sandboxing, and encryption.
  3. 3

    Step 3 — Enforce Secure-by-Default Configuration

    The security group attached to the container's ENI is configured with zero inbound rules (the ALB's target-group health check is the only whitelisted source). Outbound traffic is restricted to the DynamoDB VPC endpoint, the SES VPC endpoint, and nothing else—no Internet access. The container image is built from a distroless base image with no shell, no package manager, and no unnecessary binaries. Debug logging is OFF by default and requires an explicit environment variable to enable.
    The default deployment has near-zero attack surface: no open ports, no outbound Internet, no debug modes, no unnecessary software.
  4. 4

    Step 4 — Quantify the Improvement

    Using the breach probability model, suppose each of the four defense-in-depth layers has an individual breach probability of 0.1 (a generous estimate). The probability of an attacker breaching all four is P = 0.1 × 0.1 × 0.1 × 0.1 = 0.0001, or 0.01%. Even if the attacker reaches the application, least privilege ensures they can only read product data and write orders—not escalate to administrative access or pivot to other services.
    Combined breach probability: 10⁻⁴ (0.01%), with blast radius limited to two DynamoDB tables.

SECTION 7

Strengths, Limitations & Trade-Offs

No security principle is a silver bullet. Each of the three core principles introduces trade-offs in operational complexity, user experience, and cost. A mature security program acknowledges these trade-offs and calibrates their application to the organization's risk appetite and resource constraints.

PrincipleStrengthsLimitations / Trade-Offs
Least PrivilegeDramatically limits blast radius; simplifies audit trails; aligns with regulatory frameworks (SOC 2, PCI-DSS); supports Zero TrustIncreases operational overhead for permission management; can impede developer velocity if approval workflows are too rigid; requires continuous review as roles evolve
Defense-in-DepthProvides resilience against unknown (zero-day) threats; no single point of failure; layers can be updated independentlyIncreases infrastructure cost and complexity; more layers mean more to monitor and maintain; risk of false sense of security if layers share common-mode failures
Secure-by-DefaultEliminates a large class of misconfiguration vulnerabilities; lowers barrier to secure deployment; reduces human errorMay frustrate users who must explicitly enable features; can slow initial development if defaults are too restrictive; requires vendor discipline to maintain across updates

Comparative analysis of the three core security principles

⚖️

CONTEXTUALIZING THE TRADE-OFFS

In a real-world engineering organization, these trade-offs are navigated through risk management. High-value targets (payment systems, PII stores) warrant maximum application of all three principles despite the cost, while low-risk internal tools may relax certain constraints in favor of developer agility. The key insight is that these principles are design parameters to be tuned, not binary switches—think of them like the security equivalent of quality-of-service (QoS) knobs in networking.

SECTION 8

Connection to Advanced Frameworks — Zero Trust & Beyond

The three core principles we have studied are not static relics of 1970s research; they are the intellectual foundation upon which modern security architectures are built. The most prominent contemporary framework—Zero Trust Architecture (ZTA), as codified in NIST SP 800-207—is essentially the logical extension of least privilege, defense-in-depth, and secure-by-default to a world where the traditional network perimeter has dissolved. In a Zero Trust model, every request is authenticated, authorized, and encrypted regardless of its origin, internal or external. The network itself is never trusted—an idea that directly operationalizes least privilege (no implicit trust), defense-in-depth (identity, device, network, and data layers all independently verified), and secure-by-default (deny-all until explicitly allowed).

Classic PrincipleZero Trust ManifestationEmerging Extension
Least PrivilegeContinuous, context-aware access decisions (identity + device posture + location + time)Attribute-Based Access Control (ABAC) and policy-as-code (e.g., Open Policy Agent)
Defense-in-DepthMicro-segmentation, service mesh mutual TLS, runtime anomaly detection at every hopSoftware-Defined Perimeter (SDP), confidential computing (hardware enclaves)
Secure-by-DefaultDefault-deny network policies, infrastructure-as-code with secure templatesShift-left security: secure defaults baked into CI/CD pipelines and supply-chain attestation

Evolution from classic principles to Zero Trust and emerging paradigms

As you progress through your cybersecurity coursework, you will encounter threat modeling methodologies (STRIDE, PASTA), formal security models (Bell-LaPadula, Biba), and compliance frameworks (ISO 27001, NIST CSF). Every one of these can be understood as a structured application of the three principles discussed here. Mastering these foundational concepts now equips you with the mental scaffolding to reason clearly about any security problem you will face—whether it involves a container orchestration policy, a hardware Trusted Platform Module, or an organizational governance process.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

A junior developer argues that granting their microservice AdministratorAccess in AWS saves time because they never have to debug permission errors. Which core security principle does this violate, and what specific risk does the violation introduce?
Show answer
This violates the principle of least privilege. By granting AdministratorAccess, the microservice can perform any AWS API action—including deleting databases, modifying IAM policies, or exfiltrating data from any S3 bucket. If the service is compromised (e.g., via a server-side request forgery vulnerability), the attacker inherits full administrative control of the entire AWS account. The blast radius expands from a single service to the entire cloud environment. The correct approach is to craft a narrowly scoped IAM policy granting only the specific actions on the specific resources the service needs.

Question 2: BASIC CALCULATION

An organization deploys three independent security layers, each with an individual breach probability of 0.15. Assuming independence, calculate the probability that an attacker breaches all three layers. Then recalculate if a fourth layer with breach probability 0.10 is added.
Show answer
Using the defense-in-depth formula P(total) = p₁ × p₂ × p₃, we get P(3 layers) = 0.15 × 0.15 × 0.15 = 0.003375, or approximately 0.34%. Adding a fourth layer: P(4 layers) = 0.003375 × 0.10 = 0.0003375, or approximately 0.034%. The fourth layer—even though it is only 90% effective on its own—reduces the total breach probability by an order of magnitude (roughly 10×). This demonstrates the multiplicative power of defense-in-depth: each additional independent layer provides exponential security improvement.

Question 3: INTERMEDIATE

You are hardening a Linux server that currently runs Apache HTTP, MySQL, and an FTP daemon. The server's purpose is to serve a read-only static website. Describe a specific action you would take for each of the three core security principles (least privilege, defense-in-depth, secure-by-default) to reduce the attack surface.
Show answer
Secure-by-default: Disable and uninstall MySQL and FTP, since a static website requires neither a database nor a file-transfer daemon—these represent unnecessary default-enabled services that expand the attack surface. Least privilege: Configure Apache to run as a dedicated, unprivileged user (e.g., www-data) with read-only access to the document root and no shell access. The web server process should not be able to write to its own configuration files or binary. Defense-in-depth: Even with Apache hardened, add iptables rules allowing only ports 80 and 443 inbound, deploy a host-based intrusion detection system (e.g., OSSEC), and enable mandatory access controls via AppArmor to confine Apache's file-system access regardless of its Unix permissions.

Question 4: APPLIED

A healthcare startup is deploying a patient portal on Kubernetes. The portal reads and writes Protected Health Information (PHI) to a PostgreSQL database. The CTO asks you to design the access-control and network architecture using the three core principles. Outline at least six specific controls, identifying which principle each control implements.
Show answer
1. Least Privilege: Create a PostgreSQL role for the portal with only SELECT, INSERT, and UPDATE on patient-related tables; deny DELETE and DDL operations. 2. Least Privilege: The Kubernetes pod's service account should have no cluster-admin privileges; bind only the RBAC role needed to read its own ConfigMap and Secrets. 3. Defense-in-Depth: Deploy a Kubernetes NetworkPolicy that allows the portal pod to communicate only with the PostgreSQL pod on port 5432—no other egress or ingress. 4. Defense-in-Depth: Encrypt PHI at rest using PostgreSQL Transparent Data Encryption and in transit via mutual TLS between the portal pod and the database pod; even if the network is compromised, the data remains encrypted. 5. Secure-by-Default: The Kubernetes default NetworkPolicy should be deny-all for the namespace; only explicitly created policies open specific traffic paths. 6. Secure-by-Default: The container image should be built from a minimal distroless base with no SSH, no package manager, and a read-only root filesystem. This architecture satisfies HIPAA's requirement for layered technical safeguards protecting electronic PHI.

Question 5: CRITICAL THINKING

Consider the SolarWinds supply-chain attack (2020), in which attackers inserted malicious code into a trusted software update mechanism. Analyze which of the three core principles were violated by both SolarWinds (the vendor) and by the organizations that deployed the compromised update. Then propose at least three architectural changes—grounded in the three principles—that would have mitigated the impact.
Show answer
The SolarWinds attack exploited violations of all three principles. Least privilege violation (vendor side): the build pipeline likely ran with excessive privileges, allowing the injected code to modify production binaries. Least privilege violation (customer side): the Orion agent ran with domain-admin or root-level privileges, giving the malware full lateral-movement capability once activated. Defense-in-depth violation: many organizations trusted the signed update implicitly, with no additional runtime monitoring or behavioral analysis to detect anomalous outbound DNS or HTTP traffic from the Orion process. Secure-by-default violation: Orion's default installation granted broad network access and administrative permissions. Mitigations: (1) Apply least privilege to the monitoring agent—restrict it to read-only SNMP/WMI access with no domain-admin rights. (2) Implement defense-in-depth via runtime anomaly detection (e.g., an EDR solution) that flags unusual DNS queries or code-signing certificate changes, independent of whether the binary was signed by a trusted vendor. (3) Enforce secure-by-default by requiring network segmentation for monitoring infrastructure and default-denying outbound Internet access from management plane servers, channeling updates through a vetted proxy with binary transparency verification.

SUMMARY

Lesson Summary

Summary

This lesson examined the three foundational security design principles that underpin every well-architected system. Least privilege mandates that every user, process, and service operate with the minimum permissions necessary, thereby minimizing the blast radius of any compromise. Defense-in-depth arranges security controls in multiple independent layers—physical, network, host, application, and data—so that the failure of any single layer does not lead to total compromise; the multiplicative reduction in breach probability makes each added layer exponentially valuable. Secure-by-default ensures that the out-of-the-box configuration of any system is its safest state—deny-all postures, disabled optional services, and no default credentials—so that security requires no user action.

Historically grounded in the Saltzer and Schroeder design principles (1975) and validated by decades of high-profile breaches, these three principles form an interlocking triad. They are not isolated rules but a design philosophy that scales from kernel system calls to Zero Trust cloud architectures. Mastering them provides the conceptual foundation for every advanced security topic you will encounter—from threat modeling and formal access-control models to compliance frameworks and incident response.

Varsity Tutors • Cyber Security • Core Security Principles