A successful WebSocket upgrade answers a narrow protocol question: the client and server established a channel. It does not prove that every message, subscription or server push on that channel is authorized. A test that stops at the HTTP/1.1 101 upgrade response, a valid cookie or an open socket can therefore miss the control that matters most: whether the application binds each operation and recipient to the current user, tenant, role and object.

This article gives buyers a way to scope and accept that work. It separates connection authentication, incoming commands, object and function access, subscriptions, outbound delivery, and revocation. The aim is a bounded authorization assessment with synthetic data and test identities, not a load test or a protocol exploit recipe.

Scope the channel beyond the HTTP upgrade

Start with an inventory of real-time paths rather than a count of WebSocket URLs. For each authorized environment, record the HTTP upgrade route, application message types, roles, tenants, subscription topics, server-originated events, authentication source and the components that make an authorization decision. Include reverse proxies or gateways when they terminate the upgrade or alter identity metadata.

RFC 6455 defines how the opening handshake establishes the connection. The application still chooses how it authenticates a user and what each message means. wss protects data in transit; it does not decide whether user B may subscribe to tenant A. A stable connection identifier helps correlate evidence, but it is not an identity or a permission.

The Pentest.red scope planner can be used to name the authorized hosts, test accounts, tenants, message families, fixtures, observation sources and prohibited actions. During scoping, Pentest.red can work with the owner to map reachable channel routes, message families and test role/tenant pairs, so the brief identifies what can actually be assessed. If the channel, its application protocol, broker configuration or server logs are outside scope, record that boundary before interpreting a silent or closed connection.

Name the application protocol and trust decisions

Native WebSocket carries frames; the business protocol lives above it. One product may use JSON actions such as subscribe and update, another may use a framework with rooms, and another may carry GraphQL subscriptions. Socket.IO rooms are a server-side Socket.IO concept, not a feature defined by RFC 6455. Framework-specific rules must therefore be tested as framework behavior, not presented as universal WebSocket semantics.

Map every client-controlled field that influences authority: action name, object ID, tenant, room or topic, requested properties and recipient. Then identify the trusted source for the same decision. A tenant written inside a message is only a claim until the server binds it to an authenticated principal and current policy. The same applies to a client-supplied sender name, role or connection ID.

The broader REST API assessment guide is useful for object and function authorization, but a persistent channel adds two separate surfaces: creating a subscription and choosing recipients for later outbound events. They need their own evidence.

Use a six-row authorization matrix

The matrix below is an original practical acceptance tool. It is not a requirement attributed to a protocol or framework. Fill it with the product's actual policy and test fixtures before execution.

Scroll sideways to compare

LayerAllowed positive controlDenied relation to exerciseEvidence neededMisleading result to avoid
Connection and upgradeApproved user opens the expected route in the named buildExpired, revoked or wrong-context authentication material follows the agreed policyPrincipal source, route, build, handshake result and connection correlation IDTreating 101, an open socket, close code or error alone as an authorization verdict
Incoming commandA role performs its permitted harmless action on its own fixtureThe same role requests a forbidden functionParsed action, policy decision and observed server-side stateAssuming a rejected frame proves every other action is protected
Object, property and functionUser B reads or updates B's synthetic object within permitted fieldsB names A's object, tenant or protected propertyAuthenticated subject, object owner, function, field set and final stateTrusting a topic, tenant or sender supplied by the client
Subscription creationB subscribes to B's private topic and an agreed public topicB requests A's private topicSubscription registry or equivalent decision, plus a harmless marker deliveryTreating an acknowledgement or missing immediate event as proof
Outbound deliveryA and B receive their own distinct markers; anonymous receives only intended public eventsA private A marker must not reach B or anonymousActual recipient identity, marker, topic, time and routing decisionInferring delivery safety from a denied application-level SEND command
Revocation, reconnect and resubscribePolicy defines which public events may remain and when private authority endsOld connection, new connection, new subscription and any enabled recovery are checked separately after a role or membership changeChange record, policy-effective point, results for each applicable path and accepted latencyRequiring all sockets to close universally, or accepting one close as proof stale subscriptions cannot return

A positive control matters in every row. Without a working owner action, known recipient and reachable observation path, a missing event may mean a broken fixture, wrong build or unavailable channel. Mark that case verification blocked or unknown; do not turn silence into a pass.

Pair incoming commands with positive controls

For each message family, compare an allowed and a prohibited relation while changing only the authority-relevant dimension. User B might be allowed to update B's synthetic task title but forbidden to update A's task or a protected status field. Record both the immediate reply and the final server state. A generic success message can hide a rejected write; an error can arrive after a side effect.

Separate object-level, property-level and function-level decisions. A role may read an object but not change its owner, invoke an administrative operation or publish as another user. Denial of one foreign object does not establish protection for another message type. Conversely, an authorized administrative path is not a bypass when the policy expressly grants it; the matrix must identify that role before testing.

Use only harmless operations and owned fixtures. Rate, frame-size and queue behavior may be included as small agreed checks, but this article does not turn an authorization assessment into load testing. Stop conditions should prevent bulk messages, real-user notifications or downstream effects.

Test subscription creation and outbound delivery separately

Subscription authorization asks whether the current principal may register interest in a topic now. Delivery authorization asks whether a later event may be sent to that connection or subscriber after policy, ownership or membership has changed. A product can pass the first and fail the second, or reject an incoming publish while still leaking a server-originated event.

Spring Security documents authorization on the client inbound channel and recommends protecting subscriptions rather than treating the outbound channel as an identical enforcement point. This framework-specific boundary illustrates why subscription authorization matters; it neither describes every WebSocket stack nor requires a per-message outbound interceptor.

Test the actual event path. First confirm that A receives an A marker and B receives a B marker. Then request the prohibited subscription with B and have an authorized fixture publish one harmless A marker. Confirm that A receives that same new marker, then observe the other recipients. An acknowledgement, an empty queue or the absence of an event before the publisher ran cannot decide the result. Public announcements should remain available where policy intends them; the test is not “disconnect everyone.”

Exercise Origin, revocation, reconnect and resubscribe

Browser Origin validation is useful against cross-site WebSocket hijacking. It is not user authorization. RFC 6455 notes that non-browser clients can send a fabricated Origin value, while browsers supply Origin as part of their security model. CORS settings for ordinary HTTP requests do not replace an explicit WebSocket Origin policy, and an allowlisted Origin does not grant access to a tenant or topic. An Origin value set by a native test client alone does not demonstrate a browser hijack. Cookies participate according to their actual cookie attributes and deployment context, so the assessment must observe the real handshake rather than assume they are always sent cross-site.

Long-lived connections also make identity freshness a product decision. Django Channels documents that a consumer can outlive a logout performed elsewhere; that framework-specific fact illustrates the question without imposing a universal refresh interval. The owner should define what happens after logout, role removal, tenant departure or object transfer: close the connection, re-evaluate messages, filter delivery, require reauthentication, or apply another documented control.

Check three paths after the authorized change: the already-open connection, a new connection, and a new subscription after reconnect. If the product enables connection or subscription-state recovery, test the recovered path separately. A close on the old connection does not show that reconnect cannot restore a stale topic. A denial on reconnect does not show that the old subscriber stopped receiving. Measure the product's agreed policy-effective point and queue behavior; do not borrow a universal number from a cheat sheet or another service.

Verify a WebSocket authorization boundary
  1. MapName the route, application messages, roles, tenants, topics, recipients, build and observation sources
  2. ControlProve each user can perform an owned action and receive a distinct synthetic marker
  3. ChallengeExercise one forbidden command or subscription with the valid lower-privilege identity
  4. ObserveCorrelate the policy decision, state change and actual outbound recipients without bulk traffic
  5. RetestRepeat the old connection, reconnect, any enabled recovery and resubscribe paths on the named fixed build

Work through a fictional incident-room scenario

Consider fictional Orbit Desk, a multi-tenant incident dashboard. Alice belongs to tenant A and owns synthetic incident A-101; Bob belongs to tenant B and owns B-202. Both may receive a public maintenance announcement. Private incident updates must reach only members of the owning tenant. All accounts, incidents and markers in this example are fixtures.

Positive controls show Alice subscribing to A-101 and receiving marker A-M1, while Bob subscribes to B-202 and receives B-M1. Bob then sends a subscription request naming A-101. The server returns a generic acknowledgement, but that response does not settle whether the subscription was registered. An authorized fixture publishes one harmless update carrying A-M2; the same run confirms Alice receives it. If Bob also receives it, the observed issue is unauthorized cross-tenant outbound delivery, even if Bob's separate attempt to edit A-101 was denied.

The team removes Bob from tenant B according to the agreed test plan. It checks Bob's open connection, reconnect and attempted resubscription independently, plus any resumed or recovered connection if that feature is enabled. Bob may still receive the public maintenance event if policy allows it, but not the private B-202 marker after the documented policy-effective point. A known publication, delivery to an authorized control recipient and a bounded observation window can support a limited non-delivery conclusion without internal telemetry. If the publisher, fixture or working control cannot be established, the check is blocked rather than passed.

This scenario does not establish a universal implementation. A native WebSocket application, Socket.IO room and GraphQL subscription can make different choices. The invariant is the security relation: the server must derive authority from trusted current state and enforce it on the operation and recipient that the product actually implements.

Accept bounded evidence and retest the named fix

A useful finding records the build, route, authenticated test identity, tenant and object relation, message type, topic, expected decision, minimal request description, policy or broker observation where available, and the distinct marker received by the wrong test recipient. Remove reusable cookies, tokens and personal data. A connection transcript or screenshot without the identity and recipient relation is too weak; a full secret-bearing trace is unnecessary.

If a buyer includes the channel, test accounts, brokers or relevant configuration in an authorized Pentest.red web application assessment, Pentest.red could map the operation/topic/tenant decisions, reproduce a synthetic cross-recipient effect at small scale, and give engineers minimized evidence and remediation priority. This requires the real-time path and necessary observation access to be expressly in scope; it does not promise automatic blocking or complete coverage of every event.

The owner deploys the change. A narrow retest names the fixed application build, message schema or authorization policy revision, and any broker or gateway configuration involved. It repeats owner controls, the prohibited subscription, actual outbound delivery, the old connection, reconnect, any enabled recovery and resubscribe. A synthetic report example can show how the result and limitations are presented without implying a real customer engagement.

Classify the outcome precisely: confirmed bounded impact, fixed for the tested relations, not reproduced with stated evidence, or verification blocked. A missing event does not disprove a weakness when the channel or publisher was unavailable. A passing retest does not promise that every message family is safe. It shows that the named build satisfied the agreed matrix under the recorded conditions.

PENTEST.RED

Discuss pentest scope and pricing

We start by agreeing on systems, access, constraints and the expected evidence.

Prepare your testing scope

Based on in-depth research, edited for clarity and practical use.

PENTEST.RED / RED JOURNAL