Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->Linux技术 ->系统管理 ->正文

Linux系统下解析Elf文件DT_RPATH后门

来源: 作者: 时间:2007-04-11 点击: [收藏] [投稿]

Symbol table '。dynsym' contains 22 entries:

Num: Value Size Type Bind Vis Ndx Name

[。。。]

97: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__

Name Value Field Calculation

==== ===== ===== ===========

R_386_GLOB_DAT 6 word32 S 通常我们看到的是R_386_JMP_SLOT这种类型的R_386_GLOB_DAT This relocation type is used to set a global offset table entry to the addressof the specified symbol。 The special relocation type allows one to determinethe correspondence between symbols and global offset table entries。

* R_386_GLOB_DAT

这种重定位类型用于设置一个全局偏移表入口为指定符号的地址。该特定的重定位 (alert7大侠译)类型允许你决定符号和全局偏移表入口之间的一致性。

S This means the value of the symbol whose index resides in the relocation entry。

* S

表示索引驻留在重定位入口处的符号值。

[19] 。got PROGBITS 0804a290 001290 000058 04 WA 0 0 4

[20] 。dynamic DYNAMIC 0804a2e8 0012e8 0000c8 08 WA 5 0 4

offset=0804a2e4

实际上这个重定位标示的偏移是got节的最后一个入口,并设置这个入口的值为__gmon_start__的这个符号的地址。

下面做一个小测试实际看一下:

/*test。c*/

int __gmon_start__(){return 0;}

int main(){return __gmon_start__();}

EOF

[wujian@redhat72 elf_door]$ readelf -a test

Section Headers:

[Nr] Name Type Addr Off Size ES Flg Lk Inf Al

[。。]

[ 8] 。rel。dyn REL 08048294 000294 000008 08 A 4 0 4

[ 9] 。rel。plt REL 0804829c 00029c 000020 08 A 4 b 4

[。。]

[12] 。text PROGBITS 08048330 000330 000160 00 AX 0 0 16

[19] 。got PROGBITS 080494dc 0004dc 000020 04 WA 0 0 4

[20] 。dynamic DYNAMIC 080494fc 0004fc 0000c8 08 WA 5 0 4

----------------------------------------------------------------

Relocation section '。rel。dyn' at offset 0x294 contains 1 entries:

Offset Info Type Symbol's Value Symbol's Name

080494f8 00606 R_386_GLOB_DAT 08048430 __gmon_start__ offset=0x080494f8实际是got的最后一个入口偏移

----------------------------------------------------------------

Relocation section '。rel。plt' at offset 0x29c contains 4 entries:

Offset Info Type Symbol's Value Symbol's Name

080494e8 00107 R_386_JUMP_SLOT 080482e4 __register_frame_info

080494ec 00207 R_386_JUMP_SLOT 080482f4 __deregister_frame_info

080494f0 00307 R_386_JUMP_SLOT 08048304 __libc_start_main

----------------------------------------------------------------

Symbol table '。dynsym' contains 7 entries:

Num: Value Size Type Bind Vis Ndx Name

3: 08048304 202 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2。0">__libc_start_main@GLIBC_2。0 (2)

6: 08048430 10 FUNC GLOBAL DEFAULT 12 __gmon_start__

rel。dyn实际重定位对应。dynsym 本来__gmon_start__不应该出现在这里,对应与上面的解释

10个字节,函数类型,value为0x8048430,关联与[12]。text

----------------------------------------------------------------

Symbol table '。symtab' contains 77 entries:

Num: Value Size Type Bind Vis Ndx Name

[。。] 实际上__gmon_start不需要重定位

67: 08048304 202 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_2。0">__libc_start_main@@GLIBC_2。0

76: 08048430 10 FUNC GLOBAL DEFAULT 12 __gmon_start__

------------------------------------------------------------------

[wujian@redhat72 elf_door]$ gdb -q test

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:Linux系统调用的执行过程是怎么样的?   下一篇:Linux系统中实现内部进程通信的方法

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号