60 Mins

Milestone 3: Security Header Audit Engine

Engine Construction: Header Inspection Logic

Scenario: The VoidX SOC has detected unauthorized web services running on internal segments. You are tasked to build a lightweight Security Header Audit Engine that probes endpoints and validates them against the OWASP Secure Headers project. You must utilize Python's requests library to capture raw HTTP headers and perform a dictionary-based compliance match.

Mission Objectives: Your script must accept a target URL, extract the Content-Security-Policy, X-Frame-Options, Strict-Transport-Security, and X-Content-Type-Options headers. Your script must then compare these values against a required security policy dictionary. If a header is missing or deviates from the policy, log it as a critical finding.

Security Operator Note: Always normalize header keys using .title() or case-insensitive dictionary lookups to handle non-compliant server responses.
Text
# Target Headers Dict:
# headers = {'Strict-Transport-Security': 'max-age=63072000'}
# Expected Output: '[!] ALERT: Missing X-Content-Type-Options'

Compliance Validation & Reporting

Goals & Requirements: Your engine must implement an automated reporting function. It should accept a list of domains from a text file, iterate through them, and export a structured JSON log of failures. This is critical for our quarterly compliance audit process in the SOC.

Practical Hints: Utilize the 'requests.head()' method instead of 'requests.get()' to reduce bandwidth consumption during mass scans, as we only need the response metadata headers.

Security Operator Note: Use the json library to ensure your audit output is machine-readable for ingestion into the centralized VoidX SIEM dashboard.
Text
# Target Audit Failure Object:
# results = [{'url': 'example.com', 'status': 'fail', 'missing': ['CSP']}]
# Expected Output: 'Report generated successfully.'
Lab Overview

Objectives & Tasks

Review the tasks below and follow the interactive instructions to complete this module.

Knowledge Check

Ready to test your understanding of Milestone 3: Security Header Audit Engine?

Back