Skip to content
RCE Write-up Beginner

How to Find and Exploit Jenkins Unauthenticated RCE via Shodan

Jenkins instances with authentication disabled or misconfigured expose the /script endpoint, allowing an attacker to run Groovy scripts that execute system commands. This can lead to full takeover of the instance.

medium.com

Published on medium.com

Hello all, I am here to tell you how you can check for Jenkins Unauthenticated Remote Code Execution.

Josekutty Kunnelthazhe Binu, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could execute arbitrary commands on the Jenkins server, leading to full takeover of the instance.

What the attacker needed

Jenkins instance with auth disabled/misconfigured; Network access to the Jenkins instance

The fix

Authentication should be enabled and properly configured on Jenkins instances to prevent unauthorised access to the /script endpoint.

How it was found

  1. Find Jenkins instances using a Shodan search.
  2. Open the Jenkins instance and try to access the /script endpoint.
  3. If the script console is accessible, run a Groovy command to execute 'id'.
  4. Run a Groovy command to read /etc/passwd.
  5. Optionally run a Groovy command to read /etc/shadow.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Jenkins is a tool that automates building and testing software. If its login protection is turned off or set up wrongly, anyone can open a special page called /script and type commands that the server will run. This lets an attacker read files or take over the whole server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.