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

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章