office自带的VBE写代码不方便,上网搜索搜到一个VBA代码编辑器
啥也不说,先拖入die里面看看是什么语言写的

image.png
可以看到是.net程序
拖入dnspy,转到入口点

image.png
可以看到整个程序都已经混淆,并且字符串也全部用oRM=这个函数加密处理了
进入这个函数

image.png
想搞清楚软件的流程只能调试或者解密这些字符串
当我开始调试的时候发现,作者加入了反调试
程序执行不下去,好像是0xd4d大神的antinet
没办法就开始解密字符串吧
自己在C#照着代码写了解密方法,一个一个解密加密字符串(这种静态解密方法比较笨,wwh大神在帖子里说的动态解密我没尝试)

image.png
这个解密好像还有点问题,但是已经能看懂意思,不影响我们找到激活码校验的位置了

image.png
找到激活码校验是在下面图片中标红框的地方校验的

image.png
点进这个函数

image.png
继续解密出这些字符串是<UserName>,</UserName>,<Expires>,</Expires>,<Permissions>,</Permissions>,<Activation>,</Activation>,<OriginalRegisterCode>,</OriginalRegisterCode>
另外看到是string的split函数,知道了license文件为xml结构
这个函数的作用就是取出xml中每个节点的数据,然后去校验
可是校验函数点进去是这样的

image.png
找不到程序逻辑了,程序应该是使用反射的方式去调用校验方法了
不知道找哪个函数的时候,我看到了
Authenticator.Instance.Vfy(<AgileDotNetRT>.oRM=(""), <AgileDotNetRT>.oRM=(""), <AgileDotNetRT>.oRM=(""), <AgileDotNetRT>.oRM=(""), <AgileDotNetRT>.oRM=(""), <AgileDotNetRT>.oRM=(""));
这个函数的参数是和校验函数的数量一致,并且Authenticator能看出来是权限方面的函数
点进这个函数

image.png
到这就基本确定了,license校验就在这个地方执行的。但是这个Authenticator类并不再主程序中,而是在Mclib.dll里面
Mclib.dll在程序目录里是没有的
我又从新回去看VBANavigator.exe
直到我看到了Costura

image.png
原来是exe和dll合并了
接下来我们把这个dll还原出来吧
我用dnspy的保存模块功能,发现会丢失Eddy CZ这个存储流,不知道是不是我保存的参数不对,有知道的前辈可以指点下我

image.png
Costura.Fody 其实是把dll压缩后作为资源存储在了exe中,加载的时候用Assemloader动态加载
接下来我们就把mclib这个资源块的二进制从exe里面扣出来
然后进行解压缩就可以还原得到Mclib.dll文件
还原出来Mclib.dll后拖入dnspy
找到刚才发现的Authenticator类,打开类之后,又是一阵头大

image.png
所有的函数都使用VMEntry.Run函数实现

image.png
看到这个代码,已经毫无可读性了
在我爱破解上搜索KoiVM
找到了washi大神些的OldRod,来破解KoiVm
去github下载源码进行编译,程序提示找不到KoiStream流
接着把KoiStream这个名字 改成Edd^CZ这个流名字
程序接着运行,中间还有几个错误,修改下源码解决了
最终还原了Mclib.dll的程序逻辑,这也是最关键的地方吧

image.png
接下来就是分析程序逻辑了
先是获取HardwareInfo
根据harwareinfo 和serialNumber组成电脑标识符
然后用aliceBobHelper来进行校验,如果校验成功,则对userPermission赋值
校验使用的非对称加密

image.png
用的ECDsaCng(椭圆曲线数字签名算法)加解密算法
接下来就清晰了
我们要自己生成一对ECDsaCng的秘钥对
把程序里的公钥给换成我们的公钥
用winhex修改后保存一个新的Mclib.dll
接下来把Mclib.dll再按照Costura.Fody的压缩算法进行压缩
把这个压缩好的文件拖入winhex 复制整个二进制
最后在winhex中拖入exe文件,找到Mclib.dll资源所在的位置
write进去就可以了
多余的字节要记得nop
接下来保存exe
用我们生成的exe替换掉原程序的exe
接下来我们可以用我们的私钥写注册机了
主要函数如下

image.png
注册机做好之后就可以注册啦

image.png
把注册码保存为xml文件,导入
成功激活

image.png
ps:
1、也考虑了爆破,但是爆破程序使用的过程中容易出问题
2、一直都是看别人的贴,从未发帖,第一次发帖,跟流水账一样,希望大家不要介意O(∩_∩)O哈哈~