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

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

相关推荐
星哥说事2 小时前
网络安全设备:入侵检测系统(IDS)、入侵防御系统(IPS)的配置与使用
网络·安全·web安全
这儿有一堆花12 小时前
一次渗透测试的全过程:从扫描到提权
web安全·网络安全·web
风语者日志13 小时前
CTFSHOW—WEB4
网络·安全·web安全·网络安全·ctf
Andya_net1 天前
网络安全 | 深入了解 X.509 证书及其应用
服务器·安全·web安全
Andya_net2 天前
网络安全 | SSL/TLS 证书文件格式详解:PEM、CRT、CER、DER、PKI、PKCS12
安全·web安全·ssl
jieyu11192 天前
uploads-labs靶场通关(1)
web安全·文件上传漏洞·靶场通关
竹等寒2 天前
Linux-网络安全私房菜(二)
linux·服务器·web安全
white-persist2 天前
CSRF 漏洞全解析:从原理到实战
网络·python·安全·web安全·网络安全·系统安全·csrf
渗透测试老鸟-九青2 天前
网络安全之揭秘APT Discord C2 以及如何取证
安全·web安全·网络安全学习路线
key062 天前
大模型在网络安全领域的应用与评测
网络·人工智能·web安全