Summary
AVideo with the YPTSocket plugin enabled contains a cross-site scripting vulnerability in its WebSocket callback handling. An unauthenticated attacker may send crafted socket messages that cause untrusted data to be inserted into a victim's browser DOM, potentially executing JavaScript in the AVideo origin without user interaction.
Affected context
The issue may occur in AVideo deployments where the YPTSocket plugin is enabled and WebSocket callback names can resolve to globally accessible browser functions. Risk is increased when those functions process attacker-controlled values through unsafe DOM sinks such as innerHTML, allowing injected content to execute within an authenticated user's origin.
Exploit preconditions
- Attack surface: The YPTSocket WebSocket callback mechanism
- Required access: No authentication may be required to send the relevant socket messages
- Trigger point: Processing a callback name and its associated untrusted data in a victim's browser
- User interaction: The described behavior may not require a victim to click a link or approve an action
- Why exploitation is possible: A callback can resolve to a global function that assigns attacker-controlled content to an unsafe HTML-rendering sink
Why this happens
The vulnerability results from treating attacker-influenced WebSocket callback names and data as trusted browser-side behavior. When callback resolution permits access to global functions and those functions insert untrusted values into innerHTML without context-appropriate output encoding or sanitization, browser-executable markup can be interpreted in the application's origin. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Potential impact
- An attacker may execute arbitrary JavaScript in another user's browser
- Session-related information could be exposed, depending on available browser context
- User actions could be performed within the victim's authenticated origin
- Sensitive page content may be read or modified
- Malicious content could be used for phishing or further account compromise
General mitigation guidance
Mitigation generally focuses on treating WebSocket messages and callback identifiers as untrusted input.
Common defensive patterns include:
- Restricting callback handling to an explicit allowlist of non-executable operations
- Avoiding dynamic resolution of arbitrary global functions
- Replacing innerHTML assignments with safe text or structured DOM APIs where HTML is not required
- Applying context-aware output encoding and narrowly scoped sanitization when trusted HTML must be rendered
- Validating message schemas, callback names, and data types before processing
- Applying least privilege to application sessions and limiting sensitive operations exposed to browser callbacks
- Using a restrictive Content Security Policy as a defense-in-depth control
How teams detect issues like this
Organizations can look for:
- Static analysis findings involving innerHTML, dynamic callback resolution, and HTML insertion of WebSocket data
- Code review signals such as global-function lookup, indirect invocation, or missing callback allowlists
- Tests that send unexpected callback identifiers and markup-like data through WebSocket interfaces
- Runtime monitoring for suspicious socket messages, unusual callback names, and unexpected DOM changes
- Policy enforcement requiring output encoding, trusted-type controls, or approved DOM APIs for browser-facing code
Automated security scanning and code review tools may help identify these patterns, but findings should be validated against the application's data flow.

