The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

easyapache, mod_sec 2.7 and MULTIPART_STRICT_ERROR

Discussion in 'Security' started by sebby, Nov 8, 2013.

  1. sebby

    sebby Well-Known Member

    Joined:
    Jun 15, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    Hello everyone,

    EasyApache recently started injecting the following patch to ModSecurity 2.7:

    Code:
    SecRule MULTIPART_STRICT_ERROR "!@eq 0" "phase:2,t:none,log,deny,status:44,msg:'Multipart request body failed strict validation: PE %{REQBODY_PROCESSOR_ERROR}, BQ %{MULTIPART_BOUNDARY_QUOTED}, BW %{MULTIPART_BOUNDARY_WHITESPACE}, DB %{MULTIPART_DATA_BEFORE}, DA %{MULTIPART_DATA_AFTER}, HF %{MULTIPART_HEADER_FOLDING}, LF %{MULTIPART_LF_LINE}, SM %{MULTIPART_MISSING_SEMICOLON}, IQ %{MULTIPART_INVALID_QUOTING}, IP %{MULTIPART_INVALID_PART}, IH %{MULTIPART_INVALID_HEADER_FOLDING}, FL %{MULTIPART_FILE_LIMIT_EXCEEDED}',id:1234123456"
    When this rule was implemented, many clients complained about false positives triggered by the IQ segment (MULTIPART_INVALID_QUOTING).

    I would like to avoid whitelisting the whole rule and would prefer skipping only the IQ test.

    I have two questions:
    1. How to edit this rule to skip the IQ part.
    2. How should I override this rule (not in modsec2.conf obviously because it will be overwritten by easyapache on next run).

    I thank you in advance for your assistance.

    Kind Regards,

    Seb

    Also on this topic:
    - http://forums.cpanel.net/f185/modsecurity-2-7-3-issues-352881.html
     
  2. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    940
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    I would honestly try just removing the "IQ %{MULTIPART_INVALID_QUOTING}," part from modsec2.conf, then run an EA and see if it reverts it. If it does revert, you could make a custom hook to "Fix" the file after EA runs. Otherwise, the easiest way to whitelist would be by script file name in modsec2.user.conf or other includes file. Say it's tripping on someones site "submit.php" file, then add this:

    <LocationMatch "submit.php">
    SecRuleRemoveById 1234123456
    </LocationMatch>

    That would whitelist all checks from the multipart rule on that particular filename, but it's better than whitelisting it completely for the server or domain.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  4. sebby

    sebby Well-Known Member

    Joined:
    Jun 15, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    I already tried removing the "IQ %{MULTIPART_INVALID_QUOTING}," part from modsec2.conf but it doesn't work. The legitimate scripts were still blocked. I think that this particular string is there only for verbose mod_sec reporting/logs (i.e. explain why the rule was triggered).

    I am already using ConfigServer ModSecurity Control and used it to whitelist the complete rule server wide while I find a solution.

    So again may question is: Is there a way to skip the IQ test?

    Kind Regards,

    Seb
     
  5. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    940
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Did you restart apache after modifying the rule? Otherwise your change was not active.
     
  6. sebby

    sebby Well-Known Member

    Joined:
    Jun 15, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    Yes I did.
     
  7. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    940
    Likes Received:
    55
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    I'd check the modsec audit log for further information at that point.
     
Loading...

Share This Page