The vulnerability is a stored Cross-Site Scripting (XSS) issue in Sync-in Server, originating from the improper handling of user-uploaded files, particularly SVG files. The root cause is that the application served these files without a Content-Disposition: attachment header, allowing browsers to render them inline. When a user uploaded a malicious SVG file, any embedded JavaScript would execute in the victim's browser in the context of the application's domain.
The analysis of the patch commit a6276d067725637310e4e83a3eee337aae81f439 reveals two primary vulnerable functions that were modified to mitigate this risk:
-
SendFile.send: This is the core function for file delivery. The patch removes a condition that previously allowed files to be sent without the Content-Disposition: attachment header. The updated code now enforces this header for all files sent via this class, preventing inline rendering.
-
UsersController.avatar: This endpoint was identified as a specific attack vector. It was modified to explicitly add the Content-Disposition: attachment header when serving avatar files. This prevents a malicious SVG avatar from being rendered by the browser, thus neutralizing the XSS threat.
By forcing all served files to be treated as attachments, the patch ensures that browsers will prompt users to download them rather than rendering them directly, effectively mitigating the stored XSS vulnerability.