<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
<div class="vulnerable_code_area">
		<em><a href="?page=file1.php">file1.php</a></em>
		<em><a href="?page=file2.php">file2.php</a></em>
		<em><a href="?page=file3.php">file3.php</a></em>
</div>
</body>
</html>

<?php
$file = $_GET['page'];
if(isset($file)){
	include($file);
}
?>

medium

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
<div class="vulnerable_code_area">
		<em><a href="?page=file1.php">file1.php</a></em>
		<em><a href="?page=file2.php">file2.php</a></em>
		<em><a href="?page=file3.php">file3.php</a></em>
</div>
</body>
</html>
<?php
$file = $_GET['page'];
$file = str_replace(array("https://","http://"), "", $file);
$file = str_replace(array("../","./"), "", $file);
echo $file;
if(isset($file)){
	include($file);
}
?>

high

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
<div class="vulnerable_code_area">
		<em><a href="?page=file1.php">file1.php</a></em>
		<em><a href="?page=file2.php">file2.php</a></em>
		<em><a href="?page=file3.php">file3.php</a></em>
</div>
</body>
</html>
<?php
$file = $_GET['page'];
if(!(fnmatch("file*", $file)) && $file !="include.php"){
	echo "ERROR file not found!";
}else{
	include($file);
}
?>

PHP知识点

fnmatch() 函数根据指定的模式来匹配文件名或字符串。

相关文章:

  • 2021-06-20
  • 2021-12-09
  • 2022-12-23
  • 2021-12-07
  • 2021-12-05
  • 2021-04-02
  • 2021-06-03
  • 2022-12-23
猜你喜欢
  • 2021-07-12
  • 2021-09-24
  • 2021-09-11
  • 2022-02-14
  • 2021-06-19
  • 2021-07-11
  • 2022-12-23
相关资源
相似解决方案