A critical vulnerability, CVE-2022-20613, was recently discovered in the widely used Jenkins Mailer Plugin, affecting versions up to and including 391.ve4a_38c1b_cf4b_. This vulnerability revolves around a Cross-Site Request Forgery (CSRF) issue that allows attackers to exploit the DNS of the Jenkins instance to resolve a hostname of their choice. In this post, we will delve into the details of this exploit and provide valuable information on its potential impact, as well as steps to mitigate and protect your Jenkins environment.

Exploit Details

The Jenkins Mailer Plugin is a widely used extension that allows Jenkins to send email notifications with build results. In affected versions, the underlying issue is a lack of proper CSRF protection while processing requests to resolve a hostname specified by an attacker. As a result, attackers can potentially carry out malicious actions on the Jenkins instance by forging requests without the victim's knowledge.

When an attacker submits a specially crafted request to the vulnerable Jenkins instance, the following code snippet within the plugin demonstrates the lack of CSRF protection:

public class DnsResolutionResult {
    private String hostname;
    private InetAddress[] addresses;

    public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl();

    public static class DescriptorImpl extends Descriptor<DnsResolutionResult> {

        public FormValidation doCheck(@QueryParameter String hostname) {
            try {
                InetAddress[] allByName = InetAddress.getAllByName(hostname);
                return FormValidation.ok("Resolved to: %s", Arrays.toString(allByName));
            } catch (UnknownHostException e) {
                return FormValidation.error("Unable to resolve: %s", hostname);

The problematic part lies in the doCheck method which does not require any form of authentication or CSRF protection. As a result, adversaries can potentially exploit this vulnerability in a myriad of ways, such as stealing sensitive information or gaining unauthorized access.

Original References

For more information on the discovery and technical analysis of this vulnerability, please consult the following resources:

1. CVE-2022-20613 Official CVE Record: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-20613
2. Jenkins Security Advisory: https://www.jenkins.io/security/advisory/2022-01-18/
3. Jenkins Mailer Plugin Repository: https://github.com/jenkinsci/mailer-plugin

Mitigation and Protection Steps

Fortunately, the Jenkins project has proactively addressed this vulnerability in the Mailer Plugin version 392.ve4a_38c1b_cf4b_ and later. To safeguard your Jenkins environment, we strongly recommend adhering to the following guidelines:

1. Upgrade your Jenkins Mailer Plugin to version 392.ve4a_38c1b_cf4b_ or any subsequent release to eliminate this CSRF vulnerability.
2. Regularly update all Jenkins plugins to ensure the latest security fixes and improvements are incorporated into your environment.
3. Enable CSRF protection at the global level in your Jenkins instance by navigating to "Jenkins" > "Manage Jenkins" > "Configure Global Security" > "Enable CSRF protection." This action will enforce authentication and CSRF token validation for all requests to your Jenkins environment.


The discovery of CVE-2022-20613 serves as a reminder to consistently prioritize security measures across your infrastructure. By staying informed about potential vulnerabilities, promptly applying available patches, and diligently monitoring your environment, you can minimize the potential risk that these exploits pose. With the guidelines provided in this post, you can help protect your Jenkins ecosystem against this CSRF vulnerability and ensure that your deployments remain robust and secure.


Published on: 01/12/2022 20:15:00 UTC
Last modified on: 07/29/2022 16:20:00 UTC