/

CVE-2026-43874

Severity:

HIGH RISK

(7.2)

Code Injection in WWBN AVideo YPTSocket

CVE-2026-43874

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary JavaScript Execution in User Browsers (Stored/Reflected-like WebSocket XSS)

Severity:

HIGH RISK

(7.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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 json field, with a selected to_users_id identifying 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 under json skip 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.

Sources

SourceLink
github.comgithub.com/WWBN/AVideo/commit/9f3006f9a89a34daa67a83c6ad35f450cb91fcce
github.comgithub.com/WWBN/AVideo/security/advisories/GHSA-ghcv-22jf-vfxm

Frequently asked

questions

Yes. Any attacker who can reach the plugin/YPTSocket/getWebSocket.json.php endpoint and the associated WebSocket server can exploit this issue remotely without prior authentication, provided the YPTSocket plugin is enabled and exposed.

No. The attack described can be initiated by an unauthenticated party: the token endpoint is reachable without login, and the WebSocket server accepts connections using the issued token. However, the attack's impact is realized only when a logged-in user with a matching to_users_id receives and processes the malicious message.

The most robust fix is to remove eval()-style code execution from the client and treat WebSocket messages purely as structured data, combined with server-side schema validation for all message variants. Instead of stripping specific keys, enforce a strict, allowlisted schema for messages and reject or neutralize anything that does not conform to it.

Prevention centers on secure design practices for messaging systems:

  • Prohibit dynamic code execution based on network-supplied input.
  • Apply uniform validation and sanitization to all data paths, not just individual fields that happened to be abused previously.
  • Define and enforce explicit message schemas for WebSocket traffic.
  • Incorporate security-focused code review and automated checks targeting eval usage, WebSocket handling, and any functionality that mixes data with executable logic.
Find out what's already
exploitable in your codebase.