SEC Consult Vulnerability Lab Security Advisory < 20180208-0 > ======================================================================= title: Multiple Cross-Site Scripting Vulnerabilities product: Sonatype Nexus Repository Manager OSS/Pro vulnerable version: <=2.14.5, <=3.7.1 fixed version: 2.14.6, 3.8.0 CVE number: CVE-2018-5306, CVE-2018-5307 impact: Medium homepage: https://www.sonatype.com/ found: 2017-12-12 by: Werner Schober, Daniel Ostovary (Office Vienna) SEC Consult Vulnerability Lab An integrated part of SEC Consult Bangkok - Berlin - Linz - Luxembourg - Montreal - Moscow Kuala Lumpur - Singapore - Vienna (HQ) - Vilnius - Zurich https://www.sec-consult.com ======================================================================= Vendor description: ------------------- "At Sonatype we have a long history of partnership with the world of open source software development. From our humble beginning as core contributors to Apache Maven, to supporting the worldas largest repository of open source components (Central), to distributing the world's most popular repository manager (Nexus), we exist for one simple reason; to help accelerate software innovation." Source: https://www.sonatype.com/about-sonatype Business recommendation: ------------------------ The Sonatype Nexus Repository Server is affected by multiple XSS vulnerabilities which could be used by an attacker to execute JavaScript code in the user's browser. The vendor provides a patch for both version 2 and 3 of the product which should be installed immediately. It is recommended to conduct a thorough security review by IT security professionals in order to identify potential other security issues. Vulnerability overview/description: ----------------------------------- 1) Reflected XSS vulnerability The parameters "repoId" and "format" of the "healthCheckFileDetail" function are vulnerable to reflected XSS. If the attacker can lure a user into clicking a crafted link he could execute arbitrary JavaScript code. In case the user has sufficient permissions, an attacker can create arbitrary (administrative) users or perform stored XSS attacks (see 2). 2) Stored XSS vulnerabilities The application is vulnerable to multiple stored XSS vulnerabilities, which are described in the following list. 2.1) The first one is located in the "File Upload" functionality of the "Staging Upload". Uploading a file with JavaScript code in its name allows to store JavaScript code, which gets triggered every time the file name is shown (e.g. in "Repositories"). 2.2) The second stored XSS vulnerability is more precisely being considered as stored DOM injection. This vulnerability affects the functionality of creating a new user. When doing so it is possible to inject JavaScript/HTML code in the username, which later gets rendered/executed every time the username is displayed. 2.3) The third stored XSS vulnerability is also a stored DOM injection. It affects the "IQ Server Connection"/"IQ Server Dashboard" functionality. The "IQ Server URL" field in the "IQ Server Connection" allows to inject JavaScript/HTML code into the menu bulletpoint "IQ Server Dashboard". The vendor provided the following CVE numbers: * CVE-2018-5306 - covers the XSS vulnerabilities in Nexus 3 * CVE-2018-5307 - covers the XSS vulnerabilities in Nexus 2 Proof of concept: ----------------- 1) Reflected XSS vulnerability By luring an attacker into clicking the following link, an arbitrary JavaScript payload will be executed: https://example.com/nexus/service/siesta/healthcheck/healthCheckFile Detail/.../index.html?repoId=public&format=sectest Vulnerable parameters: -) repoId -) format 2) Stored XSS vulnerabilities ***Please note that only users with access to the respective functionalities are susceptive to the following stored XSS vulnerabilities.*** 2.1) The staging upload allows an attacker to upload a file, which contains a JavaScript payload in the filename. An example for a filename containing a "malicious" payload is as follows: ".jpg" This file can be uploaded flawlessly and everytime the filename is displayed, the JavaScript payload gets executed. 2.2) An attacker is able to create a new user, which contains a malicious JavaScript payload in the username. As an example the following username can be used: "EvilAdmin Create Repository -> Access repository via "Repositories" -> JavaScript code is being executed) 2.3) The nexus server allows to setup an IQ server connection. The server name is not validated and therefore allows the permanent injection of JavaScript code. To demonstrate the vulnerability the following IQ server URL can be set: 'https://example.com'