New to Claude Skills? Learn how to install them →

mukul975 on GitHub

Web Application Logging with ModSecurity

Free

Configure ModSecurity for effective web application logging.

Get this skill

Free · Opens the source repo

What Web Application Logging with ModSecurity does

Implementing Web Application Logging with ModSecurity is designed for developers and security professionals who need to enhance the security posture of their web applications. This skill provides a comprehensive guide to configuring ModSecurity, an open-source Web Application Firewall (WAF), in conjunction with the OWASP Core Rule Set (CRS). It enables users to establish effective audit logging and tuning mechanisms that help in detecting and mitigating web application threats.

The skill walks you through the necessary steps to deploy ModSecurity on popular web servers like Apache and Nginx, ensuring that you can log full request and response data for forensic analysis. By utilizing the OWASP CRS, you can cover a wide range of attack vectors, including SQL injection and cross-site scripting, which are critical for maintaining compliance with security standards. The skill emphasizes tuning the SecRuleEngine and SecAuditEngine to minimize false positives, which is essential for maintaining operational efficiency while ensuring robust security.

This skill is particularly useful when deploying or configuring web application logging capabilities in environments that require stringent security controls. It is also beneficial for security assessments and when establishing a security architecture that aligns with compliance requirements. By following the outlined steps, users can effectively analyze audit logs and correlate alerts with their Security Information and Event Management (SIEM) systems, thereby enhancing their overall threat detection capabilities.

Whether you are a developer working on application security or a security analyst looking to improve your logging practices, this skill provides the knowledge and steps needed to implement ModSecurity effectively in your environment.

When to use it

Use this skill when deploying or tuning a ModSecurity WAF to enhance web application security and logging.

When not to use it

This skill may not be suitable for environments without ModSecurity or those not using OWASP CRS for web security.

What you can build with it

Deploying ModSecurity in a New Environment

Use this skill to set up ModSecurity and the OWASP CRS in a new web application environment to enhance security.

Tuning ModSecurity for Existing Applications

Apply this skill to optimize ModSecurity settings for existing applications, reducing false positives while maintaining security.

Conducting Security Assessments

Utilize this skill to implement effective logging and monitoring for security assessments and compliance checks.

How to install Web Application Logging with ModSecurity

View source

1. Install with the skills CLI

npx skills add mukul975/anthropic-cybersecurity-skills/implementing-web-application-logging-with-modsecurity --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by mukul975

Implementing 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

  1. Install ModSecurity and configure SecRuleEngine in DetectionOnly mode
  2. Deploy OWASP CRS v4 and set paranoia level (PL1-PL4)
  3. Configure SecAuditEngine for relevant-only logging
  4. Tune false positives with SecRuleRemoveById and rule exclusions
  5. Switch to blocking mode (SecRuleEngine On) after tuning period
  6. 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"]

Frequently asked questions about Web Application Logging with ModSecurity

Similar skills