Skip to content
Open redirect Advisory Beginner CVE-2021-3189

GHSL-2020-199: Open redirect vulnerability in Slashify - CVE-2021-3189

The Slashify Express middleware strips a trailing slash and redirects to the resulting path without validating it, so a path beginning with two slashes or similar can send the browser to another domain. An attacker could use this to redirect users to a site they control.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

The package is an Express middleware that normalises routes by stripping any final slash, redirecting, for example, bookings/latest/ to bookings/latest. However, it does not validate the path it redirects to in any way.

ghsecuritylab, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the middleware builds the redirect target directly from the request path and does not check that it stays on the same site.

Impact

An attacker could craft a link that redirects a victim to a different domain, which may be used for phishing.

What the attacker needed

Victim clicks a crafted link; site uses the slashify middleware

The fix

The affected projects fixed it by changing how the middleware handles slashes; the package itself should validate that the redirect target stays on the same site.

How it was found

  1. Run the package as middleware and start a server on the local port.
  2. Visit a path that begins with several slashes followed by an external domain and a trailing slash.
  3. Observe the browser being redirected to that external domain.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A redirect is when a website tells your browser to go to a different address. This small add-on for a web framework took the address from the request and redirected to it without checking it, so a crafted link could send people to an attacker's site instead of the real one.

What is Open redirect?

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.

More by ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.