The vulnerability is a Cross-Site Scripting (XSS) issue within the Navidrome frontend, caused by the improper use of React's dangerouslySetInnerHTML property. This function was used in several components to render metadata from music files, such as song comments, album notes, and artist biographies. The core of the issue lies in the MultiLineTextField component, which was explicitly designed to take text input (like a song's comment) and render it as HTML without any sanitization. An attacker could embed malicious HTML and JavaScript code (e.g., <img src=x onerror=... >) into a song's metadata. When a Navidrome user views the details of this malicious song, the script would execute in their browser, allowing the attacker to steal sensitive information like the user's API token from local storage.
The security patch addresses this by systematically removing the usage of dangerouslySetInnerHTML where it's not needed or by wrapping the content in a new SafeHTML component. This new component utilizes the DOMPurify library to sanitize the HTML, removing any potentially malicious code before it is rendered. The analysis of the commit d7ec7355c9036d5be659d6ac555c334bb5848ba6 clearly shows the removal of the vulnerable code in components like MultiLineTextField, AlbumDetails, DesktopArtistDetails, MobileArtistDetails, and Linkify, and the introduction of the SafeHTML component as the primary mitigation.