implementing-web-application-logging-with-modsecurity
About implementing-web-application-logging-with-modsecurity
A deployment and tuning guide for web application logging with ModSecurity, aimed at teams configuring web-server security controls. It covers OWASP CRS rule deployment, audit logging, false-positive tuning, and forwarding events to a SIEM.
Key features
- 01Configure ModSecurity detection and blocking
- 02Deploy OWASP CRS rules
- 03Set relevant-only audit logging
- 04Tune false positives and exclusions
- 05Forward audit logs to a SIEM
Use cases
- 01Establishing web application logging
- 02Aligning controls with compliance requirements
- 03Correlating WAF events in a SIEM
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill implementing-web-application-logging-with-modsecurityAfter installing, type/implementing-web-application-logging-with-modsecurityin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
LICENSEreferences/api-reference.mdscripts/agent.pyDetails
From the project READMEImplementing Web Application Logging with ModSecurity
Overview
ModSecurity is an open-source WAF engine that works with Apache, Nginx, and IIS. The OWASP Core Rule Set (CRS) provides generic attack detection rules covering SQL injection, XSS, RCE, LFI, and other OWASP Top 10 attacks. ModSecurity logs full request/response data in audit logs for forensic analysis and generates alerts that feed into SIEM platforms.
When to Use
- When deploying or configuring implementing web application logging with modsecurity capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- Web server (Apache 2.4+ or Nginx) with ModSecurity v3 module
- OWASP CRS v4.x installed
- Log aggregation infrastructure (ELK, Splunk, or Wazuh)
Steps
- Install ModSecurity and configure SecRuleEngine in DetectionOnly mode
- Deploy OWASP CRS v4 and set paranoia level (PL1-PL4)
- Configure SecAuditEngine for relevant-only logging
- Tune false positives with SecRuleRemoveById and rule exclusions
- Switch to blocking mode (SecRuleEngine On) after tuning period
- Forward audit logs to SIEM for correlation and alerting
Expected Output
ModSecurity: Warning. Pattern match "(?:union\s+select)" [file "/etc/modsecurity/crs/rules/REQUEST-942-APPLICATION-ATTACK-SQLI.conf"] [line "45"] [id "942100"] [msg "SQL Injection Attack Detected via libinjection"] [severity "CRITICAL"]