Hongdam หงส์ดำLINE

Security · · 4 minutes to read

ws ping flood: 1.3 GB in eight seconds; ethers and socket.io-client still pin old ws

ช่องโหว่ ping ท่วมใน ws: หน่วยความจำพุ่ง 1.3 GB ในแปดวินาทีบน 8.22.2 ขณะที่ ethers และ socket.io-client ยังล็อกเวอร์ชันเก่า

GitHub published the ws advisory on 1 December. In our test a flood of pings took an unpatched server from 53 MB to 1.3 GB in eight seconds. Three popular packages still install an older ws; one line in package.json fixes it.

GitHub published GHSA-37g9-w4hg-h9qr (CVE-2026-140009) for ws on 1 December 2026 1. ws is the WebSocket library most Node.js code uses; a WebSocket is the long-lived connection behind chat boxes, live dashboards and game lobbies. The flaw: one side of a connection sends ping after ping and stops reading. The other side answers each ping with a pong automatically, the pongs cannot go out, and they pile up in memory until the process dies 1. Versions before 8.23.0 on the 8.x line are affected, with fixes backported as 7.5.14, 6.2.7 and 5.2.8 1. The fix shipped on 12 November 2, nineteen days before the advisory, so npm audit started reporting it only this week.

An unpatched server reached 1.3 GB in eight seconds

We ran the advisory's proof of concept 1 as two processes on one laptop, Node.js 24.7.0: a ws server, and an attacker that connects, pauses reading and sends 125-byte pings as fast as it can. We logged the server's memory each second. Five runs per version, measured 2 December 2026.

Server memory after an eight-second ping flood · lower is better
ws 8.22.2 (unpatched)1,284 MB
ws 8.23.1 (patched)57 MB
Median peak resident memory, measured 2 December 2026. 8.22.2: 4 valid runs of 5 (one attacker failed to connect); 8.23.1: 5 runs. Idle server: 53 MB.
VersionPeak memory per run (MB)Pings sentWhat happened
8.22.21,075 · 1,137 · 1,430 · 1,4691.8 to 2.5 millionmemory climbed 146 to 177 MB a second on average
8.23.154 · 57 · 57 · 58 · 58207 to 253server closed the connection (code 1006) within the first second

In five earlier runs of up to 20 seconds, the unpatched server passed 1.5 GB after 9, 10, 13 and 15 seconds; in the fifth the attacker's connection dropped at 12 seconds with the server at 1,267 MB. At those rates a server with 1 GB of memory runs out in about six seconds.

The fix adds a cap, maxPendingAutoPongs, on pongs waiting to go out. Its default is 60, and past it ws closes the connection 3.

Who is exposed

  • A Node.js server that accepts WebSocket connections through ws, directly or through socket.io: anyone who can open the socket can send the flood, before logging in if your code checks identity after the connection opens.
  • A Node.js process that connects out through ws: a bot, a price feed, a blockchain provider over WebSocket. Here the far end is the attacker, so the risk is a compromised or hostile server you connect to.
  • Code in a browser: not affected. Browsers use their own WebSocket, not ws.

Three packages still install an older ws

We read the ws range in the newest version of each package on npm on 2 December 2026, then installed four of them in an empty project and ran npm ls ws. A caret range (^8.20.0) accepts 8.23 on a fresh install or an npm update; a tilde range (~8.21.0) or an exact version does not.

Package (newest version)ws it asks forGets the fix by updating?
engine.io 6.6.13, socket.io's server^8.23.0yes
puppeteer-core 25.19.0^8.23.0yes
@google/genai 3.6.1^8.21.0yes (installed 8.23.1)
webpack-dev-server 6.1.0^8.20.0yes
engine.io-client 6.6.8, inside socket.io-client~8.21.0no (installed 8.21.3)
ethers 6.17.08.21.0 exactlyno (installed 8.21.0)
wrangler 4.170.0, through miniflare8.21.0 exactlyno; local development server only

socket.io's source already asks for ^8.23.0 in engine.io-client, but no release carries it yet; an issue asking for one opened on 1 December 4. @supabase/realtime-js, the live-updates part of supabase-js, has listed no ws dependency since 2.106.0 in May 2026; 2.105.x and older ask for ^8.18.2, which an update moves to 8.23 5.

The fix: one override

Find every copy:

npm ls ws --all

Then force one version across the whole tree. npm reads an overrides block in package.json 6:

{
  "overrides": {
    "ws": "^8.23.1"
  }
}

Run npm install again. In our test project, with ethers, socket.io-client, puppeteer-core and @google/genai, npm audit went from 4 high findings to 0, and npm ls ws showed a single 8.23.1. pnpm reads the same block under pnpm.overrides, Yarn under resolutions; we tested npm only. Projects still on the 7.x line take ^7.5.14 instead.

If you cannot upgrade today, the advisory names two stopgaps: rate limiting combined with heartbeats, or the autoPong: false option where your version has it 1.

Sources

  1. ws: Memory exhaustion DoS via unbounded automatic pong responses · GHSA-37g9-w4hg-h9qr github.com
  2. Release 8.23.0 · websockets/ws github.com
  3. [security] Limit automatically sent pending pongs · websockets/ws@ace7248 github.com
  4. [engine.io-client] Missing release for ws security issue. · Issue #5654 · socketio/socket.io github.com
  5. @supabase/realtime-js - npm npmjs.com
  6. package.json | npm Docs: overrides docs.npmjs.com

Hongdam Studio services on this topic