# GHSA-7944-89X5-52Q9: Reflected XSS in directory listing pages (privilege escalation via token theft)

- Database: GitHub
- Severity: CVSS 5.7 (Medium)
- Published: 2026-08-13
- Modified: 2026-08-13

## Tracked as

- [CVE-2026-53526](https://cve.now/CVE-2026-53526.md): Reposilite reflected XSS in directory listing pages

## Description

### Summary
Reposilite >= 3.5.16 is affected by reflected Cross-Site Scripting (XSS) in the Maven directory-index page, which reflects the request URI into HTML without encoding.

### Details
When a browsed path resolves to a directory, Reposilite serves a generated listing page that interpolates the raw request URI into `<title>`, `<h1>`, and the single-quoted `href` of the `<base>` and "Parent Directory" `<a>` elements with no HTML escaping. The listing is served from the same origin as the Admin UI, so injected JavaScript can read the browser's local storage where the user's token (`token-secret`) is stored.

The content-embedded `ctx.uri()` is percent-encoded, so tag injection is blocked, but a single quote `'` passes through and breaks the anchor's quoted `href`, letting an attacker attach `autofocus` and an `onfocus=` handler that fires on page load (no interaction beyond the victim opening the link).

Unlike artifact and javadoc responses which set `Content-Security-Policy: sandbox` (the fix for CVE-2024-36115), the directory-index response sets no CSP, so the same-origin restriction does not apply. The unescaped page was introduced in 3.5.16, after that fix.

The directory index only renders for an existing directory, so the attacker-named path must exist. `Location.of` strips `< > " ' :` but keeps `/`, `=` and letters, so it is plantable with a write/deploy token to a repository or, without a token, via an unauthenticated cached fetch on a `store=true` repository that proxies an attacker-influenceable upstream.

### Steps to reproduce
Default settings, `localhost:8080`.

1. With a write/deploy token, plant the directory by deploying any file under the crafted path:
   ```
   curl -u user:token --upload-file x.txt \
     "http://localhost:8080/releases/com/acme/autofocus/onfocus=document.title=PWNED/z/x.txt"
   ```
2. Open the crafted link:
   ```
   http://localhost:8080/releases/com/acme'/autofocus/onfocus=document.title='PWNED/z
   ```
   The Parent-Directory anchor is served as `<a href='/releases/com/acme'/autofocus/onfocus=document.title='PWNED'>`, which the browser parses as `<a href="/releases/com/acme" autofocus onfocus="document.title='PWNED'">`. `autofocus` fires `onfocus` on load and the script runs in the `http://localhost:8080/` origin. A real payload reads `localStorage.getItem('token-secret')` and exfiltrates it.

<img width="892" height="188" alt="image" src="https://github.com/user-attachments/assets/63400f73-5e22-4bdd-9fcd-f92f048f9e80" />

### Impact
Same-origin JavaScript can steal the victim's token from local storage. Against a manager token this is full instance compromise. Because the attacker only needs a low-privileged foothold (a CI/deploy token, or content on a proxied mirror) and then phishes a manager into opening the crafted link, this potentially escalates a scoped token to full administrative takeover.

### Remediation
* Serve the directory-index response with `Content-Security-Policy: sandbox`, the same header already used for artifact and javadoc content.
* HTML-escape every value `createDirectoryIndexPage` interpolates (the request URI and file names).
* Storing the token in plaintext local storage turns any same-origin XSS into account takeover; consider session tokens instead.

## References

- https://github.com/dzikoysk/reposilite/security/advisories/GHSA-7944-89x5-52q9

Page: https://cve.now/GHSA-7944-89X5-52Q9
