Sonatype released a patch earlier this month that fixes a Remote Code Execution (RCE) vulnerability in Nexus Repository Manager 3. The vulnerability exists because Nexus Repository Manager fails to implement Access Controls properly which leads to Remote Code Execution vulnerability.
This vulnerability affects Nexus Repository Manager 3.6.2 OSS/Pro versions up to and including 3.14.0.
The vulnerability exists in org.sonatype.nexus.coreui.ComponentComponent#previewAssets and can be triggered from two different sections, post packet parsing and JEXL expression execution.
The vulnerability can be exploited if there’s at least one Asset added to the repository. After setting a new target, we need to add a new Asset from Upload –> Maven-Releases option.
I created a sample application in Eclipse and exported it into a Runnable JAR file. This is the JAR that we need to use for creating an Asset:
Step#2: Uploading JAR
Here’s the request along with payload that exploits this vulnerability:
As you can see from screenshots above, our payload exec(“touch /tmp/pwned.txt”)’} should create a new file pwned.txt on the target.
Here’s the PoC video:
An unauthenticated, remote attacker could exploit this vulnerability to execute arbitrary Java code on the system. Customers are advised to scan their network for QID#13419 to find vulnerable instances of Nexus Repository Manager and apply appropriate patches.