Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ret2dl_resolve(x86_64)
Search
appBana
May 05, 2018
Programming
580
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ret2dl_resolve(x86_64)
in YOKARO-MON勉強会
appBana
May 05, 2018
Transcript
60 slides
None
None
None
None
Elf64_Rela r_offset (size=0x8) r_info (size=0x8) r_addend (size=0x8)
Elf64_Rela r_offset (size=0x8) r_info (size=0x8) r_addend (size=0x8) typedef struct {
Elf64_Addr r_offset; /* Address */ Elf64_Xword r_info; /* Relocation type and symbol index */ Elf64_Sxword r_addend; /* Addend */ } Elf64_Rela;
Elf64_Rela r_offset (size=0x8) r_info (size=0x8) r_addend (size=0x8) GOT Elf64_Symindex
None
Elf64_Sym st_name (size=0x4) st_info (size=0x1) st_other (size=0x1) st_shndx (size=0x2) st_value
(size=0x8) st_size (size=0x8)
Elf64_Sym st_name (size=0x4) st_info (size=0x1) st_other (size=0x1) st_shndx (size=0x2) st_value
(size=0x8) st_size (size=0x8) typedef struct { Elf64_Word st_name; /* Symbol name (string tbl index) */ unsigned char st_info; /* Symbol type and binding */ unsigned char st_other; /* Symbol visibility */ Elf64_Section st_shndx; /* Section index */ Elf64_Addr st_value; /* Symbol value */ Elf64_Xword st_size; /* Symbol size */ } Elf64_Sym;
Elf64_Sym st_name (size=0x4) st_info (size=0x1) st_other (size=0x1) st_shndx (size=0x2) st_value
(size=0x8) st_size (size=0x8) offset
None
None
None
“Hello, world!” %* '&”hello”'$'( puts() (+ “hello.c”#,! “hello”
"+$)
“Hello, world!” ).$+*”hello” +"(+,puts() ,/# “hello.c”'0% “hello” !&/(-
None
[email protected]
0x601018<
[email protected]
>0x400416
0x601018<
[email protected]
>0x400416<puts@plt+6>
1. Stack0(reloc_offset)push
1. Stack0(reloc_offset)push 2. 0x400400(.plt)
1. Stack 0(reloc_offset)push 2. 0x400400(.plt) 3. [0x601008]push [0x601010](_dl_runtime_resolve())
link_map
None
None
None
None
.rela.plt .dynstr .dynsym puts Elf64_Rela __libc_start_m ain Elf64_Rela
puts ELF64_Sym __libc_start_m ain ELF64_Sym libc.so.6¥x00 puts¥x00 __libc_start_main ¥x00 ...
.rela.plt .dynstr .dynsym puts Elf64_Rela __libc_start_m ain Elf64_Rela
puts ELF64_Sym __libc_start_m ain ELF64_Sym libc.so.6¥x00 puts¥x00 __libc_start_main ¥x00 ... .rela.plt reloc_offset Elf64_Rela
.rela.plt .dynstr .dynsym puts Elf64_Rela __libc_start_m ain Elf64_Rela puts ELF64_Sym
__libc_start_m ain ELF64_Sym libc.so.6¥x00 puts¥x00 __libc_start_main ¥x00 ... .dynsym r_info >> 32 Elf64_Sym
.rela.plt .dynstr .dynsym puts Elf64_Rela __libc_start_m ain Elf64_Rela puts ELF64_Sym
__libc_start_m ain ELF64_Sym libc.so.6¥x00 puts¥x00 __libc_start_main ¥x00 ... .dynstr st_name
None
puts()reloc_offset
puts()Elf64_Rela = rela.plt + puts()rela_offset * Elf64_Rela = 0x400398
+ 0x0 * 0x18 = 0x400398
puts()Elf64_Rela = rela.plt + puts()rela_offset * Elf64_Rela = 0x400398
+ 0x0 * 0x18 = 0x400398 r_info = puts()Elf64_Symindex << 32 | R_386_JMP_SLOT = 0x1 << 32 | 0x7 = 0x0000000100000007
puts()Elf64_Sym = .dynsym + puts()Elf64_Relar_info << 32* Elf64_Rela =
0x4002b8 + 0x1 * 0x18 = 0x4002d0
puts()Elf64_Sym = .dynsym + puts()Elf64_Relar_info << 32* Elf64_Sym =
0x4002b8 + 0x1 * 0x18 = 0x4002d0 st_name = 0xb st_info = 0x12
puts() = .dynstr + puts() Elf64_Sym st_name =
0x400318 + 0xb = 0x400323
None
None
None
None
.rela.plt .dynstr .dynsym puts Elf64_Rela __libc_start_m ain Elf64_Rela
puts ELF64_Sym __libc_start_m ain ELF64_Sym libc.so.6¥x00 puts¥x00 __libc_start_main ¥x00 ...
.bss Elf64_Relo Elf64_Sym “system¥x00” push reloc_offset _dl_runtime_resolve(“/bin/sh”)
.bss Elf64_Relo Elf64_Sym “system¥x00” push reloc_offset _dl_runtime_resolve(“/bin/sh”) reloc_offset = (A
- .rela.plt) / 0x18 A
.bss Elf64_Relo Elf64_Sym “system¥x00” push reloc_offset _dl_runtime_resolve(“/bin/sh”) r_info = ((B
- .dynsym) / 0x18) << 32 | 0x7 B
.bss Elf64_Relo Elf64_Sym “system¥x00” push reloc_offset _dl_runtime_resolve(“/bin/sh”) st_name = (C
- .dynstr) C
None
None
None
None
None
None
None
None
None
None
None
None
None
Other Decks in Programming
See All in Programming
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
150
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
210
Claude Code ハーネスDeep Dive – 君はどこまで制御する? -
takateeen_knj
6
5.9k
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
380
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
130
imagewebp()の向こう側: WebPはなぜ JPEG・PNGより軽いのか
yuzneri
0
110
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
190
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
9.2k
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
2
170
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
640
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
340
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
260
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
225
10k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.4k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
280
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
530
The Limits of Empathy - UXLibs8
cassininazir
2
790
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
60k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
330
Amusing Abliteration
ianozsvald
1
390
BBQ
matthewcrist
90
10k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.7k
HDC tutorial
michielstock
2
1k