Summary
The YPTSocket plugin in WWBN AVideo relays attacker-supplied JSON fields directly into client-side eval() calls, enabling arbitrary JavaScript execution in users' browsers.
Because anonymous tokens are minted and accepted without meaningful revalidation, an unauthenticated attacker can broadcast malicious scripts to all connected clients, potentially taking over accounts and performing privileged actions.
Affected context
The vulnerability occurs in deployments of WWBN AVideo (version 29.0 and prior) that:
- Enable and use the YPTSocket plugin's WebSocket server
- Maintain active browser sessions connected to the site (including administrators and privileged users)
- Accept JSON messages from clients and relay them to all connected peers
Under these conditions, untrusted message fields are propagated to every connected client and processed with eval() in the context of the AVideo origin, turning the messaging channel into a broadcast code-execution vector.
Exploit preconditions
- Attack surface: Browser clients connected to the AVideo site via the YPTSocket WebSocket.
- Required access: Network-level ability to reach the WebSocket endpoint; no authenticated account is required because tokens are minted for anonymous visitors and only decrypted, not revalidated.
- Trigger point: Sending a crafted JSON message to the WebSocket server where the
msg.autoEvalCodeOnHTMLorcallbackfields contain attacker-controlled JavaScript. - Why exploitation is possible:
- The WebSocket backend relays
msgandcallbackfrom attacker messages to all connected clients without sanitization or filtering. - The client-side
plugin/YPTSocket/script.jsfile useseval()onjson.msg.autoEvalCodeOnHTML(around line 568) and onjson.callback(around line 95). - Token handling does not enforce strong authentication or revalidation, allowing unauthenticated attackers to participate in the channel and inject arbitrary script.
Why this happens
This issue stems from unsafe code evaluation in the client-side plugin combined with insufficient trust boundaries on WebSocket messages.
The YPTSocket JavaScript code calls eval() directly on fields sourced from the WebSocket payload, treating arbitrary, attacker-controlled JSON fields as executable JavaScript.
On the server side, incoming JSON is rebroadcast to all clients without normalization, sanitization, or origin checks, so data from any participant is implicitly trusted by every recipient.
This pattern maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where untrusted data is incorporated into dynamically evaluated code.
The absence of strict authentication, authorization, and token revalidation on the WebSocket layer further erodes the trust barrier, allowing unauthenticated message senders to influence privileged clients.
Potential impact
- Execution of arbitrary JavaScript in the browser of every connected user, including administrators.
- Theft of session cookies, access tokens, or other authentication artifacts accessible to JavaScript.
- Forced performance of privileged actions on behalf of administrators (e.g., creating or deleting content, modifying configuration, or managing users).
- Installation of persistent browser-side payloads such as malicious scripts injected into user-facing pages.
- Lateral movement through reuse of stolen administrator sessions to reconfigure the platform or reach additional systems.
- Phishing, content defacement, or delivery of further malware to end users via the compromised web interface.
General mitigation guidance
Effective mitigation focuses on removing dynamic code execution paths and tightening trust boundaries for real-time messaging:
- Replace eval():
- Avoid
eval()and similar dynamic evaluation APIs entirely in the WebSocket client. - Use explicit dispatch tables or switch statements to map message types to predefined handler functions.
- Treat message fields as data only; never interpret them as code or JavaScript expressions.
- Constrain message formats:
- Define a strict JSON schema for WebSocket messages and reject any fields that do not conform.
- Parse incoming messages into strongly-typed structures, and process only known, safe attributes.
- Sanitize and encode untrusted data:
- When displaying message content, use safe DOM APIs that treat inputs as text, not HTML or script.
- Apply contextual output encoding when data must be inserted into the DOM to prevent script injection.
- Strengthen authentication and authorization on sockets:
- Tie WebSocket connections to authenticated user sessions with short-lived, verifiable tokens.
- Revalidate tokens and permissions server-side before accepting or broadcasting client messages.
- Consider segregating broadcast channels by role or room to avoid universal impact from a single client.
- Apply least privilege on client capabilities:
- Limit which clients are allowed to send control or callback-related messages.
- Avoid giving anonymous or low-privilege users the ability to trigger actions affecting all clients.
These measures turn the WebSocket channel into a controlled messaging medium rather than a vehicle for remote code execution.
How teams detect issues like this
Detection can leverage both code-centric and behavior-centric approaches:
- Static analysis and linters:
- Configure rules to flag uses of
eval(),Function(), or similar dynamic evaluation APIs in client JavaScript. - Add patterns that specifically detect dynamic evaluation of data sourced from network APIs or WebSocket messages.
- Code review practices:
- During review, scrutinize any logic that:
- Parses JSON from sockets or HTTP APIs and then executes or injects it into the DOM.
- Uses generic "callback" or "script" fields as strings to be run in the browser.
- Ensure reviewers verify that message schemas are defined and enforced at both server and client.
- Security testing and fuzzing:
- Perform application-level penetration tests targeting WebSocket endpoints with crafted JSON messages.
- Use browser-based testing tools to identify DOM and script injection through real-time channels.
- Runtime monitoring:
- Instrument logging to capture unexpected message types or fields on the WebSocket server.
- Use Content Security Policy (CSP) reports to detect inline script execution or eval() usage at runtime where possible.
- Automated tooling:
- Integrate SAST or dependency analysis tools into CI pipelines to detect dangerous API usage and known insecure patterns in plugins.
Combining these techniques helps organizations detect both this specific issue and similar code injection risks in future changes.

