Advisory

GHSA-f772-66g8-q5h3

Also known as: CVE-2022-35948

Summary

Nodejs ‘undici’ vulnerable to CRLF Injection via Content-Type

Details

Impact

=< [email protected] users are vulnerable to _CRLF Injection_ on headers when using unsanitized input as request headers, more specifically, inside the content-type header.

Example:

import { request } from 'undici'

const unsanitizedContentTypeInput =  'application/json\r\n\r\nGET /foo2 HTTP/1.1'

await request('http://localhost:3000, {
    method: 'GET',
    headers: {
      'content-type': unsanitizedContentTypeInput
    },
})

The above snippet will perform two requests in a single request API call:

  1. http://localhost:3000/
  2. http://localhost:3000/foo2

Patches

This issue was patched in Undici v5.8.1

Workarounds

Sanitize input when sending content-type headers using user input.

For more information
If you have any questions or comments about this advisory:

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2022-08-18 19:02 UTC
Modified
2023-11-08 04:09 UTC

Affected packages and fixes

undici

npm · All systems

Affected

  • introduced 0, fixed 5.8.2 (semver)

Fixed versions

5.8.2

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences