jf0x3f

$ cat writeup.md / 2026.11.12

Laravel Reverb's max_connections limit bypass allows unauthenticated connection exhaustion

Client devices connected by WebSocket lines to a central Laravel Reverb server, beside channel tracking and connection quota panels
WebSocket clients connect to Reverb, while its channel tracking and connection quota can count different sets of sockets.

Original reporter · Laravel Reverb v1.11.1 · CWE-770 · GHSA-jg2j-vmc9-5m2p

I reported that Laravel Reverb's configured connection limit did not account for every open socket. At the affected v1.11.1 revision, sockets that had not joined a channel were missing from the quota count. I also found that a socket rejected for exceeding the limit stayed connected after receiving an error.

Think of a venue with a maximum occupancy sign. The head count tracks only guests who have entered a room, so people still in the lobby do not count. And when the venue is full, the guard tells the next guest “no entry” but leaves the gate open, so they walk in anyway. Reverb had both gaps: it missed sockets before subscription and left some rejected sockets connected.

This is my writeup of the issue I reported as GHSA-jg2j-vmc9-5m2p. I validated the behavior at the reported affected revision. Public upstream pull requests later documented the same behaviors: PR #419 added termination for rejected sockets, and PR #422 added tracking for open sockets before they subscribe. Both fixes shipped in v1.14.0.

An attacker needs only the public application key and network access to /app/{appKey}. No user account, application secret, channel authorization token, or victim interaction is required. The attacker can hold over-limit WebSockets open until a reverse proxy, operating-system file-descriptor limit, event-loop limit, or process memory limit is reached.

At a glance

PropertyResult
Affected revision testedv1.11.1
Configuration requiredA finite per-app max_connections limit
Actor conditionsNetwork access to the WebSocket endpoint, the app's client key, and an origin accepted by that app's configuration
Observed behaviorUnsubscribed sockets were not counted; over-limit sockets received an error but stayed active at the affected revision
Patched Version>=1.14.0

What the limit is supposed to protect

REVERB_APP_MAX_CONNECTIONS configures an app-level connection cap. The expected invariant is simple: every open socket for that app should count toward the cap, whether it has subscribed to a channel yet or not. A socket rejected during admission should also be closed, so it cannot continue using the service after receiving a quota error.

Where the accounting went wrong

In the pinned Server.php, open() calls ensureWithinConnectionLimit(). That check asks the channel manager for its connections and compares the result to the configured maximum.

The quota decision counts the result of ChannelManager::connections():

// Server.php — ensureWithinConnectionLimit()
$connections = $this->channels->for($connection->app())->connections();

if (count($connections) >= $connection->app()->maxConnections()) {
    throw new ConnectionLimitExceeded;
}

The array channel manager builds its connection list by walking channel subscriptions. A socket with no subscriptions is therefore absent from the count. With max_connections=1, the local proof opened two sample sockets without subscribing either one; both were accepted and the manager still reported zero counted connections.

// ArrayChannelManager.php — connections()
$channels = Arr::wrap($this->channels($channel));
$result = [];

foreach ($channels as $ch) {
    foreach ($ch->connections() as $identifier => $connection) {
        if (! isset($result[$identifier]) ||
            ($result[$identifier]->data('user_id') === null && $connection->data('user_id') !== null)) {
            $result[$identifier] = $connection;
        }
    }
}

return $result;

This is a bookkeeping mismatch: the server has open sockets, but the quota check sees only the subset represented by channel membership. Laravel Reverb addressed the same gap in connection counting, pinging, pruning, and graceful shutdown with a registry that tracks a connection from open through close.

Why a rejected socket remained usable

When open() catches a quota exception, it calls error(). For a Pusher exception, error() sends the protocol error and returns. At v1.11.1, that path did not terminate the socket. The local proof confirmed that the sample connection received “Application is over connection quota,” was not marked terminated, and could still subscribe to a channel.

// Server.php — open()
try {
    $this->ensureWithinConnectionLimit($connection);
    $this->verifyOrigin($connection);
    $connection->touch();
    $this->handler->handle($connection, 'pusher:connection_established');
} catch (Exception $e) {
    $this->error($connection, $e);
}

