CVE-2024-5082 Nexus Repository 2 - Remote Code Execution – Sonatype Support

Sonatype Nexus Security Advisory

Date: November 13, 2024

Affected Versions: All previous Sonatype Nexus Repository Manager 2.x OSS/Pro versions up to and including 2.15.1

Fixed in Version: Sonatype Nexus Repository Manager 2.x OSS/Pro version 2.15.2

Summary:

A vulnerability has been discovered in Nexus Repository 2 requiring immediate action.

An attacker can publish a specially crafted maven artifact with a payload that will be executed upon download of that artifact.

We have mitigated the issue with an internal code change. However, if you cannot upgrade immediately, you can use a custom WAF rule as described in the "Immediate Mitigation Options" section below.

This vulnerability was identified by an external researcher and has been verified by our security team. We are not aware of any active exploits taking advantage of this issue.

Recommendation:

Sonatype Nexus Repository Manager 2.x is under Extended Maintenance. We would encourage remaining deployments to migrate to Sonatype Nexus Repository 3.

If a migration to Sonatype Nexus Repository 3 is not available, we are highly recommending all affected instances of Sonatype Nexus Repository Manager 2.x be upgraded to Nexus Repository version 2.15.2. Download the latest version from the following location:

https://help.sonatype.com/en/download-nexus-2.html

Immediate Mitigation Options:

Upgrading Nexus Repository is the recommended approach for eliminating this vulnerability. However, if you cannot upgrade immediately, you can use a custom WAF rule.

Prerequisites

Steps to Implement

In the steps to implement, we are focusing on a NXRMv2 instance or cluster that is deployed behind an Application Load Balancer (ALB).

  1. Initiate creating a web ACL

Open https://.console.aws.amazon.com/wafv2/homev2/web-acls?region= (make sure to specify the same region id as the region the ALB resides.

  1. Name and associate web ACL with ALB

  2. Add rules and rule groups

    • Initiate creating a rule

Some fields are optional, like the response body:

The rule definition in JSON:

     {
       "Name": "block-invalid-paths",
       "Priority": 0,
       "Action": {
         "Block": {
           "CustomResponse": {
             "ResponseCode": "400"
           }
         }
       },
       "VisibilityConfig": {
         "SampledRequestsEnabled": true,
         "CloudWatchMetricsEnabled": true,
         "MetricName": "block-invalid-paths"
       },
       "Statement": {
         "ByteMatchStatement": {
           "FieldToMatch": {
             "UriPath": {}
           },
           "PositionalConstraint": "CONTAINS",
           "SearchString": "//",
           "TextTransformations": [
             {
               "Type": "URL_DECODE",
               "Priority": 0
             },
             {
               "Type": "URL_DECODE",
               "Priority": 1
             }
           ]
         }
       }
     }
     ```
   - Review rules

4. Set rule priority

5. Configure metrics

6. Review and create web ACL

**Credit:**

This issue was discovered and reported responsibly by  Michael Stepankin (artsploit) via [Sonatype’s Bug Bounty Program](/content/report-a-security-vulnerability/index.html).

**Support:**

If you run into any problems, or have any questions/concerns, please contact us by filing a ticket at [https://support.sonatype.com](https://support.sonatype.com/).

**Frequently Asked Questions:**

Q:  What is the risk associated with this vulnerability?

A:  An attacker can publish a specially crafted maven artifact with a payload that will be executed upon download of that artifact.

Q: What preconditions must be met in order to be vulnerable?

A: An attacker must have network access to the Sonatype Nexus Repository Manager 2.x instance with credentials and minimal permission to publish a maven artifact.

Q: Are there implications associated with this advisory itself?

A: Disclosure unfortunately means bad actors may try to take advantage.  While we have initially limited the information to the minimum details necessary for users to affect an appropriate fix, this merely slows down a would-be attacker.  As such, we are advising all organisations using Nexus Repository to immediately assess their individual impact and take appropriate action in response.

Q:  Where can I obtain more information associated with the vulnerability?

A:  At this time, and in the interest of best protecting our user community, we are limiting the information released to that absolutely required in order to assess impact and affect remediation. Please contact support for more information.

Q:  Why is Sonatype making this information available?

A:  This is part of a responsible disclosure process. We are taking a concerted and proactive approach in our outreach activities in an effort to achieve the most rapid remediation possible for our customers and users.