一:背景
1. 讲故事
<appSettings><!-- 数据库连接字符串 --><add key="OLEDBConnStr" value="XfES27am6Muw48iB1GlMVqvUbq7/Pp9n4XbZJsDu19YDr/Zdb3m7KT6haD7f9HLj/ZEvIiZbmSU4O5L9g03Y5IUB6KLCZI7s3nDLwTIC+bXLf5quu/r8ZAI+rgNnsNZdwoDfquRLQy5Cf2X8/MFDOcMNaZYMpTYeHsZoEERU/TP9t3n5QllJTihrmDFbiGHLqe1kfN3uB3g1kgs0oobIEfNPr09kQ/pFgzZi/kZCrK10PLZZ0pFj1YU5ReFqBsdBlecV3D2Zl3lx1Ibls24t7w==" />
二:使用 ILSpy 去脱库
1. 从DAL/Repository层去反编译代码
class Program{static void Main(string[] args){var str = "XfES27am6Muw48iB1GlMVqvUbq7/Pp9n4XbZJsDu19YDr/Zdb3m7KT6haD7f9HLj/ZEvIiZbmSU4O5L9g03Y5IUB6KLCZI7s3nDLwTIC+bXLf5quu/r8ZAI+rgNnsNZdwoDfquRLQy5Cf2X8/MFDOcMNaZYMpTYeHsZoEERU/TP9t3n5QllJTihrmDFbiGHLqe1kfN3uB3g1kgs0oobIEfNPr09kQ/pFgzZi/kZCrK10PLZZ0pFj1YU5ReFqBsdBlecV3D2Zl3lx1Ibls24t7w==";Console.WriteLine(Decrypt(str));}public static string Decrypt(string str){if (!string.IsNullOrEmpty(str)){DESCryptoServiceProvider descsp = new DESCryptoServiceProvider();byte[] key = Encoding.Unicode.GetBytes("Oyea");byte[] data = Convert.FromBase64String(str);MemoryStream MStream = new MemoryStream();CryptoStream CStream = new CryptoStream(MStream, descsp.CreateDecryptor(key, key), CryptoStreamMode.Write);CStream.Write(data, 0, data.Length);CStream.FlushFinalBlock();return Encoding.Unicode.GetString(MStream.ToArray());}return "";}}
2. 加壳/混淆/加密狗
3. 将解密算法放在 server 端
三:使用 windbg 去脱库
1. 思路
2. windbg 挖矿实战
- 0:000> !name2ee xxx.Utilities.dll xxx.Utilities.Database.OleDbHelper.Decrypt
- Module: 08ed7cdc
- Assembly: xxx.Utilities.dll
- Token: 060002aa
- MethodDesc: 08ed83b0
- Name: xxx.Utilities.Database.OleDbHelper.Decrypt(System.String)
- JITTED Code Address: 048b6af0
0:000> !dumpmd 08ed83b0Method Name: xxx.Utilities.Database.OleDbHelper.Decrypt(System.String)Class: 08ecab30MethodTable: 08ed8468mdToken: 060002aaModule: 08ed7cdcIsJitted: yesCodeAddr: 048b6af0Transparency: Critical
0:000> !dumpclass 08ecab30Class Name: xxx.Utilities.Database.OleDbHelpermdToken: 02000033File: D:\code\A18001\Source\Main\TunnelClient\bin\Debug\xxx.Utilities.dllParent Class: 795115b0Module: 08ed7cdcMethod Table: 08ed8468Vtable Slots: 4Total Method Slots: 6Class Attributes: 100081 Abstract,Transparency: CriticalNumInstanceFields: 0NumStaticFields: 2MT Field Offset Type VT Attr Value Name799bfd60 4000152 74 System.String 0 static 04c28270 ConnectionString799bfd60 4000153 78 System.String 0 static 04c299e8 SecurityConnectionString
四:总结
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/3673.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~