Miggo Logo

CVE-2025-62595: Koa Vulnerable to Open Redirect via Trailing Double-Slash (//) in back Redirect Logic

4.7

CVSS Score
3.1

Basic Information

EPSS Score
-
Published
10/21/2025
Updated
10/21/2025
KEV Status
No
Technology
TechnologyJavaScript

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
koanpm>= 3.0.1, < 3.0.33.0.3
koanpm>= 2.16.2, < 2.16.32.16.3

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability analysis began by examining the provided commit 769fd75cc6b30d72493b370b5a3ae2332ca03c5b, which was identified as the patch for the open redirect issue in Koa. The commit modified lib/response.js. The key change was the removal of a code block within the back function. This removed block checked if the Referrer header started with / and, if so, performed a redirect, assuming it was a safe relative path. The vulnerability description and the test case added in __tests__/response/back.test.js confirm that this logic was flawed because protocol-relative URLs (e.g., //evil.com) also start with / but are interpreted by browsers as external URLs. By removing this check, the patch ensures that all referrer URLs are properly parsed and their origin is validated against the application's host, thus closing the open redirect vulnerability. The vulnerable function is therefore back in lib/response.js, as it contained the logic that processed the malicious Referrer header and triggered the unsafe redirect.

Vulnerable functions

back
lib/response.js
The `back` function in `lib/response.js` was vulnerable to an open redirect. The code checked if the `Referrer` header started with a `/` to determine if it was a relative path. However, it did not account for protocol-relative URLs like `//evil.com`, which also start with `/`. An attacker could provide a crafted `Referrer` header like `//evil.com`, which the application would treat as a safe relative path and redirect the user to it. Browsers interpret a `Location` header of `//evil.com` as a redirect to `https://evil.com`, leading to the open redirect.

WAF Protection Rules

WAF Rule

### Summ*ry: * *yp*ss w*s *is*ov*r** in t** `Ko*.js` *r*m*work *****tin* its ***k r**ir**t *un*tion*lity. In **rt*in *ir*umst*n**s, *n *tt**k*r **n m*nipul*t* t** R***r*r *****r to *or** * us*r’s *rows*r to n*vi**t* to *n *xt*rn*l, pot*nti*lly m*li*

Reasoning

T** vuln*r**ility *n*lysis ****n *y *x*minin* t** provi*** *ommit `****************************************`, w*i** w*s i**nti*i** *s t** p*t** *or t** op*n r**ir**t issu* in Ko*. T** *ommit mo*i*i** `li*/r*spons*.js`. T** k*y ***n** w*s t** r*mov*l