0:000> p
eax=00000001 ebx=00a1e420 ecx=00000000 edx=00b796a0 esi=00000000 edi=00a1da80
eip=00b5aec1 esp=0012da58 ebp=00a1e468 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
php_tidy!get_module+0x9ec1:
00b5aec1 57 push edi
0:000> p
eax=00000001 ebx=00a1e420 ecx=00000000 edx=00b796a0 esi=00000000 edi=00a1da80
eip=00b5aec2 esp=0012da54 ebp=00a1e468 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
php_tidy!get_module+0x9ec2:
00b5aec2 53 push ebx
0:000> p
eax=00000001 ebx=00a1e420 ecx=00000000 edx=00b796a0 esi=00000000 edi=00a1da80
eip=00b5aec3 esp=0012da50 ebp=00a1e468 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
php_tidy!get_module+0x9ec3:
00b5aec3 e8b88f0000 call php_tidy!get_module+0x12e80 (00b63e80)
0:000> dd edi
00a1da80 41414141 41414141 41414141 41414141
00a1da90 41414141 41414141 41414141 41414141
00a1daa0 41414141 41414141 41414141 41414141
00a1dab0 41414141 41414141 41414141 41414141
00a1dac0 41414141 41414141 41414141 41414141
00a1dad0 41414141 41414141 41414141 41414141
接下来00b5aec3地址位置的call函数调用,有4个参数,看一下伪代码。
int (__cdecl *sub_10013A20(int arg0, int arg4, char *Format, ...))(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD) { va_list va; // [sp+10h] [bp+10h]@1 va_start(va, Format); return sub_10013A50(arg0, arg4, 0, 0, Format, va); }
这里会直接传入sub_10013A50函数,但实际上这个函数传参和畸形字符串并没有关系,va是一个名为va_list的结构体。
实际上,进入的这个函数,就是要负责处理构造一个报错的字符串,而问题就出在这个函数中,跟入这个函数,单步跟踪后会发现,函数首先会进入一处循环。
0:000> p
eax=0000006e ebx=00000000 ecx=00a21080 edx=00a1e958 esi=00a1e420 edi=0012d1de
eip=00b63b3a esp=0012d1cc ebp=00000000 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
php_tidy!get_module+0x12b3a:
00b63b3a 0fbec0 movsx eax,al
0:000> p
eax=0000006e ebx=00000000 ecx=00a21080 edx=00a1e958 esi=00a1e420 edi=0012d1de
eip=00b63b3d esp=0012d1cc ebp=00000000 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
php_tidy!get_module+0x12b3d:
00b63b3d 52 push edx
0:000> p
eax=0000006e ebx=00000000 ecx=00a21080 edx=00a1e958 esi=00a1e420 edi=0012d1de
eip=00b63b3e esp=0012d1c8 ebp=00000000 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
php_tidy!get_module+0x12b3e:
00b63b3e 50 push eax
0:000> p
eax=0000006e ebx=00000000 ecx=00a21080 edx=00a1e958 esi=00a1e420 edi=0012d1de
eip=00b63b3f esp=0012d1c4 ebp=00000000 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
php_tidy!get_module+0x12b3f:
00b63b3f e88c34ffff call php_tidy!get_module+0x5fd0 (00b56fd0)
0:000> p
eax=00000003 ebx=00000000 ecx=00a21080 edx=00000002 esi=00a1e420 edi=0012d1de
eip=00b63b44 esp=0012d1c4 ebp=00000000 iopl=0 nv up ei pl nz ac pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000216
php_tidy!get_module+0x12b44:
00b63b44 8a4701 mov al,byte ptr [edi+1] ds:0023:0012d1df=66
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00000002 esi=00a1e420 edi=0012d1de
eip=00b63b47 esp=0012d1c4 ebp=00000000 iopl=0 nv up ei pl nz ac pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000216
php_tidy!get_module+0x12b47:
00b63b47 83c408 add esp,8
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00000002 esi=00a1e420 edi=0012d1de
eip=00b63b4a esp=0012d1cc ebp=00000000 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
php_tidy!get_module+0x12b4a:
00b63b4a 47 inc edi
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00000002 esi=00a1e420 edi=0012d1df
eip=00b63b4b esp=0012d1cc ebp=00000000 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
php_tidy!get_module+0x12b4b:
00b63b4b 84c0 test al,al
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00000002 esi=00a1e420 edi=0012d1df
eip=00b63b4d esp=0012d1cc ebp=00000000 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
php_tidy!get_module+0x12b4d:
00b63b4d 75e5 jne php_tidy!get_module+0x12b34 (00b63b34) [br=1]
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00000002 esi=00a1e420 edi=0012d1df
eip=00b63b34 esp=0012d1cc ebp=00000000 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
php_tidy!get_module+0x12b34:
00b63b34 8b9684040000 mov edx,dword ptr [esi+484h] ds:0023:00a1e8a4=00a1e958
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00a1e958 esi=00a1e420 edi=0012d1df
eip=00b63b3a esp=0012d1cc ebp=00000000 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
php_tidy!get_module+0x12b3a:
00b63b3a 0fbec0 movsx eax,al
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00a1e958 esi=00a1e420 edi=0012d1df
eip=00b63b3d esp=0012d1cc ebp=00000000 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
php_tidy!get_module+0x12b3d:
00b63b3d 52 push edx
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00a1e958 esi=00a1e420 edi=0012d1df
eip=00b63b3e esp=0012d1c8 ebp=00000000 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
php_tidy!get_module+0x12b3e:
00b63b3e 50 push eax
0:000> p
eax=00000066 ebx=00000000 ecx=00a21080 edx=00a1e958 esi=00a1e420 edi=0012d1df
eip=00b63b3f esp=0012d1c4 ebp=00000000 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000206
php_tidy!get_module+0x12b3f:
00b63b3f e88c34ffff call php_tidy!get_module+0x5fd0 (00b56fd0)
0:000> p
eax=00000004 ebx=00000000 ecx=00a21080 edx=00000003 esi=00a1e420 edi=0012d1df
eip=00b63b44 esp=0012d1c4 ebp=00000000 iopl=0 nv up ei pl nz ac pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000216
php_tidy!get_module+0x12b44:
00b63b44 8a4701 mov al,byte ptr [edi+1] ds:0023:0012d1e0=69
0:000> dc edi
0012d1df 3a676966 12d20020 12d26c00 92e90000 fig: ....l......
0012d1ef 9392f87c ffffff7c 9392efff 12d27c7c |...|.......||..