implementing-web-application-logging-with-modsecurity
它能做什么
这个功能帮你设置一个名为 ModSecurity 的安全系统,用来记录网页应用上的活动。它就像互联网流量的“交警”,记录谁试图访问什么内容,以及是否存在可疑行为。
适用场景
- ✓当你为网站安装新的安全系统时。
- ✓当你需要调查针对网站的攻击尝试时。
- ✓当你需要微调安全规则,避免不必要的拦截时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-web-application-logging-with-modsecurity/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“设置 ModSecurity,记录针对我网站的 SQL Injection 攻击尝试。”
每周 5 个新技能,1 分钟读完。
工作原理
ModSecurity 会监控发送到你网站的请求。它使用一套规则(OWASP CRS)来识别恶意活动,并把这些尝试记录到日志文件中,供之后分析。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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
- 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"]
常见问题
什么是 ModSecurity?
ModSecurity 是一个充当 Web 应用防火墙(WAF)的程序,可以保护你的网站免受常见攻击。
什么是 OWASP CRS?
OWASP CRS 是一套预定义的安全规则,ModSecurity 用它来检测和拦截 SQL 注入、XSS 等威胁。
什么是“误报”?
误报是指安全系统把正常操作误认为是攻击而将其拦截。调整规则有助于避免这种情况。
详情
作者的原始描述
Configure ModSecurity WAF with the OWASP Core Rule Set (CRS) for web application audit logging, tuning SecRuleEngine, SecAuditEngine, and CRS paranoia levels to reduce false positives, and writing custom SecRules for application-specific threats. Use when deploying or tuning a ModSecurity WAF, analyzing audit logs for attack detection, or reducing CRS false positives.
热度
- GitHub 星标
- 35k
- 排名
- #8139
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。