Koa open redirect via Referrer header

Severity: low · CVSS 3.1 · Published 2025-07-25

Koa is a popular Node.js web framework used to build web applications and APIs. A vulnerability in Koa's redirect functionality allows an attacker to redirect users to arbitrary external websites by crafting a request with a malicious Referrer header. An attacker could exploit this to conduct phishing attacks, credential theft, or spread malware by tricking users into visiting attacker-controlled sites.

Technologies: Koajs Koa. Vendors: Koajs.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Low severity, with a CVSS score of 3.1, published 25 July 2025.
Which products and versions are affected?
Koajs Koa up to 3.0.0.
Is there a fix for This vulnerability?
A patch was published on 2025: Fixed in version 3.0.1 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run Koajs Koa at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

The vulnerability is an open redirect (CWE-601) in the `back()` method of Koa's HTTP response handler (lib/response.js). The method uses the user-controlled Referrer header to determine the redirect target without validation, allowing an attacker to specify an arbitrary URL. The attack is network-accessible and requires minimal preconditions: an attacker sends a request with a malicious Referrer header to a route using `ctx.redirect('back')`. The vulnerability affects Koa versions up to 3.0.0 and is fixed in version 3.0.1.

Affected products

  • KoaJS Koa up to 3.0.0

Timeline

  • 2025-07-08: disclosed
  • 2025-07-25: advisory
  • 2025-07-29: other: Advisory withdrawn as duplicate of GHSA-jgmv-j7ww-jx2x
  • 2025: patched: Fixed in version 3.0.1

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.