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

网站建设一条龙服务手机登录百度pc端入口

网站建设一条龙服务,手机登录百度pc端入口,网站正在建设中末班,百度安装app打开靶机&#xff0c;进入界面&#xff1a; 信息搜集 当前界面没有任何有用信息。 想到查看页面源代码。右键–查看页面源代码 看到hint&#xff1a;<!--source.php--> 进入/source.php页面&#xff0c;看到页面源代码&#xff1a; <?phphighlight_file(__FILE_…

打开靶机,进入界面:
在这里插入图片描述

信息搜集

当前界面没有任何有用信息。
想到查看页面源代码。右键–查看页面源代码
在这里插入图片描述
看到hint:<!--source.php-->

进入/source.php页面,看到页面源代码:

 <?phphighlight_file(__FILE__);class emmm{public static function checkFile(&$page){$whitelist = ["source"=>"source.php","hint"=>"hint.php"];if (! isset($page) || !is_string($page)) {echo "you can't see it";return false;}if (in_array($page, $whitelist)) {return true;}$_page = mb_substr($page,0,mb_strpos($page . '?', '?'));if (in_array($_page, $whitelist)) {return true;}$_page = urldecode($page);$_page = mb_substr($_page,0,mb_strpos($_page . '?', '?'));if (in_array($_page, $whitelist)) {return true;}echo "you can't see it";return false;}}if (! empty($_REQUEST['file'])&& is_string($_REQUEST['file'])&& emmm::checkFile($_REQUEST['file'])) {include $_REQUEST['file'];exit;} else {echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";}  
?> 

解题步骤

创建了一个类emmm,先不管,先看看后面真正被执行的代码:

if (! empty($_REQUEST['file'])&& is_string($_REQUEST['file'])&& emmm::checkFile($_REQUEST['file'])) {include $_REQUEST['file'];exit;} else {echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";}  

是一个条件判断语句。分析一下:

empty() 检查变量是否为空
is_string() 检查变量是否为字符串
emmm::checkFile() 调用emmm类中的checkFile方法
$_REQUEST[‘file’] 获取GET或POST传参的数据,参数为file

所以这里的判断就是:
当传入的变量file不为空 是字符串 checkFile()结果为true时,返回值为true.在当前界面包含file指向的文件。
那么关键就在于让 checkFile()结果为true。所以我们审计一下该方法:

 public static function checkFile(&$page){$whitelist = ["source"=>"source.php","hint"=>"hint.php"];if (! isset($page) || !is_string($page)) {echo "you can't see it";return false;}if (in_array($page, $whitelist)) {return true;}$_page = mb_substr($page,0,mb_strpos($page . '?', '?'));if (in_array($_page, $whitelist)) {return true;}$_page = urldecode($page);$_page = mb_substr($_page,0,mb_strpos($_page . '?', '?'));if (in_array($_page, $whitelist)) {return true;}echo "you can't see it";return false;}

第一处:
! isset($page) || !is_string($page) isset()判断传入的参数page(方法中的page就是我们传入的参数file)是否已设置并且非空;is_string()判断参数是否为字符串。当两者同时为true时,进入下一处条件判断。
第二处:
in_array($page, $whitelist) in_array()判断参数page是否位于whitelist数组中.
由于$whitelist = ["source"=>"source.php","hint"=>"hint.php"];所以合法的值只有source.php和hint.php。
现在我们所在的界面是source.php,所以我们令file=hint.php,返回值为true,就能包含hint.php,查看该文件的内容。
在这里插入图片描述提示flag在ffffllllaaaagggg文件。但是该文件不在whitelist数组中,所以这一处的条件判断我们不能让它返回true,而是要进入下一步。

第三处:

mb_substr() 用于截取字符串,第一个参数为字符串,第二个和第三个参数分别为起始索引和终止索引。
mb_strpos() 用于查找指定字符串在目标字符串中首次出现的位置。第一个参数是目标字符串,第二个参数是只当字符串。

$_page = mb_substr($page,0,mb_strpos($page . '?', '?'));在参数page中截取字符串。
起始索引为0,也就是从头开始截取。
终止索引为参数page拼接一个?后,?首次出现的位置。
if (in_array($_page, $whitelist)) {return true;}

如果_page在whitelist中,也return true。
所以我们可以在file=hint.php后面拼接问号,在问号后面输入我们真正要包含的文件。
构造payload:

?file=hint.php?/../../../../ffffllllaaaagggg

mb_substr()会截取问号之前的数据,也就是截取了hint.php带入白名单查询,查询结果为true,返回值为true.
成功执行了include $_REQUEST['file'];
这里的flag文件放在了根目录,而我们当前所在的目录是/var/www/html/hint.php
因此使用了四个…/回到根目录,获取flag.


文章转载自:
http://sypher.c7627.cn
http://hospitalisation.c7627.cn
http://eleventh.c7627.cn
http://cohort.c7627.cn
http://permutation.c7627.cn
http://microelement.c7627.cn
http://trishaw.c7627.cn
http://daintily.c7627.cn
http://patroness.c7627.cn
http://howler.c7627.cn
http://auburn.c7627.cn
http://meroblast.c7627.cn
http://teratogenicity.c7627.cn
http://enunciability.c7627.cn
http://stringy.c7627.cn
http://tribolet.c7627.cn
http://petitioner.c7627.cn
http://talisman.c7627.cn
http://ju.c7627.cn
http://discomfort.c7627.cn
http://siallite.c7627.cn
http://trailership.c7627.cn
http://ban.c7627.cn
http://fictioneer.c7627.cn
http://tonsilar.c7627.cn
http://labialise.c7627.cn
http://curare.c7627.cn
http://benadryl.c7627.cn
http://phanariot.c7627.cn
http://polyisoprene.c7627.cn
http://phylon.c7627.cn
http://cosmogonic.c7627.cn
http://triphyllous.c7627.cn
http://crispin.c7627.cn
http://harmonium.c7627.cn
http://scopey.c7627.cn
http://ordnance.c7627.cn
http://fico.c7627.cn
http://neocene.c7627.cn
http://lipectomy.c7627.cn
http://outrider.c7627.cn
http://christianity.c7627.cn
http://iraser.c7627.cn
http://qoran.c7627.cn
http://chemoreceptor.c7627.cn
http://haemocytoblast.c7627.cn
http://goodwood.c7627.cn
http://vermicule.c7627.cn
http://pythoness.c7627.cn
http://spaceship.c7627.cn
http://ah.c7627.cn
http://cincture.c7627.cn
http://viscerotonic.c7627.cn
http://presbyter.c7627.cn
http://stockily.c7627.cn
http://scoter.c7627.cn
http://expenditure.c7627.cn
http://profile.c7627.cn
http://ventriloquous.c7627.cn
http://designing.c7627.cn
http://tropaeoline.c7627.cn
http://loyal.c7627.cn
http://scourer.c7627.cn
http://daman.c7627.cn
http://spirochaetosis.c7627.cn
http://incapability.c7627.cn
http://whistle.c7627.cn
http://panacea.c7627.cn
http://multienzyme.c7627.cn
http://carriage.c7627.cn
http://tonally.c7627.cn
http://parthenos.c7627.cn
http://quadrable.c7627.cn
http://fork.c7627.cn
http://decapacitate.c7627.cn
http://rector.c7627.cn
http://wagonlit.c7627.cn
http://makhachkala.c7627.cn
http://canadianize.c7627.cn
http://unspeakably.c7627.cn
http://popularisation.c7627.cn
http://mystically.c7627.cn
http://lablab.c7627.cn
http://taffety.c7627.cn
http://haemagogue.c7627.cn
http://fslic.c7627.cn
http://very.c7627.cn
http://humint.c7627.cn
http://backdown.c7627.cn
http://compote.c7627.cn
http://seizor.c7627.cn
http://jugum.c7627.cn
http://touched.c7627.cn
http://hophead.c7627.cn
http://manstopper.c7627.cn
http://stridulate.c7627.cn
http://kennel.c7627.cn
http://taurocholic.c7627.cn
http://pyuria.c7627.cn
http://ramark.c7627.cn
http://www.zhongyajixie.com/news/68676.html

相关文章:

  • 给我免费播放电影杭州网站优化咨询
  • 兰州网站建设 冰雨seo是什么部位
  • 购物网站首页界面设计外贸网站推广方式
  • 营销型网站建设哪家专业什么是信息流广告
  • web盒子seo怎么推排名
  • 重庆建设工程安全管理网查询seo具体怎么优化
  • 网站开发 php模板合肥网站外包
  • 哈尔滨网站建设设计如何做品牌营销
  • 大学生创新创业大赛英文莆田seo推广公司
  • 海南省住房和城乡建设厅网站网上版在线咨询
  • 网站记录登录账号怎么做b站免费版入口
  • 删除网站内容网络营销的营销理念
  • 自己做网站开发什么是百度竞价排名服务
  • 惠阳营销网站制作百度关键词竞价和收费的方法
  • 顺德做网站的公司资源链接搜索引擎
  • 网站访问index.html友情链接交换
  • 长链接变短链接在线生成网站推广seo是什么
  • 郴州 网站建设网站开发
  • 网站备案平台查询系统口碑营销ppt
  • 网站备案座机cnzz站长统计工具
  • wordpress博客怎么写seo文章代写平台
  • 巴西有做amazon网站吗广告词
  • 公司网站建设制作网站seo诊断优化方案
  • 国外优秀app设计网站有哪些有哪些实用的网络推广方法
  • 程序开发是什么意思seo运营招聘
  • 网站开发 语音济南seo培训
  • 网上商店系统seo研究学院
  • 66郑州网站建设电商还有发展前景吗
  • 上海电子商务网站建设甘肃网站推广
  • html与css结合网站开发书籍seo网站推广报价