# GHSA-9VW8-RF55-XVR8: Stored XSS via unescaped scrobble metadata

- Database: GitHub
- Severity: medium (stated by ghsa, no CVSS score)
- Published: 2026-10-09
- Modified: 2026-10-09

## Affected versions

- malojaserver (PyPI): through 3.2.6

## Description

## Summary

Maloja builds its Jinja2 environment with `autoescape=select_autoescape(['html', 'xml'])` (`maloja/jinjaenv/context.py`) but loads every template under a `*.jinja` name (`maloja/server.py`), so autoescaping never applies. Scrobble metadata (track title, artist, album) sent to the documented `POST /apis/mlj_1/newscrobble` API is stored verbatim and rendered into several pages without escaping, so a title containing HTML becomes live markup. A scrobble API key only authorises scrobbling, not admin actions, so this lets a write-only credential run script in the browser of anyone viewing the pages, including the signed-in administrator.

## Proof of concept

Reproduced against `malojaserver` 3.2.6 installed from PyPI.

```
# Start the published package. A scrobble key is auto-created on first run.
pip install malojaserver==3.2.6
MALOJA_DATA_DIRECTORY=./data MALOJA_SKIP_SETUP=true maloja run
# the key is written to ./data/apikeys.yml

# Store a track whose title is HTML, using that scrobble key (default processing left on).
curl -X POST http://localhost:42010/apis/mlj_1/newscrobble \
     --data-urlencode "key=<SCROBBLE_KEY>" \
     --data-urlencode "artist=PwnArtist" \
     --data-urlencode 'title=pwn"><img src=x onerror=alert(document.domain)>'

# View the default dashboard as any unauthenticated visitor.
curl http://localhost:42010/
```

The top-tracks tile returns the title as live markup rather than text:

```
<span>pwn"><img src=x onerror=alert(document.domain)></span>
```

The same unescaped value reaches `data-entity_name="..."` on `/charts_tracks` (where the `"` closes the attribute), and the `<title>` element on the track page. Default server-side processing (`maloja/cleanup.py`) only collapses whitespace and rewrites `[` `]`; it does not touch `<`, `>` or `"`.

## Impact

Any holder of a scrobble API key can store HTML that runs when the pages are viewed. The sinks sit on the default dashboard `/` and the public chart pages, which the administrator browses with the `maloja_sessiontoken` cookie set, so the injected script runs in that session and can call the session-only admin API: server settings, API-key management, scrobble deletion, full database export. A scrobble-only credential thus takes over the whole instance. Scrobble metadata normally comes from third-party sources (file tags, streaming services, the scrobbler clients the key is handed to) rather than the administrator, so a malicious title is realistic. This is separate from the reflected error-page XSS fixed in 3.2.2 (GHSA-4h72-34j6-j8x7), which escaped only the error template.

## References

- https://github.com/krateng/maloja/security/advisories/GHSA-9vw8-rf55-xvr8

Page: https://cve.now/GHSA-9VW8-RF55-XVR8

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
