Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Padding Oracle Attack
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
zhouyunao
June 14, 2019
Technology
600
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Padding Oracle Attack
zhouyunao
June 14, 2019
More Decks by zhouyunao
See All by zhouyunao
knock
zhouyunao
0
43
Other Decks in Technology
See All in Technology
JavaScript 研修 (2026)
recruitengineers
PRO
2
510
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
130
ボトムアップ文化が強い組織で セキュリティをどう根付かせていくかの現在進行形の話 / Making Security Stick in a Bottom-Up Organization
yamaguchitk333
0
210
FDEの心得
noriakioji
3
3.1k
ガバメントクラウドでのランサムウェア対策
techniczna
2
1.1k
ガバメント AI 源内を地方自治体は活用できるのか可能性と課題、期待について
takeda_h
1
390
TypeScript入門 2026
recruitengineers
PRO
3
550
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
190
【CEDEC2026】『ウマ娘 プリティーダービー』 英語版のキャラクターの方言や口調をローカライズするための創造的アプローチ
cygames
PRO
1
240
カートの信頼性を担保するWireMockを使ったe2eテスト
ykagano
0
160
Genie Codeハンズオン基礎編
taka_aki
1
110
つくって納得、つかって実感! 大規模言語モデルことはじめ ver2.0
recruitengineers
PRO
4
1.5k
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Music & Morning Musume
bryan
47
7.3k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
290
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
330
How to Think Like a Performance Engineer
csswizardry
28
2.7k
The untapped power of vector embeddings
frankvandijk
2
1.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
760
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
460
Rails Girls Zürich Keynote
gr2m
96
14k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
400
Transcript
Padding Oracle with INSHACK 2019 jean bash picoctf2018 Magic padding
oracle 2019/6/14 m1z0r3 @Zhouyunao
⽬次 n Padding Oracle Attack l Encryption Attack l Decryption
Attack n 実践問題 2019/6/13 m1z0r3
n 概略 l 共通鍵ブロック暗号のCBCモードに対する攻撃⼿法 l 14年SSL3.0のPOODLEという脆弱性もこの⼿法 n CTFに置いての位置付け l ちょくちょく⾒る
l 初⾒としはうざい 2019/6/13 m1z0r3 Padding Oracle Attack
n 特徴 (あくまでも⾃分経験上の話) l CBCモード ←必須 l AES類のブロック暗号 ←必須 l
サーバーが復号化をやってくれる l サーバーコードは⼤概公開 l IVまでこっちから送られる ←場合によって 2019/6/13 m1z0r3 Padding Oracle Attack
n 何ができる︖ l Decryption Attack 難易度:⾼ 暗号⽂の復号ができる 平⽂はflagの場合 l Encryption
Attack 難易度:中 暗号⽂の改造による平⽂の改ざん 平⽂を特定なコマンド/データに改ざんし認証をバイパスできる 2019/6/13 m1z0r3 Padding Oracle Attack
n イメージ 2019/6/13 m1z0r3 Encryption Attack # a&…86 % +
+ + # ) user…
n イメージ 2019/6/13 m1z0r3 Encryption Attack # 01…8c % +
+ + # ) admin…
n 本来なら ) ⨁ 2 = ” … ” n
平⽂をすり替える為に差を計算 = “ … ”⨁” … ” n 差と⼀個前のブロックとxor )⨁⨁(%) = “ … ” 2019/6/13 m1z0r3 Encryption Attack
n それをサーバーに送ると 2019/6/13 m1z0r3 Encryption Attack # 01…8c % +
+ + # xxxxx admin… 最後のブロックを変える為に前のブロックを犠牲にする ※全ブロックを弄る⽅法もあります(後ほど説明)
n さらなる特徴(経験上) l PKCS7を使いがち l Padding errorの時のエラー⽂が特殊 n どうやる︖ 簡単にいうと
前のブロックをいじって、違うpaddingの形式に復号させ、 求めたいブロック平⽂⼀歩⼿前のDec(ct)を求めて、平⽂を取り 出す 2019/6/13 m1z0r3 Decryption Attack
2019/6/13 m1z0r3 Decryption Attack 1c a d m i n
u s e r 07 07 07 07 07 07 01 xx + + Dec Dec + xxxxx ) ブルートフォース ※適当に埋めた
2019/6/13 m1z0r3 Decryption Attack 2f 1c a d m i
n u s e r 07 07 07 07 07 02 02 yy xx 01 02 Dec + ) + Dec xxxxx + + + 01 ブルートフォース済み の部分を新しいpadding 形式に合わせる
2019/6/13 m1z0r3 Decryption Attack 3e 2f 1c a d m
i n u s e r 07 07 07 07 03 03 03 zz yy xx 02 01 03 03 + + + + Dec xxxxx Dec + )
2019/6/13 m1z0r3 Decryption Attack 4a 3e 2f 1c a d
m i n u s e r 07 07 07 04 04 04 04 aa zz yy xx 03 02 01 04 04 04 + + + + Dec xxxxx Dec + )
オ ラ ク ル 。 。 。 2019/6/13 m1z0r3 Decryption
Attack
2019/6/13 m1z0r3 Decryption Attack gy f1 ez dx cp bk
ag 9l 8i 7u 6n 5b 4a 3e 2f 1c 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 qq zz cc vv ee nn ll hh gg bb ee ff aa zz yy xx 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + + + + Dec xxxxx Dec + ) 全部¥x10になる為既知明⽂か らDec(ct1)を計算して最後ct0と xor取り最後のブロックを算出
2019/6/13 m1z0r3 Decryption Attack gy f1 ez dx cp bk
ag 9l 8i 7u 6n 5b 4a 3e 2f 1c 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 qq zz cc vv ee nn ll hh gg bb ee ff aa zz yy xx 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 + + + + Dec xxxxx Dec + ) ′# ′) ′# ′) が10(padding)に埋め 尽くされた時: ′# ⨁ 1010. . = () ) () )⨁ # = )
2019/6/13 m1z0r3 全ブロックのEncryption Attack # 01…8c % + + +
# xxxxx user… + # admin… n Step 1 最後の2ブロックから差分を計算
n Step 2 前の2ブロックに移動 2019/6/13 m1z0r3 全ブロックのEncryption Attack xxxx 01…8c
% + + + # xxxxx user… + # admin… + ) I am…
n Step 3 2019/6/13 m1z0r3 全ブロックのEncryption Attack xxxx 01…8c %
+ + + # xxxxx user… + # admin… + ) I am… + % Yes… 最後は1ブロック⽬を すりかえられるよう に差分を計算
n picoctf 2018 magic padding oracle l De+Encryption Attack l
https://kusuwada.hatenablog.com/entry/2019/04/17/052525 n INS’hack 2019 Jean-Sébastien Bash l Encryption Attack l https://www.hackademint.org/Jean-Sebastien_Bash 2019/6/13 m1z0r3 実践問題
n http://rintaro.hateblo.jp/entry/2017/12/31/174327 2019/6/13 m1z0r3 レファレンス