2

I try to craft a http post using this curl :

curl -v -X POST "http://example.com/submit.php" -H "Content-Type: application/x-www-form-urlencoded;" --data "[email protected]"

Unluckyly, it is got block by the Modsecurity CRS rules 920470. As far as I know the default POST for HTML is 'application/x-www-form-urlencoded' as explained in this post : https://stackoverflow.com/a/2436725/4004975

CRS version 4.3.0

Any guidance is appreciated.

1 Answer 1

5
... "Content-Type: application/x-www-form-urlencoded;"
                                                   ^^^

A semicolon is the delimiter between the content type and additional parameters like charset or between multiple parameters. There should be no semicolon at the end of the content type when not followed by a parameter. The regex in the rule enforces this. Thus it must be instead without semicolon:

 ... "Content-Type: application/x-www-form-urlencoded"
3
  • Wouldn't curl also supply this correctly if no content type header was specified manually? Commented Jun 29 at 11:53
  • @multithr3at3d: I'm pretty sure curl does this correct by its own Commented Jun 29 at 12:21
  • Yes, all --data* options (and the short-form -d) in curl automatically set Content-Type to application/x-www-form-urlencoded (which is correct) and they also set the method/verb to POST so specifying that is unnecessary (@multithr3at3d) Commented Jun 30 at 1:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .