Security Best Practices
Enterprise Security

Security Best Practices

A comprehensive guide to cybersecurity best practices: Defense in Depth, Principle of Least Privilege, vulnerability management, security hygiene, and incident response.

Think about how a bank keeps its money safe. The bank does not rely on a single lock on the front glass door. If that single lock failed, anyone could walk in and empty the vault. Instead, the bank uses multiple layers of defense: security guards at the entrance, cameras in every corner, bulletproof glass at teller windows, badge scanners on internal doors, reinforced steel vault doors with time locks, dye packs in cash drawers, and alarms connected directly to the local police station. Even if an intruder bypasses the front door, several other independent barriers stand in their way. In addition, the teller only has keys to their own cash drawer, not to the main underground vault. In cybersecurity, this multi-layered strategy is known as Defense in Depth, combined with the Principle of Least Privilege. Security is not a single product or a single setting. It is a continuous, disciplined set of practices applied across people, processes, and technology.

Definition

Security Best Practices are proven, standardized operational and architectural principles designed to minimize an organization's attack surface, prevent unauthorized access, ensure resilience, and rapidly handle vulnerabilities and incidents.

Why It Matters

Most successful data breaches are not caused by complex zero-day exploits. They are caused by basic security oversights: unpatched software, default passwords, overly broad cloud permissions, missing multi-factor authentication, or a lack of employee security training. Following established security practices turns an organization from an easy target into a hardened environment where attacks become too difficult, expensive, and time-consuming for attackers to succeed.

How It Works

Enterprise security relies on several foundational principles: 1. Defense in Depth (Layered Defense): Never rely on a single defensive control. Implement protection at every level: • Physical: Access controls for server rooms, cameras, and secure facilities. • Perimeter: Firewalls, web application firewalls (WAF), and DDoS protection. • Network: Network segmentation, private subnets, and intrusion detection systems. • Endpoint: Antivirus and EDR software, full-disk encryption, and automated OS updates. • Application: Input validation, secure coding reviews, and automated dependency checks. • Data: Encryption at rest (AES-256), encryption in transit (TLS 1.3), and access controls. • People: Regular phishing simulations, security awareness training, and clear company policies. 2. Principle of Least Privilege (PoLP): Give users, applications, and services only the minimum permissions necessary to do their work. A web application, for example, should only be able to read and write to specific database tables, never drop tables or modify database users. 3. Separation of Duties: Require multiple people or steps for sensitive actions. For example, a developer who writes code should not be the sole person who approves and deploys that code directly to production. 4. Patch and Vulnerability Management: Software naturally contains flaws that are regularly discovered and assigned CVE tracking numbers. Organizations must scan their dependencies regularly and deploy security patches promptly according to defined timelines. 5. The 6-Stage Incident Response Lifecycle (NIST SP 800-61): When an incident occurs, teams follow six structured steps: 1) Preparation, 2) Detection and Analysis, 3) Containment, 4) Eradication, 5) Recovery, and 6) Lessons Learned.

Defense in Depth: Layered Security Architecture

1. Perimeter & Edge
DDoS mitigation, web application firewalls (WAF), and public DNS filtering
2. Network & Segmentation
Private subnets, micro-segmentation, and zero-trust proxy gateways
3. Endpoint & Host Security
EDR monitoring, operating system hardening, and automated patch management
4. Identity & Access Control
Multi-factor authentication (MFA), Single Sign-On, and least-privilege IAM roles
5. Data & Cryptography
AES-256 encryption at rest, TLS 1.3 in transit, and continuous data loss prevention

Key Points

  • Defense in Depth ensures that if one security barrier fails, other layers prevent a complete compromise.
  • The Principle of Least Privilege limits accounts and services to the minimum permissions needed.
  • Most breaches exploit known vulnerabilities for which security patches are already available.
  • Automated dependency scanning catches insecure third-party packages before code reaches production.
  • The 3-2-1 backup rule with immutable storage provides reliable protection against ransomware.
  • Incident response plans should be practiced through drills before an actual emergency happens.

Steps

  1. Require Multi-Factor Authentication Everywhere

    Enforce MFA (preferably authenticator apps or hardware security keys) across corporate email, cloud consoles, code repositories, and remote access tools.

  2. Enforce the Principle of Least Privilege

    Audit cloud roles and administrative accounts. Remove shared root accounts and grant temporary elevated privileges only when specifically needed.

  3. Automate Vulnerability Scanning and Patching

    Add automated dependency scanners into build pipelines and turn on automatic security patch updates for operating systems and servers.

  4. Set Up Centralized Logging and Monitoring

    Collect logs from servers, firewalls, and cloud infrastructure into a central monitoring system with alerts for unusual activity like repeated failed logins.

  5. Maintain Isolated, Immutable Backups

    Follow the 3-2-1 backup rule by keeping three copies of data, across two different storage types, with at least one copy stored offline or in immutable storage.

  6. Provide Regular Employee Security Training

    Run periodic phishing awareness exercises and encourage team members to report suspicious emails promptly.

Examples

Least Privilege in Cloud IAM

Insecure approach: Giving an automated deployment script full administrator permissions across all cloud services so things do not break. Best practice approach: Giving the script a role that can only upload files to a single storage bucket and update a specific application function, restricted to one cloud region.

Prompt Patching vs The Equifax Breach

In March 2017, a critical patch was released for an open-source web framework (Apache Struts). Equifax did not locate and patch their vulnerable server for months. Attackers exploited that unpatched flaw, exposing the personal records of over 140 million people. Automated vulnerability scanning helps teams identify and apply such patches quickly.

Real-World Examples

The Capital One Cloud Data Incident (2019)

