Summary
WWBN AVideo versions up to and including 29.0 contain a code injection vulnerability in the YPTSocket WebSocket message handling path, where untrusted message content can be routed to a client-side eval() sink without proper sanitization.
By crafting a WebSocket message with malicious code nested under a top-level json field, an unauthenticated attacker can cause arbitrary JavaScript to execute in the browsers of targeted logged-in users.
Affected context
This issue arises in WWBN AVideo deployments that:
- Enable and use the YPTSocket plugin for WebSocket-based messaging
- Rely on the server-side stripping logic that only inspects $json['msg'] for autoEvalCodeOnHTML
- Expose plugin/YPTSocket/getWebSocket.json.php to obtain WebSocket tokens
The vulnerability sits in the server-side relay function msgToResourceId(), which selects content from $msg['json'] before $msg['msg'], allowing attacker-controlled data to bypass the mitigation and reach a client-side eval() call.
Exploit preconditions
- Attack surface: Public-facing WebSocket interface exposed by the YPTSocket plugin.
- Required access: No prior authentication required to:
- Request a WebSocket token via plugin/YPTSocket/getWebSocket.json.php
- Connect to the WebSocket server using that token.
- Trigger point: Sending a crafted WebSocket message where the autoEvalCodeOnHTML structure is nested under a top-level
jsonfield, with a selectedto_users_ididentifying logged-in recipients. - Why exploitation is possible: The server-side filter only strips autoEvalCodeOnHTML when it appears under
$json['msg'], while the relay prefers$msg['json']. As a result, malicious payloads placed underjsonskip the stripping branch and are forwarded verbatim to clients, where the browser-side script processes them with eval().
Why this happens
The underlying bug is a code injection pattern (CWE-94) emerging from inconsistent validation paths combined with dynamic code evaluation on the client side.
Server logic attempts to sanitize one specific field ($json['msg']) for autoEvalCodeOnHTML but fails to apply equivalent checks to other structurally similar fields ($msg['json']) that are actually used when routing messages.
Because the client's JavaScript uses eval() on the delivered payload, any attacker-controlled content that reaches this sink can execute as code in the user's browser.
Conceptually, this is an insecure design where:
- Untrusted data from a messaging channel is assumed trustworthy based on incomplete field-level filtering
- The same logical data (a script-carrying structure) takes multiple code paths, but only one is defended
- A powerful dynamic evaluation primitive (eval) is used instead of safer data-driven handling.
Potential impact
- Execution of arbitrary JavaScript in the context of logged-in users' browsers.
- Theft of session tokens, CSRF tokens, and other sensitive data accessible via the DOM or JavaScript APIs.
- Forced actions on behalf of victims, such as changing account settings, uploading or deleting content, or managing videos, depending on permissions.
- Persistence of malicious behavior through hijacked WebSocket messaging flows, potentially enabling targeted attacks against specific users.
- Use of affected user sessions as a pivot to further compromise administrative accounts or perform large-scale account abuse.
General mitigation guidance
Effective mitigation generally focuses on both server-side message handling and client-side execution patterns:
- Treat all WebSocket message fields as untrusted and apply consistent validation and sanitization regardless of nesting (
msg,json, or related structures). - Avoid designs that rely on special-case stripping of specific keys like autoEvalCodeOnHTML; instead, adopt a positive-allowlist approach for what shapes and types of data are permitted.
- Replace eval()-based processing with explicit parsing and safe dispatching logic, for example by mapping message types to predefined handler functions and treating payloads as inert data.
- Introduce strict schema validation for WebSocket messages on the server, rejecting messages that do not conform to a known message schema.
- Separate control data from any content that might reasonably contain HTML or script-like text, and encode or escape content before rendering.
- Limit the authority and capabilities exposed via WebSocket APIs, honoring least privilege for all actions initiated through these channels.
How teams detect issues like this
Detection can combine code-level analysis and runtime monitoring:
- Use static analysis or code review checklists to flag uses of eval() and equivalent dynamic execution primitives in client-side code, especially when fed from WebSocket or other network-derived inputs.
- Review server-side message routing functions (like msgToResourceId) for inconsistent field handling, special cases, or logic that only validates selective branches of incoming data structures.
- Define linting or security rules that prohibit message handlers from directly forwarding unprocessed JSON fields to clients; require explicit transformation or validation steps.
- Configure Web application firewalls (WAF) or reverse proxies, where applicable, to log or block WebSocket messages carrying script-like structures or suspicious auto-evaluation keys.
- Periodically run security tests that attempt to pass inert markers or benign payloads through all message paths to verify that filters and schemas are applied uniformly.

