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.
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.
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
- Run the package as middleware and start a server on the local port.
- Visit a path that begins with several slashes followed by an external domain and a trailing slash.
- 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.