CG
SkillsImplementing Web Application Logging with Modsecurity
Start Free
Back to Skills Library
Application Security🟡 Intermediate

Implementing Web Application Logging with Modsecurity

Configure ModSecurity WAF with OWASP Core Rule Set (CRS) for web application logging, tune rules to reduce false positives, analyze audit logs for attack detection, and implement custom SecRules for application-specific threats.

3 min read1 code examples

Prerequisites

  • Web server (Apache 2.4+ or Nginx) with ModSecurity v3 module
  • OWASP CRS v4.x installed
  • Log aggregation infrastructure (ELK, Splunk, or Wazuh)

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.

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"]

Verification Criteria

Confirm successful execution by validating:

  • [ ] All prerequisite tools and access requirements are satisfied
  • [ ] Each workflow step completed without errors
  • [ ] Output matches expected format and contains expected data
  • [ ] No security warnings or misconfigurations detected
  • [ ] Results are documented and evidence is preserved for audit

Compliance Framework Mapping

This skill supports compliance evidence collection across multiple frameworks:

  • SOC 2: CC6.1 (Logical Access), CC8.1 (Change Management)
  • ISO 27001: A.14.2 (Secure Development), A.14.1 (Security Requirements)
  • NIST 800-53: SA-11 (Developer Testing), SI-10 (Input Validation), SC-18 (Mobile Code)
  • OWASP LLM Top 10: LLM01 (Prompt Injection), LLM02 (Insecure Output)

Claw GRC Tip: When this skill is executed by a registered agent, compliance evidence is automatically captured and mapped to the relevant controls in your active frameworks.

Deploying This Skill with Claw GRC

Agent Execution

Register this skill with your Claw GRC agent for automated execution:

# Install via CLI
npx claw-grc skills add implementing-web-application-logging-with-modsecurity

# Or load dynamically via MCP
grc.load_skill("implementing-web-application-logging-with-modsecurity")

Audit Trail Integration

When executed through Claw GRC, every step of this skill generates tamper-evident audit records:

  • SHA-256 chain hashing ensures no step can be modified after execution
  • Evidence artifacts (configs, scan results, logs) are automatically attached to relevant controls
  • Trust score impact — successful execution increases your agent's trust score

Continuous Compliance

Schedule this skill for recurring execution to maintain continuous compliance posture. Claw GRC monitors for drift and alerts when re-execution is needed.

Use with Claw GRC Agents

This skill is fully compatible with Claw GRC's autonomous agent system. Deploy it to any registered agent via MCP, and every execution will be logged in the tamper-evident audit trail.

// Load this skill in your agent
npx claw-grc skills add implementing-web-application-logging-with-modsecurity
// Or via MCP
grc.load_skill("implementing-web-application-logging-with-modsecurity")

Tags

modsecuritywafcrsowaspweb-securityaudit-loggingrule-tuning

Related Skills

Application Security

Performing Clickjacking Attack Test

8m·intermediate
Application Security

Performing Directory Traversal Testing

6m·intermediate
Application Security

Performing GraphQL Security Assessment

8m·intermediate
Application Security

Performing Security Headers Audit

8m·intermediate
Application Security

Testing for Broken Access Control

8m·intermediate
Application Security

Testing for Business Logic Vulnerabilities

8m·intermediate

Skill Details

Domain
Application Security
Difficulty
intermediate
Read Time
3 min
Code Examples
1

On This Page

OverviewPrerequisitesStepsExpected OutputVerification CriteriaCompliance Framework MappingDeploying This Skill with Claw GRC

Deploy This Skill

Add this skill to your Claw GRC agent and start automating.

Get Started Free →