SlideShare a Scribd company logo
CSS×2.0
Polyglotシェルコードの
最高記録に挑戦しよう☆
☆NTTセキュアプラットフォーム研究所
☆中島明日香
Polyglotシェルコードとは
複数のアーキテクチャ上で
動作するシェルコードのこと
Polyglotシェルコードの仕組み[1/2]
アーキテクチャ1の
シェルコード
アーキテクチャ2の
シェルコード
シェルコードの先頭で各アーキテクチャの
シェルコードに分岐させる命令を置く
1への分岐命令
2への分岐命令
Polyglotシェルコードの仕組み[2/2]
あるアーキテクチャだと意味のない命令だが
別のアーキテクチャで分岐命令となる機械語を探す
1への分岐命令
■3アーキテクチャの場合
3への分岐命令
2への分岐命令
意味のない命令 意味のない命令
意味のない命令
シェルコード1へ シェルコード2へ シェルコード3へ
挑戦☆
過去のPolyglotシェルコードでは
4アーキテクチャが最高?
最低でも5アーキテクチャを目指す☆
試行錯誤・・・
‣遅延分岐するアーキテクチャは?
‣マイコン系は?
‣NOPに相当する命令は?
‣JMPに相当する命令は?
‣エンディアン違うとどうなるのか?
■振り分け処理生成補助
→ radare2 + objdump
■実行環境
→ qemu
結果☆
¥x42¥x90¥x0f¥xa0¥x00¥xd2¥x90¥90
¥xeb¥x00¥x00¥xea¥x48¥x31¥xc0¥x48
¥x85¥xc0¥x75¥x1d
x86, x86-64, armeb,armeb,powerpc, sheb
6アーキテクチャで実現!
シェルコードの詳細(先頭のみ)
inc edx
nop
push fs
add dl, dl
nop
nop
jmp 0xa
add dl, ch
dec eax
xor eax, eax
dec eax
test eax, eax
jne 0x31
rex.X xchg eax,eax
push fs
add dl,dl
nop
nop
jmp 0xa
add dl,ch
xor rax,rax
test rax,rax
jne 0x31
■x86 ■x86-64
REXプレフィックスの違いを利用して振り分ける
andge r9, pc, r2, asr 32
addsls sp, r0, r0, lsl 4
b 0x000003bc
stmiami r0, {r3, r6, r8, ip, sp}^
wldrhne wr12, [r5, -133]!
bc- 20, 4*cr4+lt, 0x00000fa0
lwa r24, 232(0)
b 0x0031c054
lwzu r14, 29981(0)
addsmi r0, r0, 160, 30
smullseq r9, r2, r0, r0
bl 0x000003b8
ldmdami r1!, {r3, r6, lr, pc}
strbhi r7, [r0, 1309]
mov.w 0x00000088,r0 ! 0x9042
bra 0x00000024
mov.l 0x00000008,r2 ! 0xd200
mov.w 0x0000012a,r0 ! 0x9090
.word 0x00eb mov #0,r10
sub r4,r1
.word 0x48c0
mov.b r0,@(133,gbr)
mov.l r7,@(20,r13)
■ARM(リトルエンディアン) ■ARM(ビッグエンディアン)
■PowerPC(ビッグエンディアン) ■SuperH-4(ビッグエンディアン)
※エンディアン違いを上手く利用して振り分ける
フィーリングで各アーキテクチャの
アセンブリが読めるようになってくる
単一のシェルコードで全てのPCを
操れて楽しい。実用性は・・。
感想
ご清聴ありがとうございました!

More Related Content

PDF
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
PDF
[Dagstuhl Seminar 17281] Similarity Calculation Method for Binary Executables
PDF
技術紹介: S2E: Selective Symbolic Execution Engine
PDF
[JPCERT/CC POC Meeting] 研究紹介 + DLLハイジャックの脆弱性
PDF
第二回CTF勉強会資料
PDF
[セキュリティ・キャンプフォーラム 2014] 卒業生プレゼンテーション 『私とセキュリティと過去と未来』
PDF
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
PDF
[AsiaCCS2019] A Pilot Study on Consumer IoT Device Vulnerability Disclosure a...
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
[Dagstuhl Seminar 17281] Similarity Calculation Method for Binary Executables
技術紹介: S2E: Selective Symbolic Execution Engine
[JPCERT/CC POC Meeting] 研究紹介 + DLLハイジャックの脆弱性
第二回CTF勉強会資料
[セキュリティ・キャンプフォーラム 2014] 卒業生プレゼンテーション 『私とセキュリティと過去と未来』
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[AsiaCCS2019] A Pilot Study on Consumer IoT Device Vulnerability Disclosure a...
Ad

[CSS×2.0 2014] Polyglotシェルコードの最高記録に挑戦しよう☆