PLT and GOT
Dynamic Linking
How it works ?
0x0804925b <+137>: push 0x804a012
0x08049260 <+142>: call 0x8049040 <printf@plt>
0x08049265 <+147>: add esp,0x10Read tables
Resources
Last updated
$ readelf -r chall
Relocation section '.rel.dyn' at offset 0x3bc contains 1 entry:
Offset Info Type Sym.Value Sym. Name
0804bffc 00000606 R_386_GLOB_DAT 00000000 __gmon_start__
Relocation section '.rel.plt' at offset 0x3c4 contains 9 entries:
Offset Info Type Sym.Value Sym. Name
0804c00c 00000107 R_386_JUMP_SLOT 00000000 strcmp@GLIBC_2.0
0804c010 00000207 R_386_JUMP_SLOT 00000000 printf@GLIBC_2.0
0804c014 00000307 R_386_JUMP_SLOT 00000000 fclose@GLIBC_2.1
0804c018 00000407 R_386_JUMP_SLOT 00000000 fread@GLIBC_2.0
0804c01c 00000507 R_386_JUMP_SLOT 00000000 puts@GLIBC_2.0
0804c020 00000707 R_386_JUMP_SLOT 00000000 __libc_start_main@GLIBC_2.0
0804c024 00000807 R_386_JUMP_SLOT 00000000 fopen@GLIBC_2.1
0804c028 00000907 R_386_JUMP_SLOT 00000000 putchar@GLIBC_2.0
0804c02c 00000a07 R_386_JUMP_SLOT 00000000 __isoc99_scanf@GLIBC_2.7from pwn import *
elf = ELF("./chall")
print(elf.plt)
# {'strcmp': 134516784, 'printf': 134516800, 'fclose': 134516816, 'fread': 134516832, 'puts': 134516848, '__libc_start_main': 134516864, 'fopen': 134516880, 'putchar': 134516896, '__isoc99_scanf': 134516912}
print(elf.got)
# {'__gmon_start__': 134529020, 'strcmp': 134529036, 'printf': 134529040, 'fclose': 134529044, 'fread': 134529048, 'puts': 134529052, '__libc_start_main': 134529056, 'fopen': 134529060, 'putchar': 134529064, '__isoc99_scanf': 134529068}