An attacker can use unvalidated redirected links as a medium to redirect user to malicious contents and tricks victims into clicking it. Attacker can exploit it to bypass security checks and make it believe trustworthy.
For example, the "Learning Resources" link (
/learn?url=...
) in the application redirects to another website without validating the url.
Here is code from
routes/index.js
,
// Handle redirect for learning resources link app.get("/learn", function (req, res, next) { return res.redirect(req.query.url); });An attacker can change the
url
query parameter to point to malicious website and share it. Victims are more likely to click on it, as the initial part of the link (before query parameters) points to a trusted site.
Safe use of redirects and forwards can be done in a number of ways: