`bodyLimit()` keeps every transfer chunk of a request body in memory, allowing memory exhaustion with tiny chunks.
Does it affect you?
Not extractedThe conditions could not be extracted from the source.
Since 4.12.16, bodyLimit() reads the whole request body before the handler runs so that the limit also applies to chunked requests. It kept every chunk delivered by the runtime as a separate array and later replayed them. A client that sends the body in very small transfer chunks makes the middleware retain millions of small arrays for a body that is within the configured limit. The memory used is many times the body size, and the process can be terminated before the handler runs. The size check counted the payload bytes correctly, so the configured maxSize was respected. The problem is the…
Timeline
11 Nov- Published by the maintainer in honojs/hono11 Nov, 08:54 UTC
- Seen by Patchwire +15 min11 Nov, 09:09 UTC
- Not in the GitHub database 18 days later29 Nov, 19:15 UTC
Versions of hono
Related alerts(8)
Same packages- The application runs on Bun.
- A reverse proxy that restricts access by path passes a request without a usable Host header to the application.
- Affected
- hono <4.13.23 · hono >=5.0.0-rc.0 <=5.0.0-rc.1
- Fixed in
- after 5.0.0-rc.1 · 4.13.23
- ID
- GHSA-mhwf-w6q6-q58w
- TrieRouter is in use.
- The application accepts arbitrary method names, for example with HTTP/2 on Node.js or with hono/method-override.
- Affected
- hono >=4.8.0 <4.13.23 · hono >=3.11.7 <4.1.2 · hono >=5.0.0-rc.0 <=5.0.0-rc.1
- Fixed in
- after 5.0.0-rc.1 · 4.13.23 · 4.1.2
- ID
- GHSA-656w-x92q-369m
- Applications use except() with an alternation in a constrained parameter.
- A wider route handles the same paths.
- Affected
- hono >=4.5.0 <4.13.23 · hono >=5.0.0-rc.0 <=5.0.0-rc.1
- Fixed in
- after 5.0.0-rc.1 · 4.13.23
- ID
- GHSA-586x-c76g-h528
- Hono version is 4.13.16 or 4.13.17.
- Application uses mount() or app.mount().
- Application uses a custom getPath that prepends a prefix to the routed path (e.g., host name for host-based routing).
- Application relies on middleware registered on a sub-path inside the mount prefix for authentication or authorization.
- Affected
- hono >=4.13.16 <=4.13.17
- Fixed in
- 4.13.18
- ID
- GHSA-h25j-2p75-qj33
- Application uses Hono's validator('json') or validator('form') middleware.
- The application relies on that validator to reject or restrict request fields (allow-list or required-field checks).
- The validation callback does not fail when given an empty object.
- The route handler reads the request body directly via c.req.json() or c.req.parseBody().
- Affected
- hono >=4.5.1 <=4.13.17
- Fixed in
- 4.13.18
- ID
- GHSA-92p4-j3wq-jmqx
- Uses Hono's serveStatic to serve a directory.
- serveStatic is configured with allowPercentInPath: true.
- Middleware (e.g., an authentication check) is mounted on a prefix that covers part of the directory served by serveStatic.
- Affected
- hono >=4.13.11 <=4.13.17
- Fixed in
- 4.13.18
- ID
- GHSA-74fm-fwc7-3fwp
- Application relies on the csrf() middleware as its CSRF protection.
- Application exposes state-changing POST endpoints whose effect does not depend on the request body (selected by path or query string).
- Session cookie is sent cross-site: set with SameSite=None, or the attacker controls a same-site origin (cookie not SameSite=Strict).
- Victim uses Chrome or Edge (hyperlink auditing enabled) while logged in.
- Affected
- hono <4.13.16
- Fixed in
- 4.13.16
- ID
- GHSA-46wx-v44x-9hh2
- Application uses Hono's validator('form') middleware.
- Application accepts multipart/form-data requests on routes guarded by validator('form').
- The validator('form') callback does not fail when given an empty object.
- Application relies on validator('form') to reject, restrict, or require form fields.
- The handler reads submitted fields via c.req.parseBody() or c.req.formData().
- Affected
- hono >=4.5.1 <=4.13.15
- Fixed in
- 4.13.16
- ID
- GHSA-4h7h-rv7c-7m2v