1. 程式人生 > >android逆向----記憶體dump下來的so檔案的section簡單修復

android逆向----記憶體dump下來的so檔案的section簡單修復

之前弄了下抖音1.8.3版本,實在是加密太複雜,只得從記憶體中dump出關鍵的libcms.so,但弄出來後用IDA開啟,提示first section must be SHT_NULL,查看了下dump下來的so發現沒有section header table,只能自己來加上去了

1、從反編譯出來的libcms.so中找到section header table和Section header string table位置及內容

2、將其copy到(我這裡直接手動修改)dump下來的libcms.so檔案末位,重新命名為libcms_fix.so

3、修改ELF header 中的section偏移地址e_shoff,將其改為libcms_fix.so檔案對應的section header table的偏移地址

4、並且將Section header table中的索引為22的section header(指向了Section header string table)的偏移地址修改為libcms_fix.so對應的Section header string table的偏移地址

這樣用IDA就可以解析到完整的檢視了,方便我們檢視

 

這是反編譯出來的libcms.so檔案的ELF header 資訊,

1、從中可以取到e_shoff:00079BE0(上圖左邊,section header table的偏移地址),然後找到對應的偏移地址位置,將其後所有的位元組全部複製到libcms_dump.so的末位;

2、這裡還需要一個欄位shstrndx(左下,這個是section header table中索引號,表示section header string table header,可以用來獲取section header string table :  儲存了section 的名字),這裡是0x0016(十進位制22),表示儲存section header string table header 的是22號索引的section header ,獲取其中的section的位置(即section header string table的位置),然後將其內容copy到libcms_dump.so中

3、e_shnum是section header table中section的數量,這裡是0x0017(十進位制23),共23個section

 

已經將libcms.so中的section header table 和section header string table 拷貝到libcms_dump.so中,記錄偏移地址

section header table :0x0007acf0h

section header string table :0x0007ac16h

 

將libcms_dump.so中的ELF header中的e_shoff欄位修改為0x0007acf0h(看第一張圖)

將libcms_dump.so中的section header table 中的索引為22號的section header 中的欄位section檔案偏移改為0x0007ac16h