JavaScript-based Redirect
This lab demonstrates open redirect vulnerabilities that occur when JavaScript is used for redirects without proper validation of the target URL.
Objective: Test JavaScript-based redirects and understand how client-side redirects can be exploited.
$redirect_url = $_GET['url'] ?? '';
$delay = $_GET['delay'] ?? 3;
// Vulnerable: No validation of the redirect URL
// JavaScript will execute:
// setTimeout(function() {
// window.location = "$redirect_url";
// }, $delay * 1000);
url, delayTry these URLs to test the vulnerability:
?url=https://evil.com&delay=1?url=//evil.com&delay=2?url=javascript:alert('XSS')&delay=1?url=data:text/html,&delay=1?url=ftp://evil.com&delay=3?url=file:///etc/passwd&delay=2