Skip to content

Question about the audit log when RelevantOnly is specified #2637

Closed
@AirisX

Description

@AirisX

Hello, @zimmerle.

https://github.com/SpiderLabs/ModSecurity/blob/ec86b242e15f9df1d143c1b7f86a27889658b4cb/src/audit_log/audit_log.cc#L299-L302

I have some doubts about the correct handling of the "noauditlog" action in "saveIfRelevant".
In my case I defined next config with the relevant statuses and the only one non disruptive rule for simplifying (other setting is omitted). Pay attention that I am not using "nouauditlog" in the rule:

...
SecAuditEngine RelevantOnly
SecAuditLogRelevantStatus "^(?:500|403)"
...
SecRule &REQUEST_HEADERS:Accept "@eq 0" \
  "msg:'Request Missing an Accept Header',\
   phase:request,\
   rev:'3',\
   ver:'OWASP_CRS/3.0.0',\
   maturity:'9',\
   accuracy:'8',\
   t:none,\
   pass,\
   severity:'NOTICE',\
   id:3067"
...

Then I send the request without the "Accept" header. Eventually I get an audit log record with a 200 status code, although it's not the relevant status.
Debug log:

[4] Initializing transaction
[4] Transaction context created.
[4] Starting phase CONNECTION. (SecRules 0)
[9] This phase consists of 0 rule(s).
[4] Starting phase URI. (SecRules 0 + 1/2)
[4] Starting phase REQUEST_HEADERS.  (SecRules 1)
[9] This phase consists of 0 rule(s).
[9] Appending request body: 2 bytes. Limit set to: 0.000000
[9] Appending request body: 0 bytes. Limit set to: 0.000000
[4] Starting phase REQUEST_BODY. (SecRules 2)
[4] Don't use timeout
[9] This phase consists of 1 rule(s).
[4] (Rule: 3067) Executing operator "Eq" with param "0" against REQUEST_HEADERS:Accept.
[9] Target value: "0" (Variable: REQUEST_HEADERS:Accept)
[9] Matched vars updated.
[4] Rule returned 1.
[9] This rule severity is: 5 current transaction is: 255
[9] Saving msg: Request Missing an Accept Header
[4] Running (disruptive)     action: pass.
[8] Running action pass
[4] Starting phase RESPONSE_HEADERS. (SecRules 3)
[9] This phase consists of 0 rule(s).
[4] Not appending response body. Response Content-Type is application/x-www-form-urlencoded. It is not marked to be inspected.
[4] Starting phase RESPONSE_BODY. (SecRules 4)
[4] Don't use timeout
[5] Response Content-Type is application/x-www-form-urlencoded. It is not marked to be inspected.
[8] Content-Type(s) marked to be inspected: application/json application/xml text/html text/plain text/xml
[4] Starting phase LOGGING. (SecRules 5)
[9] This phase consists of 0 rule(s).
[8] Checking if this request is suitable to be saved as an audit log.
[8] Checking if this request is relevant to be part of the audit logs.
[5] Saving this request as part of the audit logs.
[8] Request was relevant to be saved. Parts: 8174

Could you please help to inspect this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions