环境下载:download
题目来源:XCTF高校战"疫"分享赛
1.漏洞分析
功能分析:
// 共 4 个功能:add_note、del_note、show_note、edit_note,用户输入 user_input 格式——(index+user_addr+size),全局数组pool处存放(note+size)。、
// 1.add_note cmd=0x30000
signed __int64 __usercall add_note@<rax>(__int64 a1@<rbp>, unsigned __int64 *user_input@<rdi>, __int64 a3@<rsi>)
{
unsigned __int64 index; // [rsp-20h] [rbp-20h]
__int64 chunk; // [rsp-18h] [rbp-18h]
_fentry__(user_input, a3); // index + ___ + size
index = *user_input;
if ( user_input[2] > 0x70 || user_input[2] <= 0x1F )// 0x20 =< size =< 0x70 漏洞 double-fetch
return -1LL;
if ( index > 0x1F || *((_QWORD *)&pool + 2 * index) )
return -1LL;
chunk = _kmalloc(user_input[2], 0x14000C0LL);
if ( !chunk )
return -1LL;
*((_QWORD *)&pool + 2 * index) = chunk;
pool_0x8[2 * index] = user_input[2];
return 0LL;
}
// 2.del_note cmd=0x30001
signed __int64 __usercall del_note@<rax>(__int64 a1@<rbp>, _QWORD *index@<rdi>, __int64 a3@<rsi>)
{
__int64 chunk; // [rsp-10h] [rbp-10h]
_fentry__(index, a3);
chunk = *((_QWORD *)&pool + 2 * *index);
if ( *index > 0x1FuLL )
return -1LL;
if ( !chunk )
return -1LL;
kfree(chunk); // 漏洞 UAF
return 0LL;
}
// 3.show_note cmd=0x30003
signed __int64 __usercall show_note@<rax>(__int64 a1@<rbp>, __int64 *user_input@<rdi>, __int64 a3@<rsi>)
{
__int64 user_addr; // ST20_8
__int64 chunk; // ST28_8
__int64 index; // [rsp-50h] [rbp-50h]
unsigned __int64 size; // [rsp-48h] [rbp-48h]
_fentry__(user_input, a3); // index+user_addr+size
index = *user_input;
size = user_input[2];
if ( (unsigned __int64)*user_input > 0x1F )
return -1LL;
if ( !*((_QWORD *)&pool +

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



