CVE-2024-36115: Reposilite backend Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-9w8w-34vr-65j2
CVSS 7.5
CWE-79
Published
Advisory Summary

CVE-2024-36115 is a HIGH (CVSS 7.5) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Reposilite backend libraries in the Maven ecosystem. The issue involves reposilite artifacts vulnerable to stored cross-site scripting. Remediation is available by upgrading affected packages to version 3.5.12.

CVE-2024-36115 at a Glance

CVE Identifier CVE-2024-36115
GHSA Identifier GHSA-9w8w-34vr-65j2
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Reposilite backend
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2024-36115

To remediate this vulnerability, upgrade all affected Reposilite backend dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

com.reposilite:reposilite-backend fixed: 3.5.12
<dependency>
    <groupId>com.reposilite</groupId>
    <artifactId>reposilite-backend</artifactId>
    <version>3.5.12</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=com.reposilite

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2024-36115, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=com.reposilite

Analyze the terminal output to locate any version of Reposilite backend in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.5.12), your application is affected.

Note: The mvn dependency:tree -Dincludes=com.reposilite command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Reposilite backend, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Reposilite v3.5.10 is affected by Stored Cross-Site Scripting (XSS) when displaying artifact's content in the browser. ### Details As a Maven repository manager, Reposilite provides the ability to view the artifacts content in the browser, as well as perform administrative tasks via API. The problem lies in the fact that the artifact's content is served via the same origin (protocol/host/port) as the Admin UI. If the artifact contains HTML content with javascript inside, the javascript is executed within the same origin. Therefore, if an authenticated user is viewing the artifacts content, the javascript inside can access the browser's local storage where the user's password (aka 'token-secret') is stored. It is especially dangerous in scenarios where Reposilite is configured to mirror third party repositories, like the Maven Central Repository. Since anyone can publish an artifact to Maven Central under its own name, such malicious packages can be used to attack the Reposilite instance. ### Steps to reproduce To demonstrate this vulnerability, we can start Reposilite with default settings at localhost:8080 and configure its 'release' repository to mirror https://artsploit.com/maven. This is my own website intended to emulate http://repo1.maven.org/, but it also contains a proof-of-concept payload for this vulnerability. Technically I could publish this payload to Maven Central Repository, but I don't want to clutter it. Then, as an administrator or authenticated Reposilite user, navigate to http://localhost:8080/releases/com/artsploit/reposilite-xss/1.0/reposilite-xss-1.0.pom in the browser. This file contains the basic `application/xml` payload: ```xml <?xml version="1.0" encoding="UTF-8"?> <a:script xmlns:a="http://www.w3.org/1999/xhtml"> alert(`Secret key: ${localStorage.getItem('token-secret')}`) </a:script> ``` The script will be executed within the http://localhost:8080/ origin and the leaked token is displayed. ![image](https://github.com/dzikoysk/reposilite/assets/44605151/e6324fc8-fa7f-485c-90b3-19640c179773) ### Impact This issue may lead to the full Reposilite instance compromise. If this attack is performed against the admin user, it's possible to use the admin API to modify settings and artifacts on the instance. In the worst case scenario, an attacker would be able to obtain the Remote code execution on all systems that use artifacts from Reposilite. It's important to note that the attacker does not need to lure a victim user to use a malicious artifact, but just open a link in the browser. This link can be silently loaded among the other HTML content, making this attack unnoticeable. Even if the Reposilite instance is located in an isolated environment, such as behind a VPN or in the local network, this attack is still possible as it can be performed from the admin browser. ### Remediation When serving artifact's content via HTTPS, it's important to understand that this content might be potentially untrusted HTML code, so the javascript execution should be restricted. Consider the following options to remediate this vulnerability: * [preferred] Use the "Content-Security-Policy: sandbox;" header when serving artifact's content. This makes the resource treated as being from a special origin that always fails the same-origin policy (potentially preventing access to data storage/cookies and some JavaScript APIs). * [not preferred, but also works] Use the "Content-Disposition: attachment" header. This will prevent the browser from displaying the content entirely, so it just saves it to the local filesystem. Additionally, we strongly recommend reconsidering how the website authentication works for Reposilite. Storing user's passwords in plaintext in the browser's local storage is not an ideal option. The more robust and secure option would be to issue a one time session ID or a token to the browser after checking the login/password on the server. These session IDs or tokens should have limited validity time, so their compromise would be trickier to exploit.

CVE-2024-36115 Affected Reposilite backend Versions

1 component(s)
Fixed Versions:
3.5.12
Product / Package Ecosystem Affected Versions Fixed Version
com.reposilite:reposilite-backend
Maven
≥ 3.3.0
< 3.5.12
3.5.12

References

Frequently Asked Questions