An attacker exploited a server-side flaw in a web application firewall running on a cloud server. While the flaw was the initial entry point, the larger issue was that the server had been assigned an overly broad cloud role with permission to read hundreds of storage buckets. If least privilege had been enforced on that server's role, the attacker would have been stopped from downloading customer records.

The Maersk Ransomware Recovery (2017)

Global shipping company Maersk was hit by the NotPetya malware, which rapidly encrypted computers and domain controllers across hundreds of offices worldwide. The company was able to recover because a single domain controller in an office in Ghana happened to be offline during a local power outage when the malware struck. That offline copy allowed engineers to restore their directory infrastructure.

Technical Examples

AWS IAM Least Privilege Policy (Strict Access Control)json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowReadLogsOnlyForSpecificApp",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::corporate-production-audit-logs",
        "arn:aws:s3:::corporate-production-audit-logs/*"
      ],
      "Condition": {
        "Bool": {
          "aws:MultiFactorAuthPresent": "true",
          "aws:SecureTransport": "true"
        },
        "IpAddress": {
          "aws:SourceIp": [
            "198.51.100.0/24"
          ]
        }
      }
    },
    {
      "Sid": "DenyAllDestructiveActions",
      "Effect": "Deny",
      "Action": [
        "s3:DeleteObject",
        "s3:DeleteBucket",
        "s3:PutBucketPolicy"
      ],
      "Resource": "*"
    }
  ]
}
This IAM policy demonstrates Least Privilege: 1) Permissions are limited to read-only actions on a single bucket; 2) MFA is required; 3) HTTPS is mandated; 4) Access is restricted to corporate IP ranges; and 5) Destructive actions like deleting objects are explicitly blocked.
Automated Security Scanning in CI/CD (GitHub Actions)yaml
name: Security Audit & Vulnerability Scan

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  schedule:
    # Run every morning at 6 AM to check for new CVE disclosures
    - cron: '0 6 * * *'

jobs:
  security-audit:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Run NPM Security Audit
        # Fails the build if high or critical vulnerabilities exist
        run: npm audit --audit-level=high

      - name: Run Trivy Vulnerability Scanner
        uses: aquasecurity/trivy-action@master
        with:
          scan-type: 'fs'
          ignore-unfixed: true
          severity: 'CRITICAL,HIGH'
          exit-code: '1'
This GitHub Actions workflow checks dependencies on every pull request and runs daily. If a library contains a high or critical vulnerability, the build stops, preventing vulnerable packages from reaching production.

Reactive Security (Ad-Hoc) vs Proactive Defense in Depth

AspectReactive Security (Ad-Hoc)Proactive Defense in Depth
ApproachWait until an alert triggers or an incident happens, then rush to fix itAssume systems will be targeted; design overlapping layers to contain issues
User PermissionsGive broad admin rights to avoid permission questions and complaintsEnforce least privilege: minimal rights and temporary access when needed
Software UpdatesManual patching once a year or only when servers are restartedAutomated scanning in CI/CD and regular patching within agreed timeframes
BackupsA local external drive or shared folder on the same network3-2-1 strategy: 3 copies, 2 media types, with 1 offline or immutable copy
Account SecuritySingle passwords reused across accounts and rarely updatedMulti-factor authentication required on all company systems
Incident PlanningNo written plan; confusion when an incident occursDocumented incident response steps practiced through team drills

CIS Critical Security Controls (v8) Overview

The Center for Internet Security (CIS Controls) provides a practical, prioritized list of cybersecurity actions: • Control 01: Inventory and Control of Enterprise Assets (Track all devices connected to the network). • Control 02: Inventory and Control of Software Assets (Allow only approved applications to run). • Control 03: Data Protection (Classify and encrypt sensitive business information). • Control 04: Secure Configuration of Hardware and Software (Harden operating systems and disable default settings). • Control 05: Account Management (Assign unique accounts and deprovision departed staff promptly). • Control 06: Access Control Management (Enforce MFA and least privilege on all administrative accounts).

Advantages

  • Reduces Common Risks: Blocks the vast majority of automated cyber attack vectors.
  • Protects Against Ransomware: Offline, immutable backups ensure business data can be recovered.
  • Supports Compliance: Helps satisfy requirements for SOC 2, ISO 27001, HIPAA, and PCI-DSS.
  • Enables Faster Recovery: Clear incident runbooks reduce downtime from weeks to hours.

Limitations

  • Requires Team Discipline: Best practices must be followed consistently across all departments.
  • Needs Initial Planning: Designing proper permission roles takes thoughtful coordination.
  • Ongoing Maintenance: Keeping dependencies and systems updated is an ongoing operational commitment.

Interview Questions

What are the 6 stages of the NIST Incident Response Lifecycle (NIST SP 800-61)?

The 6 stages are: 1) Preparation, which involves setting up teams, tools, and response plans before an incident; 2) Detection and Analysis, which means identifying security alerts and confirming the scope of an event; 3) Containment, which involves isolating affected machines and revoking compromised credentials; 4) Eradication, which means removing malicious files and closing vulnerabilities; 5) Recovery, which means restoring systems from clean backups and testing operations; and 6) Lessons Learned, which involves reviewing the incident to improve future defenses.

What is the Principle of Least Privilege and how is it applied in software design?

The Principle of Least Privilege states that every user, service, and process should have only the minimum access rights needed to do its job. In software systems, this means giving microservices dedicated cloud roles with narrow permissions, limiting database accounts to only the tables they use, and ensuring standard user accounts cannot perform administrative actions.

Practice Questions

  1. Create a security checklist for configuring a new cloud server before deploying it to production.
  2. How would you organize a team incident response drill to test your company's backup and recovery procedures?