owasp-modsecurity / owasp-modsecurity/ModSecurity

SecAuditLogParts never logs anything for 'K' type (list of rule IDs)

Open
#2,684 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.x
Dominant language
C++
Stars
9.8k
Forks
1.8k
Avg merge
2h 46m
Merged PRs (30d)
1

Description

Describe the bug

I want to analyse POST body content but I don't want to print any POST body content (or any actual data snippets from the request, such as cookies etc) to the log file. So I don't want to log 'B', 'C', 'F', 'H', 'J' etc.

I just want to get the time of the event and the rule ID that tripped the blocked request.

I believe the 'K' type in SecAuditLogParts is meant to log the rule ID

https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-(v3.x)#SecAuditLogParts

However, in all my logs, the 'K' is always empty. The only meaningful data I can get about the rules that tripped is from 'H', but it contains too many other messages in that log entry such as personal data, which I can't put in logs.

Logs and dumps

Example:

---0s7Btvlo---A--
[17/Feb/2022:02:39:54 +0000] 1645065594 10.42.0.11 0 172.17.0.3 80

---0s7Btvlo---K--

---0s7Btvlo---Z--

To Reproduce

Steps to reproduce the behavior:

Set SecAuditLogParts to 'AKZ' and you'll never get entries for 'K'.

Expected behavior

I should get the rule ID or something like that (? since it's never worked, I don't know what it looks like) when logging K.

Server

  • ModSecurity version: libmodsecurity 3.0.6 (commit hash c3d7f4b560797a052681dcffb97a22bb906487cd), ModSecurity-nginx v1.0.2
  • WebServer Nginx 1.14.0 (the official debian package 1.14.0-0ubuntu1.9 from on Ubuntu 18.04)
  • OS (and distro): Ubuntu Linux 18.04 LTS

Rule Set

  • public coreruleset 3.3.2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the issue with SecAuditLogParts set to AKZ on the stated ModSecurity-nginx setup, then trace the audit-log handling for the K part. Done means K contains the triggered rule ID while omitting the sensitive request data described in the report, with regression coverage for the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, nginx
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.