Defense in Depth

Defense in depth deploys multiple, redundant layers of diverse security controls, so the failure of one layer does not compromise the whole system. No single product delivers all the protection a network needs.

Protect the software applies this principle to development environments, source code, and released artifacts.

See principles of secure system design for the underlying principle.

Each layer sits at a different point between the Internet and the data.

Perimeter

The perimeter is the boundary between an untrusted network and the organization’s network. It filters and monitors traffic before that traffic reaches internal systems.

  • Firewall
    Allows or denies traffic using rules for its source, destination, port, protocol, or application policy.
  • Intrusion detection system
    Observes network or host activity and raises an alert for suspicious behaviour or a known attack pattern. It can detect attacks inside permitted connections.
  • DDoS mitigation absorbs or filters large volumes of malicious traffic.
  • An intrusion prevention system blocks traffic matching known attacks or policy violations.

Examples:

  • An Internet-facing firewall permits HTTPS traffic to a web server but blocks remote desktop traffic.
  • A DDoS protection service filters a flood of requests before it reaches the organization’s Internet connection.

Demilitarized Zone

Place public-facing services in the DMZ. Firewalls separate those services from internal hosts and application servers. A compromised public server then has no direct access to the internal network.

Network

The network layer limits communication between internal systems. It contains a compromise so that an attacker cannot move freely from an exposed machine to a sensitive system.

  • Network segmentation divides systems into zones with different trust levels.
  • Internal firewalls enforce rules between zones.
  • Network access control restricts devices that may join a network.
  • Network monitoring detects unusual connections, scans, and data transfers.

Examples:

  • An employee workstation can reach the Internet and application servers but cannot connect directly to the database subnet.
  • A guest wireless network has Internet access but no route to the corporate network.

Network Segmentation

Network segmentation splits the internal network into zones separated by firewalls, such as Finance and Engineering subnets.

Prevents an attacker who compromises a machine in 1 subnet from freely reaching assets in another.

Host

The host layer protects each endpoint and server after traffic reaches it. Reduces the chance that a compromised account or application becomes full control of a machine.

  • OS hardening removes unnecessary services and disables insecure defaults.
  • Patch management fixes vulnerabilities in the OS and installed software.
  • Endpoint protection detects malware and suspicious process behavior.
  • File permissions and local privilege controls restrict access to system resources.

Examples:

  • A web server runs only its web service and accepts administrative access only through a managed channel.
  • Endpoint detection software quarantines a downloaded executable that attempts to modify system files.

Application

The application layer protects the code that processes requests and makes business decisions. It prevents a valid network connection from becoming unauthorized actions or access to data.

  • Input validation rejects malformed and unexpected data.
  • Authorization checks run before every access to a protected function or record.
  • Secure session management protects authentication tokens from theft and reuse.
  • A web application firewall filters common HTTP attacks before they reach the application.

Examples:

  • A banking application verifies that a customer owns an account before showing its transaction history.
  • Parameterized database queries prevent user input from changing the structure of an SQL query.

Data

The data layer protects information wherever it is stored, processed, or transmitted. It preserves confidentiality and integrity even after another layer has failed.

  • Encryption at rest protects files, databases, backups, and removable storage.
  • TLS protects data in transit between clients, services, and administrators.
  • Access controls limit which identities may read, change, or delete data.
  • Backups and integrity checks support recovery from corruption, deletion, and ransomware.

Examples:

  • A stolen backup cannot be read without the encryption key.
  • A database account used by a reporting service can read reports but cannot modify customer records.

Identity

The identity layer establishes who or what is requesting access. It grants only the permissions needed for the requested task and records the resulting actions.

  • Authentication verifies a user, service, or device identity.
  • Multi-factor authentication requires an additional factor beyond a password.
  • Least privilege limits permissions to the minimum required scope and duration.
  • Privileged access management separates administrative accounts from ordinary user accounts.

Examples:

  • A developer uses a standard account for email and source control, then receives temporary administrative access for a deployment.
  • A service account can read objects from 1 storage bucket but cannot list or access other buckets.

Control Categories

  • Technical controls
    Software and hardware mechanisms, such as multi-factor authentication, end-to-end encryption, and endpoint detection and response.
  • Administrative controls
    Policies, procedures, and training.
  • Physical controls
    Locks, guards, and server room access control.

Diversity of Defense

Layers should come from different vendors and use different technologies. A single vulnerability or zero-day in one vendor’s software then cannot neutralize all the layers.

Complementary Controls

  • Stateful firewall plus web application firewall
    A web application firewall inspects Layer 7 traffic for application-specific attacks. A next-generation firewall does not specialize in these.
  • SSL inspection
    A firewall decrypts and inspects TLS traffic, so attackers cannot hide malicious payloads, command-and-control traffic, or data exfiltration inside encrypted streams.
  • Least privilege at the identity layer
    Users and systems get only the minimum access needed for their job.

Security Policy

A security policy is the compromise an organization adopts between absolute security and absolute access. It states:

  • Who can get in and out.
  • Where they can go.
  • When they can get in and out.
  • What they can bring in or carry out.
  • How physical access and the management station are protected.

Users benefit from a published policy. They see that the organization protects their files, and they understand that access limits protect the organization from disaster.

Security as a Dynamic Process

A policy, devices, and automatic antivirus updates do not finish the job. New attack styles keep appearing, so security needs continuous vigilance and maintenance.

Vulnerability Window

The vulnerability window is the time between the first attack and the moment the organization is ready to face it. A larger window means higher exposure.

Example:

  • First attack at 02:30 GMT.
  • Security partner notices it at 05:30.
  • Patch available at 11:45.
  • Patch applied and organization ready at 15:50.

The vulnerability window is 15:50−02:30=13h 20m15{:}50 - 02{:}30 = 13\text{h}\,20\text{m}.

Intrusion Detection and Prevention

  • Intrusion detection
    Uses logs to check for vulnerabilities. It cannot prevent an attack, only detect it after or while it happens. Passive security.
  • Intrusion prevention
    Blocks an attack before it happens, and needs more processing power. Active security.

Prevention methods:

  • Protocol anomaly detection
  • Signature based detection
  • Behavior based detection
Written by October 30, 2026 6 min read
Was this helpful?