The vulnerability is a stored DOM-based Cross-Site Scripting (XSS) in the YPTSocket plugin of AVideo. The root cause is the lack of input sanitization for the page_title and webSocketSelfURI parameters provided by a user during WebSocket connection setup.
The attack flow is as follows:
- An unauthenticated attacker sends a request to
/plugin/YPTSocket/getWebSocket.json.php. The webSocketSelfURI parameter in this request is not validated and is encoded into the WebSocket connection token by the getEncryptedInfo function.
- The attacker then establishes a WebSocket connection, providing a malicious
page_title and the crafted webSocketSelfURI.
- The
MessageSQLiteV2::onOpen function on the server processes these parameters. Before the patch, it stored them without proper sanitization. The page_title was only passed through utf8_encode, which is not an XSS mitigation, and webSocketSelfURI was not validated.
- The unsanitized data is then broadcast to all connected clients, specifically to administrators viewing the online-users debug panel.
- In the administrator's browser, the client-side JavaScript function
updateSocketUserCard receives the malicious page_title. It dynamically constructs HTML and appends it to the DOM using jQuery's .append() method. This causes the browser to parse and execute the attacker's JavaScript payload in the context of the administrator's session.
The patch in commit 8be71e53ccbe9b84b30870db386fb4d2b11e1c16 addresses the vulnerability in MessageSQLiteV2::onOpen by:
- Sanitizing the
page_title using htmlspecialchars to prevent HTML and script injection.
- Validating the
webSocketSelfURI to ensure it is a valid HTTP/HTTPS URL, preventing javascript: scheme injection.
Therefore, the primary vulnerable function is MessageSQLiteV2::onOpen. The client-side sink is updateSocketUserCard.