// Server.php — error()
if ($exception instanceof PusherException) {
    $connection->send(json_encode($exception->payload()));
    return;
}

The reproduction output was:

observed: max_connections=1; two unsubscribed sockets accepted; counted channel connections=0
observed: over-limit socket got quota error, stayed active, subscribed; counted channel connections=2
2 passed (7 assertions)

The proof used the pinned first-party Server and channel manager with Reverb's FakeConnection test class. It did not open real network sockets, attempt to exhaust resources, or contact a running Reverb service. The result establishes the logic error; it does not measure a production outage or quantify resource consumption.

The Proof of Concept

This PoC exercises the affected v1.11.1 source. In a checkout with development dependencies installed, save it as tests/Unit/Protocols/Pusher/ConnectionLimitBypassPocTest.php and run vendor/bin/pest tests/Unit/Protocols/Pusher/ConnectionLimitBypassPocTest.php.

<?php

use Laravel\Reverb\Protocols\Pusher\Server;
use Laravel\Reverb\Tests\FakeConnection;

beforeEach(function () {
    $this->server = $this->app->make(Server::class);
});

it('reproduces an unsubscribed connection count bypass', function () {
    $this->app['config']->set('reverb.apps.apps.0.max_connections', 1);

    $this->server->open($first = new FakeConnection('sample-unsubscribed-1'));
    $this->server->open($second = new FakeConnection('sample-unsubscribed-2'));

    expect($first->messages[0])->toContain('connection_established');
    expect($second->messages[0])->toContain('connection_established');
    expect(channels()->connections())->toHaveCount(0);

    echo "observed: max_connections=1; two unsubscribed sockets accepted; counted channel connections=0\n";
});

it('reproduces a rejected socket remaining live and able to subscribe', function () {
    $this->app['config']->set('reverb.apps.apps.0.max_connections', 1);
    $this->server->open($first = new FakeConnection('sample-subscribed'));
    $this->server->message($first, json_encode([
        'event' => 'pusher:subscribe',
        'data' => ['channel' => 'sample-channel-1'],
    ]));

    $this->server->open($rejected = new FakeConnection('sample-rejected'));
    expect($rejected->messages[0])->toContain('Application is over connection quota');
    expect($rejected->wasTerminated)->toBeFalse();

    $this->server->message($rejected, json_encode([
        'event' => 'pusher:subscribe',
        'data' => ['channel' => 'sample-channel-2'],
    ]));

    expect($rejected->wasTerminated)->toBeFalse();
    expect(channels()->connections())->toHaveCount(2);

    echo "observed: over-limit socket got quota error, stayed active, subscribed; counted channel connections=2\n";
});

Upstream response and current status

To verify the first upstream change, I ran the sample test against the main snapshot at 55e3e539ad6662cb7f727eebd48ac06f45223347. The unsubscribed-socket case still passed. The rejected-socket case failed its “remains active” assertion because the connection was now terminated. That was a check of the intermediate snapshot before PR #422 merged, not a test of the final v1.14.0 release.

Impact and limits

For a deployment that relies on max_connections as an availability control, an unauthenticated client able to reach the endpoint can open sockets that the quota does not count before channel subscription. The app key identifies the application; the attack still depends on the endpoint and an accepted origin policy.

References

Timeline

I reported the issue as GHSA-jg2j-vmc9-5m2p. The published advisory lists versions before 1.14.0 as affected and 1.14.0 and later as patched.

  • August 11, 2026: Reverb v1.11.1 was released. This is the affected revision I later tested.
  • October 9, 2026: I filed GHSA-jg2j-vmc9-5m2p and was credited as its reporter.
  • November 10, 2026: Reverb v1.13.0 was released before the two upstream fixes.
  • November 11, 2026: Laravel accepted my report. On the same day, PR #422 was opened to track open sockets independently of channel subscriptions, while PR #419 merged to close sockets rejected during open.
  • November 12, 2026: I validated the issue against v1.11.1 and compared it with an intermediate upstream main snapshot. PR #422 merged later that day.
  • November 17, 2026: Reverb v1.14.0 was released with both fixes.
  • November 18, 2026: GHSA-jg2j-vmc9-5m2p was published.