/

CVE-2026-91160

Severity:

HIGH RISK

(8.2)

Missing Authorization (CWE-862) in OpenWA WebSocket Gateway

CVE-2026-91160

Deferred

Vulnerability type

Category:

Missing Authorization

CWE:

CWE-862

Impact:

WhatsApp account compromise and unauthorized message access

Severity:

HIGH RISK

(8.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

OpenWA's WebSocket event gateway may disclose WhatsApp session QR codes to VIEWER API keys that subscribe to the relevant event, despite QR retrieval being restricted to the OPERATOR role. If a permitted session is waiting for pairing, an exposed QR code could let the key holder link an external device and read or send messages outside OpenWA's controls and audit trail.

Affected context

The issue occurs in OpenWA deployments where:

  • The /events WebSocket gateway is enabled
  • A session is waiting to be paired
  • A VIEWER API key can subscribe by event name or through a wildcard subscription
  • Authorization for the session.qr event is weaker than authorization for the corresponding QR API endpoint

Keys constrained with allowedSessions remain limited to those sessions. Deployments that issue only OPERATOR or ADMIN keys are not affected by this specific exposure.

Exploit preconditions

  • Attack surface: The OpenWA /events WebSocket gateway
  • Required access: A valid API key with VIEWER-level access and permission to observe the affected session
  • Trigger point: A session.qr event is emitted while the session awaits pairing
  • Why exploitation is possible: Event subscription authorization does not consistently enforce the stronger role requirement applied to direct QR retrieval

Why this happens

The underlying flaw is an authorization mismatch between related access paths. The WebSocket gateway exposes a sensitive session QR event to subscribers whose role would not permit retrieving the same information through the HTTP API. This represents CWE-862: Missing Authorization, because a server-side authorization check is absent or insufficient at a sensitive event delivery boundary.

Potential impact

  • An attacker with suitable VIEWER access may link an external device to an allowed WhatsApp session
  • The attacker could read messages associated with the linked account
  • The attacker could send messages while operating outside OpenWA's audit trail
  • The affected WhatsApp account or session could be compromised
  • Business communications and connected workflows may be exposed or misused

General mitigation guidance

Mitigation generally focuses on enforcing consistent, server-side authorization for sensitive events and equivalent API operations.

Defensive patterns include:

  • Require an OPERATOR-level authorization decision before emitting session QR events
  • Apply the same session and role checks to direct endpoints, WebSocket subscriptions, and wildcard subscriptions
  • Treat QR codes and pairing artifacts as highly sensitive credentials
  • Default new API keys to the least privilege needed and restrict them to specific sessions where possible
  • Prevent VIEWER roles from receiving operational secrets or account-linking material
  • Preserve authorization decisions and sensitive-event access in security logs
  • Invalidate or rotate pairing artifacts when exposure is suspected

How teams detect issues like this

Detection approaches may include:

  • Static and architectural analysis comparing authorization checks across HTTP and WebSocket handlers
  • Code review for event subscription paths that rely only on event names or wildcard filters
  • Tests verifying that each role receives only events authorized for its privilege level
  • Policy checks ensuring sensitive session artifacts are excluded from viewer-scoped channels
  • Runtime monitoring for QR-event delivery to low-privilege keys and unusual device-linking activity
  • Automated security testing of wildcard subscriptions and session-scoping rules

Sources

SourceLink
github.comgithub.com/rmyndharis/OpenWA/commit/acc23c3803c07f43791a92e8e48456572fd69bdc
github.comgithub.com/rmyndharis/OpenWA/commit/b9d9ea1c57bde98b7833a5d6e482998703667ef0
github.comgithub.com/rmyndharis/OpenWA/pull/1602
github.comgithub.com/rmyndharis/OpenWA/releases/tag/v0.23.5
github.comgithub.com/rmyndharis/OpenWA/security/advisories/GHSA-m427-j4h4-9qwj

Frequently asked

questions

It may be exploitable over the network when the WebSocket gateway is reachable and an attacker possesses a VIEWER API key with access to an affected session.

Exploitation requires a valid key capable of subscribing to the relevant event or wildcard channel. Session restrictions can limit the exposure to the sessions assigned to that key.

Enforce the strongest authorization required for the underlying resource before delivering the event, and apply identical role and session checks across HTTP and WebSocket interfaces.

Classify QR codes as sensitive credentials, use least-privilege keys, test every subscription form including wildcards, and monitor delivery of privileged session events.

Find out what's already
exploitable in your codebase.