مستغلة: 178
الأحدثCVE-2022-29966 — ثغرة غياب المصادقة للوظائف الحرجة في منتج Emerson Ovation
VulnFeed.org
AREN
7.5
CVE-2026-119202يتوفر تصحيح

ثغرة عالية الخطورة في @hapi/content

@hapi/contentقراءة 2 داقرأ بلغة

الملخص

### Summary `Content.disposition()` takes quadratic time when a `Content-Disposition` parameter contains a long token without `=`. One unauthenticated multipart request can block the Node.js event loop for several minutes. ### Details `Content.disposition()` reads the parameters with a global regular expression in `String.prototype.replace()`: ```js /([^\=\*\s]+)(\*)?\s*\=\s*(?:([^;'"\s]+\'[\w-]*\'[^;\s]+)|(?:\"([^"]*)\")|([^;\s]*))/g ``` The parameter name part `([^\=\*\s]+)` has no anchor. When a run of name characters has no `=` after it, the match attempt reads the full run and fails. The global scan then starts again at the next character and reads the remaining run again. The total time is proportional to the square of the run length. `@hapi/pez` calls `Content.disposition()` on the header of every part in a `multipart/form-data` body. In hapi, this occurs on each route with `payload.multipart` enabled, before the route handler and before any validation. The only size limit is the route `payload.maxBytes`, which is 1 MB by default. The fix adds an alternative that matches the full run of name characters when no `=` follows it. The scan then continues after the run, and the callback ignores this match. A match attempt that starts later in the same run always fails in the same way, so the parse result does not change. The parse time is now linear. ```js /([^\=\*\s]+)(\*)?\s*\=\s*(?:([^;'"\s]+\'[\w-]*\'[^;\s]+)|(?:\"([^"]*)\")|([^;\s]*))|[^\=\*\s]+/g ``` Every release from `3.0.6` (published as `content`) up to and including `@hapi/content` `6.0.2` is affected. Workarounds: none that removes the risk, upgrade required. To reduce the delay for each request until you upgrade, set a low `payload.maxBytes` on routes that accept multipart payloads. A token of 64 KB still blocks the process for more than 1 second. ### Proof of concept Install `@hapi/hapi` with `@hapi/content` `6.0.2`, then run: ```js const Hapi = require('@hapi/hapi'); const Net = require('net'); cons…

المعالجة

المراجع

Esc