The vulnerability exists in the Server-Sent Events (SSE) implementation for upload status, located at the /uploadStatus endpoint. The root cause is a lack of proper access control. The system was broadcasting the upload status of all users to any authenticated user who subscribed to the status stream.
The analysis of the patch between vulnerable version 2.2.2 and patched version 2.2.3 reveals the exact flaw. The primary vulnerable function is sse.GetStatusSSE. In its insecure state, it called pstatusdb.GetAll(), which fetched every single upload status object from the database, regardless of the user who owned it. These statuses, containing sensitive file_ids, were then passed to sse.publishMessage.
The sse.publishMessage function, in turn, would iterate through all active SSE listeners and push the status update to them, failing to check if the user associated with the listener was the actual owner of the file being uploaded. This created a data leak where any authenticated user could monitor the file uploads of all other users on the platform.
The patch rectifies this by introducing user-ID-based filtering at multiple levels:
- A
UserId field is added to the UploadStatus model.
- The
pstatusdb.GetAll() function is replaced with pstatusdb.GetAllForUser(userId), which only fetches statuses belonging to the specified user.
- The
sse.publishMessage function is modified to accept a userId and only sends the event to the listener associated with that user.
- The
sse.GetStatusSSE handler is updated to use these new, secure functions, ensuring that a user connecting to the stream only receives status updates for their own uploads.