分享一下本人做题记录,不足之处多多指正。
Never give up:
打开链接发现自动提交了一个id=1,猜想是个注入,但是试了半天id=’1 and 1=1#之类的没什么用,应该不是注入。
看源代码有个1p.html,去访问发现直接跳到了论坛主页,用burp抓一下包,发现burp的Proxy只能看到跳转到论坛主页的包,没什么用,要去Target看,抓包go一下得到一串:
用escape和base64解码得到以下代码:
<script>window.location.href='http://www.bugku.com';</script>
<!--";if(!$_GET['id'])
{
header('Location:hello.php?id=1');
exit();
}
$id=$_GET['id'];
$a=$_GET['a'];
$b=$_GET['b'];
if(stripos($a,'.'))
{
echo'no no no no no no no';
return;
}
$data = @file_get_contents($a,'r');
if($data=="bugku is a niceplateform!" and $id==0 and strlen($b)>5 anderegi("111".substr($b,0,1),"1114") and substr($b,0,1)!=4)
{
require("f4l2a3g.txt");
}
else
{
print"never never never give up !!!";
}
?>-->
需要绕过重重险阻最后require("f4l2a3g.txt") 我直接访问这个文件,就得到了flag….:
welcome to bugkuctf:
打开链接,看源代码,要求txt传入的文件内容是welcome to the bugkuctf,利用php://input和post提交内容可解决,提交:?txt=php://input&file=hint.php,发现没什么用,显示hello,利用php://filter打出hint.php的内容:
<?php
class Flag{//flag.php
public $file;
publicfunction __tostring(){
if(isset($this->file)){
echo file_get_contents($this->file);
echo"<br>";
return("good");
}
}
}
?>
定义了一个类,有__tostring方法,不过没什么联系,把index.php内容也打出来:
<?php
$txt = $_GET["txt"];
$file = $_GET["file"];
$password =$_GET["password"];
if(isset($txt)&&(file_get_contents($txt,'r')==="welcometo the bugkuctf")){
echo "hello friend!<br>";
if(preg_match("/flag/",$file)){
echo "ä¸èƒ½çŽ°åœ¨å°±ç»™ä½ flag哦";
exit();
}else{
include($file);
$password = unserialize($password);
echo $password;
}
}else{
echo "you are not the number of bugku ! ";
}
?>
这时发现还提交一个password呢,不可能什么用都没有,看代码有这样一行:
$password= unserialize($password);
百度了一下用法,unserialize是反序列化的,需要password传入一个Flag类型的对象(并且file=flag.php),password到底赋值多少写个php脚本来看一下:
打开phpstudy,启动,浏览器localhost运行xulie.php文件,结果:
这行就是password的值,再提交,payload:
?txt=php://input&file=hint.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
查看源代码得到flag:
过狗一句话:
题目提示就是通过传入的s来用alert()执行代码,但是不知道执行什么… 这又是一个套路,看wp是读出文件列表,用print_r(glob("*")),提交s=print_r(glob("*")),得到:
看到flag.txt,再读取flag.txt的内容,用show_source():
各种绕过呦:
打开发现就是php绕过,百度了一下shal绕过,发现不同值的数组可以,所以uname与passwd分别为[]=1和[]=2,id=margin,用hackbar插件提交得到flag:
Web8:
利用之前用过的php://input来绕过file_get_content():
字符?正则?
就是提交一个能够匹配该正则表达式的id,根据规则提交一个就可以了:
考细心:
打开发现什么都没有,用dirsearch扫描,发现两个文件:
查看robots.txt,发现又有一个resusl.php,查看这个PHP文件:
结合提示(成为admin),提交x=admin,得到flag:
求getshell:
打开链接让上传一个图片而不是php文件,肯定是改包的操作,上传一个图片,抓包看下:
把.png改成.php没什么用,试php1,2,3,4,5也没用,百度了一下,要把哪个multipart改成Multipart,再php5,就得到了flag:
Flag.php:
提示hint,提交?hint=1,出现了php代码,阅读代码,要求提交一个cookie,ISecer值反序列化后等于变量key,所以看变量key,$KEY='ISecer:www.isecer.com'; 给他序列化提交,发现没什么用,很费解,最后阅读代码才发现这个赋值语句是在最后执行的…也就是KEY应该为空,对空字符串进行序列化提交: