Skip to content

Commit 9f55561

Browse files
committed
Add srop example
1 parent fa8caf3 commit 9f55561

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

srop/srop

19.3 KB
Binary file not shown.

srop/srop.c

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <signal.h>
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
5+
// gcc srop.c -o srop -g -fno-stack-protector -no-pie
6+
7+
void my_restore_rt() { asm("mov $0xf, %rax; syscall; syscall; ret"); }
8+
9+
int main() {
10+
char *new_stack = malloc(0x40000);
11+
char buf[0x10];
12+
13+
setvbuf(stdout, buf, _IONBF, 0);
14+
setvbuf(stderr, buf, _IONBF, 0);
15+
setvbuf(stdin, buf, _IONBF, 0);
16+
17+
printf("my_restore_rt: %p\n", my_restore_rt);
18+
printf("new_mmap: %p\n", new_stack);
19+
read(0, buf, 0x1000);
20+
puts("done");
21+
return 0;
22+
}
23+

0 commit comments

Comments
 (0)