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

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

相关推荐
zl0_00_02 小时前
rce漏洞学习
学习·安全·web安全
ALe要立志成为web糕手2 小时前
数据库脱裤
数据库·windows·mysql·web安全·网络安全·adb·mssql
暴躁的小胡!!!3 小时前
2025年最新Web安全(面试题)
网络·安全·web安全
Fanche40410 小时前
SQL 语句基础(增删改查)
运维·数据库·sql·mysql·web安全·oracle
it技术分享just_free21 小时前
软考教材重点内容 信息安全工程师 第22章 网站安全需求分析与安全保护工程
web安全·网络安全·信息安全·系统安全·软考
ICT系统集成阿祥1 天前
100 个网络安全基础知识
安全·web安全
Lovely_181 天前
DDoS(分布式拒绝服务)攻击
web安全
计算机鬼才~1 天前
网络安全·第四天·扫描工具Nmap的运用
网络·tcp/ip·安全·web安全·nmap
事业运财运爆棚1 天前
ssh 三级跳
服务器·web安全·ssh
virelin_Y.lin1 天前
系统与网络安全------网络通信原理(5)
网络·安全·web安全·udp·tcp·传输层