CVE-2020-2186: CSRF vulnerability in Amazon EC2 Plugin
Summary
CVE-2020-2186: CSRF vulnerability in Amazon EC2 Plugin. Affects org.jenkins-ci.plugins:ec2 versions < 1.50.2. Fixed in 1.50.2. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The Amazon EC2 Plugin is a Maven package that provides integration between Jenkins and Amazon EC2, allowing users to provision instances on Amazon EC2 as part of their Jenkins workflows. It offers various features such as launching instances, managing security groups, and configuring instance templates.
Vulnerability Detail
The Amazon EC2 Plugin version 1.50.1 and earlier is vulnerable to cross-site request forgery (CSRF) attacks. These versions do not require POST requests for several HTTP endpoints, which allows an attacker to exploit this vulnerability. By tricking a user into visiting a malicious website or clicking on a crafted link, the attacker can provision instances with an attacker-specified template ID. This can lead to unauthorized access, data leakage, or disruption of the Jenkins workflow.
How To Fix
Minimum fixed version
1.50.2
This is the first release that contains the fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to version 1.50.2 is not immediately feasible, a temporary workaround is to implement CSRF protection at the network or application layer. This can be achieved by adding CSRF tokens to the affected HTTP endpoints and validating them on the server-side. Here is an example of how to implement CSRF protection using Java Servlet Filter:
public class CsrfFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
if (httpRequest.getMethod().equals("POST") && httpRequest.getHeader("Referer") == null) {
// Validate CSRF token
// ... (implementation details)
}
chain.doFilter(request, response);
}
}
Note: This is just an example and may require customization based on your application's architecture and framework.
Conclusion
The CSRF vulnerability in the Amazon EC2 Plugin can be mitigated by upgrading to version 1.50.2 or later. It is important to promptly apply the fix to prevent unauthorized access and potential disruption of Jenkins workflows. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for org.jenkins-ci.plugins:ec2 →
FAQ
Cross-Site Request Forgery (CSRF) is an attack that tricks a victim into performing unwanted actions on a web application in which they are authenticated. It occurs when an attacker can predict or control the victim's requests to the application.
The CSRF vulnerability in the Amazon EC2 Plugin can allow an attacker to provision instances with an attacker-specified template ID. This can lead to unauthorized access, data leakage, or disruption of the Jenkins workflow.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities in software using just the pom.xml file.
Yes, upgrading to Amazon EC2 Plugin version 1.50.2 or later fixes this vulnerability. Version 1.50.2 introduces the requirement of POST requests for the affected HTTP endpoints, mitigating the CSRF vulnerability.
If upgrading to version 1.50.2 is not immediately feasible, you can implement CSRF protection at the network or application layer. This involves adding CSRF tokens to the affected HTTP endpoints and validating them on the server-side.
Related vulnerabilities
Recent vulnerabilities recorded for org.jenkins-ci.plugins:ec2.