Web Security Series: Open Redirect Vulnerabilities
Web Development Tutorials
0:00 / 0:00
Web Security Series: Open Redirect Vulnerabilities
4 просмотра · 7 дней назад
Web Development Tutorials
117 подписчиков
4 просмотра · 7 дней назад
A real, trusted URL genuinely redirecting somewhere it shouldn't -- let's see the real fix.
Code walkthrough (javascript):
app.get('/goto', (req, res) =› {
res.redirect(req.query.url);
});
GET /goto?url=http://real-attacker-site.example
const allowed = ['/dashboard', '/profile', '/settings'];
if (!allowed.includes(req.query.url)) {
return res.status(400).end('Real: invalid redirect target');
}
// Real result: the untrusted external target
// genuinely gets rejected now
What it looks like: ❌ Real redirect target genuinely unchecked -- any real external URL accepted → ✅ Real allowlist genuinely rejects any target outside a known, real, internal set
Try it yourself: Find one real redirect endpoint on your site and check if its target is genuinely validated.
#websecurity #cybersecurity #webdev #javascript #coding #tutorial