目录
[极客大挑战 2019]EasySQL
打开靶机
直接尝试万能密码,账号admin' or 1=1#,密码随意
[HCTF 2018]WarmUp
打开靶机,里面有一个大大的表情包
按f12查看源码,发现了source.php
直接url进行访问得到了php代码
<?php
highlight_file(__FILE__);
class emmm
{
public static function checkFile(&$page)//定义了一个checkFire函数
{
$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 . '?', '?')//对'?'二次url解码
);
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'])//调用checkFire函数
) {
include $_REQUEST['file'];//这里有个文件
exit;
} else {
echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";
}
?>
在这段代码中发现了hint.txt,仍然是url进行访问查看
发现flag在ffffllllaaaagggg中
构造payload source.php?file=hint.php?ffffllllaaaagggg
发现表情没了,说明payload是正确的
但是不知道目录,所以用../来返回查看当返回到第五个的时候发现flag
[极客大挑战 2019]Havefun
打开靶机有一只懒惰的猫,查看网页源码发现php
大概意思就是get值使得cat=dog
[ACTF2020 新生赛]Include
打开靶机,发现里面有tips
点击进去有
打开一个新的网页的同时发现?file=flag.php
输入?file=/etc/passwd,发现有返回值,确定有文件包含漏洞
但是并没有什么实质性的信息,flag在哪也不知道。所以用文件包含漏洞中的php://filter/convert.base64-encode/resource伪协议来返回已知页面的代码。构造payload:?file=php://filter/convert.base64-encode/resource=index.php就可以得到index.php的源代码的base64密文
Base64 在线编码解码 | Base64 加密解密 - Base64.us
解密可得
<?php
error_reporting(0);
$file = $_GET["file"];
if(stristr($file,"php://input") || stristr($file,"zip://") || stristr($file,"phar://") || stristr($file,"data:")){
exit('hacker!');
}
if($file){
include($file);
}else{
echo '<a href="?file=flag.php">tips</a>';
}
?>
大概意思就是它过滤了几个php伪协议,但是没有过滤现在这个
我们直接看一下flag.php的内容
构造payload:?file=php://filter/convert.base64-encode/resource=flag.php得到flag的base64密文