Rapid7 Vulnerability & Exploit Database

Jenkins ACL Bypass and Metaprogramming RCE

Back to Search

Jenkins ACL Bypass and Metaprogramming RCE

Disclosed
01/08/2019
Created
03/19/2019

Description

This module exploits a vulnerability in Jenkins dynamic routing to bypass the Overall/Read ACL and leverage Groovy metaprogramming to download and execute a malicious JAR file. When the "Java Dropper" target is selected, the original entry point based on classLoader.parseClass is used, which requires the use of Groovy metaprogramming to achieve RCE. When the "Unix In-Memory" target is selected, a newer, higher-level, and more universal entry point based on GroovyShell.parse is used. This permits the use of in-memory arbitrary command execution. The ACL bypass gadget is specific to Jenkins <= 2.137 and will not work on later versions of Jenkins. Tested against Jenkins 2.137 and Pipeline: Groovy Plugin 2.61.

Author(s)

  • Orange Tsai
  • Mikhail Egorov
  • George Noseevich
  • wvu <wvu@metasploit.com>

Platform

Java,Unix

Architectures

cmd, java

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/multi/http/jenkins_metaprogramming
msf exploit(jenkins_metaprogramming) > show targets
    ...targets...
msf exploit(jenkins_metaprogramming) > set TARGET < target-id >
msf exploit(jenkins_metaprogramming) > show options
    ...show and set options...
msf exploit(jenkins_metaprogramming) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;