7.5high
Path traversal in Reposilite javadoc file expansion
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.47% (higher than 74% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-frvj-cfq4-3228
Description
Reposilite is an open source, lightweight and easy-to-use repository manager for Maven based artifacts in JVM ecosystem. Reposilite provides support for JavaDocs files, which are archives that contain documentation for artifacts. Specifically, JavadocEndpoints.kt controller allows to expand the javadoc archive into the server's file system and return its content. The problem is in the way how the archives are expanded, specifically how the new filename is created. The `file.name` taken from the archive can contain path traversal characters, such as '/../../../anything.txt', so the resulting extraction path can be outside the target directory. If the archive is taken from an untrusted source, such as Maven Central or JitPack for example, an attacker can craft a special archive to overwrite any local file on Reposilite instance. This could lead to remote code execution, for example by placing a new plugin into the '$workspace$/plugins' directory. Alternatively, an attacker can overwrite the content of any other package. Note that the attacker can use its own malicious package from Maven Central to overwrite any other package on Reposilite. Reposilite has addressed this issue in version 3.5.12. Users are advised to upgrade. There are no known workarounds for this vulnerability. This issue was discovered and reported by the GitHub Security lab and is also tracked as GHSL-2024-073.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| dzikoysk reposilite | >= 3.3.0, < 3.5.12, from 3.3.0 before 3.5.12 | CVE List |
| com.reposilite:reposilite-backend (Maven) | from 3.3.0 before 3.5.12 | GitHub Advisory Database |
| reposilite reposilite | from 3.3.0 before 3.5.12 | NVD |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.
What each source says
CVE List
Reposilite is an open source, lightweight and easy-to-use repository manager for Maven based artifacts in JVM ecosystem. Reposilite provides support for JavaDocs files, which are archives that contain documentation for artifacts. Specifically, JavadocEndpoints.kt controller allows to expand the javadoc archive into the server's file system and return its content. The problem is in the way how the archives are expanded, specifically how the new filename is created. The `file.name` taken from the archive can contain path traversal characters, such as '/../../../anything.txt', so the resulting extraction path can be outside the target directory. If the archive is taken from an untrusted source, such as Maven Central or JitPack for example, an attacker can craft a special archive to overwrite any local file on Reposilite instance. This could lead to remote code execution, for example by placing a new plugin into the '$workspace$/plugins' directory. Alternatively, an attacker can overwrite the content of any other package. Note that the attacker can use its own malicious package from Maven Central to overwrite any other package on Reposilite. Reposilite has addressed this issue in version 3.5.12. Users are advised to upgrade. There are no known workarounds for this vulnerability. This issue was discovered and reported by the GitHub Security lab and is also tracked as GHSL-2024-073.
GitHub Advisory Database
Summary
Reposilite v3.5.10 is affected by an Arbitrary File Upload vulnerability via path traversal in expanding of Javadoc archives.
Details
Reposilite provides support for JavaDocs files, which are archives that contain documentation for artifacts. Specifically, JavadocEndpoints.kt controller allows to expand the javadoc archive into the server's file system and return its content. The problem is in the way how the archives are expanded, specifically how the new filename is created:
JavadocContainerService.kt#L127-L136
jarFile.entries().asSequence().forEach { file ->
if (file.isDirectory) {
return@forEach
}
val path = Paths.get(javadocUnpackPath.toString() + "/" + file.name)
path.parent?.also { parent -> Files.createDirectories(parent) }
jarFile.getInputStream(file).copyToAndClose(path.outputStream())
}.asSuccess<Unit, ErrorResponse>()
The file.name taken from the archive can contain path traversal characters, such as '/../../../anything.txt', so the resulting extraction path can be outside the target directory.
Impact
If the archive is taken from an untrusted source, such as Maven Central or JitPack for example, an attacker can craft a special archive to overwrite any local file on Reposilite instance. This could lead to remote code execution, for example by placing a new plugin into the '$workspace$/plugins' directory. Alternatively, an attacker can overwrite the content of any other package.
Note that the attacker can use its own malicious package from Maven Central to overwrite any other package on Reposilite.
Steps to reproduce
- Create a malicious javadoc archive that contains filenames with path traversal characters:
zip test-1.0-javadoc.jar ../../../../../../../../tmp/evil.txt index.html
Make sure that ../../../../../../../../tmp/evil.txt and index.html files exist on the system where you create this archive.
-
Publish this archive to the repository which Reposilite is mirroring, such as Maven Central or JitPack. For the test purposes, I used my own server that imitates the upstream maven repository: http://artsploit.com/maven/com/artsploit/reposilite-zipslip/1.0/reposilite-zipslip-1.0-javadoc.jar
-
Start Reposilite with 'releases' repository mirroring to 'http://artsploit.com/maven/'
-
Now, if the attacker send the request to http://localhost:8080/javadoc/releases/com/artsploit/reposilite-zipslip/1.0, the aforementioned archive will be obtained from the http://artsploit.com/maven/com/artsploit/reposilite-zipslip/1.0/reposilite-zipslip-1.0-javadoc.jar address and its 'evil.txt' file will be expanded to '$workspace$/tmp/evil.txt'. Note that to perform this action, an attacker does not need to provide any credentials, as fetching from the mirrored repository does not require authentication.
-
Confirm that '$workspace$/tmp/evil.txt' is created on the server where Reposilite is running.
Remediation
Normalize (remove all occurrences of /../) the file.name variable before concatenating it with javadocUnpackPath. E.g.:
val path = Paths.get(javadocUnpackPath.toString() + "/" + Paths.get(file.name).normalize().toString())
NVD (es)
Reposilite es un administrador de repositorio de código abierto, liviano y fácil de usar para artefactos basados en Maven en el ecosistema JVM. Reposilite brinda soporte para archivos JavaDocs, que son archivos que contienen documentación para artefactos. Específicamente, el controlador JavadocEndpoints.kt permite expandir el archivo javadoc al sistema de archivos del servidor y devolver su contenido. El problema está en la forma en que se expanden los archivos, específicamente en cómo se crea el nuevo nombre de archivo. El `file.name` tomado del archivo puede contener caracteres de path traversal, como '/../../../anything.txt', por lo que la ruta de extracción resultante puede estar fuera del directorio de destino. Si el archivo se toma de una fuente que no es de confianza, como Maven Central o JitPack, por ejemplo, un atacante puede crear un archivo especial para sobrescribir cualquier archivo local en la instancia de Reposilite. Esto podría conducir a la ejecución remota de código, por ejemplo, colocando un nuevo complemento en el directorio '$workspace$/plugins'. Alternativamente, un atacante puede sobrescribir el contenido de cualquier otro paquete. Tenga en cuenta que el atacante puede utilizar su propio paquete malicioso de Maven Central para sobrescribir cualquier otro paquete en Reposilite. Reposilite ha solucionado este problema en la versión 3.5.12. Se recomienda a los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad. Este problema fue descubierto e informado por el laboratorio de seguridad de GitHub y también se rastrea como GHSL-2024-073.
References
| https://github.com/dzikoysk/reposilite/security/advisories/GHSA-frvj-cfq4-3228 | exploit, mitigation, vendor-advisory, web | |
| https://github.com/dzikoysk/reposilite/commit/848173738e4375482c70365db5cebae29f125eaa | patch, web | |
| https://github.com/dzikoysk/reposilite/releases/tag/3.5.12 | release-notes, web | |
| https://github.com/dzikoysk/reposilite | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-36116 changed 2024-08-02 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-frvj-cfq4-3228 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2024-36116 changed 2026-06-17 | Public domain |