質問

序章

Lidnugからこのビデオを見た後、.NETコード保護について http://secureteam.net/lidnug_recording/untitled.swf (特に46:30から57:30まで)、私が作成したexeでshowへの呼び出しを見つけます。

私の「TrialApp.exe」の唯一のロジックは次のとおりです。

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        MessageBox.Show("This is trial app");
    }
}

リリース構成にコンパイルされています: http://rapidshare.com/files/392503054/trialapp.exe.html

通話を見つけるために私がすること

WindBGでアプリケーションを実行し、メッセージボックスが表示された後に破損します。

CLRスタックを取得します !clrstack:

0040e840 5e21350b [InlinedCallFrame: 0040e840] System.Windows.Forms.SafeNativeMethods.MessageBox(System.Runtime.InteropServices.HandleRef, System.String, System.String, Int32)
0040e894 5e21350b System.Windows.Forms.MessageBox.ShowCore(System.Windows.Forms.IWin32Window, System.String, System.String, System.Windows.Forms.MessageBoxButtons, System.Windows.Forms.MessageBoxIcon, System.Windows.Forms.MessageBoxDefaultButton, System.Windows.Forms.MessageBoxOptions, Boolean)
0040e898 002701f0 [InlinedCallFrame: 0040e898] 
0040e934 002701f0 TrialApp.Form1.Form1_Load(System.Object, System.EventArgs)

MethodDESC構造を取得します(form1_loadのアドレスを使用) !ip2md 002701f0

MethodDesc:   001762f8
Method Name:  TrialApp.Form1.Form1_Load(System.Object, System.EventArgs)
Class:        00171678
MethodTable:  00176354
mdToken:      06000005
Module:       00172e9c
IsJitted:     yes
CodeAddr:     002701d0
Transparency: Critical
Source file:  D:\temp\TrialApp\TrialApp\Form1.cs @ 22

この方法のILをダンプします(MethodDescによる) !dumpil 001762f8

IL_0000: ldstr "This is trial app"
IL_0005: call System.Windows.Forms.MessageBox::Show 
IL_000a: pop 
IL_000b: ret 

だから、ビデオが述べたように、への呼び出し Show メソッド実装の開始から5バイトです。

次に、CFFExplorer(ビデオのように)を開き、form1_loadメソッドのRVAを取得します。 00002083.

この後、私はコンバーターに住所(もう一度CFFエクスプローラーで)に移動し、オフセットに移動します 00002083. 。そこに私たちがあります:

32 72 01 00 00 70 28 16 00 00 0A 26 2A 7A 03 2C
13 02 7B 02 00 00 04 2C 0B 02 7B 02 00 00 04 6F
17 00 00 0A 02 03 28 18 00 00 0A 2A 00 03 30 04 
00 67 00 00 00 00 00 00 00 02 28 19 00 00 0A 02

ビデオでは、最初の12バイトがメソッドヘッダー用であるため、スキップします

                                    2A 7A 03 2C
13 02 7B 02 00 00 04 2C 0B 02 7B 02 00 00 04 6F
17 00 00 0A 02 03 28 18 00 00 0A 2A 00 03 30 04 
00 67 00 00 00 00 00 00 00 02 28 19 00 00 0A 02

実装の開始時から5バイトは、メソッド呼び出し(28)のオペコードである必要があります。残念ながら、そこにはありません。

   02 7B 02 00 00 04 2C 0B 02 7B 02 00 00 04 6F
17 00 00 0A 02 03 28 18 00 00 0A 2A 00 03 30 04 
00 67 00 00 00 00 00 00 00 02 28 19 00 00 0A 02

質問:

  1. 私は何が間違っているのですか?
  2. ファイル内のその位置にメソッド呼び出しがないのはなぜですか?または、ビデオにいくつかの情報が欠けているかもしれません...
  3. なぜそのビデオの男がコールを9ゼロに置き換えるのですか?
役に立ちましたか?

解決

ildasm.exeを使用して、ショーバイトをオンにしてilを見ると、これがわかります。

.method private hidebysig instance void  Form1_Load(object sender,
                                                    class [mscorlib]System.EventArgs e) cil managed
// SIG: 20 02 01 1C 12 15
{
  // Method begins at RVA 0x20f1
  // Code size       12 (0xc)
  .maxstack  8
  IL_0000:  /* 72   | (70)00000D       */ ldstr      "This is trial app"
  IL_0005:  /* 28   | (0A)00001E       */ call       valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
  IL_000a:  /* 26   |                  */ pop
  IL_000b:  /* 2A   |                  */ ret
} // end of method Form1::Form1_Load

ダンプのトークン値は同じではありません。はるかに大きなプログラムがあるようです。しかし、ダンプのILは、12ではなくオフセット1で始まります。なぜオフがオフになっているのかわかりません。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top