破解CuteFTP 4.0的方法
CuteFTP早期的版本的保护还是比较厉害的,先是KeyFile,后来才改成注册码。它有个3.x版本被拿来作为HCU(High Cracking University)的strainer。4.0版本可以变成注册版,但是输入注册码之后它要连到其公司的服务器上去验证。输入注册码之后是可以跟出注册码来的,但是通不过联机验证则它不会将注册码保存起来,所以下次启动还是未注册版。可以从它启动时开始跟踪,找到注册码,实际上所有的软件都可以从启动时入手。
用RegMon、FileMon检查一下,发现有个注册表键叫做Key1,里面放的是一些很长的乱七八糟的字符。可以用bpx RegQueryValueExA作断点,然后跟踪,但是这玩意儿读的注册表键太多,且SoftICE的条件断点又不是很灵光(我用bpx RegQueryValueExA if *(esp 8)==’Key1’作断点它不中断),所以改用W32Dasm来寻找合适的断点。将其反汇编之后查找引用到"Key1"这个字符串的地方,记下其地址作为断点,然后用Symbol Loader加载主程序,设好断点,发现在下面的地方读出该键值,但它要求Key1串的长度小于等于20。
015F:00489074 MOV ESI,[ADVAPI32!RegQueryValueExA]
015F:0048907A JNZ 004890A9
015F:0048907C MOV ECX,[ESP 10]
015F:00489080 LEA EDX,[ESP 14]
015F:00489084 PUSH EDX
015F:00489085 LEA EAX,[ESP 20]
015F:00489089 PUSH EBX
015F:0048908A PUSH EAX
015F:0048908B PUSH 00
015F:0048908D PUSH 0053E030 //Key1
015F:00489092 PUSH ECX
015F:00489093 CALL ESI //读注册表
015F:00489095 TEST EAX,EAX
015F:00489097 JNZ 004890A2
015F:00489099 MOV EDX,[ESP 10]
015F:0048909D PUSH EDX
015F:0048909E CALL EBP
015F:004890A0 JMP 00489108
.........
015F:00489108 MOV ECX,[ESP 14] //Key1串的长度
015F:0048910C CMP ECX,14 //长度小于等于0x14则继续检查
015F:0048910F JBE 0048911B
015F:00489111 POP EDI
015F:00489112 POP ESI
015F:00489113 POP EBP
015F:00489114 XOR EAX,EAX //bag guy
015F:00489116 POP EBX
015F:00489117 ADD ESP,10
015F:0048911A RET
015F:0048911B MOV EAX,[ESP 28]
015F:0048911F TEST EAX,EAX
015F:00489121 JZ 00489125
015F:00489123 MOV [EAX],ECX
015F:00489125 POP EDI
015F:00489126 POP ESI
015F:00489127 POP EBP
015F:00489128 MOV EAX,00000001
015F:0048912D POP EBX
015F:0048912E ADD ESP,10
015F:00489131 RET
将Key1串改成一个长度小于20的ASCIIZ串,重新来一遍。等它读完Key1后用BPR断点监视Key1串,会看见它把Key1转换成大写,并检查长度:
015F:004AB0F0 REPNZ SCASB
015F:004AB0F2 NOT ECX
015F:004AB0F4 DEC ECX
015F:004AB0F5 CMP ECX,0E
015F:004AB0F8 JNZ 004AB16D
可见长度应为14个字符。接下来它检查Key1的第一个字符是否为’A’,并计算注册码的其它位:
015F:00491828 CMP BYTE PTR [EBX],41 //Key1的首字符
015F:0049182B JZ 00491832
015F:0049182D POP EDI
015F:0049182E XOR EAX,EAX //bad guy
015F:00491830 POP EBX
015F:00491831 RET
015F:00491832 PUSH ESI //以下为计算过程
015F:00491833 MOV ESI,00000001
015F:00491838 MOV AL,[EBX ESI]
015F:0049183B PUSH EAX
015F:0049183C CALL 004917D0
015F:00491841 SHL EDI,05
015F:00491844 ADD ESP,04
015F:00491847 OR EDI,EAX
015F:00491849 INC ESI
015F:0049184A CMP ESI,07
015F:0049184D JL 00491838
015F:0049184F MOV CL,[EBX 07]
015F:00491852 PUSH ECX
015F:00491853 CALL 004917D0
015F:00491858 ADD ESP,04
015F:0049185B LEA EDX,[EDI*4 00000000]
015F:00491862 SHR EAX,02
015F:00491865 POP ESI
015F:00491866 POP EDI
015F:00491867 OR EAX,EDX
015F:00491869 POP EBX
015F:0049186A RET
计算完了之后就开始比较:
015F:004AB0F0 REPNZ SCASB
015F:004AB0F2 NOT ECX
015F:004AB0F4 DEC ECX
015F:004AB0F5 CMP ECX,0E //这是刚才判长度的地方
015F:004AB0F8 JNZ 004AB16D
015F:004AB0FA PUSH ESI
015F:004AB0FB CALL 004B1B8A
015F:004AB100 PUSH 0E
015F:004AB102 LEA EAX,[ESP 20]
015F:004AB106 PUSH ESI
015F:004AB107 PUSH EAX
015F:004AB108 CALL 004AF930
015F:004AB10D LEA ECX,[ESP 28]
015F:004AB111 MOV BYTE PTR [ESP 36],00
015F:004AB116 PUSH ECX
015F:004AB117 CALL 00491820 //这是刚才计算的地方
015F:004AB11C MOV ESI,EAX
015F:004AB11E PUSH ESI
015F:004AB11F CALL 00491510
015F:004AB124 LEA EDX,[ESP 20]
015F:004AB128 MOV EDI,EAX
015F:004AB12A PUSH EDX
015F:004AB12B PUSH ESI
015F:004AB12C MOV BYTE PTR [ESP 28],00
015F:004AB131 CALL 004916A0
015F:004AB136 LEA EAX,[ESP 38]
015F:004AB13A PUSH 0E //14个字符
015F:004AB13C LEA ECX,[ESP 2C]
015F:004AB140 PUSH EAX //真注册码
015F:004AB141 PUSH ECX //假注册码
015F:004AB142 CALL 004B04D0 //比较
015F:004AB147 ADD ESP,2C
015F:004AB14A TEST EAX,EAX
015F:004AB14C JNZ 004AB15E
015F:004AB14E MOV EDX,[ESP 2C]
015F:004AB152 OR AX,FFFF //good guy
015F:004AB156 MOV [EDX],EDI
015F:004AB158 POP EDI
015F:004AB159 POP ESI
015F:004AB15A ADD ESP,20
015F:004AB15D RET
015F:004AB15E MOV EAX,[ESP 2C]
015F:004AB162 MOV [EAX],EDI
015F:004AB164 POP EDI
015F:004AB165 XOR AX,AX //bad guy
015F:004AB168 POP ESI
015F:004AB169 ADD ESP,20
015F:004AB16C RET
至此就找出了注册码。根据上面的计算和比较过程可知注册码与名字什么的没有关系,所以它启动时不用读取用户名。用RegMon监视一下它显示About对话框的时候的动作,发现它还读取RegUserName键,这显然是存放用户名的。
关键的健:
HKEY_LOCAL_MACHINE\Software\GlobalSCAPE Inc.\CuteFTP\Key1
HKEY_LOCAL_MACHINE\Software\GlobalSCAPE Inc.\CuteFTP\RegUserName
HKEY_CLASSES_ROOT\pfc
最后一个键是存放日期的,老版本的也在这里。
用RegMon、FileMon检查一下,发现有个注册表键叫做Key1,里面放的是一些很长的乱七八糟的字符。可以用bpx RegQueryValueExA作断点,然后跟踪,但是这玩意儿读的注册表键太多,且SoftICE的条件断点又不是很灵光(我用bpx RegQueryValueExA if *(esp 8)==’Key1’作断点它不中断),所以改用W32Dasm来寻找合适的断点。将其反汇编之后查找引用到"Key1"这个字符串的地方,记下其地址作为断点,然后用Symbol Loader加载主程序,设好断点,发现在下面的地方读出该键值,但它要求Key1串的长度小于等于20。
015F:00489074 MOV ESI,[ADVAPI32!RegQueryValueExA]
015F:0048907A JNZ 004890A9
015F:0048907C MOV ECX,[ESP 10]
015F:00489080 LEA EDX,[ESP 14]
015F:00489084 PUSH EDX
015F:00489085 LEA EAX,[ESP 20]
015F:00489089 PUSH EBX
015F:0048908A PUSH EAX
015F:0048908B PUSH 00
015F:0048908D PUSH 0053E030 //Key1
015F:00489092 PUSH ECX
015F:00489093 CALL ESI //读注册表
015F:00489095 TEST EAX,EAX
015F:00489097 JNZ 004890A2
015F:00489099 MOV EDX,[ESP 10]
015F:0048909D PUSH EDX
015F:0048909E CALL EBP
015F:004890A0 JMP 00489108
.........
015F:00489108 MOV ECX,[ESP 14] //Key1串的长度
015F:0048910C CMP ECX,14 //长度小于等于0x14则继续检查
015F:0048910F JBE 0048911B
015F:00489111 POP EDI
015F:00489112 POP ESI
015F:00489113 POP EBP
015F:00489114 XOR EAX,EAX //bag guy
015F:00489116 POP EBX
015F:00489117 ADD ESP,10
015F:0048911A RET
015F:0048911B MOV EAX,[ESP 28]
015F:0048911F TEST EAX,EAX
015F:00489121 JZ 00489125
015F:00489123 MOV [EAX],ECX
015F:00489125 POP EDI
015F:00489126 POP ESI
015F:00489127 POP EBP
015F:00489128 MOV EAX,00000001
015F:0048912D POP EBX
015F:0048912E ADD ESP,10
015F:00489131 RET
将Key1串改成一个长度小于20的ASCIIZ串,重新来一遍。等它读完Key1后用BPR断点监视Key1串,会看见它把Key1转换成大写,并检查长度:
015F:004AB0F0 REPNZ SCASB
015F:004AB0F2 NOT ECX
015F:004AB0F4 DEC ECX
015F:004AB0F5 CMP ECX,0E
015F:004AB0F8 JNZ 004AB16D
可见长度应为14个字符。接下来它检查Key1的第一个字符是否为’A’,并计算注册码的其它位:
015F:00491828 CMP BYTE PTR [EBX],41 //Key1的首字符
015F:0049182B JZ 00491832
015F:0049182D POP EDI
015F:0049182E XOR EAX,EAX //bad guy
015F:00491830 POP EBX
015F:00491831 RET
015F:00491832 PUSH ESI //以下为计算过程
015F:00491833 MOV ESI,00000001
015F:00491838 MOV AL,[EBX ESI]
015F:0049183B PUSH EAX
015F:0049183C CALL 004917D0
015F:00491841 SHL EDI,05
015F:00491844 ADD ESP,04
015F:00491847 OR EDI,EAX
015F:00491849 INC ESI
015F:0049184A CMP ESI,07
015F:0049184D JL 00491838
015F:0049184F MOV CL,[EBX 07]
015F:00491852 PUSH ECX
015F:00491853 CALL 004917D0
015F:00491858 ADD ESP,04
015F:0049185B LEA EDX,[EDI*4 00000000]
015F:00491862 SHR EAX,02
015F:00491865 POP ESI
015F:00491866 POP EDI
015F:00491867 OR EAX,EDX
015F:00491869 POP EBX
015F:0049186A RET
计算完了之后就开始比较:
015F:004AB0F0 REPNZ SCASB
015F:004AB0F2 NOT ECX
015F:004AB0F4 DEC ECX
015F:004AB0F5 CMP ECX,0E //这是刚才判长度的地方
015F:004AB0F8 JNZ 004AB16D
015F:004AB0FA PUSH ESI
015F:004AB0FB CALL 004B1B8A
015F:004AB100 PUSH 0E
015F:004AB102 LEA EAX,[ESP 20]
015F:004AB106 PUSH ESI
015F:004AB107 PUSH EAX
015F:004AB108 CALL 004AF930
015F:004AB10D LEA ECX,[ESP 28]
015F:004AB111 MOV BYTE PTR [ESP 36],00
015F:004AB116 PUSH ECX
015F:004AB117 CALL 00491820 //这是刚才计算的地方
015F:004AB11C MOV ESI,EAX
015F:004AB11E PUSH ESI
015F:004AB11F CALL 00491510
015F:004AB124 LEA EDX,[ESP 20]
015F:004AB128 MOV EDI,EAX
015F:004AB12A PUSH EDX
015F:004AB12B PUSH ESI
015F:004AB12C MOV BYTE PTR [ESP 28],00
015F:004AB131 CALL 004916A0
015F:004AB136 LEA EAX,[ESP 38]
015F:004AB13A PUSH 0E //14个字符
015F:004AB13C LEA ECX,[ESP 2C]
015F:004AB140 PUSH EAX //真注册码
015F:004AB141 PUSH ECX //假注册码
015F:004AB142 CALL 004B04D0 //比较
015F:004AB147 ADD ESP,2C
015F:004AB14A TEST EAX,EAX
015F:004AB14C JNZ 004AB15E
015F:004AB14E MOV EDX,[ESP 2C]
015F:004AB152 OR AX,FFFF //good guy
015F:004AB156 MOV [EDX],EDI
015F:004AB158 POP EDI
015F:004AB159 POP ESI
015F:004AB15A ADD ESP,20
015F:004AB15D RET
015F:004AB15E MOV EAX,[ESP 2C]
015F:004AB162 MOV [EAX],EDI
015F:004AB164 POP EDI
015F:004AB165 XOR AX,AX //bad guy
015F:004AB168 POP ESI
015F:004AB169 ADD ESP,20
015F:004AB16C RET
至此就找出了注册码。根据上面的计算和比较过程可知注册码与名字什么的没有关系,所以它启动时不用读取用户名。用RegMon监视一下它显示About对话框的时候的动作,发现它还读取RegUserName键,这显然是存放用户名的。
关键的健:
HKEY_LOCAL_MACHINE\Software\GlobalSCAPE Inc.\CuteFTP\Key1
HKEY_LOCAL_MACHINE\Software\GlobalSCAPE Inc.\CuteFTP\RegUserName
HKEY_CLASSES_ROOT\pfc
最后一个键是存放日期的,老版本的也在这里。