DVWA-Open HTTP Redirect

重定向漏洞

Low

点击Quote 1,burp抓包到

发现redirect传递参数,观察后端代码。

页面重定向到redirect传进来的参数,并且没有做任何过滤,可以通过修改redirect,将页面重定向到任何页面。

GET /vulnerabilities/open_redirect/source/low.php?redirect=https://www.baidu.com HTTP/1.1将页面重定向到https://www.baidu.com

php 复制代码
<?php

if (array_key_exists ("redirect", $_GET) && $_GET['redirect'] != "") {
	header ("location: " . $_GET['redirect']);
	exit;
}

http_response_code (500);
?>
<p>Missing redirect target.</p>
<?php
exit;
?>

Medium

观察后端代码,发现后端对redirect进行了过滤,如果以http://或者https://开头则返回500响应码,并终止运行。

php 复制代码
<?php

if (array_key_exists ("redirect", $_GET) && $_GET['redirect'] != "") {
	if (preg_match ("/http:\/\/|https:\/\//i", $_GET['redirect'])) {
		http_response_code (500);
		?>
		<p>Absolute URLs not allowed.</p>
		<?php
		exit;
	} else {
		header ("location: " . $_GET['redirect']);
		exit;
	}
}

http_response_code (500);
?>
<p>Missing redirect target.</p>
<?php
exit;
?>

High

观察后端代码,检测redirect参数中是否包含info.php,包含的话才重定向。只能重定向到info.php页面。

php 复制代码
<?php

if (array_key_exists ("redirect", $_GET) && $_GET['redirect'] != "") {
	if (strpos($_GET['redirect'], "info.php") !== false) {
		header ("location: " . $_GET['redirect']);
		exit;
	} else {
		http_response_code (500);
		?>
		<p>You can only redirect to the info page.</p>
		<?php
		exit;
	}
}

http_response_code (500);
?>
<p>Missing redirect target.</p>
<?php
exit;
?>

Impossible

观察后端代码,重定向到指定页面,无法修改。

相关推荐
pandarking1 小时前
[CTF]攻防世界:fakebook (sql注入)
数据库·sql·web安全·网络安全
重生之我在番茄自学网安拯救世界2 小时前
网络安全中级阶段学习笔记(七):Web 安全之文件上传漏洞笔记1(包含upload-labs-master靶场前三关实战)
笔记·学习·web安全·文件上传漏洞·网安基础
liebe1*12 小时前
第十四章 网络安全方案设计
安全·web安全
wanhengidc18 小时前
云手机 数据网络安全防护
安全·web安全
网络研究院1 天前
2026年智能体人工智能的激增引发新的网络安全风险
网络·人工智能·安全·web安全·ai
编程乐学(Arfan开发工程师)1 天前
渗透测试基础详解:通往 CISP-PTE 的第一步
网络·安全·web安全
pandarking1 天前
[CTF]攻防世界:easy_laravel 学习
java·学习·web安全·laravel·ctf
lubiii_1 天前
网络安全需掌握的专业术语解析
安全·web安全·网络安全
计算机毕设指导61 天前
基于微信小程序的网络安全知识科普平台系统【源码文末联系】
java·spring boot·安全·web安全·微信小程序·小程序·tomcat