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

猜你喜欢

转载自blog.csdn.net/yimo_5288/article/details/84780206