[Owasp-modsecurity-core-rule-set] ipMatch and X-Forwarded-For

Brian Davis (bridavis) bridavis at cisco.com
Fri Mar 4 08:36:30 UTC 2016

Can I use "@ipMatchFromFile <file>" against REQUEST_HEADER:X-Forwarded-For? I didn't think this was possible.

From: Leos Rivas Manuel <Manuel.LeosRivas at gemalto.com<mailto:Manuel.LeosRivas at gemalto.com>>
Date: Friday, March 4, 2016 at 12:33 AM
To: "Brian A. Davis" <bridavis at cisco.com<mailto:bridavis at cisco.com>>, "owasp-modsecurity-core-rule-set at lists.owasp.org<mailto:owasp-modsecurity-core-rule-set at lists.owasp.org>" <owasp-modsecurity-core-rule-set at lists.owasp.org<mailto:owasp-modsecurity-core-rule-set at lists.owasp.org>>
Subject: RE: ipMatch and X-Forwarded-For

You don't need to modify the remote_address, simply use header:x-forwarded-for instead and deny if it matches.

From: owasp-modsecurity-core-rule-set-bounces at lists.owasp.org<mailto:owasp-modsecurity-core-rule-set-bounces at lists.owasp.org> [mailto:owasp-modsecurity-core-rule-set-bounces at lists.owasp.org] On Behalf Of Brian Davis (bridavis)
Sent: vendredi 4 mars 2016 08:55
To: owasp-modsecurity-core-rule-set at lists.owasp.org<mailto:owasp-modsecurity-core-rule-set at lists.owasp.org>
Subject: [Owasp-modsecurity-core-rule-set] ipMatch and X-Forwarded-For


I have ModSecurity running as a reverse proxy behind an haproxy LB. Because we're behind HAProxy, we're getting LB IP addresses for REMOTE_ADDR.

I have a large number of IPs that I have to whitelist, and would therefore really take advantage of the ipMatch and ipMatchFromFile functions. However, those can only be used on REMOTE_ADDR.

Does anyone have a creative way of taking the X-Forwarded-For value and somehow setting REMOTE_ADDR to that, and then using ipMatch on the result?


This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited.
E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender.
Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.owasp.org/pipermail/owasp-modsecurity-core-rule-set/attachments/20160304/f4a5bcbf/attachment-0001.html>

More information about the Owasp-modsecurity-core-rule-set mailing list