The vulnerability is a reflected Cross-Site Scripting (XSS) in the GET /api/app-images/logo endpoint, with a related stored XSS vector in the settings. The root cause is the lack of input validation on the color query parameter, which is used to customize an SVG image returned to the user.
The attack flow for the reflected XSS is as follows:
- An attacker crafts a URL to the
/api/app-images/logo endpoint with a malicious payload in the color parameter (e.g., color=red</style><script>alert('XSS')</script>).
- The
(*AppImagesHandler).GetLogo function receives the request and passes the malicious color value to the (*ApplicationImagesService).GetImageWithColor method.
- This method calls
applyAccentColorToSVG (renamed to applyAccentColorToSVGInternal in the patch), which uses strings.ReplaceAll to substitute the payload directly into the SVG's <style> block without sanitization.
- The payload closes the style block and injects a
<script> tag into the SVG.
- The server responds with the manipulated SVG with a
Content-Type of image/svg+xml.
- When a victim, such as a logged-in administrator, opens the malicious URL, their browser executes the injected script in the application's origin, allowing the attacker to hijack the session and perform unauthorized actions.
A similar stored XSS vulnerability existed in (*SettingsService).prepareUpdateValues, which allowed saving a malicious color value to the database.
The patch mitigates these vulnerabilities by introducing a strict regex (settings.SafeAccentColor) to validate the color parameter in both the image rendering and settings update paths, ensuring only safe CSS color values are processed. It also adds the X-Content-Type-Options: nosniff header as a defense-in-depth measure.