The vulnerability, CVE-2025-56761, is a stored Cross-Site Scripting (XSS) issue in Memos <= 0.22.0, caused by the application's failure to validate the content type of user-uploaded data in two distinct features: user avatars and file attachments.
-
User Avatar XSS: An attacker can exploit the UpdateUser function to set their avatar to a data: URL containing a JavaScript payload and a text/html MIME type. The GetUserAvatarBinary function, which relies on the flawed extractImageInfo helper function, later serves this avatar to other users. It reads the attacker-specified text/html content type and uses it in the HTTP response, causing the victim's browser to execute the script. This provides a clear path for a stored XSS attack.
-
Attachment XSS: The CreateResource function allows an authenticated user to upload a file and set an arbitrary content type. The vulnerability description confirms that Memos serves this file back 'as is'. This means the unvalidated, user-provided content type is used in the Content-Type header when the file is viewed. An attacker can upload a file containing a script, set the type to text/html, and when another user (e.g., an administrator) views the file, the script executes in their browser.
Both vectors allow an authenticated attacker to execute arbitrary scripts in the context of a victim's browser, which can be leveraged to steal session tokens, perform unauthorized actions, or chain with other vulnerabilities for a full server compromise.