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
Padding Oracle Attack
Search
zhouyunao
June 14, 2019
Technology
620
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
47
Other Decks in Technology
See All in Technology
高負荷プロダクション環境におけるAWS Lambdaのリアル 〜スケールとコストを左右する実行ライフサイクルの技術仕様〜
maimyyym
2
560
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
33
21k
10年欲しかった音楽管理アプリを、AIと一緒に作りはじめた
judau
1
110
AIエージェントを最高のパートナーに育てる方法|評価と判断軸を育てる5つのステップ
koichiaoki
1
160
技術的負債から考える、AI時代のエンジニアリング投資 — ビズリーチの技術的負債と向き合った経験から、変更し続けられるソフトウェアを考える/ technical-debt-con2026
visional_engineering_and_design
4
3.7k
バイブコーディング時代のWebアプリ開発入門~Cloud Runで学ぶセキュアなビルドとデプロイ
waiwai2111
1
150
ADKで始める業務改善 - AIエージェント開発時の考えと設計
harappa80
2
290
ボードゲームの遊び相手をFoundation Modelsで作る / iOSDC Japan 2026
genda
0
180
特殊変数大全
dak2
0
130
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
570
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
130
Why Agent Cost Needs Observability
nttcom
0
150
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
500
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
410
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Deep Space Network (abreviated)
tonyrice
0
320
The Cult of Friendly URLs
andyhume
79
7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
Paper Plane (Part 1)
katiecoart
PRO
2
11k
It's Worth the Effort
3n
188
29k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
730
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
250
Designing Powerful Visuals for Engaging Learning
tmiket
1
580
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 レファレンス