What is CVE-2024-36115?
CVE-2024-36115 is a security vulnerability in Reposilite backend involving Reposilite artifacts vulnerable to Stored Cross-site Scripting under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Reposilite backend versions are affected?
Affected versions include releases prior to 3.5.12 across affected packages: com.reposilite:reposilite-backend.
What version fixes CVE-2024-36115?
Upgrading to 3.5.12 (or the latest patched release for your respective branch) resolves the vulnerability.
Is reposilite-backend affected?
Yes, com.reposilite:reposilite-backend is affected in releases prior to 3.5.12. Upgrade your dependency to 3.5.12 or later.
What is the CVSS score of CVE-2024-36115?
CVE-2024-36115 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-36115?
CVE-2024-36115 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Maven dependencies for CVE-2024-36115?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.reposilite'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9w8w-34vr-65j2",
  "modified" : "2024-11-04T13:53:24Z",
  "published" : "2024-08-02T21:12:54Z",
  "aliases" : [ "CVE-2024-36115" ],
  "summary" : "Reposilite artifacts vulnerable to Stored Cross-site Scripting",
  "details" : "### Summary\nReposilite v3.5.10 is affected by Stored Cross-Site Scripting (XSS) when displaying artifact's content in the browser.\n\n### Details\nAs a Maven repository manager, Reposilite provides the ability to view the artifacts content in the browser, as well as perform administrative tasks via API. The problem lies in the fact that the artifact's content is served via the same origin (protocol/host/port) as the Admin UI. If the artifact contains HTML content with javascript inside, the javascript is executed within the same origin. Therefore, if an authenticated user is viewing the artifacts content, the javascript inside can access the browser's local storage where the user's password (aka 'token-secret') is stored.\nIt is especially dangerous in scenarios where Reposilite is configured to mirror third party repositories, like the Maven Central Repository. Since anyone can publish an artifact to Maven Central under its own name, such malicious packages can be used to attack the Reposilite instance.\n\n### Steps to reproduce\nTo demonstrate this vulnerability, we can start Reposilite with default settings at localhost:8080 and configure its 'release' repository to mirror https://artsploit.com/maven. This is my own website intended to emulate http://repo1.maven.org/, but it also contains a proof-of-concept payload for this vulnerability. Technically I could publish this payload to Maven Central Repository, but I don't want to clutter it.\n\nThen, as an administrator or authenticated Reposilite user, navigate to http://localhost:8080/releases/com/artsploit/reposilite-xss/1.0/reposilite-xss-1.0.pom in the browser.\nThis file contains the basic `application/xml` payload:\n\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<a:script xmlns:a=\"http://www.w3.org/1999/xhtml\">\n    alert(`Secret key: ${localStorage.getItem('token-secret')}`)\n</a:script>\n```\n\nThe script will be executed within the http://localhost:8080/ origin and the leaked token is displayed.\n\n![image](https://github.com/dzikoysk/reposilite/assets/44605151/e6324fc8-fa7f-485c-90b3-19640c179773)\n\n### Impact\nThis issue may lead to the full Reposilite instance compromise. If this attack is performed against the admin user, it's possible to use the admin API to modify settings and artifacts on the instance. In the worst case scenario, an attacker would be able to obtain the Remote code execution on all systems that use artifacts from Reposilite.\n\nIt's important to note that the attacker does not need to lure a victim user to use a malicious artifact, but just open a link in the browser. This link can be silently loaded among the other HTML content, making this attack unnoticeable.\n\nEven if the Reposilite instance is located in an isolated environment, such as behind a VPN or in the local network, this attack is still possible as it can be performed from the admin browser.\n\n### Remediation\n\nWhen serving artifact's content via HTTPS, it's important to understand that this content might be potentially untrusted HTML code, so the javascript execution should be restricted.\nConsider the following options to remediate this vulnerability:\n* [preferred] Use the \"Content-Security-Policy: sandbox;\" header when serving artifact's content. This makes the resource treated as being from a special origin that always fails the same-origin policy (potentially preventing access to data storage/cookies and some JavaScript APIs).\n* [not preferred, but also works] Use the \"Content-Disposition: attachment\" header. This will prevent the browser from displaying the content entirely, so it just saves it to the local filesystem.\n\nAdditionally, we strongly recommend reconsidering how the website authentication works for Reposilite. Storing user's passwords in plaintext in the browser's local storage is not an ideal option. The more robust and secure option would be to issue a one time session ID or a token to the browser after checking the login/password on the server. These session IDs or tokens should have limited validity time, so their compromise would be trickier to exploit.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.reposilite:reposilite-backend"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.3.0"
      }, {
        "fixed" : "3.5.12"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dzikoysk/reposilite/security/advisories/GHSA-9w8w-34vr-65j2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-36115"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dzikoysk/reposilite/commit/279a472015ec675c1da449d902dc82e4dd578484"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dzikoysk/reposilite/commit/d11609f427aba255e0f6f54b1105d5d20ab043cf"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dzikoysk/reposilite"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dzikoysk/reposilite/releases/tag/3.5.12"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-08-02T21:12:54Z",
    "nvd_published_at" : null
  }
}