text
stringlengths
0
1.99k
h = {
endp = 0x5a5a5a5a5a5a5a5a,
next = 0x5a5a5a5a5a5a5a5a,
first_avail = 0x5644f0439c91
}
gef➤
Let's also put a breakpoint on pool.c:597 in case we lose the control of p,
and continue the execution:
gef➤ break pool.c:597 if (p && p->first >= 0x4141414141414141)
gef➤ c
Humm, interesting. It seems that it's allocating a buffer to store the
responses to our commands. Let's recap the previous and the current
answers:
First break:
────────────────────────────────────────────────────────────── trace ────
[#0] 0x5644eeabd5cd → alloc_pool(p=0x5644f0439bd1, reqsz=0x4, exact=0x0)
[#1] 0x5644eeabd6b0 → palloc(p=0x5644f0439bd1, sz=0x4)
[#2] 0x5644eeabf409 → pstrdup(p=0x5644f0439bd1, str=0x5644f0408dd0 "426")
[#3] 0x5644eeaeb6f0 → pr_response_set_pool(p=0x5644f0439bd1)
Second break (current):
────────────────────────────────────────────────────────────── trace ────
[#0] 0x5644eeabd5a1 → alloc_pool(p=0x5644f0439c51, reqsz=0x29, exact=0x0)
[#1] 0x5644eeabd6b0 → palloc(p=0x5644f0439c51, sz=0x29)
[#2] 0x5644eeabf409 → pstrdup(p=0x5644f0439c51, str=0x5644f0408de0
"Transfer aborted. Data connection closed")
[#3] 0x5644eeaeb721 → pr_response_set_pool(p=0x5644f0439c51)
As we know, p points to resp_pool which was set in pr_response_set_pool().
ProFTPd uses the p->last block to store error messages due to lost data
connections.
At the first break it contained the "426" error code. At the second break
the string "Transfer aborted. Data connection closed" is seen. We also know
the size of each string from the reqsz parameter.
We can continue with gdb two more times; it will print the "426" error code
and the string again.
On the 5th time we'll get SIGSEGV in another function:
$rax : 0x4141414141414141 ("AAAAAAAA"?)
$rbx : 0x000055555567aac0 → 0x0000000000000002
$rcx : 0x00005555556db030 → 0x0000000000000000
$rdx : 0x00005555556dae30 → 0x00005555556dae10
$rsp : 0x00007fffffffd940 → 0x0000000000000000
$rbp : 0x00007fffffffd960 → 0x00007fffffffda00
$rsi : 0x0
$rdi : 0x00005555556dae30 → 0x00005555556dae10
$rip : 0x00005555555757d5 → <make_sub_pool+197>
$r8 : 0x56a
$r9 : 0x0000555555674dc0 → 0x0000000000000001
$r10 : 0x00007ffff7eff040 → 0x0000000000000000
$r11 : 0x9
$r12 : 0x00007fffffffe3f8 → 0x00007fffffffe68d
$r13 : 0x00005555555734ea → <main+0> endbr64
$r14 : 0x0
$r15 : 0x00007ffff7ffbc40 → 0x00050f0800000000
──────────────────────────────────────────────────────────────── stack ────
0x00007fffffffd940│+0x0000: 0x0000000000000000 ← $rsp
0x00007fffffffd948│+0x0008: 0x0000555555712760 → "DDDDDDDDp'qUUU"
0x00007fffffffd950│+0x0010: 0x00005555556dae10 → 0x00005555556db030
0x00007fffffffd958│+0x0018: 0x00005555556dae30 → 0x00005555556dae10
0x00007fffffffd960│+0x0020: 0x00007fffffffda00 → 0x00007fffffffda40
0x00007fffffffd968│+0x0028: 0x000055555556f7be → <_dispatch+577>
0x00007fffffffd970│+0x0030: 0x00005555556d5da8 → 0x0000000000000000
0x00007fffffffd978│+0x0038: 0x000055555563d3b1 → 0x660000000000002a
────────────────────────────────────────────────────────── code:x86:64 ────
0x5555555757c9 <make_sub_pool+185> mov rax, QWORD PTR [rbp-0x8]
0x5555555757cd <make_sub_pool+189> mov rax, QWORD PTR [rax+0x20]
0x5555555757d1 <make_sub_pool+193> mov rdx, QWORD PTR [rbp-0x8]
→ 0x5555555757d5 <make_sub_pool+197> mov QWORD PTR [rax+0x28], rdx
0x5555555757d9 <make_sub_pool+201> mov rax, QWORD PTR [rbp-0x18]
0x5555555757dd <make_sub_pool+205> mov rdx, QWORD PTR [rbp-0x8]
0x5555555757e1 <make_sub_pool+209> mov QWORD PTR [rax+0x18], rdx
0x5555555757e5 <make_sub_pool+213> call <pr_alarms_unblock>
0x5555555757ea <make_sub_pool+218> mov rax, QWORD PTR [rbp-0x8]
──────────────────────────────────────────────────── source:pool.c+435 ────
430 if (p) {
431 new_pool->parent = p;
432 new_pool->sub_next = p->sub_pools;
433
434 if (new_pool->sub_next)
→ 435 new_pool->sub_next->sub_prev = new_pool;
436
437 p->sub_pools = new_pool;
438 }
439
440 pr_alarms_unblock();
────────────────────────────────────────────────────────────── threads ────
[#0] Id 1, Name: "proftpd", stopped in make_sub_pool (), reason: SIGSEGV
──────────────────────────────────────────────────────────────── trace ────
[#0] 0x5555555757d5 → make_sub_pool(p=0x555555712760)
[#1] 0x55555556f7be → _dispatch(cmd=0x5555556d24f8, cmd_type=0x6, [...]
[#2] 0x5555555708a6 → pr_cmd_dispatch_phase(cmd=0x5555556d24f8, [...]
[#3] 0x5555555fc5f9 → xfer_exit_ev(event_data=0x0, user_data=0x0)