CVE-2024-5083 Nexus Repository 2 - Stored XSS Vulnerability – 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 maven artifact with an embedded XSS attack. If an administrator views the content of said artifact in their browser window, that may execute unwanted actions permitted by the administrator’s account level.

We have mitigated the issue with an internal code change. See the Immediate Mitigation Options below for an alternative if you are using a reverse proxy in front of your deployment.

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:

Download Nexus Repository

Immediate Mitigation Options:

Upgrading Nexus Repository is the recommended approach for eliminating this vulnerability. However, immediate mitigation options are available for deployments that cannot upgrade immediately:

Nginx configuration:

events {

}

http {
  proxy_send_timeout        120;
  proxy_read_timeout        300;
  proxy_buffering           off;
  keepalive_timeout         5 5;
  tcp_nodelay              on;

client_max_body_size      1G;

map $uri $is_content {
    ~*/content/  1;
    default      0;
  }

map $upstream_http_content_security_policy:$is_content $csp {
    ":1"        "sandbox allow-forms allow-modals allow-popups allow-presentation allow-top-navigation allow-scripts";
    default      $upstream_http_content_security_policy;
  }

server {
    listen                  *:80;

location / {
      proxy_pass            http://nexus-repository:8081/;
      proxy_redirect         off;
      proxy_set_header      Host $host;
      proxy_set_header      X-Real-IP $remote_addr;
      proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header      X-Forwarded-Host $server_name;
      proxy_set_header      X-Forwarded-Proto $scheme;

add_header            Content-Security-Policy $csp;
    }
  }
}

Credit:

This issue was discovered and reported responsibly by Michael Stepankin (artsploit) via Sonatype’s Bug Bounty Program.

Support:

If you run into any problems, or have any questions/concerns, please contact us by filing a ticket at Sonatype Support.

Frequently Asked Questions:

Q: What is the risk associated with this vulnerability?
A: An attacker can publish a maven artifact with an embedded XSS attack. If an administrator views the content of said artifact, that may execute unwanted actions permitted by the administrator’s account level.

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.