Recently, a Remote Code Execution vulnerability was discovered in the Java Spring Core library. This vulnerability allows attackers to execute arbitrary code on affected systems.
You can find more information on that vulnerability in the announcement on the Spring Blog.
While HAProxy Enterprise, HAProxy ALOHA, and other products within the HAProxy Technologies portfolio are not impacted by this (they do not use the Spring Core library at all), you can use our products to mitigate the attack.
These mitigation techniques we describe are subject to change as attackers come up with new attack vectors, new false positives are discovered, or better ways to handle the issue are found. When the rules change, this blog post will be updated with a changelog added to the bottom. While these rules have been tested against the original attack vectors, they have a high risk of false positives in many environments. We recommend testing these rules in your environment (such as replacing the http-request deny rules with an http-request capture rule to log violations rather than deny them outright).
To block the attack, add the following ACLs, which are an adaptation of the ModSecurity solution described later, to a frontend or listen section within your load balancer configuration:
Alternatively, enable the ModSecurity web application firewall (WAF) module:
Find the following line in the file /etc/hapee-2.4/modsec.rules.d/lb-modsecurity.conf in HAProxy Enterprise:
Or find the following line in the file /app/security/etc/sec-offloader/modsecurity.load in HAProxy ALOHA :
Then add the following rule directly after:
This rule can be found at ModSecurity Core Rule Set project page. If this is the first time you are enabling the ModSecurity WAF, we recommend running it in detection-only mode at first to log malicious requests but not immediately block them.
With HAProxy Enterprise, you can also block the attack by enabling the Advanced WAF:
Then update your ruleset files by updating to the latest hapee-2.5r1-lb-wafadvanced package (or using the corresponding package for your version of HAProxy Enterprise). Follow the documentation for how to set thresholds for blocking threats.
If this is the first time you are enabling the Advanced WAF, we recommend running it in learning mode at first, to log malicious requests, but not immediately block them.
To test the mitigations you have configured are working correctly, try the following curl command on your HAProxy Enterprise server:
If the blocking rules are working correctly, that request will be denied.
- 11 April 2022: Changed ModSecurity rule to use « urlDecodeUni » instead of « urlDecode »