owasp-modsecurity / owasp-modsecurity/ModSecurity

sanitiseMatchedBytes range does not work on POST arguments

Open
#841 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

If you have the following rule:

SecRule ARGS "@verifyCC \d{13,16}" "id:1,phase:5,pass,sanitiseMatchedBytes:4/4,capture"

Sending a GET request (www.example.com/test?a=1001200230034004) produces the following in the log as expected:

GET /test?a=1001********4004 HTTP/1.1

Sending a POST request however produces the following in the log:

a=****************

So it's not showing the first and last 4 characters as expected, but is instead doing a full sanitisation.

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

Reproduce the SecRule example with both the GET query string and POST arguments, then compare the sanitiseMatchedBytes handling and resulting logs. Done means POST arguments preserve the first and last four characters just as the GET request does.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
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.