BY 混世魔王。
很久沒搞破解了。最近黑了一套.NET的商業程式,給自己用。由於是網路驗證。就嘗試破解了一下。由於是內部的程式,破解的難度不大。要大了。我也破不了。隨筆,寫成心的,作為技術交流。高手掠過。先查看殼,可以看到無殼,.NET的程式。
既然是網路驗證的程式,那要開啟Sniffer 類的程式,來抓取資料包,我這裡用的HTTP Analyzer.運行程式,來看看她的驗證,輸入郵箱和密碼,提示“Sorry,wrong username,password or computer ID”
我們看看HTTP Analyzer擷取到的資料。
POST /verify_license.php?email=fuck@you.com&password=ST4GBVNE&mid=BFEBFBFF00010676 HTTP/1.1
我們提交了$email,$password,$mid這3個變數到verify_license.php 檔案
$email 是我們輸入的郵箱號碼,$password 是我們輸入的密碼,$mid 是程式擷取你的機器碼。
verify_license.php根據計算,我們提交的驗證碼錯誤,於是傳回值“NOT”。
弱弱的分析了一下驗證機制,接下我們來分析一下程式,看他的驗證碼模組的代碼。
用ildasm 載入程式。
選擇“FILE”選項的“DUMP”。
她的驗證是verify_license.php,那我們就搜尋一下“verify_license.php”。可以看到,就一次。
我們來看下代碼。
// HEX: 00 00 00 00 17 00 00 00 A4 00 00 00 BB 00 00 00 03 00 00 00 0E 00 00 01
IL_00be: /* 1C | */ ldc.i4.6
IL_00bf: /* 8D | (01)00001F */ newarr [mscorlib/*23000001*/]System.String/*0100001F*/
IL_00c4: /* 13 | 0D */ stloc.s V_13
IL_00c6: /* 11 | 0D */ ldloc.s V_13
IL_00c8: /* 16 | */ ldc.i4.0
IL_00c9: /* 72 | (70)0070A3 */ ldstr http://26836659.blgocn.com/verify_license.php/? //這裡是驗證的網址,我改成我的BLOG了。
+ "email=" /* 700070A3 */
IL_00ce: /* A2 | */ stelem.ref
IL_00cf: /* 11 | 0D */ ldloc.s V_13
IL_00d1: /* 17 | */ ldc.i4.1
IL_00d2: /* 02 | */ ldarg.0
IL_00d3: /* 7B | (04)00010E */ ldfld class [System.Windows.Forms/*23000002*/]System.Windows.Forms.TextBox/*01000055*/ de/*02000049*/::e /* 0400010E */
IL_00d8: /* 6F | (0A)000076 */ callvirt instance string [System.Windows.Forms/*23000002*/]System.Windows.Forms.Control/*01000039*/::get_Text() /* 0A000076 */ 擷取常值內容,應該是我們的郵箱
IL_00dd: /* A2 | */ stelem.ref
IL_00de: /* 11 | 0D */ ldloc.s V_13
IL_00e0: /* 18 | */ ldc.i4.2
IL_00e1: /* 72 | (70)007115 */ ldstr "&password=" /* 70007115 */ 輸入的密碼
IL_00e6: /* A2 | */ stelem.ref
IL_00e7: /* 11 | 0D */ ldloc.s V_13
IL_00e9: /* 19 | */ ldc.i4.3
IL_00ea: /* 02 | */ ldarg.0
IL_00eb: /* 7B | (04)00010C */ ldfld class [System.Windows.Forms/*23000002*/]System.Windows.Forms.TextBox/*01000055*/ de/*02000049*/::c /* 0400010C */
IL_00f0: /* 6F | (0A)000076 */ callvirt instance string [System.Windows.Forms/*23000002*/]System.Windows.Forms.Control/*01000039*/::get_Text() /* 0A000076 */
IL_00f5: /* A2 | */ stelem.ref
IL_00f6: /* 11 | 0D */ ldloc.s V_13
IL_00f8: /* 1A | */ ldc.i4.4
IL_00f9: /* 72 | (70)00712B */ ldstr "&mid=" /* 7000712B */ 機器碼
IL_00fe: /* A2 | */ stelem.ref
IL_00ff: /* 11 | 0D */ ldloc.s V_13
IL_0101: /* 1B | */ ldc.i4.5
IL_0102: /* 06 | */ ldloc.0
IL_0103: /* A2 | */ stelem.ref
IL_0104: /* 11 | 0D */ ldloc.s V_13
IL_0106: /* 28 | (0A)00007D */ call string [mscorlib/*23000001*/]System.String/*0100001F*/::Concat(string[]) /* 0A00007D */
IL_010b: /* 28 | (0A)000026 */ call class [System/*23000003*/]System.Net.WebRequest/*0100002F*/ [System/*23000003*/]System.Net.WebRequest/*0100002F*/::Create(string) /* 0A000026 */
IL_0110: /* 74 | (01)000027 */ castclass [System/*23000003*/]System.Net.HttpWebRequest/*01000027*/
IL_0115: /* 13 | 04 */ stloc.s V_4
IL_0117: /* 11 | 04 */ ldloc.s V_4
IL_0119: /* 72 | (70)0000E3 */ ldstr "POST" /* 700000E3 */ POST 提交
IL_011e: /* 6F | (0A)000029 */ callvirt instance void [System/*23000003*/]System.Net.WebRequest/*0100002F*/::set_Method(string) /* 0A000029 */
IL_0123: /* 11 | 04 */ ldloc.s V_4
IL_0125: /* 16 | */ ldc.i4.0
IL_0126: /* 6A | */ conv.i8
IL_0127: /* 6F | (0A)000039 */ callvirt instance void [System/*23000003*/]System.Net.WebRequest/*0100002F*/::set_ContentLength(int64) /* 0A000039 */
IL_012c: /* 11 | 04 */ ldloc.s V_4
IL_012e: /* 6F | (0A)00003E */ callvirt instance class [System/*23000003*/]System.Net.WebResponse/*01000028*/ [System/*23000003*/]System.Net.WebRequest/*0100002F*/::GetResponse() /* 0A00003E */
IL_0133: /* 13 | 05 */ stloc.s V_5
IL_0135: /* 11 | 05 */ ldloc.s V_5
IL_0137: /* 6F | (0A)00003F */ callvirt instance class [mscorlib/*23000001*/]System.IO.Stream/*01000025*/ [System/*23000003*/]System.Net.WebResponse/*01000028*/::GetResponseStream() /* 0A00003F */
IL_013c: /* 13 | 06 */ stloc.s V_6
IL_013e: /* 11 | 06 */ ldloc.s V_6
IL_0140: /* 73 | (0A)000040 */ newobj instance void [mscorlib/*23000001*/]System.IO.StreamReader/*01000029*/::.ctor(class [mscorlib/*23000001*/]System.IO.Stream/*01000025*/) /* 0A000040 */
IL_0145: /* 13 | 07 */ stloc.s V_7
IL_0147: /* 11 | 07 */ ldloc.s V_7
IL_0149: /* 6F | (0A)000041 */ callvirt instance string [mscorlib/*23000001*/]System.IO.TextReader/*0100001C*/::ReadToEnd() /* 0A000041 */
IL_014e: /* 13 | 08 */ stloc.s V_8
IL_0150: /* 11 | 08 */ ldloc.s V_8
IL_0152: /* 72 | (70)007137 */ ldstr "NEW USER" /* 70007137 */
從new user開始了
IL_0157: /* 28 | (0A)000083 */ call bool [mscorlib/*23000001*/]System.String/*0100001F*/::op_Equality(string, string) /* 0A000083 */
這裡用到一個
op_equality函數,.NET我是不清楚,不過,在VB中,op_equality 裡面見過,是比較兩個串是否相等
IL_015c: /* 2D | 0E */ brtrue.s IL_016c
他先比較是不是new user,然後,後面跟著一句,是brture.s,就是如果相等的話就跳
IL_015e: /* 11 | 08 */ ldloc.s V_8
IL_0160: /* 72 | (70)007149 */ ldstr "VALID" /* 70007149 */
然後,就比較是不是VALID,如果不相等就跳。VALID後面跟著的是brfalse了,這是推測的。來測試下看看。
IL_0165: /* 28 | (0A)000083 */ call bool [mscorlib/*23000001*/]System.String/*0100001F*/::op_Equality(string,
string) /* 0A000083 */
IL_016a: /* 2C | 0F */ brfalse.s IL_017b
IL_016c: /* 02 | */ ldarg.0
IL_016d: /* 17 | */ ldc.i4.1
IL_016e: /* 7D | (04)000111 */ stfld bool de/*02000049*/::h /* 04000111 */
IL_0173: /* 02 | */ ldarg.0
IL_0174: /* 28 | (0A)0000EB */ call instance void [System.Windows.Forms/*23000002*/]System.Windows.Forms.Form/*01000011*/::Close() /* 0A0000EB */
IL_0179: /* 2B | 13 */ br.s IL_018e
IL_017b: /* 72 | (70)007155 */ ldstr "Sorry, wrong username, password or computer ID" /* 70007155 */ 如果錯誤的話,跳轉到我們開始的錯誤提示。
IL_0180: /* 72 | (70)006FE9 */ ldstr "Login" /* 70006FE9 */
IL_0185: /* 16 | */ ldc.i4.0
IL_0186: /* 1F | 10 */ ldc.i4.s 16
IL_0188: /* 28 | (0A)0000DD */ call valuetype [System.Windows.Forms/*23000002*/]System.Windows.Forms.DialogResult/*0100003C*/ [System.Windows.Forms/*23000002*/]System.Windows.Forms.MessageBox/*01000086*/::Show(string,
修改本地的 c:/windows/system32/drivers/etc/hosts
127.0.0.1 26836659.blogcn.com //這裡是驗證的網址,我改成我的BLOG了。
本地架設一個APM環境,在跟目錄下建立一個“verify_license.php”檔案,裡面的內容改為VALID ,測試成功。
我們輸入任何使用者名稱。都可以成功登陸了。測試了下程式,註冊使用。
OK。結束。
FORM: http://www.7747.net/Article/201101/81499.html